code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("../index.zig"); const assert = std.debug.assert; const mem = std.mem; const ast = std.zig.ast; const Tokenizer = std.zig.Tokenizer; const Token = std.zig.Token; const TokenIndex = ast.TokenIndex; const Error = ast.Error; /// Result should be freed with tree.deinit() when there are /// no more references to any of the tokens or nodes. pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { var tree_arena = std.heap.ArenaAllocator.init(allocator); errdefer tree_arena.deinit(); var stack = std.ArrayList(State).init(allocator); defer stack.deinit(); const arena = &tree_arena.allocator; const root_node = try arena.create(ast.Node.Root{ .base = ast.Node{ .id = ast.Node.Id.Root }, .decls = ast.Node.Root.DeclList.init(arena), .doc_comments = null, // initialized when we get the eof token .eof_token = undefined, }); var tree = ast.Tree{ .source = source, .root_node = root_node, .arena_allocator = tree_arena, .tokens = ast.Tree.TokenList.init(arena), .errors = ast.Tree.ErrorList.init(arena), }; var tokenizer = Tokenizer.init(tree.source); while (true) { const token_ptr = try tree.tokens.addOne(); token_ptr.* = tokenizer.next(); if (token_ptr.id == Token.Id.Eof) break; } var tok_it = tree.tokens.iterator(0); // skip over line comments at the top of the file while (true) { const next_tok = tok_it.peek() orelse break; if (next_tok.id != Token.Id.LineComment) break; _ = tok_it.next(); } try stack.append(State.TopLevel); while (true) { // This gives us 1 free push that can't fail const state = stack.pop(); switch (state) { State.TopLevel => { const comments = try eatDocComments(arena, &tok_it, &tree); const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_test => { stack.append(State.TopLevel) catch unreachable; const block = try arena.create(ast.Node.Block{ .base = ast.Node{ .id = ast.Node.Id.Block }, .label = null, .lbrace = undefined, .statements = ast.Node.Block.StatementList.init(arena), .rbrace = undefined, }); const test_node = try arena.create(ast.Node.TestDecl{ .base = ast.Node{ .id = ast.Node.Id.TestDecl }, .doc_comments = comments, .test_token = token_index, .name = undefined, .body_node = &block.base, }); try root_node.decls.push(&test_node.base); try stack.append(State{ .Block = block }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.LBrace, .ptr = &block.lbrace, }, }); try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &test_node.name } }); continue; }, Token.Id.Eof => { root_node.eof_token = token_index; root_node.doc_comments = comments; return tree; }, Token.Id.Keyword_pub => { stack.append(State.TopLevel) catch unreachable; try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{ .decls = &root_node.decls, .visib_token = token_index, .extern_export_inline_token = null, .lib_name = null, .comments = comments, }, }); continue; }, Token.Id.Keyword_comptime => { const block = try arena.create(ast.Node.Block{ .base = ast.Node{ .id = ast.Node.Id.Block }, .label = null, .lbrace = undefined, .statements = ast.Node.Block.StatementList.init(arena), .rbrace = undefined, }); const node = try arena.create(ast.Node.Comptime{ .base = ast.Node{ .id = ast.Node.Id.Comptime }, .comptime_token = token_index, .expr = &block.base, .doc_comments = comments, }); try root_node.decls.push(&node.base); stack.append(State.TopLevel) catch unreachable; try stack.append(State{ .Block = block }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.LBrace, .ptr = &block.lbrace, }, }); continue; }, else => { prevToken(&tok_it, &tree); stack.append(State.TopLevel) catch unreachable; try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{ .decls = &root_node.decls, .visib_token = null, .extern_export_inline_token = null, .lib_name = null, .comments = comments, }, }); continue; }, } }, State.TopLevelExtern => |ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_export, Token.Id.Keyword_inline => { stack.append(State{ .TopLevelDecl = TopLevelDeclCtx{ .decls = ctx.decls, .visib_token = ctx.visib_token, .extern_export_inline_token = AnnotatedToken{ .index = token_index, .ptr = token_ptr, }, .lib_name = null, .comments = ctx.comments, }, }) catch unreachable; continue; }, Token.Id.Keyword_extern => { stack.append(State{ .TopLevelLibname = TopLevelDeclCtx{ .decls = ctx.decls, .visib_token = ctx.visib_token, .extern_export_inline_token = AnnotatedToken{ .index = token_index, .ptr = token_ptr, }, .lib_name = null, .comments = ctx.comments, }, }) catch unreachable; continue; }, else => { prevToken(&tok_it, &tree); stack.append(State{ .TopLevelDecl = ctx }) catch unreachable; continue; }, } }, State.TopLevelLibname => |ctx| { const lib_name = blk: { const lib_name_token = nextToken(&tok_it, &tree); const lib_name_token_index = lib_name_token.index; const lib_name_token_ptr = lib_name_token.ptr; break :blk (try parseStringLiteral(arena, &tok_it, lib_name_token_ptr, lib_name_token_index, &tree)) orelse { prevToken(&tok_it, &tree); break :blk null; }; }; stack.append(State{ .TopLevelDecl = TopLevelDeclCtx{ .decls = ctx.decls, .visib_token = ctx.visib_token, .extern_export_inline_token = ctx.extern_export_inline_token, .lib_name = lib_name, .comments = ctx.comments, }, }) catch unreachable; continue; }, State.TopLevelDecl => |ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_use => { if (ctx.extern_export_inline_token) |annotated_token| { ((try tree.errors.addOne())).* = Error{ .InvalidToken = Error.InvalidToken{ .token = annotated_token.index } }; return tree; } const node = try arena.create(ast.Node.Use{ .base = ast.Node{ .id = ast.Node.Id.Use }, .use_token = token_index, .visib_token = ctx.visib_token, .expr = undefined, .semicolon_token = undefined, .doc_comments = ctx.comments, }); try ctx.decls.push(&node.base); stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Semicolon, .ptr = &node.semicolon_token, }, }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } }); continue; }, Token.Id.Keyword_var, Token.Id.Keyword_const => { if (ctx.extern_export_inline_token) |annotated_token| { if (annotated_token.ptr.id == Token.Id.Keyword_inline) { ((try tree.errors.addOne())).* = Error{ .InvalidToken = Error.InvalidToken{ .token = annotated_token.index } }; return tree; } } try stack.append(State{ .VarDecl = VarDeclCtx{ .comments = ctx.comments, .visib_token = ctx.visib_token, .lib_name = ctx.lib_name, .comptime_token = null, .extern_export_token = if (ctx.extern_export_inline_token) |at| at.index else null, .mut_token = token_index, .list = ctx.decls, }, }); continue; }, Token.Id.Keyword_fn, Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc, Token.Id.Keyword_async => { const fn_proto = try arena.create(ast.Node.FnProto{ .base = ast.Node{ .id = ast.Node.Id.FnProto }, .doc_comments = ctx.comments, .visib_token = ctx.visib_token, .name_token = null, .fn_token = undefined, .params = ast.Node.FnProto.ParamList.init(arena), .return_type = undefined, .var_args_token = null, .extern_export_inline_token = if (ctx.extern_export_inline_token) |at| at.index else null, .cc_token = null, .async_attr = null, .body_node = null, .lib_name = ctx.lib_name, .align_expr = null, }); try ctx.decls.push(&fn_proto.base); stack.append(State{ .FnDef = fn_proto }) catch unreachable; try stack.append(State{ .FnProto = fn_proto }); switch (token_ptr.id) { Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc => { fn_proto.cc_token = token_index; try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Keyword_fn, .ptr = &fn_proto.fn_token, }, }); continue; }, Token.Id.Keyword_async => { const async_node = try arena.create(ast.Node.AsyncAttribute{ .base = ast.Node{ .id = ast.Node.Id.AsyncAttribute }, .async_token = token_index, .allocator_type = null, .rangle_bracket = null, }); fn_proto.async_attr = async_node; try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Keyword_fn, .ptr = &fn_proto.fn_token, }, }); try stack.append(State{ .AsyncAllocator = async_node }); continue; }, Token.Id.Keyword_fn => { fn_proto.fn_token = token_index; continue; }, else => unreachable, } }, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedVarDeclOrFn = Error.ExpectedVarDeclOrFn{ .token = token_index } }; return tree; }, } }, State.TopLevelExternOrField => |ctx| { if (eatToken(&tok_it, &tree, Token.Id.Identifier)) |identifier| { const node = try arena.create(ast.Node.StructField{ .base = ast.Node{ .id = ast.Node.Id.StructField }, .doc_comments = ctx.comments, .visib_token = ctx.visib_token, .name_token = identifier, .type_expr = undefined, }); const node_ptr = try ctx.container_decl.fields_and_decls.addOne(); node_ptr.* = &node.base; stack.append(State{ .FieldListCommaOrEnd = ctx.container_decl }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.type_expr } }); try stack.append(State{ .ExpectToken = Token.Id.Colon }); continue; } stack.append(State{ .ContainerDecl = ctx.container_decl }) catch unreachable; try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{ .decls = &ctx.container_decl.fields_and_decls, .visib_token = ctx.visib_token, .extern_export_inline_token = null, .lib_name = null, .comments = ctx.comments, }, }); continue; }, State.FieldInitValue => |ctx| { const eq_tok = nextToken(&tok_it, &tree); const eq_tok_index = eq_tok.index; const eq_tok_ptr = eq_tok.ptr; if (eq_tok_ptr.id != Token.Id.Equal) { prevToken(&tok_it, &tree); continue; } stack.append(State{ .Expression = ctx }) catch unreachable; continue; }, State.ContainerKind => |ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; const node = try arena.create(ast.Node.ContainerDecl{ .base = ast.Node{ .id = ast.Node.Id.ContainerDecl }, .layout_token = ctx.layout_token, .kind_token = switch (token_ptr.id) { Token.Id.Keyword_struct, Token.Id.Keyword_union, Token.Id.Keyword_enum => token_index, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedAggregateKw = Error.ExpectedAggregateKw{ .token = token_index } }; return tree; }, }, .init_arg_expr = ast.Node.ContainerDecl.InitArg.None, .fields_and_decls = ast.Node.ContainerDecl.DeclList.init(arena), .lbrace_token = undefined, .rbrace_token = undefined, }); ctx.opt_ctx.store(&node.base); stack.append(State{ .ContainerDecl = node }) catch unreachable; try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.LBrace, .ptr = &node.lbrace_token, }, }); try stack.append(State{ .ContainerInitArgStart = node }); continue; }, State.ContainerInitArgStart => |container_decl| { if (eatToken(&tok_it, &tree, Token.Id.LParen) == null) { continue; } stack.append(State{ .ExpectToken = Token.Id.RParen }) catch unreachable; try stack.append(State{ .ContainerInitArg = container_decl }); continue; }, State.ContainerInitArg => |container_decl| { const init_arg_token = nextToken(&tok_it, &tree); const init_arg_token_index = init_arg_token.index; const init_arg_token_ptr = init_arg_token.ptr; switch (init_arg_token_ptr.id) { Token.Id.Keyword_enum => { container_decl.init_arg_expr = ast.Node.ContainerDecl.InitArg{ .Enum = null }; const lparen_tok = nextToken(&tok_it, &tree); const lparen_tok_index = lparen_tok.index; const lparen_tok_ptr = lparen_tok.ptr; if (lparen_tok_ptr.id == Token.Id.LParen) { try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .RequiredNull = &container_decl.init_arg_expr.Enum } }); } else { prevToken(&tok_it, &tree); } }, else => { prevToken(&tok_it, &tree); container_decl.init_arg_expr = ast.Node.ContainerDecl.InitArg{ .Type = undefined }; stack.append(State{ .Expression = OptionalCtx{ .Required = &container_decl.init_arg_expr.Type } }) catch unreachable; }, } continue; }, State.ContainerDecl => |container_decl| { const comments = try eatDocComments(arena, &tok_it, &tree); const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Identifier => { switch (tree.tokens.at(container_decl.kind_token).id) { Token.Id.Keyword_struct => { const node = try arena.create(ast.Node.StructField{ .base = ast.Node{ .id = ast.Node.Id.StructField }, .doc_comments = comments, .visib_token = null, .name_token = token_index, .type_expr = undefined, }); const node_ptr = try container_decl.fields_and_decls.addOne(); node_ptr.* = &node.base; try stack.append(State{ .FieldListCommaOrEnd = container_decl }); try stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.type_expr } }); try stack.append(State{ .ExpectToken = Token.Id.Colon }); continue; }, Token.Id.Keyword_union => { const node = try arena.create(ast.Node.UnionTag{ .base = ast.Node{ .id = ast.Node.Id.UnionTag }, .name_token = token_index, .type_expr = null, .value_expr = null, .doc_comments = comments, }); try container_decl.fields_and_decls.push(&node.base); stack.append(State{ .FieldListCommaOrEnd = container_decl }) catch unreachable; try stack.append(State{ .FieldInitValue = OptionalCtx{ .RequiredNull = &node.value_expr } }); try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &node.type_expr } }); try stack.append(State{ .IfToken = Token.Id.Colon }); continue; }, Token.Id.Keyword_enum => { const node = try arena.create(ast.Node.EnumTag{ .base = ast.Node{ .id = ast.Node.Id.EnumTag }, .name_token = token_index, .value = null, .doc_comments = comments, }); try container_decl.fields_and_decls.push(&node.base); stack.append(State{ .FieldListCommaOrEnd = container_decl }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .RequiredNull = &node.value } }); try stack.append(State{ .IfToken = Token.Id.Equal }); continue; }, else => unreachable, } }, Token.Id.Keyword_pub => { switch (tree.tokens.at(container_decl.kind_token).id) { Token.Id.Keyword_struct => { try stack.append(State{ .TopLevelExternOrField = TopLevelExternOrFieldCtx{ .visib_token = token_index, .container_decl = container_decl, .comments = comments, }, }); continue; }, else => { stack.append(State{ .ContainerDecl = container_decl }) catch unreachable; try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{ .decls = &container_decl.fields_and_decls, .visib_token = token_index, .extern_export_inline_token = null, .lib_name = null, .comments = comments, }, }); continue; }, } }, Token.Id.Keyword_export => { stack.append(State{ .ContainerDecl = container_decl }) catch unreachable; try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{ .decls = &container_decl.fields_and_decls, .visib_token = token_index, .extern_export_inline_token = null, .lib_name = null, .comments = comments, }, }); continue; }, Token.Id.RBrace => { if (comments != null) { ((try tree.errors.addOne())).* = Error{ .UnattachedDocComment = Error.UnattachedDocComment{ .token = token_index } }; return tree; } container_decl.rbrace_token = token_index; continue; }, else => { prevToken(&tok_it, &tree); stack.append(State{ .ContainerDecl = container_decl }) catch unreachable; try stack.append(State{ .TopLevelExtern = TopLevelDeclCtx{ .decls = &container_decl.fields_and_decls, .visib_token = null, .extern_export_inline_token = null, .lib_name = null, .comments = comments, }, }); continue; }, } }, State.VarDecl => |ctx| { const var_decl = try arena.create(ast.Node.VarDecl{ .base = ast.Node{ .id = ast.Node.Id.VarDecl }, .doc_comments = ctx.comments, .visib_token = ctx.visib_token, .mut_token = ctx.mut_token, .comptime_token = ctx.comptime_token, .extern_export_token = ctx.extern_export_token, .type_node = null, .align_node = null, .init_node = null, .lib_name = ctx.lib_name, // initialized later .name_token = undefined, .eq_token = undefined, .semicolon_token = undefined, }); try ctx.list.push(&var_decl.base); try stack.append(State{ .VarDeclAlign = var_decl }); try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &var_decl.type_node } }); try stack.append(State{ .IfToken = Token.Id.Colon }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Identifier, .ptr = &var_decl.name_token, }, }); continue; }, State.VarDeclAlign => |var_decl| { try stack.append(State{ .VarDeclEq = var_decl }); const next_token = nextToken(&tok_it, &tree); const next_token_index = next_token.index; const next_token_ptr = next_token.ptr; if (next_token_ptr.id == Token.Id.Keyword_align) { try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .RequiredNull = &var_decl.align_node } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); continue; } prevToken(&tok_it, &tree); continue; }, State.VarDeclEq => |var_decl| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Equal => { var_decl.eq_token = token_index; stack.append(State{ .VarDeclSemiColon = var_decl }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .RequiredNull = &var_decl.init_node } }); continue; }, Token.Id.Semicolon => { var_decl.semicolon_token = token_index; continue; }, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedEqOrSemi = Error.ExpectedEqOrSemi{ .token = token_index } }; return tree; }, } }, State.VarDeclSemiColon => |var_decl| { const semicolon_token = nextToken(&tok_it, &tree); if (semicolon_token.ptr.id != Token.Id.Semicolon) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = semicolon_token.index, .expected_id = Token.Id.Semicolon, }, }; return tree; } var_decl.semicolon_token = semicolon_token.index; if (eatToken(&tok_it, &tree, Token.Id.DocComment)) |doc_comment_token| { const loc = tree.tokenLocation(semicolon_token.ptr.end, doc_comment_token); if (loc.line == 0) { try pushDocComment(arena, doc_comment_token, &var_decl.doc_comments); } else { prevToken(&tok_it, &tree); } } }, State.FnDef => |fn_proto| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.LBrace => { const block = try arena.create(ast.Node.Block{ .base = ast.Node{ .id = ast.Node.Id.Block }, .label = null, .lbrace = token_index, .statements = ast.Node.Block.StatementList.init(arena), .rbrace = undefined, }); fn_proto.body_node = &block.base; stack.append(State{ .Block = block }) catch unreachable; continue; }, Token.Id.Semicolon => continue, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedSemiOrLBrace = Error.ExpectedSemiOrLBrace{ .token = token_index } }; return tree; }, } }, State.FnProto => |fn_proto| { stack.append(State{ .FnProtoAlign = fn_proto }) catch unreachable; try stack.append(State{ .ParamDecl = fn_proto }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); if (eatToken(&tok_it, &tree, Token.Id.Identifier)) |name_token| { fn_proto.name_token = name_token; } continue; }, State.FnProtoAlign => |fn_proto| { stack.append(State{ .FnProtoReturnType = fn_proto }) catch unreachable; if (eatToken(&tok_it, &tree, Token.Id.Keyword_align)) |align_token| { try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .RequiredNull = &fn_proto.align_expr } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); } continue; }, State.FnProtoReturnType => |fn_proto| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Bang => { fn_proto.return_type = ast.Node.FnProto.ReturnType{ .InferErrorSet = undefined }; stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &fn_proto.return_type.InferErrorSet } }) catch unreachable; continue; }, else => { // TODO: this is a special case. Remove this when #760 is fixed if (token_ptr.id == Token.Id.Keyword_error) { if (tok_it.peek().?.id == Token.Id.LBrace) { const error_type_node = try arena.create(ast.Node.ErrorType{ .base = ast.Node{ .id = ast.Node.Id.ErrorType }, .token = token_index, }); fn_proto.return_type = ast.Node.FnProto.ReturnType{ .Explicit = &error_type_node.base }; continue; } } prevToken(&tok_it, &tree); fn_proto.return_type = ast.Node.FnProto.ReturnType{ .Explicit = undefined }; stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &fn_proto.return_type.Explicit } }) catch unreachable; continue; }, } }, State.ParamDecl => |fn_proto| { if (eatToken(&tok_it, &tree, Token.Id.RParen)) |_| { continue; } const param_decl = try arena.create(ast.Node.ParamDecl{ .base = ast.Node{ .id = ast.Node.Id.ParamDecl }, .comptime_token = null, .noalias_token = null, .name_token = null, .type_node = undefined, .var_args_token = null, }); try fn_proto.params.push(&param_decl.base); stack.append(State{ .ParamDeclEnd = ParamDeclEndCtx{ .param_decl = param_decl, .fn_proto = fn_proto, }, }) catch unreachable; try stack.append(State{ .ParamDeclName = param_decl }); try stack.append(State{ .ParamDeclAliasOrComptime = param_decl }); continue; }, State.ParamDeclAliasOrComptime => |param_decl| { if (eatToken(&tok_it, &tree, Token.Id.Keyword_comptime)) |comptime_token| { param_decl.comptime_token = comptime_token; } else if (eatToken(&tok_it, &tree, Token.Id.Keyword_noalias)) |noalias_token| { param_decl.noalias_token = noalias_token; } continue; }, State.ParamDeclName => |param_decl| { // TODO: Here, we eat two tokens in one state. This means that we can't have // comments between these two tokens. if (eatToken(&tok_it, &tree, Token.Id.Identifier)) |ident_token| { if (eatToken(&tok_it, &tree, Token.Id.Colon)) |_| { param_decl.name_token = ident_token; } else { prevToken(&tok_it, &tree); } } continue; }, State.ParamDeclEnd => |ctx| { if (eatToken(&tok_it, &tree, Token.Id.Ellipsis3)) |ellipsis3| { ctx.param_decl.var_args_token = ellipsis3; stack.append(State{ .ExpectToken = Token.Id.RParen }) catch unreachable; continue; } try stack.append(State{ .ParamDeclComma = ctx.fn_proto }); try stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &ctx.param_decl.type_node } }); continue; }, State.ParamDeclComma => |fn_proto| { switch (expectCommaOrEnd(&tok_it, &tree, Token.Id.RParen)) { ExpectCommaOrEndResult.end_token => |t| { if (t == null) { stack.append(State{ .ParamDecl = fn_proto }) catch unreachable; } continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } }, State.MaybeLabeledExpression => |ctx| { if (eatToken(&tok_it, &tree, Token.Id.Colon)) |_| { stack.append(State{ .LabeledExpression = LabelCtx{ .label = ctx.label, .opt_ctx = ctx.opt_ctx, }, }) catch unreachable; continue; } _ = try createToCtxLiteral(arena, ctx.opt_ctx, ast.Node.Identifier, ctx.label); continue; }, State.LabeledExpression => |ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.LBrace => { const block = try arena.create(ast.Node.Block{ .base = ast.Node{ .id = ast.Node.Id.Block }, .label = ctx.label, .lbrace = token_index, .statements = ast.Node.Block.StatementList.init(arena), .rbrace = undefined, }); ctx.opt_ctx.store(&block.base); stack.append(State{ .Block = block }) catch unreachable; continue; }, Token.Id.Keyword_while => { stack.append(State{ .While = LoopCtx{ .label = ctx.label, .inline_token = null, .loop_token = token_index, .opt_ctx = ctx.opt_ctx.toRequired(), }, }) catch unreachable; continue; }, Token.Id.Keyword_for => { stack.append(State{ .For = LoopCtx{ .label = ctx.label, .inline_token = null, .loop_token = token_index, .opt_ctx = ctx.opt_ctx.toRequired(), }, }) catch unreachable; continue; }, Token.Id.Keyword_suspend => { const node = try arena.create(ast.Node.Suspend{ .base = ast.Node{ .id = ast.Node.Id.Suspend }, .label = ctx.label, .suspend_token = token_index, .payload = null, .body = null, }); ctx.opt_ctx.store(&node.base); stack.append(State{ .SuspendBody = node }) catch unreachable; try stack.append(State{ .Payload = OptionalCtx{ .Optional = &node.payload } }); continue; }, Token.Id.Keyword_inline => { stack.append(State{ .Inline = InlineCtx{ .label = ctx.label, .inline_token = token_index, .opt_ctx = ctx.opt_ctx.toRequired(), }, }) catch unreachable; continue; }, else => { if (ctx.opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedLabelable = Error.ExpectedLabelable{ .token = token_index } }; return tree; } prevToken(&tok_it, &tree); continue; }, } }, State.Inline => |ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_while => { stack.append(State{ .While = LoopCtx{ .inline_token = ctx.inline_token, .label = ctx.label, .loop_token = token_index, .opt_ctx = ctx.opt_ctx.toRequired(), }, }) catch unreachable; continue; }, Token.Id.Keyword_for => { stack.append(State{ .For = LoopCtx{ .inline_token = ctx.inline_token, .label = ctx.label, .loop_token = token_index, .opt_ctx = ctx.opt_ctx.toRequired(), }, }) catch unreachable; continue; }, else => { if (ctx.opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedInlinable = Error.ExpectedInlinable{ .token = token_index } }; return tree; } prevToken(&tok_it, &tree); continue; }, } }, State.While => |ctx| { const node = try arena.create(ast.Node.While{ .base = ast.Node{ .id = ast.Node.Id.While }, .label = ctx.label, .inline_token = ctx.inline_token, .while_token = ctx.loop_token, .condition = undefined, .payload = null, .continue_expr = null, .body = undefined, .@"else" = null, }); ctx.opt_ctx.store(&node.base); stack.append(State{ .Else = &node.@"else" }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.body } }); try stack.append(State{ .WhileContinueExpr = &node.continue_expr }); try stack.append(State{ .IfToken = Token.Id.Colon }); try stack.append(State{ .PointerPayload = OptionalCtx{ .Optional = &node.payload } }); try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.condition } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); continue; }, State.WhileContinueExpr => |dest| { stack.append(State{ .ExpectToken = Token.Id.RParen }) catch unreachable; try stack.append(State{ .AssignmentExpressionBegin = OptionalCtx{ .RequiredNull = dest } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); continue; }, State.For => |ctx| { const node = try arena.create(ast.Node.For{ .base = ast.Node{ .id = ast.Node.Id.For }, .label = ctx.label, .inline_token = ctx.inline_token, .for_token = ctx.loop_token, .array_expr = undefined, .payload = null, .body = undefined, .@"else" = null, }); ctx.opt_ctx.store(&node.base); stack.append(State{ .Else = &node.@"else" }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.body } }); try stack.append(State{ .PointerIndexPayload = OptionalCtx{ .Optional = &node.payload } }); try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.array_expr } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); continue; }, State.Else => |dest| { if (eatToken(&tok_it, &tree, Token.Id.Keyword_else)) |else_token| { const node = try arena.create(ast.Node.Else{ .base = ast.Node{ .id = ast.Node.Id.Else }, .else_token = else_token, .payload = null, .body = undefined, }); dest.* = node; stack.append(State{ .Expression = OptionalCtx{ .Required = &node.body } }) catch unreachable; try stack.append(State{ .Payload = OptionalCtx{ .Optional = &node.payload } }); continue; } else { continue; } }, State.Block => |block| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.RBrace => { block.rbrace = token_index; continue; }, else => { prevToken(&tok_it, &tree); stack.append(State{ .Block = block }) catch unreachable; try stack.append(State{ .Statement = block }); continue; }, } }, State.Statement => |block| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_comptime => { stack.append(State{ .ComptimeStatement = ComptimeStatementCtx{ .comptime_token = token_index, .block = block, }, }) catch unreachable; continue; }, Token.Id.Keyword_var, Token.Id.Keyword_const => { stack.append(State{ .VarDecl = VarDeclCtx{ .comments = null, .visib_token = null, .comptime_token = null, .extern_export_token = null, .lib_name = null, .mut_token = token_index, .list = &block.statements, }, }) catch unreachable; continue; }, Token.Id.Keyword_defer, Token.Id.Keyword_errdefer => { const node = try arena.create(ast.Node.Defer{ .base = ast.Node{ .id = ast.Node.Id.Defer }, .defer_token = token_index, .kind = switch (token_ptr.id) { Token.Id.Keyword_defer => ast.Node.Defer.Kind.Unconditional, Token.Id.Keyword_errdefer => ast.Node.Defer.Kind.Error, else => unreachable, }, .expr = undefined, }); const node_ptr = try block.statements.addOne(); node_ptr.* = &node.base; stack.append(State{ .Semicolon = node_ptr }) catch unreachable; try stack.append(State{ .AssignmentExpressionBegin = OptionalCtx{ .Required = &node.expr } }); continue; }, Token.Id.LBrace => { const inner_block = try arena.create(ast.Node.Block{ .base = ast.Node{ .id = ast.Node.Id.Block }, .label = null, .lbrace = token_index, .statements = ast.Node.Block.StatementList.init(arena), .rbrace = undefined, }); try block.statements.push(&inner_block.base); stack.append(State{ .Block = inner_block }) catch unreachable; continue; }, else => { prevToken(&tok_it, &tree); const statement = try block.statements.addOne(); try stack.append(State{ .Semicolon = statement }); try stack.append(State{ .AssignmentExpressionBegin = OptionalCtx{ .Required = statement } }); continue; }, } }, State.ComptimeStatement => |ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_var, Token.Id.Keyword_const => { stack.append(State{ .VarDecl = VarDeclCtx{ .comments = null, .visib_token = null, .comptime_token = ctx.comptime_token, .extern_export_token = null, .lib_name = null, .mut_token = token_index, .list = &ctx.block.statements, }, }) catch unreachable; continue; }, else => { prevToken(&tok_it, &tree); prevToken(&tok_it, &tree); const statement = try ctx.block.statements.addOne(); try stack.append(State{ .Semicolon = statement }); try stack.append(State{ .Expression = OptionalCtx{ .Required = statement } }); continue; }, } }, State.Semicolon => |node_ptr| { const node = node_ptr.*; if (node.requireSemiColon()) { stack.append(State{ .ExpectToken = Token.Id.Semicolon }) catch unreachable; continue; } continue; }, State.AsmOutputItems => |items| { const lbracket = nextToken(&tok_it, &tree); const lbracket_index = lbracket.index; const lbracket_ptr = lbracket.ptr; if (lbracket_ptr.id != Token.Id.LBracket) { prevToken(&tok_it, &tree); continue; } const node = try arena.create(ast.Node.AsmOutput{ .base = ast.Node{ .id = ast.Node.Id.AsmOutput }, .lbracket = lbracket_index, .symbolic_name = undefined, .constraint = undefined, .kind = undefined, .rparen = undefined, }); try items.push(node); stack.append(State{ .AsmOutputItems = items }) catch unreachable; try stack.append(State{ .IfToken = Token.Id.Comma }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.RParen, .ptr = &node.rparen, }, }); try stack.append(State{ .AsmOutputReturnOrType = node }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.constraint } }); try stack.append(State{ .ExpectToken = Token.Id.RBracket }); try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.symbolic_name } }); continue; }, State.AsmOutputReturnOrType => |node| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Identifier => { node.kind = ast.Node.AsmOutput.Kind{ .Variable = try createLiteral(arena, ast.Node.Identifier, token_index) }; continue; }, Token.Id.Arrow => { node.kind = ast.Node.AsmOutput.Kind{ .Return = undefined }; try stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.kind.Return } }); continue; }, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedAsmOutputReturnOrType = Error.ExpectedAsmOutputReturnOrType{ .token = token_index } }; return tree; }, } }, State.AsmInputItems => |items| { const lbracket = nextToken(&tok_it, &tree); const lbracket_index = lbracket.index; const lbracket_ptr = lbracket.ptr; if (lbracket_ptr.id != Token.Id.LBracket) { prevToken(&tok_it, &tree); continue; } const node = try arena.create(ast.Node.AsmInput{ .base = ast.Node{ .id = ast.Node.Id.AsmInput }, .lbracket = lbracket_index, .symbolic_name = undefined, .constraint = undefined, .expr = undefined, .rparen = undefined, }); try items.push(node); stack.append(State{ .AsmInputItems = items }) catch unreachable; try stack.append(State{ .IfToken = Token.Id.Comma }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.RParen, .ptr = &node.rparen, }, }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.constraint } }); try stack.append(State{ .ExpectToken = Token.Id.RBracket }); try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.symbolic_name } }); continue; }, State.AsmClobberItems => |items| { while (eatToken(&tok_it, &tree, Token.Id.StringLiteral)) |strlit| { try items.push(strlit); if (eatToken(&tok_it, &tree, Token.Id.Comma) == null) break; } continue; }, State.ExprListItemOrEnd => |list_state| { if (eatToken(&tok_it, &tree, list_state.end)) |token_index| { (list_state.ptr).* = token_index; continue; } stack.append(State{ .ExprListCommaOrEnd = list_state }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = try list_state.list.addOne() } }); continue; }, State.ExprListCommaOrEnd => |list_state| { switch (expectCommaOrEnd(&tok_it, &tree, list_state.end)) { ExpectCommaOrEndResult.end_token => |maybe_end| if (maybe_end) |end| { (list_state.ptr).* = end; continue; } else { stack.append(State{ .ExprListItemOrEnd = list_state }) catch unreachable; continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } }, State.FieldInitListItemOrEnd => |list_state| { if (eatToken(&tok_it, &tree, Token.Id.RBrace)) |rbrace| { (list_state.ptr).* = rbrace; continue; } const node = try arena.create(ast.Node.FieldInitializer{ .base = ast.Node{ .id = ast.Node.Id.FieldInitializer }, .period_token = undefined, .name_token = undefined, .expr = undefined, }); try list_state.list.push(&node.base); stack.append(State{ .FieldInitListCommaOrEnd = list_state }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } }); try stack.append(State{ .ExpectToken = Token.Id.Equal }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Identifier, .ptr = &node.name_token, }, }); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Period, .ptr = &node.period_token, }, }); continue; }, State.FieldInitListCommaOrEnd => |list_state| { switch (expectCommaOrEnd(&tok_it, &tree, Token.Id.RBrace)) { ExpectCommaOrEndResult.end_token => |maybe_end| if (maybe_end) |end| { (list_state.ptr).* = end; continue; } else { stack.append(State{ .FieldInitListItemOrEnd = list_state }) catch unreachable; continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } }, State.FieldListCommaOrEnd => |container_decl| { switch (expectCommaOrEnd(&tok_it, &tree, Token.Id.RBrace)) { ExpectCommaOrEndResult.end_token => |maybe_end| if (maybe_end) |end| { container_decl.rbrace_token = end; continue; } else { try stack.append(State{ .ContainerDecl = container_decl }); continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } }, State.ErrorTagListItemOrEnd => |list_state| { if (eatToken(&tok_it, &tree, Token.Id.RBrace)) |rbrace| { (list_state.ptr).* = rbrace; continue; } const node_ptr = try list_state.list.addOne(); try stack.append(State{ .ErrorTagListCommaOrEnd = list_state }); try stack.append(State{ .ErrorTag = node_ptr }); continue; }, State.ErrorTagListCommaOrEnd => |list_state| { switch (expectCommaOrEnd(&tok_it, &tree, Token.Id.RBrace)) { ExpectCommaOrEndResult.end_token => |maybe_end| if (maybe_end) |end| { (list_state.ptr).* = end; continue; } else { stack.append(State{ .ErrorTagListItemOrEnd = list_state }) catch unreachable; continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } }, State.SwitchCaseOrEnd => |list_state| { if (eatToken(&tok_it, &tree, Token.Id.RBrace)) |rbrace| { (list_state.ptr).* = rbrace; continue; } const comments = try eatDocComments(arena, &tok_it, &tree); const node = try arena.create(ast.Node.SwitchCase{ .base = ast.Node{ .id = ast.Node.Id.SwitchCase }, .items = ast.Node.SwitchCase.ItemList.init(arena), .payload = null, .expr = undefined, .arrow_token = undefined, }); try list_state.list.push(&node.base); try stack.append(State{ .SwitchCaseCommaOrEnd = list_state }); try stack.append(State{ .AssignmentExpressionBegin = OptionalCtx{ .Required = &node.expr } }); try stack.append(State{ .PointerPayload = OptionalCtx{ .Optional = &node.payload } }); try stack.append(State{ .SwitchCaseFirstItem = node }); continue; }, State.SwitchCaseCommaOrEnd => |list_state| { switch (expectCommaOrEnd(&tok_it, &tree, Token.Id.RBrace)) { ExpectCommaOrEndResult.end_token => |maybe_end| if (maybe_end) |end| { (list_state.ptr).* = end; continue; } else { try stack.append(State{ .SwitchCaseOrEnd = list_state }); continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } }, State.SwitchCaseFirstItem => |switch_case| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (token_ptr.id == Token.Id.Keyword_else) { const else_node = try arena.create(ast.Node.SwitchElse{ .base = ast.Node{ .id = ast.Node.Id.SwitchElse }, .token = token_index, }); try switch_case.items.push(&else_node.base); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.EqualAngleBracketRight, .ptr = &switch_case.arrow_token, }, }); continue; } else { prevToken(&tok_it, &tree); stack.append(State{ .SwitchCaseItemCommaOrEnd = switch_case }) catch unreachable; try stack.append(State{ .RangeExpressionBegin = OptionalCtx{ .Required = try switch_case.items.addOne() } }); continue; } }, State.SwitchCaseItemOrEnd => |switch_case| { const token = nextToken(&tok_it, &tree); if (token.ptr.id == Token.Id.EqualAngleBracketRight) { switch_case.arrow_token = token.index; continue; } else { prevToken(&tok_it, &tree); stack.append(State{ .SwitchCaseItemCommaOrEnd = switch_case }) catch unreachable; try stack.append(State{ .RangeExpressionBegin = OptionalCtx{ .Required = try switch_case.items.addOne() } }); continue; } }, State.SwitchCaseItemCommaOrEnd => |switch_case| { switch (expectCommaOrEnd(&tok_it, &tree, Token.Id.EqualAngleBracketRight)) { ExpectCommaOrEndResult.end_token => |end_token| { if (end_token) |t| { switch_case.arrow_token = t; } else { stack.append(State{ .SwitchCaseItemOrEnd = switch_case }) catch unreachable; } continue; }, ExpectCommaOrEndResult.parse_error => |e| { try tree.errors.push(e); return tree; }, } continue; }, State.SuspendBody => |suspend_node| { if (suspend_node.payload != null) { try stack.append(State{ .AssignmentExpressionBegin = OptionalCtx{ .RequiredNull = &suspend_node.body } }); } continue; }, State.AsyncAllocator => |async_node| { if (eatToken(&tok_it, &tree, Token.Id.AngleBracketLeft) == null) { continue; } async_node.rangle_bracket = TokenIndex(0); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.AngleBracketRight, .ptr = &async_node.rangle_bracket.?, }, }); try stack.append(State{ .TypeExprBegin = OptionalCtx{ .RequiredNull = &async_node.allocator_type } }); continue; }, State.AsyncEnd => |ctx| { const node = ctx.ctx.get() orelse continue; switch (node.id) { ast.Node.Id.FnProto => { const fn_proto = @fieldParentPtr(ast.Node.FnProto, "base", node); fn_proto.async_attr = ctx.attribute; continue; }, ast.Node.Id.SuffixOp => { const suffix_op = @fieldParentPtr(ast.Node.SuffixOp, "base", node); if (suffix_op.op == @TagType(ast.Node.SuffixOp.Op).Call) { suffix_op.op.Call.async_attr = ctx.attribute; continue; } ((try tree.errors.addOne())).* = Error{ .ExpectedCall = Error.ExpectedCall{ .node = node } }; return tree; }, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedCallOrFnProto = Error.ExpectedCallOrFnProto{ .node = node } }; return tree; }, } }, State.ExternType => |ctx| { if (eatToken(&tok_it, &tree, Token.Id.Keyword_fn)) |fn_token| { const fn_proto = try arena.create(ast.Node.FnProto{ .base = ast.Node{ .id = ast.Node.Id.FnProto }, .doc_comments = ctx.comments, .visib_token = null, .name_token = null, .fn_token = fn_token, .params = ast.Node.FnProto.ParamList.init(arena), .return_type = undefined, .var_args_token = null, .extern_export_inline_token = ctx.extern_token, .cc_token = null, .async_attr = null, .body_node = null, .lib_name = null, .align_expr = null, }); ctx.opt_ctx.store(&fn_proto.base); stack.append(State{ .FnProto = fn_proto }) catch unreachable; continue; } stack.append(State{ .ContainerKind = ContainerKindCtx{ .opt_ctx = ctx.opt_ctx, .layout_token = ctx.extern_token, }, }) catch unreachable; continue; }, State.SliceOrArrayAccess => |node| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Ellipsis2 => { const start = node.op.ArrayAccess; node.op = ast.Node.SuffixOp.Op{ .Slice = ast.Node.SuffixOp.Op.Slice{ .start = start, .end = null, }, }; stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.RBracket, .ptr = &node.rtoken, }, }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Optional = &node.op.Slice.end } }); continue; }, Token.Id.RBracket => { node.rtoken = token_index; continue; }, else => { ((try tree.errors.addOne())).* = Error{ .ExpectedSliceOrRBracket = Error.ExpectedSliceOrRBracket{ .token = token_index } }; return tree; }, } }, State.SliceOrArrayType => |node| { if (eatToken(&tok_it, &tree, Token.Id.RBracket)) |_| { node.op = ast.Node.PrefixOp.Op{ .SliceType = ast.Node.PrefixOp.PtrInfo{ .align_info = null, .const_token = null, .volatile_token = null, }, }; stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.rhs } }) catch unreachable; try stack.append(State{ .PtrTypeModifiers = &node.op.SliceType }); continue; } node.op = ast.Node.PrefixOp.Op{ .ArrayType = undefined }; stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.rhs } }) catch unreachable; try stack.append(State{ .ExpectToken = Token.Id.RBracket }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.op.ArrayType } }); continue; }, State.PtrTypeModifiers => |addr_of_info| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_align => { stack.append(state) catch unreachable; if (addr_of_info.align_info != null) { ((try tree.errors.addOne())).* = Error{ .ExtraAlignQualifier = Error.ExtraAlignQualifier{ .token = token_index } }; return tree; } addr_of_info.align_info = ast.Node.PrefixOp.PtrInfo.Align{ .node = undefined, .bit_range = null, }; // TODO https://github.com/ziglang/zig/issues/1022 const align_info = &addr_of_info.align_info.?; try stack.append(State{ .AlignBitRange = align_info }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &align_info.node } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); continue; }, Token.Id.Keyword_const => { stack.append(state) catch unreachable; if (addr_of_info.const_token != null) { ((try tree.errors.addOne())).* = Error{ .ExtraConstQualifier = Error.ExtraConstQualifier{ .token = token_index } }; return tree; } addr_of_info.const_token = token_index; continue; }, Token.Id.Keyword_volatile => { stack.append(state) catch unreachable; if (addr_of_info.volatile_token != null) { ((try tree.errors.addOne())).* = Error{ .ExtraVolatileQualifier = Error.ExtraVolatileQualifier{ .token = token_index } }; return tree; } addr_of_info.volatile_token = token_index; continue; }, else => { prevToken(&tok_it, &tree); continue; }, } }, State.AlignBitRange => |align_info| { const token = nextToken(&tok_it, &tree); switch (token.ptr.id) { Token.Id.Colon => { align_info.bit_range = ast.Node.PrefixOp.PtrInfo.Align.BitRange(undefined); const bit_range = &align_info.bit_range.?; try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &bit_range.end } }); try stack.append(State{ .ExpectToken = Token.Id.Colon }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &bit_range.start } }); continue; }, Token.Id.RParen => continue, else => { (try tree.errors.addOne()).* = Error{ .ExpectedColonOrRParen = Error.ExpectedColonOrRParen{ .token = token.index }, }; return tree; }, } }, State.Payload => |opt_ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (token_ptr.id != Token.Id.Pipe) { if (opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = token_index, .expected_id = Token.Id.Pipe, }, }; return tree; } prevToken(&tok_it, &tree); continue; } const node = try arena.create(ast.Node.Payload{ .base = ast.Node{ .id = ast.Node.Id.Payload }, .lpipe = token_index, .error_symbol = undefined, .rpipe = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Pipe, .ptr = &node.rpipe, }, }) catch unreachable; try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.error_symbol } }); continue; }, State.PointerPayload => |opt_ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (token_ptr.id != Token.Id.Pipe) { if (opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = token_index, .expected_id = Token.Id.Pipe, }, }; return tree; } prevToken(&tok_it, &tree); continue; } const node = try arena.create(ast.Node.PointerPayload{ .base = ast.Node{ .id = ast.Node.Id.PointerPayload }, .lpipe = token_index, .ptr_token = null, .value_symbol = undefined, .rpipe = undefined, }); opt_ctx.store(&node.base); try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Pipe, .ptr = &node.rpipe, }, }); try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.value_symbol } }); try stack.append(State{ .OptionalTokenSave = OptionalTokenSave{ .id = Token.Id.Asterisk, .ptr = &node.ptr_token, }, }); continue; }, State.PointerIndexPayload => |opt_ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (token_ptr.id != Token.Id.Pipe) { if (opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = token_index, .expected_id = Token.Id.Pipe, }, }; return tree; } prevToken(&tok_it, &tree); continue; } const node = try arena.create(ast.Node.PointerIndexPayload{ .base = ast.Node{ .id = ast.Node.Id.PointerIndexPayload }, .lpipe = token_index, .ptr_token = null, .value_symbol = undefined, .index_symbol = null, .rpipe = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Pipe, .ptr = &node.rpipe, }, }) catch unreachable; try stack.append(State{ .Identifier = OptionalCtx{ .RequiredNull = &node.index_symbol } }); try stack.append(State{ .IfToken = Token.Id.Comma }); try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.value_symbol } }); try stack.append(State{ .OptionalTokenSave = OptionalTokenSave{ .id = Token.Id.Asterisk, .ptr = &node.ptr_token, }, }); continue; }, State.Expression => |opt_ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Keyword_return, Token.Id.Keyword_break, Token.Id.Keyword_continue => { const node = try arena.create(ast.Node.ControlFlowExpression{ .base = ast.Node{ .id = ast.Node.Id.ControlFlowExpression }, .ltoken = token_index, .kind = undefined, .rhs = null, }); opt_ctx.store(&node.base); stack.append(State{ .Expression = OptionalCtx{ .Optional = &node.rhs } }) catch unreachable; switch (token_ptr.id) { Token.Id.Keyword_break => { node.kind = ast.Node.ControlFlowExpression.Kind{ .Break = null }; try stack.append(State{ .Identifier = OptionalCtx{ .RequiredNull = &node.kind.Break } }); try stack.append(State{ .IfToken = Token.Id.Colon }); }, Token.Id.Keyword_continue => { node.kind = ast.Node.ControlFlowExpression.Kind{ .Continue = null }; try stack.append(State{ .Identifier = OptionalCtx{ .RequiredNull = &node.kind.Continue } }); try stack.append(State{ .IfToken = Token.Id.Colon }); }, Token.Id.Keyword_return => { node.kind = ast.Node.ControlFlowExpression.Kind.Return; }, else => unreachable, } continue; }, Token.Id.Keyword_try, Token.Id.Keyword_cancel, Token.Id.Keyword_resume => { const node = try arena.create(ast.Node.PrefixOp{ .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, .op_token = token_index, .op = switch (token_ptr.id) { Token.Id.Keyword_try => ast.Node.PrefixOp.Op{ .Try = void{} }, Token.Id.Keyword_cancel => ast.Node.PrefixOp.Op{ .Cancel = void{} }, Token.Id.Keyword_resume => ast.Node.PrefixOp.Op{ .Resume = void{} }, else => unreachable, }, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .Expression = OptionalCtx{ .Required = &node.rhs } }) catch unreachable; continue; }, else => { if (!try parseBlockExpr(&stack, arena, opt_ctx, token_ptr, token_index)) { prevToken(&tok_it, &tree); stack.append(State{ .UnwrapExpressionBegin = opt_ctx }) catch unreachable; } continue; }, } }, State.RangeExpressionBegin => |opt_ctx| { stack.append(State{ .RangeExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .Expression = opt_ctx }); continue; }, State.RangeExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Ellipsis3)) |ellipsis3| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = ellipsis3, .op = ast.Node.InfixOp.Op.Range, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .Expression = OptionalCtx{ .Required = &node.rhs } }) catch unreachable; continue; } }, State.AssignmentExpressionBegin => |opt_ctx| { stack.append(State{ .AssignmentExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .Expression = opt_ctx }); continue; }, State.AssignmentExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToAssignment(token_ptr.id)) |ass_id| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = ass_id, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .AssignmentExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.rhs } }); continue; } else { prevToken(&tok_it, &tree); continue; } }, State.UnwrapExpressionBegin => |opt_ctx| { stack.append(State{ .UnwrapExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .BoolOrExpressionBegin = opt_ctx }); continue; }, State.UnwrapExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToUnwrapExpr(token_ptr.id)) |unwrap_id| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = unwrap_id, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .UnwrapExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.rhs } }); if (node.op == ast.Node.InfixOp.Op.Catch) { try stack.append(State{ .Payload = OptionalCtx{ .Optional = &node.op.Catch } }); } continue; } else { prevToken(&tok_it, &tree); continue; } }, State.BoolOrExpressionBegin => |opt_ctx| { stack.append(State{ .BoolOrExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .BoolAndExpressionBegin = opt_ctx }); continue; }, State.BoolOrExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Keyword_or)) |or_token| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = or_token, .op = ast.Node.InfixOp.Op.BoolOr, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .BoolOrExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .BoolAndExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } }, State.BoolAndExpressionBegin => |opt_ctx| { stack.append(State{ .BoolAndExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .ComparisonExpressionBegin = opt_ctx }); continue; }, State.BoolAndExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Keyword_and)) |and_token| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = and_token, .op = ast.Node.InfixOp.Op.BoolAnd, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .BoolAndExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .ComparisonExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } }, State.ComparisonExpressionBegin => |opt_ctx| { stack.append(State{ .ComparisonExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .BinaryOrExpressionBegin = opt_ctx }); continue; }, State.ComparisonExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToComparison(token_ptr.id)) |comp_id| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = comp_id, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .ComparisonExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .BinaryOrExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } else { prevToken(&tok_it, &tree); continue; } }, State.BinaryOrExpressionBegin => |opt_ctx| { stack.append(State{ .BinaryOrExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .BinaryXorExpressionBegin = opt_ctx }); continue; }, State.BinaryOrExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Pipe)) |pipe| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = pipe, .op = ast.Node.InfixOp.Op.BitOr, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .BinaryOrExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .BinaryXorExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } }, State.BinaryXorExpressionBegin => |opt_ctx| { stack.append(State{ .BinaryXorExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .BinaryAndExpressionBegin = opt_ctx }); continue; }, State.BinaryXorExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Caret)) |caret| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = caret, .op = ast.Node.InfixOp.Op.BitXor, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .BinaryXorExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .BinaryAndExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } }, State.BinaryAndExpressionBegin => |opt_ctx| { stack.append(State{ .BinaryAndExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .BitShiftExpressionBegin = opt_ctx }); continue; }, State.BinaryAndExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Ampersand)) |ampersand| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = ampersand, .op = ast.Node.InfixOp.Op.BitAnd, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .BinaryAndExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .BitShiftExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } }, State.BitShiftExpressionBegin => |opt_ctx| { stack.append(State{ .BitShiftExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .AdditionExpressionBegin = opt_ctx }); continue; }, State.BitShiftExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToBitShift(token_ptr.id)) |bitshift_id| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = bitshift_id, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .BitShiftExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .AdditionExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } else { prevToken(&tok_it, &tree); continue; } }, State.AdditionExpressionBegin => |opt_ctx| { stack.append(State{ .AdditionExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .MultiplyExpressionBegin = opt_ctx }); continue; }, State.AdditionExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToAddition(token_ptr.id)) |add_id| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = add_id, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .AdditionExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .MultiplyExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } else { prevToken(&tok_it, &tree); continue; } }, State.MultiplyExpressionBegin => |opt_ctx| { stack.append(State{ .MultiplyExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .CurlySuffixExpressionBegin = opt_ctx }); continue; }, State.MultiplyExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToMultiply(token_ptr.id)) |mult_id| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = mult_id, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .MultiplyExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .CurlySuffixExpressionBegin = OptionalCtx{ .Required = &node.rhs } }); continue; } else { prevToken(&tok_it, &tree); continue; } }, State.CurlySuffixExpressionBegin => |opt_ctx| { stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .IfToken = Token.Id.LBrace }); try stack.append(State{ .TypeExprBegin = opt_ctx }); continue; }, State.CurlySuffixExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (tok_it.peek().?.id == Token.Id.Period) { const node = try arena.create(ast.Node.SuffixOp{ .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, .lhs = lhs, .op = ast.Node.SuffixOp.Op{ .StructInitializer = ast.Node.SuffixOp.Op.InitList.init(arena) }, .rtoken = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .IfToken = Token.Id.LBrace }); try stack.append(State{ .FieldInitListItemOrEnd = ListSave(@typeOf(node.op.StructInitializer)){ .list = &node.op.StructInitializer, .ptr = &node.rtoken, }, }); continue; } const node = try arena.create(ast.Node.SuffixOp{ .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, .lhs = lhs, .op = ast.Node.SuffixOp.Op{ .ArrayInitializer = ast.Node.SuffixOp.Op.InitList.init(arena) }, .rtoken = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .CurlySuffixExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .IfToken = Token.Id.LBrace }); try stack.append(State{ .ExprListItemOrEnd = ExprListCtx{ .list = &node.op.ArrayInitializer, .end = Token.Id.RBrace, .ptr = &node.rtoken, }, }); continue; }, State.TypeExprBegin => |opt_ctx| { stack.append(State{ .TypeExprEnd = opt_ctx }) catch unreachable; try stack.append(State{ .PrefixOpExpression = opt_ctx }); continue; }, State.TypeExprEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; if (eatToken(&tok_it, &tree, Token.Id.Bang)) |bang| { const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = bang, .op = ast.Node.InfixOp.Op.ErrorUnion, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .TypeExprEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .PrefixOpExpression = OptionalCtx{ .Required = &node.rhs } }); continue; } }, State.PrefixOpExpression => |opt_ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (tokenIdToPrefixOp(token_ptr.id)) |prefix_id| { var node = try arena.create(ast.Node.PrefixOp{ .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, .op_token = token_index, .op = prefix_id, .rhs = undefined, }); opt_ctx.store(&node.base); // Treat '**' token as two pointer types if (token_ptr.id == Token.Id.AsteriskAsterisk) { const child = try arena.create(ast.Node.PrefixOp{ .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, .op_token = token_index, .op = prefix_id, .rhs = undefined, }); node.rhs = &child.base; node = child; } stack.append(State{ .TypeExprBegin = OptionalCtx{ .Required = &node.rhs } }) catch unreachable; if (node.op == ast.Node.PrefixOp.Op.PtrType) { try stack.append(State{ .PtrTypeModifiers = &node.op.PtrType }); } continue; } else { prevToken(&tok_it, &tree); stack.append(State{ .SuffixOpExpressionBegin = opt_ctx }) catch unreachable; continue; } }, State.SuffixOpExpressionBegin => |opt_ctx| { if (eatToken(&tok_it, &tree, Token.Id.Keyword_async)) |async_token| { const async_node = try arena.create(ast.Node.AsyncAttribute{ .base = ast.Node{ .id = ast.Node.Id.AsyncAttribute }, .async_token = async_token, .allocator_type = null, .rangle_bracket = null, }); stack.append(State{ .AsyncEnd = AsyncEndCtx{ .ctx = opt_ctx, .attribute = async_node, }, }) catch unreachable; try stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }); try stack.append(State{ .PrimaryExpression = opt_ctx.toRequired() }); try stack.append(State{ .AsyncAllocator = async_node }); continue; } stack.append(State{ .SuffixOpExpressionEnd = opt_ctx }) catch unreachable; try stack.append(State{ .PrimaryExpression = opt_ctx }); continue; }, State.SuffixOpExpressionEnd => |opt_ctx| { const lhs = opt_ctx.get() orelse continue; const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.LParen => { const node = try arena.create(ast.Node.SuffixOp{ .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, .lhs = lhs, .op = ast.Node.SuffixOp.Op{ .Call = ast.Node.SuffixOp.Op.Call{ .params = ast.Node.SuffixOp.Op.Call.ParamList.init(arena), .async_attr = null, }, }, .rtoken = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .ExprListItemOrEnd = ExprListCtx{ .list = &node.op.Call.params, .end = Token.Id.RParen, .ptr = &node.rtoken, }, }); continue; }, Token.Id.LBracket => { const node = try arena.create(ast.Node.SuffixOp{ .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, .lhs = lhs, .op = ast.Node.SuffixOp.Op{ .ArrayAccess = undefined }, .rtoken = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .SliceOrArrayAccess = node }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.op.ArrayAccess } }); continue; }, Token.Id.Period => { if (eatToken(&tok_it, &tree, Token.Id.Asterisk)) |asterisk_token| { const node = try arena.create(ast.Node.SuffixOp{ .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, .lhs = lhs, .op = ast.Node.SuffixOp.Op.Deref, .rtoken = asterisk_token, }); opt_ctx.store(&node.base); stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; continue; } if (eatToken(&tok_it, &tree, Token.Id.QuestionMark)) |question_token| { const node = try arena.create(ast.Node.SuffixOp{ .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, .lhs = lhs, .op = ast.Node.SuffixOp.Op.UnwrapOptional, .rtoken = question_token, }); opt_ctx.store(&node.base); stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; continue; } const node = try arena.create(ast.Node.InfixOp{ .base = ast.Node{ .id = ast.Node.Id.InfixOp }, .lhs = lhs, .op_token = token_index, .op = ast.Node.InfixOp.Op.Period, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; try stack.append(State{ .Identifier = OptionalCtx{ .Required = &node.rhs } }); continue; }, else => { prevToken(&tok_it, &tree); continue; }, } }, State.PrimaryExpression => |opt_ctx| { const token = nextToken(&tok_it, &tree); switch (token.ptr.id) { Token.Id.IntegerLiteral => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.StringLiteral, token.index); continue; }, Token.Id.FloatLiteral => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.FloatLiteral, token.index); continue; }, Token.Id.CharLiteral => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.CharLiteral, token.index); continue; }, Token.Id.Keyword_undefined => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.UndefinedLiteral, token.index); continue; }, Token.Id.Keyword_true, Token.Id.Keyword_false => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.BoolLiteral, token.index); continue; }, Token.Id.Keyword_null => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.NullLiteral, token.index); continue; }, Token.Id.Keyword_this => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.ThisLiteral, token.index); continue; }, Token.Id.Keyword_var => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.VarType, token.index); continue; }, Token.Id.Keyword_unreachable => { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.Unreachable, token.index); continue; }, Token.Id.Keyword_promise => { const node = try arena.create(ast.Node.PromiseType{ .base = ast.Node{ .id = ast.Node.Id.PromiseType }, .promise_token = token.index, .result = null, }); opt_ctx.store(&node.base); const next_token = nextToken(&tok_it, &tree); const next_token_index = next_token.index; const next_token_ptr = next_token.ptr; if (next_token_ptr.id != Token.Id.Arrow) { prevToken(&tok_it, &tree); continue; } node.result = ast.Node.PromiseType.Result{ .arrow_token = next_token_index, .return_type = undefined, }; const return_type_ptr = &node.result.?.return_type; try stack.append(State{ .Expression = OptionalCtx{ .Required = return_type_ptr } }); continue; }, Token.Id.StringLiteral, Token.Id.MultilineStringLiteralLine => { opt_ctx.store((try parseStringLiteral(arena, &tok_it, token.ptr, token.index, &tree)) orelse unreachable); continue; }, Token.Id.LParen => { const node = try arena.create(ast.Node.GroupedExpression{ .base = ast.Node{ .id = ast.Node.Id.GroupedExpression }, .lparen = token.index, .expr = undefined, .rparen = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.RParen, .ptr = &node.rparen, }, }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } }); continue; }, Token.Id.Builtin => { const node = try arena.create(ast.Node.BuiltinCall{ .base = ast.Node{ .id = ast.Node.Id.BuiltinCall }, .builtin_token = token.index, .params = ast.Node.BuiltinCall.ParamList.init(arena), .rparen_token = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .ExprListItemOrEnd = ExprListCtx{ .list = &node.params, .end = Token.Id.RParen, .ptr = &node.rparen_token, }, }) catch unreachable; try stack.append(State{ .ExpectToken = Token.Id.LParen }); continue; }, Token.Id.LBracket => { const node = try arena.create(ast.Node.PrefixOp{ .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, .op_token = token.index, .op = undefined, .rhs = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .SliceOrArrayType = node }) catch unreachable; continue; }, Token.Id.Keyword_error => { stack.append(State{ .ErrorTypeOrSetDecl = ErrorTypeOrSetDeclCtx{ .error_token = token.index, .opt_ctx = opt_ctx, }, }) catch unreachable; continue; }, Token.Id.Keyword_packed => { stack.append(State{ .ContainerKind = ContainerKindCtx{ .opt_ctx = opt_ctx, .layout_token = token.index, }, }) catch unreachable; continue; }, Token.Id.Keyword_extern => { stack.append(State{ .ExternType = ExternTypeCtx{ .opt_ctx = opt_ctx, .extern_token = token.index, .comments = null, }, }) catch unreachable; continue; }, Token.Id.Keyword_struct, Token.Id.Keyword_union, Token.Id.Keyword_enum => { prevToken(&tok_it, &tree); stack.append(State{ .ContainerKind = ContainerKindCtx{ .opt_ctx = opt_ctx, .layout_token = null, }, }) catch unreachable; continue; }, Token.Id.Identifier => { stack.append(State{ .MaybeLabeledExpression = MaybeLabeledExpressionCtx{ .label = token.index, .opt_ctx = opt_ctx, }, }) catch unreachable; continue; }, Token.Id.Keyword_fn => { const fn_proto = try arena.create(ast.Node.FnProto{ .base = ast.Node{ .id = ast.Node.Id.FnProto }, .doc_comments = null, .visib_token = null, .name_token = null, .fn_token = token.index, .params = ast.Node.FnProto.ParamList.init(arena), .return_type = undefined, .var_args_token = null, .extern_export_inline_token = null, .cc_token = null, .async_attr = null, .body_node = null, .lib_name = null, .align_expr = null, }); opt_ctx.store(&fn_proto.base); stack.append(State{ .FnProto = fn_proto }) catch unreachable; continue; }, Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc => { const fn_proto = try arena.create(ast.Node.FnProto{ .base = ast.Node{ .id = ast.Node.Id.FnProto }, .doc_comments = null, .visib_token = null, .name_token = null, .fn_token = undefined, .params = ast.Node.FnProto.ParamList.init(arena), .return_type = undefined, .var_args_token = null, .extern_export_inline_token = null, .cc_token = token.index, .async_attr = null, .body_node = null, .lib_name = null, .align_expr = null, }); opt_ctx.store(&fn_proto.base); stack.append(State{ .FnProto = fn_proto }) catch unreachable; try stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.Keyword_fn, .ptr = &fn_proto.fn_token, }, }); continue; }, Token.Id.Keyword_asm => { const node = try arena.create(ast.Node.Asm{ .base = ast.Node{ .id = ast.Node.Id.Asm }, .asm_token = token.index, .volatile_token = null, .template = undefined, .outputs = ast.Node.Asm.OutputList.init(arena), .inputs = ast.Node.Asm.InputList.init(arena), .clobbers = ast.Node.Asm.ClobberList.init(arena), .rparen = undefined, }); opt_ctx.store(&node.base); stack.append(State{ .ExpectTokenSave = ExpectTokenSave{ .id = Token.Id.RParen, .ptr = &node.rparen, }, }) catch unreachable; try stack.append(State{ .AsmClobberItems = &node.clobbers }); try stack.append(State{ .IfToken = Token.Id.Colon }); try stack.append(State{ .AsmInputItems = &node.inputs }); try stack.append(State{ .IfToken = Token.Id.Colon }); try stack.append(State{ .AsmOutputItems = &node.outputs }); try stack.append(State{ .IfToken = Token.Id.Colon }); try stack.append(State{ .StringLiteral = OptionalCtx{ .Required = &node.template } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); try stack.append(State{ .OptionalTokenSave = OptionalTokenSave{ .id = Token.Id.Keyword_volatile, .ptr = &node.volatile_token, }, }); }, Token.Id.Keyword_inline => { stack.append(State{ .Inline = InlineCtx{ .label = null, .inline_token = token.index, .opt_ctx = opt_ctx, }, }) catch unreachable; continue; }, else => { if (!try parseBlockExpr(&stack, arena, opt_ctx, token.ptr, token.index)) { prevToken(&tok_it, &tree); if (opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedPrimaryExpr = Error.ExpectedPrimaryExpr{ .token = token.index } }; return tree; } } continue; }, } }, State.ErrorTypeOrSetDecl => |ctx| { if (eatToken(&tok_it, &tree, Token.Id.LBrace) == null) { _ = try createToCtxLiteral(arena, ctx.opt_ctx, ast.Node.ErrorType, ctx.error_token); continue; } const node = try arena.create(ast.Node.ErrorSetDecl{ .base = ast.Node{ .id = ast.Node.Id.ErrorSetDecl }, .error_token = ctx.error_token, .decls = ast.Node.ErrorSetDecl.DeclList.init(arena), .rbrace_token = undefined, }); ctx.opt_ctx.store(&node.base); stack.append(State{ .ErrorTagListItemOrEnd = ListSave(@typeOf(node.decls)){ .list = &node.decls, .ptr = &node.rbrace_token, }, }) catch unreachable; continue; }, State.StringLiteral => |opt_ctx| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; opt_ctx.store((try parseStringLiteral(arena, &tok_it, token_ptr, token_index, &tree)) orelse { prevToken(&tok_it, &tree); if (opt_ctx != OptionalCtx.Optional) { ((try tree.errors.addOne())).* = Error{ .ExpectedPrimaryExpr = Error.ExpectedPrimaryExpr{ .token = token_index } }; return tree; } continue; }); }, State.Identifier => |opt_ctx| { if (eatToken(&tok_it, &tree, Token.Id.Identifier)) |ident_token| { _ = try createToCtxLiteral(arena, opt_ctx, ast.Node.Identifier, ident_token); continue; } if (opt_ctx != OptionalCtx.Optional) { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = token_index, .expected_id = Token.Id.Identifier, }, }; return tree; } }, State.ErrorTag => |node_ptr| { const comments = try eatDocComments(arena, &tok_it, &tree); const ident_token = nextToken(&tok_it, &tree); const ident_token_index = ident_token.index; const ident_token_ptr = ident_token.ptr; if (ident_token_ptr.id != Token.Id.Identifier) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = ident_token_index, .expected_id = Token.Id.Identifier, }, }; return tree; } const node = try arena.create(ast.Node.ErrorTag{ .base = ast.Node{ .id = ast.Node.Id.ErrorTag }, .doc_comments = comments, .name_token = ident_token_index, }); node_ptr.* = &node.base; continue; }, State.ExpectToken => |token_id| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (token_ptr.id != token_id) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = token_index, .expected_id = token_id, }, }; return tree; } continue; }, State.ExpectTokenSave => |expect_token_save| { const token = nextToken(&tok_it, &tree); const token_index = token.index; const token_ptr = token.ptr; if (token_ptr.id != expect_token_save.id) { ((try tree.errors.addOne())).* = Error{ .ExpectedToken = Error.ExpectedToken{ .token = token_index, .expected_id = expect_token_save.id, }, }; return tree; } expect_token_save.ptr.* = token_index; continue; }, State.IfToken => |token_id| { if (eatToken(&tok_it, &tree, token_id)) |_| { continue; } _ = stack.pop(); continue; }, State.IfTokenSave => |if_token_save| { if (eatToken(&tok_it, &tree, if_token_save.id)) |token_index| { (if_token_save.ptr).* = token_index; continue; } _ = stack.pop(); continue; }, State.OptionalTokenSave => |optional_token_save| { if (eatToken(&tok_it, &tree, optional_token_save.id)) |token_index| { (optional_token_save.ptr).* = token_index; continue; } continue; }, } } } const AnnotatedToken = struct { ptr: *Token, index: TokenIndex, }; const TopLevelDeclCtx = struct { decls: *ast.Node.Root.DeclList, visib_token: ?TokenIndex, extern_export_inline_token: ?AnnotatedToken, lib_name: ?*ast.Node, comments: ?*ast.Node.DocComment, }; const VarDeclCtx = struct { mut_token: TokenIndex, visib_token: ?TokenIndex, comptime_token: ?TokenIndex, extern_export_token: ?TokenIndex, lib_name: ?*ast.Node, list: *ast.Node.Root.DeclList, comments: ?*ast.Node.DocComment, }; const TopLevelExternOrFieldCtx = struct { visib_token: TokenIndex, container_decl: *ast.Node.ContainerDecl, comments: ?*ast.Node.DocComment, }; const ExternTypeCtx = struct { opt_ctx: OptionalCtx, extern_token: TokenIndex, comments: ?*ast.Node.DocComment, }; const ContainerKindCtx = struct { opt_ctx: OptionalCtx, layout_token: ?TokenIndex, }; const ExpectTokenSave = struct { id: @TagType(Token.Id), ptr: *TokenIndex, }; const OptionalTokenSave = struct { id: @TagType(Token.Id), ptr: *?TokenIndex, }; const ExprListCtx = struct { list: *ast.Node.SuffixOp.Op.InitList, end: Token.Id, ptr: *TokenIndex, }; fn ListSave(comptime List: type) type { return struct { list: *List, ptr: *TokenIndex, }; } const MaybeLabeledExpressionCtx = struct { label: TokenIndex, opt_ctx: OptionalCtx, }; const LabelCtx = struct { label: ?TokenIndex, opt_ctx: OptionalCtx, }; const InlineCtx = struct { label: ?TokenIndex, inline_token: ?TokenIndex, opt_ctx: OptionalCtx, }; const LoopCtx = struct { label: ?TokenIndex, inline_token: ?TokenIndex, loop_token: TokenIndex, opt_ctx: OptionalCtx, }; const AsyncEndCtx = struct { ctx: OptionalCtx, attribute: *ast.Node.AsyncAttribute, }; const ErrorTypeOrSetDeclCtx = struct { opt_ctx: OptionalCtx, error_token: TokenIndex, }; const ParamDeclEndCtx = struct { fn_proto: *ast.Node.FnProto, param_decl: *ast.Node.ParamDecl, }; const ComptimeStatementCtx = struct { comptime_token: TokenIndex, block: *ast.Node.Block, }; const OptionalCtx = union(enum) { Optional: *?*ast.Node, RequiredNull: *?*ast.Node, Required: **ast.Node, pub fn store(self: *const OptionalCtx, value: *ast.Node) void { switch (self.*) { OptionalCtx.Optional => |ptr| ptr.* = value, OptionalCtx.RequiredNull => |ptr| ptr.* = value, OptionalCtx.Required => |ptr| ptr.* = value, } } pub fn get(self: *const OptionalCtx) ?*ast.Node { switch (self.*) { OptionalCtx.Optional => |ptr| return ptr.*, OptionalCtx.RequiredNull => |ptr| return ptr.*.?, OptionalCtx.Required => |ptr| return ptr.*, } } pub fn toRequired(self: *const OptionalCtx) OptionalCtx { switch (self.*) { OptionalCtx.Optional => |ptr| { return OptionalCtx{ .RequiredNull = ptr }; }, OptionalCtx.RequiredNull => |ptr| return self.*, OptionalCtx.Required => |ptr| return self.*, } } }; const AddCommentsCtx = struct { node_ptr: **ast.Node, comments: ?*ast.Node.DocComment, }; const State = union(enum) { TopLevel, TopLevelExtern: TopLevelDeclCtx, TopLevelLibname: TopLevelDeclCtx, TopLevelDecl: TopLevelDeclCtx, TopLevelExternOrField: TopLevelExternOrFieldCtx, ContainerKind: ContainerKindCtx, ContainerInitArgStart: *ast.Node.ContainerDecl, ContainerInitArg: *ast.Node.ContainerDecl, ContainerDecl: *ast.Node.ContainerDecl, VarDecl: VarDeclCtx, VarDeclAlign: *ast.Node.VarDecl, VarDeclEq: *ast.Node.VarDecl, VarDeclSemiColon: *ast.Node.VarDecl, FnDef: *ast.Node.FnProto, FnProto: *ast.Node.FnProto, FnProtoAlign: *ast.Node.FnProto, FnProtoReturnType: *ast.Node.FnProto, ParamDecl: *ast.Node.FnProto, ParamDeclAliasOrComptime: *ast.Node.ParamDecl, ParamDeclName: *ast.Node.ParamDecl, ParamDeclEnd: ParamDeclEndCtx, ParamDeclComma: *ast.Node.FnProto, MaybeLabeledExpression: MaybeLabeledExpressionCtx, LabeledExpression: LabelCtx, Inline: InlineCtx, While: LoopCtx, WhileContinueExpr: *?*ast.Node, For: LoopCtx, Else: *?*ast.Node.Else, Block: *ast.Node.Block, Statement: *ast.Node.Block, ComptimeStatement: ComptimeStatementCtx, Semicolon: **ast.Node, AsmOutputItems: *ast.Node.Asm.OutputList, AsmOutputReturnOrType: *ast.Node.AsmOutput, AsmInputItems: *ast.Node.Asm.InputList, AsmClobberItems: *ast.Node.Asm.ClobberList, ExprListItemOrEnd: ExprListCtx, ExprListCommaOrEnd: ExprListCtx, FieldInitListItemOrEnd: ListSave(ast.Node.SuffixOp.Op.InitList), FieldInitListCommaOrEnd: ListSave(ast.Node.SuffixOp.Op.InitList), FieldListCommaOrEnd: *ast.Node.ContainerDecl, FieldInitValue: OptionalCtx, ErrorTagListItemOrEnd: ListSave(ast.Node.ErrorSetDecl.DeclList), ErrorTagListCommaOrEnd: ListSave(ast.Node.ErrorSetDecl.DeclList), SwitchCaseOrEnd: ListSave(ast.Node.Switch.CaseList), SwitchCaseCommaOrEnd: ListSave(ast.Node.Switch.CaseList), SwitchCaseFirstItem: *ast.Node.SwitchCase, SwitchCaseItemCommaOrEnd: *ast.Node.SwitchCase, SwitchCaseItemOrEnd: *ast.Node.SwitchCase, SuspendBody: *ast.Node.Suspend, AsyncAllocator: *ast.Node.AsyncAttribute, AsyncEnd: AsyncEndCtx, ExternType: ExternTypeCtx, SliceOrArrayAccess: *ast.Node.SuffixOp, SliceOrArrayType: *ast.Node.PrefixOp, PtrTypeModifiers: *ast.Node.PrefixOp.PtrInfo, AlignBitRange: *ast.Node.PrefixOp.PtrInfo.Align, Payload: OptionalCtx, PointerPayload: OptionalCtx, PointerIndexPayload: OptionalCtx, Expression: OptionalCtx, RangeExpressionBegin: OptionalCtx, RangeExpressionEnd: OptionalCtx, AssignmentExpressionBegin: OptionalCtx, AssignmentExpressionEnd: OptionalCtx, UnwrapExpressionBegin: OptionalCtx, UnwrapExpressionEnd: OptionalCtx, BoolOrExpressionBegin: OptionalCtx, BoolOrExpressionEnd: OptionalCtx, BoolAndExpressionBegin: OptionalCtx, BoolAndExpressionEnd: OptionalCtx, ComparisonExpressionBegin: OptionalCtx, ComparisonExpressionEnd: OptionalCtx, BinaryOrExpressionBegin: OptionalCtx, BinaryOrExpressionEnd: OptionalCtx, BinaryXorExpressionBegin: OptionalCtx, BinaryXorExpressionEnd: OptionalCtx, BinaryAndExpressionBegin: OptionalCtx, BinaryAndExpressionEnd: OptionalCtx, BitShiftExpressionBegin: OptionalCtx, BitShiftExpressionEnd: OptionalCtx, AdditionExpressionBegin: OptionalCtx, AdditionExpressionEnd: OptionalCtx, MultiplyExpressionBegin: OptionalCtx, MultiplyExpressionEnd: OptionalCtx, CurlySuffixExpressionBegin: OptionalCtx, CurlySuffixExpressionEnd: OptionalCtx, TypeExprBegin: OptionalCtx, TypeExprEnd: OptionalCtx, PrefixOpExpression: OptionalCtx, SuffixOpExpressionBegin: OptionalCtx, SuffixOpExpressionEnd: OptionalCtx, PrimaryExpression: OptionalCtx, ErrorTypeOrSetDecl: ErrorTypeOrSetDeclCtx, StringLiteral: OptionalCtx, Identifier: OptionalCtx, ErrorTag: **ast.Node, IfToken: @TagType(Token.Id), IfTokenSave: ExpectTokenSave, ExpectToken: @TagType(Token.Id), ExpectTokenSave: ExpectTokenSave, OptionalTokenSave: OptionalTokenSave, }; fn pushDocComment(arena: *mem.Allocator, line_comment: TokenIndex, result: *?*ast.Node.DocComment) !void { const node = blk: { if (result.*) |comment_node| { break :blk comment_node; } else { const comment_node = try arena.create(ast.Node.DocComment{ .base = ast.Node{ .id = ast.Node.Id.DocComment }, .lines = ast.Node.DocComment.LineList.init(arena), }); result.* = comment_node; break :blk comment_node; } }; try node.lines.push(line_comment); } fn eatDocComments(arena: *mem.Allocator, tok_it: *ast.Tree.TokenList.Iterator, tree: *ast.Tree) !?*ast.Node.DocComment { var result: ?*ast.Node.DocComment = null; while (true) { if (eatToken(tok_it, tree, Token.Id.DocComment)) |line_comment| { try pushDocComment(arena, line_comment, &result); continue; } break; } return result; } fn parseStringLiteral(arena: *mem.Allocator, tok_it: *ast.Tree.TokenList.Iterator, token_ptr: *const Token, token_index: TokenIndex, tree: *ast.Tree) !?*ast.Node { switch (token_ptr.id) { Token.Id.StringLiteral => { return &(try createLiteral(arena, ast.Node.StringLiteral, token_index)).base; }, Token.Id.MultilineStringLiteralLine => { const node = try arena.create(ast.Node.MultilineStringLiteral{ .base = ast.Node{ .id = ast.Node.Id.MultilineStringLiteral }, .lines = ast.Node.MultilineStringLiteral.LineList.init(arena), }); try node.lines.push(token_index); while (true) { const multiline_str = nextToken(tok_it, tree); const multiline_str_index = multiline_str.index; const multiline_str_ptr = multiline_str.ptr; if (multiline_str_ptr.id != Token.Id.MultilineStringLiteralLine) { prevToken(tok_it, tree); break; } try node.lines.push(multiline_str_index); } return &node.base; }, // TODO: We shouldn't need a cast, but: // zig: /home/jc/Documents/zig/src/ir.cpp:7962: TypeTableEntry* ir_resolve_peer_types(IrAnalyze*, AstNode*, IrInstruction**, size_t): Assertion `err_set_type != nullptr' failed. else => return (?*ast.Node)(null), } } fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *const OptionalCtx, token_ptr: *const Token, token_index: TokenIndex) !bool { switch (token_ptr.id) { Token.Id.Keyword_suspend => { const node = try arena.create(ast.Node.Suspend{ .base = ast.Node{ .id = ast.Node.Id.Suspend }, .label = null, .suspend_token = token_index, .payload = null, .body = null, }); ctx.store(&node.base); stack.append(State{ .SuspendBody = node }) catch unreachable; try stack.append(State{ .Payload = OptionalCtx{ .Optional = &node.payload } }); return true; }, Token.Id.Keyword_if => { const node = try arena.create(ast.Node.If{ .base = ast.Node{ .id = ast.Node.Id.If }, .if_token = token_index, .condition = undefined, .payload = null, .body = undefined, .@"else" = null, }); ctx.store(&node.base); stack.append(State{ .Else = &node.@"else" }) catch unreachable; try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.body } }); try stack.append(State{ .PointerPayload = OptionalCtx{ .Optional = &node.payload } }); try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.condition } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); return true; }, Token.Id.Keyword_while => { stack.append(State{ .While = LoopCtx{ .label = null, .inline_token = null, .loop_token = token_index, .opt_ctx = ctx.*, }, }) catch unreachable; return true; }, Token.Id.Keyword_for => { stack.append(State{ .For = LoopCtx{ .label = null, .inline_token = null, .loop_token = token_index, .opt_ctx = ctx.*, }, }) catch unreachable; return true; }, Token.Id.Keyword_switch => { const node = try arena.create(ast.Node.Switch{ .base = ast.Node{ .id = ast.Node.Id.Switch }, .switch_token = token_index, .expr = undefined, .cases = ast.Node.Switch.CaseList.init(arena), .rbrace = undefined, }); ctx.store(&node.base); stack.append(State{ .SwitchCaseOrEnd = ListSave(@typeOf(node.cases)){ .list = &node.cases, .ptr = &node.rbrace, }, }) catch unreachable; try stack.append(State{ .ExpectToken = Token.Id.LBrace }); try stack.append(State{ .ExpectToken = Token.Id.RParen }); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } }); try stack.append(State{ .ExpectToken = Token.Id.LParen }); return true; }, Token.Id.Keyword_comptime => { const node = try arena.create(ast.Node.Comptime{ .base = ast.Node{ .id = ast.Node.Id.Comptime }, .comptime_token = token_index, .expr = undefined, .doc_comments = null, }); ctx.store(&node.base); try stack.append(State{ .Expression = OptionalCtx{ .Required = &node.expr } }); return true; }, Token.Id.LBrace => { const block = try arena.create(ast.Node.Block{ .base = ast.Node{ .id = ast.Node.Id.Block }, .label = null, .lbrace = token_index, .statements = ast.Node.Block.StatementList.init(arena), .rbrace = undefined, }); ctx.store(&block.base); stack.append(State{ .Block = block }) catch unreachable; return true; }, else => { return false; }, } } const ExpectCommaOrEndResult = union(enum) { end_token: ?TokenIndex, parse_error: Error, }; fn expectCommaOrEnd(tok_it: *ast.Tree.TokenList.Iterator, tree: *ast.Tree, end: @TagType(Token.Id)) ExpectCommaOrEndResult { const token = nextToken(tok_it, tree); const token_index = token.index; const token_ptr = token.ptr; switch (token_ptr.id) { Token.Id.Comma => return ExpectCommaOrEndResult{ .end_token = null }, else => { if (end == token_ptr.id) { return ExpectCommaOrEndResult{ .end_token = token_index }; } return ExpectCommaOrEndResult{ .parse_error = Error{ .ExpectedCommaOrEnd = Error.ExpectedCommaOrEnd{ .token = token_index, .end_id = end, }, }, }; }, } } fn tokenIdToAssignment(id: *const Token.Id) ?ast.Node.InfixOp.Op { // TODO: We have to cast all cases because of this: // error: expected type '?InfixOp', found '?@TagType(InfixOp)' return switch (id.*) { Token.Id.AmpersandEqual => ast.Node.InfixOp.Op{ .AssignBitAnd = {} }, Token.Id.AngleBracketAngleBracketLeftEqual => ast.Node.InfixOp.Op{ .AssignBitShiftLeft = {} }, Token.Id.AngleBracketAngleBracketRightEqual => ast.Node.InfixOp.Op{ .AssignBitShiftRight = {} }, Token.Id.AsteriskEqual => ast.Node.InfixOp.Op{ .AssignTimes = {} }, Token.Id.AsteriskPercentEqual => ast.Node.InfixOp.Op{ .AssignTimesWarp = {} }, Token.Id.CaretEqual => ast.Node.InfixOp.Op{ .AssignBitXor = {} }, Token.Id.Equal => ast.Node.InfixOp.Op{ .Assign = {} }, Token.Id.MinusEqual => ast.Node.InfixOp.Op{ .AssignMinus = {} }, Token.Id.MinusPercentEqual => ast.Node.InfixOp.Op{ .AssignMinusWrap = {} }, Token.Id.PercentEqual => ast.Node.InfixOp.Op{ .AssignMod = {} }, Token.Id.PipeEqual => ast.Node.InfixOp.Op{ .AssignBitOr = {} }, Token.Id.PlusEqual => ast.Node.InfixOp.Op{ .AssignPlus = {} }, Token.Id.PlusPercentEqual => ast.Node.InfixOp.Op{ .AssignPlusWrap = {} }, Token.Id.SlashEqual => ast.Node.InfixOp.Op{ .AssignDiv = {} }, else => null, }; } fn tokenIdToUnwrapExpr(id: @TagType(Token.Id)) ?ast.Node.InfixOp.Op { return switch (id) { Token.Id.Keyword_catch => ast.Node.InfixOp.Op{ .Catch = null }, Token.Id.Keyword_orelse => ast.Node.InfixOp.Op{ .UnwrapOptional = void{} }, else => null, }; } fn tokenIdToComparison(id: @TagType(Token.Id)) ?ast.Node.InfixOp.Op { return switch (id) { Token.Id.BangEqual => ast.Node.InfixOp.Op{ .BangEqual = void{} }, Token.Id.EqualEqual => ast.Node.InfixOp.Op{ .EqualEqual = void{} }, Token.Id.AngleBracketLeft => ast.Node.InfixOp.Op{ .LessThan = void{} }, Token.Id.AngleBracketLeftEqual => ast.Node.InfixOp.Op{ .LessOrEqual = void{} }, Token.Id.AngleBracketRight => ast.Node.InfixOp.Op{ .GreaterThan = void{} }, Token.Id.AngleBracketRightEqual => ast.Node.InfixOp.Op{ .GreaterOrEqual = void{} }, else => null, }; } fn tokenIdToBitShift(id: @TagType(Token.Id)) ?ast.Node.InfixOp.Op { return switch (id) { Token.Id.AngleBracketAngleBracketLeft => ast.Node.InfixOp.Op{ .BitShiftLeft = void{} }, Token.Id.AngleBracketAngleBracketRight => ast.Node.InfixOp.Op{ .BitShiftRight = void{} }, else => null, }; } fn tokenIdToAddition(id: @TagType(Token.Id)) ?ast.Node.InfixOp.Op { return switch (id) { Token.Id.Minus => ast.Node.InfixOp.Op{ .Sub = void{} }, Token.Id.MinusPercent => ast.Node.InfixOp.Op{ .SubWrap = void{} }, Token.Id.Plus => ast.Node.InfixOp.Op{ .Add = void{} }, Token.Id.PlusPercent => ast.Node.InfixOp.Op{ .AddWrap = void{} }, Token.Id.PlusPlus => ast.Node.InfixOp.Op{ .ArrayCat = void{} }, else => null, }; } fn tokenIdToMultiply(id: @TagType(Token.Id)) ?ast.Node.InfixOp.Op { return switch (id) { Token.Id.Slash => ast.Node.InfixOp.Op{ .Div = void{} }, Token.Id.Asterisk => ast.Node.InfixOp.Op{ .Mult = void{} }, Token.Id.AsteriskAsterisk => ast.Node.InfixOp.Op{ .ArrayMult = void{} }, Token.Id.AsteriskPercent => ast.Node.InfixOp.Op{ .MultWrap = void{} }, Token.Id.Percent => ast.Node.InfixOp.Op{ .Mod = void{} }, Token.Id.PipePipe => ast.Node.InfixOp.Op{ .MergeErrorSets = void{} }, else => null, }; } fn tokenIdToPrefixOp(id: @TagType(Token.Id)) ?ast.Node.PrefixOp.Op { return switch (id) { Token.Id.Bang => ast.Node.PrefixOp.Op{ .BoolNot = void{} }, Token.Id.Tilde => ast.Node.PrefixOp.Op{ .BitNot = void{} }, Token.Id.Minus => ast.Node.PrefixOp.Op{ .Negation = void{} }, Token.Id.MinusPercent => ast.Node.PrefixOp.Op{ .NegationWrap = void{} }, Token.Id.Ampersand => ast.Node.PrefixOp.Op{ .AddressOf = void{} }, Token.Id.Asterisk, Token.Id.AsteriskAsterisk, Token.Id.BracketStarBracket => ast.Node.PrefixOp.Op{ .PtrType = ast.Node.PrefixOp.PtrInfo{ .align_info = null, .const_token = null, .volatile_token = null, }, }, Token.Id.QuestionMark => ast.Node.PrefixOp.Op{ .OptionalType = void{} }, Token.Id.Keyword_await => ast.Node.PrefixOp.Op{ .Await = void{} }, Token.Id.Keyword_try => ast.Node.PrefixOp.Op{ .Try = void{} }, else => null, }; } fn createLiteral(arena: *mem.Allocator, comptime T: type, token_index: TokenIndex) !*T { return arena.create(T{ .base = ast.Node{ .id = ast.Node.typeToId(T) }, .token = token_index, }); } fn createToCtxLiteral(arena: *mem.Allocator, opt_ctx: *const OptionalCtx, comptime T: type, token_index: TokenIndex) !*T { const node = try createLiteral(arena, T, token_index); opt_ctx.store(&node.base); return node; } fn eatToken(tok_it: *ast.Tree.TokenList.Iterator, tree: *ast.Tree, id: @TagType(Token.Id)) ?TokenIndex { const token = tok_it.peek().?; if (token.id == id) { return nextToken(tok_it, tree).index; } return null; } fn nextToken(tok_it: *ast.Tree.TokenList.Iterator, tree: *ast.Tree) AnnotatedToken { const result = AnnotatedToken{ .index = tok_it.index, .ptr = tok_it.next().?, }; assert(result.ptr.id != Token.Id.LineComment); while (true) { const next_tok = tok_it.peek() orelse return result; if (next_tok.id != Token.Id.LineComment) return result; _ = tok_it.next(); } } fn prevToken(tok_it: *ast.Tree.TokenList.Iterator, tree: *ast.Tree) void { while (true) { const prev_tok = tok_it.prev() orelse return; if (prev_tok.id == Token.Id.LineComment) continue; return; } } test "std.zig.parser" { _ = @import("parser_test.zig"); }
std/zig/parse.zig
const std = @import("std.zig"); const builtin = std.builtin; const os = std.os; const mem = std.mem; const windows = std.os.windows; const c = std.c; const assert = std.debug.assert; const bad_startfn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'"; pub const Thread = struct { data: Data, pub const use_pthreads = std.Target.current.os.tag != .windows and builtin.link_libc; /// Represents a kernel thread handle. /// May be an integer or a pointer depending on the platform. /// On Linux and POSIX, this is the same as Id. pub const Handle = if (use_pthreads) c.pthread_t else switch (std.Target.current.os.tag) { .linux => i32, .windows => windows.HANDLE, else => void, }; /// Represents a unique ID per thread. /// May be an integer or pointer depending on the platform. /// On Linux and POSIX, this is the same as Handle. pub const Id = switch (std.Target.current.os.tag) { .windows => windows.DWORD, else => Handle, }; pub const Data = if (use_pthreads) struct { handle: Thread.Handle, memory: []align(mem.page_size) u8, } else switch (std.Target.current.os.tag) { .linux => struct { handle: Thread.Handle, memory: []align(mem.page_size) u8, }, .windows => struct { handle: Thread.Handle, alloc_start: *c_void, heap_handle: windows.HANDLE, }, else => struct {}, }; /// Returns the ID of the calling thread. /// Makes a syscall every time the function is called. /// On Linux and POSIX, this Id is the same as a Handle. pub fn getCurrentId() Id { if (use_pthreads) { return c.pthread_self(); } else return switch (std.Target.current.os.tag) { .linux => os.linux.gettid(), .windows => windows.kernel32.GetCurrentThreadId(), else => @compileError("Unsupported OS"), }; } /// Returns the handle of this thread. /// On Linux and POSIX, this is the same as Id. /// On Linux, it is possible that the thread spawned with `spawn` /// finishes executing entirely before the clone syscall completes. In this /// case, this function will return 0 rather than the no-longer-existing thread's /// pid. pub fn handle(self: Thread) Handle { return self.data.handle; } pub fn wait(self: *const Thread) void { if (use_pthreads) { const err = c.pthread_join(self.data.handle, null); switch (err) { 0 => {}, os.EINVAL => unreachable, os.ESRCH => unreachable, os.EDEADLK => unreachable, else => unreachable, } os.munmap(self.data.memory); } else switch (std.Target.current.os.tag) { .linux => { while (true) { const pid_value = @atomicLoad(i32, &self.data.handle, .SeqCst); if (pid_value == 0) break; const rc = os.linux.futex_wait(&self.data.handle, os.linux.FUTEX_WAIT, pid_value, null); switch (os.linux.getErrno(rc)) { 0 => continue, os.EINTR => continue, os.EAGAIN => continue, else => unreachable, } } os.munmap(self.data.memory); }, .windows => { windows.WaitForSingleObjectEx(self.data.handle, windows.INFINITE, false) catch unreachable; windows.CloseHandle(self.data.handle); windows.HeapFree(self.data.heap_handle, 0, self.data.alloc_start); }, else => @compileError("Unsupported OS"), } } pub const SpawnError = error{ /// A system-imposed limit on the number of threads was encountered. /// There are a number of limits that may trigger this error: /// * the RLIMIT_NPROC soft resource limit (set via setrlimit(2)), /// which limits the number of processes and threads for a real /// user ID, was reached; /// * the kernel's system-wide limit on the number of processes and /// threads, /proc/sys/kernel/threads-max, was reached (see /// proc(5)); /// * the maximum number of PIDs, /proc/sys/kernel/pid_max, was /// reached (see proc(5)); or /// * the PID limit (pids.max) imposed by the cgroup "process num‐ /// ber" (PIDs) controller was reached. ThreadQuotaExceeded, /// The kernel cannot allocate sufficient memory to allocate a task structure /// for the child, or to copy those parts of the caller's context that need to /// be copied. SystemResources, /// Not enough userland memory to spawn the thread. OutOfMemory, /// `mlockall` is enabled, and the memory needed to spawn the thread /// would exceed the limit. LockedMemoryLimitExceeded, Unexpected, }; /// caller must call wait on the returned thread /// fn startFn(@TypeOf(context)) T /// where T is u8, noreturn, void, or !void /// caller must call wait on the returned thread pub fn spawn(context: var, comptime startFn: var) SpawnError!*Thread { if (builtin.single_threaded) @compileError("cannot spawn thread when building in single-threaded mode"); // TODO compile-time call graph analysis to determine stack upper bound // https://github.com/ziglang/zig/issues/157 const default_stack_size = 16 * 1024 * 1024; const Context = @TypeOf(context); comptime assert(@typeInfo(@TypeOf(startFn)).Fn.args[0].arg_type.? == Context); if (std.Target.current.os.tag == .windows) { const WinThread = struct { const OuterContext = struct { thread: Thread, inner: Context, }; fn threadMain(raw_arg: windows.LPVOID) callconv(.C) windows.DWORD { const arg = if (@sizeOf(Context) == 0) {} else @ptrCast(*Context, @alignCast(@alignOf(Context), raw_arg)).*; switch (@typeInfo(@TypeOf(startFn).ReturnType)) { .NoReturn => { startFn(arg); }, .Void => { startFn(arg); return 0; }, .Int => |info| { if (info.bits != 8) { @compileError(bad_startfn_ret); } return startFn(arg); }, .ErrorUnion => |info| { if (info.payload != void) { @compileError(bad_startfn_ret); } startFn(arg) catch |err| { std.debug.warn("error: {}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { std.debug.dumpStackTrace(trace.*); } }; return 0; }, else => @compileError(bad_startfn_ret), } } }; const heap_handle = windows.kernel32.GetProcessHeap() orelse return error.OutOfMemory; const byte_count = @alignOf(WinThread.OuterContext) + @sizeOf(WinThread.OuterContext); const bytes_ptr = windows.kernel32.HeapAlloc(heap_handle, 0, byte_count) orelse return error.OutOfMemory; errdefer assert(windows.kernel32.HeapFree(heap_handle, 0, bytes_ptr) != 0); const bytes = @ptrCast([*]u8, bytes_ptr)[0..byte_count]; const outer_context = std.heap.FixedBufferAllocator.init(bytes).allocator.create(WinThread.OuterContext) catch unreachable; outer_context.* = WinThread.OuterContext{ .thread = Thread{ .data = Thread.Data{ .heap_handle = heap_handle, .alloc_start = bytes_ptr, .handle = undefined, }, }, .inner = context, }; const parameter = if (@sizeOf(Context) == 0) null else @ptrCast(*c_void, &outer_context.inner); outer_context.thread.data.handle = windows.kernel32.CreateThread(null, default_stack_size, WinThread.threadMain, parameter, 0, null) orelse { switch (windows.kernel32.GetLastError()) { else => |err| return windows.unexpectedError(err), } }; return &outer_context.thread; } const MainFuncs = struct { fn linuxThreadMain(ctx_addr: usize) callconv(.C) u8 { const arg = if (@sizeOf(Context) == 0) {} else @intToPtr(*const Context, ctx_addr).*; switch (@typeInfo(@TypeOf(startFn).ReturnType)) { .NoReturn => { startFn(arg); }, .Void => { startFn(arg); return 0; }, .Int => |info| { if (info.bits != 8) { @compileError(bad_startfn_ret); } return startFn(arg); }, .ErrorUnion => |info| { if (info.payload != void) { @compileError(bad_startfn_ret); } startFn(arg) catch |err| { std.debug.warn("error: {}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { std.debug.dumpStackTrace(trace.*); } }; return 0; }, else => @compileError(bad_startfn_ret), } } fn posixThreadMain(ctx: ?*c_void) callconv(.C) ?*c_void { if (@sizeOf(Context) == 0) { _ = startFn({}); return null; } else { _ = startFn(@ptrCast(*const Context, @alignCast(@alignOf(Context), ctx)).*); return null; } } }; var guard_end_offset: usize = undefined; var stack_end_offset: usize = undefined; var thread_start_offset: usize = undefined; var context_start_offset: usize = undefined; var tls_start_offset: usize = undefined; const mmap_len = blk: { var l: usize = mem.page_size; // Allocate a guard page right after the end of the stack region guard_end_offset = l; // The stack itself, which grows downwards. l = mem.alignForward(l + default_stack_size, mem.page_size); stack_end_offset = l; // Above the stack, so that it can be in the same mmap call, put the Thread object. l = mem.alignForward(l, @alignOf(Thread)); thread_start_offset = l; l += @sizeOf(Thread); // Next, the Context object. if (@sizeOf(Context) != 0) { l = mem.alignForward(l, @alignOf(Context)); context_start_offset = l; l += @sizeOf(Context); } // Finally, the Thread Local Storage, if any. if (!Thread.use_pthreads) { l = mem.alignForward(l, os.linux.tls.tls_image.alloc_align); tls_start_offset = l; l += os.linux.tls.tls_image.alloc_size; } // Round the size to the page size. break :blk mem.alignForward(l, mem.page_size); }; const mmap_slice = mem: { if (std.Target.current.os.tag != .netbsd) { // Map the whole stack with no rw permissions to avoid // committing the whole region right away const mmap_slice = os.mmap( null, mmap_len, os.PROT_NONE, os.MAP_PRIVATE | os.MAP_ANONYMOUS, -1, 0, ) catch |err| switch (err) { error.MemoryMappingNotSupported => unreachable, error.AccessDenied => unreachable, error.PermissionDenied => unreachable, else => |e| return e, }; errdefer os.munmap(mmap_slice); // Map everything but the guard page as rw os.mprotect( mmap_slice[guard_end_offset..], os.PROT_READ | os.PROT_WRITE, ) catch |err| switch (err) { error.AccessDenied => unreachable, else => |e| return e, }; break :mem mmap_slice; } else { // NetBSD mprotect is very strict and doesn't allow to "upgrade" // a PROT_NONE mapping to a RW one so let's allocate everything // right away const mmap_slice = os.mmap( null, mmap_len, os.PROT_READ | os.PROT_WRITE, os.MAP_PRIVATE | os.MAP_ANONYMOUS, -1, 0, ) catch |err| switch (err) { error.MemoryMappingNotSupported => unreachable, error.AccessDenied => unreachable, error.PermissionDenied => unreachable, else => |e| return e, }; errdefer os.munmap(mmap_slice); // Remap the guard page with no permissions os.mprotect( mmap_slice[0..guard_end_offset], os.PROT_NONE, ) catch |err| switch (err) { error.AccessDenied => unreachable, else => |e| return e, }; break :mem mmap_slice; } }; const mmap_addr = @ptrToInt(mmap_slice.ptr); const thread_ptr = @alignCast(@alignOf(Thread), @intToPtr(*Thread, mmap_addr + thread_start_offset)); thread_ptr.data.memory = mmap_slice; var arg: usize = undefined; if (@sizeOf(Context) != 0) { arg = mmap_addr + context_start_offset; const context_ptr = @alignCast(@alignOf(Context), @intToPtr(*Context, arg)); context_ptr.* = context; } if (Thread.use_pthreads) { // use pthreads var attr: c.pthread_attr_t = undefined; if (c.pthread_attr_init(&attr) != 0) return error.SystemResources; defer assert(c.pthread_attr_destroy(&attr) == 0); // Tell pthread where the effective stack start is and its size assert(c.pthread_attr_setstack( &attr, mmap_slice.ptr + guard_end_offset, stack_end_offset - guard_end_offset, ) == 0); // Even though pthread's man pages state that the guard size is // ignored when the stack address is explicitly given, on some // plaforms such as NetBSD we still have to zero it to prevent // random crashes in pthread_join calls assert(c.pthread_attr_setguardsize(&attr, 0) == 0); const err = c.pthread_create(&thread_ptr.data.handle, &attr, MainFuncs.posixThreadMain, @intToPtr(*c_void, arg)); switch (err) { 0 => return thread_ptr, os.EAGAIN => return error.SystemResources, os.EPERM => unreachable, os.EINVAL => unreachable, else => return os.unexpectedErrno(@intCast(usize, err)), } } else if (std.Target.current.os.tag == .linux) { const flags: u32 = os.CLONE_VM | os.CLONE_FS | os.CLONE_FILES | os.CLONE_SIGHAND | os.CLONE_THREAD | os.CLONE_SYSVSEM | os.CLONE_PARENT_SETTID | os.CLONE_CHILD_CLEARTID | os.CLONE_DETACHED | os.CLONE_SETTLS; // This structure is only needed when targeting i386 var user_desc: if (std.Target.current.cpu.arch == .i386) os.linux.user_desc else void = undefined; const tls_area = mmap_slice[tls_start_offset..]; const tp_value = os.linux.tls.prepareTLS(tls_area); const newtls = blk: { if (std.Target.current.cpu.arch == .i386) { user_desc = os.linux.user_desc{ .entry_number = os.linux.tls.tls_image.gdt_entry_number, .base_addr = tp_value, .limit = 0xfffff, .seg_32bit = 1, .contents = 0, // Data .read_exec_only = 0, .limit_in_pages = 1, .seg_not_present = 0, .useable = 1, }; break :blk @ptrToInt(&user_desc); } else { break :blk tp_value; } }; const rc = os.linux.clone( MainFuncs.linuxThreadMain, mmap_addr + stack_end_offset, flags, arg, &thread_ptr.data.handle, newtls, &thread_ptr.data.handle, ); switch (os.errno(rc)) { 0 => return thread_ptr, os.EAGAIN => return error.ThreadQuotaExceeded, os.EINVAL => unreachable, os.ENOMEM => return error.SystemResources, os.ENOSPC => unreachable, os.EPERM => unreachable, os.EUSERS => unreachable, else => |err| return os.unexpectedErrno(err), } } else { @compileError("Unsupported OS"); } } pub const CpuCountError = error{ PermissionDenied, SystemResources, Unexpected, }; pub fn cpuCount() CpuCountError!usize { if (std.Target.current.os.tag == .linux) { const cpu_set = try os.sched_getaffinity(0); return @as(usize, os.CPU_COUNT(cpu_set)); // TODO should not need this usize cast } if (std.Target.current.os.tag == .windows) { return os.windows.peb().NumberOfProcessors; } var count: c_int = undefined; var count_len: usize = @sizeOf(c_int); const name = if (comptime std.Target.current.isDarwin()) "hw.logicalcpu" else "hw.ncpu"; os.sysctlbynameZ(name, &count, &count_len, null, 0) catch |err| switch (err) { error.NameTooLong, error.UnknownName => unreachable, else => |e| return e, }; return @intCast(usize, count); } };
lib/std/thread.zig
//! A lock that supports one writer or many readers. //! This API is for kernel threads, not evented I/O. //! This API requires being initialized at runtime, and initialization //! can fail. Once initialized, the core operations cannot fail. impl: Impl, const RwLock = @This(); const std = @import("../std.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const Mutex = std.Thread.Mutex; const Semaphore = std.Semaphore; const CondVar = std.CondVar; pub const Impl = if (builtin.single_threaded) SingleThreadedRwLock else if (std.Thread.use_pthreads) PthreadRwLock else DefaultRwLock; pub fn init(rwl: *RwLock) void { return rwl.impl.init(); } pub fn deinit(rwl: *RwLock) void { return rwl.impl.deinit(); } /// Attempts to obtain exclusive lock ownership. /// Returns `true` if the lock is obtained, `false` otherwise. pub fn tryLock(rwl: *RwLock) bool { return rwl.impl.tryLock(); } /// Blocks until exclusive lock ownership is acquired. pub fn lock(rwl: *RwLock) void { return rwl.impl.lock(); } /// Releases a held exclusive lock. /// Asserts the lock is held exclusively. pub fn unlock(rwl: *RwLock) void { return rwl.impl.unlock(); } /// Attempts to obtain shared lock ownership. /// Returns `true` if the lock is obtained, `false` otherwise. pub fn tryLockShared(rwl: *RwLock) bool { return rwl.impl.tryLockShared(); } /// Blocks until shared lock ownership is acquired. pub fn lockShared(rwl: *RwLock) void { return rwl.impl.lockShared(); } /// Releases a held shared lock. pub fn unlockShared(rwl: *RwLock) void { return rwl.impl.unlockShared(); } /// Single-threaded applications use this for deadlock checks in /// debug mode, and no-ops in release modes. pub const SingleThreadedRwLock = struct { state: enum { unlocked, locked_exclusive, locked_shared }, shared_count: usize, pub fn init(rwl: *SingleThreadedRwLock) void { rwl.* = .{ .state = .unlocked, .shared_count = 0, }; } pub fn deinit(rwl: *SingleThreadedRwLock) void { assert(rwl.state == .unlocked); assert(rwl.shared_count == 0); } /// Attempts to obtain exclusive lock ownership. /// Returns `true` if the lock is obtained, `false` otherwise. pub fn tryLock(rwl: *SingleThreadedRwLock) bool { switch (rwl.state) { .unlocked => { assert(rwl.shared_count == 0); rwl.state = .locked_exclusive; return true; }, .locked_exclusive, .locked_shared => return false, } } /// Blocks until exclusive lock ownership is acquired. pub fn lock(rwl: *SingleThreadedRwLock) void { assert(rwl.state == .unlocked); // deadlock detected assert(rwl.shared_count == 0); // corrupted state detected rwl.state = .locked_exclusive; } /// Releases a held exclusive lock. /// Asserts the lock is held exclusively. pub fn unlock(rwl: *SingleThreadedRwLock) void { assert(rwl.state == .locked_exclusive); assert(rwl.shared_count == 0); // corrupted state detected rwl.state = .unlocked; } /// Attempts to obtain shared lock ownership. /// Returns `true` if the lock is obtained, `false` otherwise. pub fn tryLockShared(rwl: *SingleThreadedRwLock) bool { switch (rwl.state) { .unlocked => { rwl.state = .locked_shared; assert(rwl.shared_count == 0); rwl.shared_count = 1; return true; }, .locked_exclusive, .locked_shared => return false, } } /// Blocks until shared lock ownership is acquired. pub fn lockShared(rwl: *SingleThreadedRwLock) void { switch (rwl.state) { .unlocked => { rwl.state = .locked_shared; assert(rwl.shared_count == 0); rwl.shared_count = 1; }, .locked_shared => { rwl.shared_count += 1; }, .locked_exclusive => unreachable, // deadlock detected } } /// Releases a held shared lock. pub fn unlockShared(rwl: *SingleThreadedRwLock) void { switch (rwl.state) { .unlocked => unreachable, // too many calls to `unlockShared` .locked_exclusive => unreachable, // exclusively held lock .locked_shared => { rwl.shared_count -= 1; if (rwl.shared_count == 0) { rwl.state = .unlocked; } }, } } }; pub const PthreadRwLock = struct { rwlock: pthread_rwlock_t, pub fn init(rwl: *PthreadRwLock) void { rwl.* = .{ .rwlock = .{} }; } pub fn deinit(rwl: *PthreadRwLock) void { const safe_rc: std.os.E = switch (builtin.os.tag) { .dragonfly, .netbsd => .AGAIN, else => .SUCCESS, }; const rc = std.c.pthread_rwlock_destroy(&rwl.rwlock); assert(rc == .SUCCESS or rc == safe_rc); rwl.* = undefined; } pub fn tryLock(rwl: *PthreadRwLock) bool { return pthread_rwlock_trywrlock(&rwl.rwlock) == .SUCCESS; } pub fn lock(rwl: *PthreadRwLock) void { const rc = pthread_rwlock_wrlock(&rwl.rwlock); assert(rc == .SUCCESS); } pub fn unlock(rwl: *PthreadRwLock) void { const rc = pthread_rwlock_unlock(&rwl.rwlock); assert(rc == .SUCCESS); } pub fn tryLockShared(rwl: *PthreadRwLock) bool { return pthread_rwlock_tryrdlock(&rwl.rwlock) == .SUCCESS; } pub fn lockShared(rwl: *PthreadRwLock) void { const rc = pthread_rwlock_rdlock(&rwl.rwlock); assert(rc == .SUCCESS); } pub fn unlockShared(rwl: *PthreadRwLock) void { const rc = pthread_rwlock_unlock(&rwl.rwlock); assert(rc == .SUCCESS); } }; pub const DefaultRwLock = struct { state: usize, mutex: Mutex, semaphore: Semaphore, const IS_WRITING: usize = 1; const WRITER: usize = 1 << 1; const READER: usize = 1 << (1 + std.meta.bitCount(Count)); const WRITER_MASK: usize = std.math.maxInt(Count) << @ctz(usize, WRITER); const READER_MASK: usize = std.math.maxInt(Count) << @ctz(usize, READER); const Count = std.meta.Int(.unsigned, @divFloor(std.meta.bitCount(usize) - 1, 2)); pub fn init(rwl: *DefaultRwLock) void { rwl.* = .{ .state = 0, .mutex = Mutex.init(), .semaphore = Semaphore.init(0), }; } pub fn deinit(rwl: *DefaultRwLock) void { rwl.semaphore.deinit(); rwl.mutex.deinit(); rwl.* = undefined; } pub fn tryLock(rwl: *DefaultRwLock) bool { if (rwl.mutex.tryLock()) { const state = @atomicLoad(usize, &rwl.state, .SeqCst); if (state & READER_MASK == 0) { _ = @atomicRmw(usize, &rwl.state, .Or, IS_WRITING, .SeqCst); return true; } rwl.mutex.unlock(); } return false; } pub fn lock(rwl: *DefaultRwLock) void { _ = @atomicRmw(usize, &rwl.state, .Add, WRITER, .SeqCst); rwl.mutex.lock(); const state = @atomicRmw(usize, &rwl.state, .Or, IS_WRITING, .SeqCst); if (state & READER_MASK != 0) rwl.semaphore.wait(); } pub fn unlock(rwl: *DefaultRwLock) void { _ = @atomicRmw(usize, &rwl.state, .And, ~IS_WRITING, .SeqCst); rwl.mutex.unlock(); } pub fn tryLockShared(rwl: *DefaultRwLock) bool { const state = @atomicLoad(usize, &rwl.state, .SeqCst); if (state & (IS_WRITING | WRITER_MASK) == 0) { _ = @cmpxchgStrong( usize, &rwl.state, state, state + READER, .SeqCst, .SeqCst, ) orelse return true; } if (rwl.mutex.tryLock()) { _ = @atomicRmw(usize, &rwl.state, .Add, READER, .SeqCst); rwl.mutex.unlock(); return true; } return false; } pub fn lockShared(rwl: *DefaultRwLock) void { var state = @atomicLoad(usize, &rwl.state, .SeqCst); while (state & (IS_WRITING | WRITER_MASK) == 0) { state = @cmpxchgWeak( usize, &rwl.state, state, state + READER, .SeqCst, .SeqCst, ) orelse return; } rwl.mutex.lock(); _ = @atomicRmw(usize, &rwl.state, .Add, READER, .SeqCst); rwl.mutex.unlock(); } pub fn unlockShared(rwl: *DefaultRwLock) void { const state = @atomicRmw(usize, &rwl.state, .Sub, READER, .SeqCst); if ((state & READER_MASK == READER) and (state & IS_WRITING != 0)) rwl.semaphore.post(); } };
lib/std/Thread/RwLock.zig
const std = @import("std"); const expect = @import("std").testing.expect; const mem = @import("std").mem; pub fn codebaseOwnership() void { std.log.info("All your codebase are belong to us.", .{}); } test "while with continue expression" { var sum: u8 = 0; var i: u8 = 1; while (i <= 10) : (i += 1) { if (i == 2) continue; sum += i; std.log.warn("i={}, sum={}", .{ i, sum }); } expect(sum == 53); } test "defer" { var x: i16 = 5; { { defer x += 2; expect(x == 5); } defer x += 2; expect(x == 7); x += 1; expect(x == 8); } expect(x == 10); } fn increment(num: *u8) void { num.* += 1; } test "pointers" { var x: u8 = 1; increment(&x); expect(x == 2); } const Suit = enum { clubs, spades, diamonds, hearts, pub fn isClubs(self: Suit) bool { return self == Suit.clubs; } }; test "enum method" { expect(Suit.spades.isClubs() == Suit.isClubs(.spades)); } const Stuff = struct { x: i32, y: i32, fn swap(self: *Stuff) void { const tmp = self.x; self.x = self.y; self.y = tmp; } }; test "automatic dereference" { var thing = Stuff{ .x = 10, .y = 20 }; thing.swap(); expect(thing.x == 20); expect(thing.y == 10); } test "simple union" { const Payload = union { int: i64, float: f64, bool: bool, }; var payload = Payload{ .int = 1234 }; std.log.warn("{s}", .{payload}); } test "switch on tagged union" { const Tagged = union(enum) { a: u8, b: f32, c: bool }; var value = Tagged{ .b = 1.5 }; switch (value) { .a => |*byte| byte.* += 1, .b => |*float| float.* *= 2, .c => |*b| b.* = !b.*, } expect(value.b == 3); } test "well defined overflow" { var a: u8 = 255; a +%= 1; expect(a == 0); } test "int-float conversion" { const a: i32 = 9; const b = @intToFloat(f32, a); const c = @floatToInt(i32, b); expect(c == a); } var numbers_left2: u32 = undefined; fn eventuallyErrorSequence() !u32 { return if (numbers_left2 == 0) error.ReachedZero else blk: { numbers_left2 -= 1; break :blk numbers_left2; }; } test "while error union capture" { var sum: u32 = 0; numbers_left2 = 3; while (eventuallyErrorSequence()) |value| { sum += value; } else |err| { std.log.warn("Error captured {s}", .{err}); expect(err == error.ReachedZero); } } const FileOpenError = error{ AccessDenied, OutOfMemory, FileNotFound, }; const AllocationError = error{OutOfMemory}; test "coerce error from a subset to a superset" { const err: FileOpenError = AllocationError.OutOfMemory; expect(err == FileOpenError.OutOfMemory); } const Info = union(enum) { a: u32, b: []const u8, c, d: u32, }; test "switch capture" { var b = Info{ .a = 10 }; const x = switch (b) { .b => |str| blk: { expect(@TypeOf(str) == []const u8); break :blk 1; }, .c => 2, //if these are of the same type, they //may be inside the same capture group .a, .d => |num| blk: { expect(@TypeOf(num) == u32); break :blk num * 2; }, }; expect(x == 20); } test "for with pointer capture" { var data = [_]u8{ 1, 2, 3 }; for (data) |*byte| byte.* += 1; data[2] += 10; expect(mem.eql(u8, &data, &[_]u8{ 2, 3, 14 })); } test "inline for" { const types = [_]type{ i32, f32, u8, bool }; var sum: usize = 0; inline for (types) |T| sum += @sizeOf(T); std.log.warn("{d}", .{@sizeOf(i32)}); expect(sum == 10); } test "anonymous struct literal" { const Point = struct { x: i32, y: i32 }; const Point3 = struct { x: i32, y: i32, z: i32 = 0 }; var pt: Point = .{ .x = 13, .y = 67, }; expect(pt.x == 13); expect(pt.y == 67); var pt3: Point3 = .{ .x = 14, .y = 68, }; expect(pt3.x == 14); expect(pt3.y == 68); } test "fully anonymous struct" { dump(.{ .int = @as(u32, 1234), .float = @as(f64, 12.34), .b = true, .s = "hi", }); } fn dump(args: anytype) void { expect(args.int == 1234); expect(args.float == 12.34); expect(args.b); expect(args.s[0] == 'h'); expect(args.s[1] == 'i'); } test "tuple" { const values = .{ @as(u32, 1234), @as(f64, 12.34), true, "hi", } ++ .{false} ** 2; expect(values[0] == 1234); expect(values[4] == false); inline for (values) |v, i| { if (i != 2) continue; expect(v); } expect(values.len == 6); expect(values[4] == values[5]); expect(values.@"4" == values[4]); expect(values.@"3"[0] == 'h'); } test "sentinel terminated slicing" { var x = [_:0]u8{255} ** 2 ++ [_]u8{254}; const y = x[0..2 :254]; _ = y; } fn nextLine(reader: anytype, buffer: []u8) !?[]const u8 { var line = (try reader.readUntilDelimiterOrEof( buffer, '\n', )) orelse return null; // trim annoying windows-only carriage return character if (std.builtin.Target.current.os.tag == .windows) { line = std.mem.trimRight(u8, line, "\r"); } return line; } const test_allocator = std.testing.allocator; test "read until next line" { const mystdout = std.io.getStdOut(); var buf = "Unknown"; const reader = std.io.fixedBufferStream(buf).reader(); try mystdout.writeAll( \\ Enter your name: ); var buffer: [100]u8 = undefined; const input = (try nextLine(reader, &buffer)).?; try mystdout.writer().print( "Your name is: \"{s}\"\n", .{input}, ); } // Don't create a type like this! Use an // arraylist with a fixed buffer allocator const MyByteList = struct { data: [100]u8 = undefined, items: []u8 = &[_]u8{}, const Writer = std.io.Writer( *MyByteList, error{EndOfBuffer}, appendWrite, ); fn appendWrite( self: *MyByteList, data: []const u8, ) error{EndOfBuffer}!usize { if (self.items.len + data.len > self.data.len) { return error.EndOfBuffer; } std.mem.copy( u8, self.data[self.items.len..], data, ); self.items = self.data[0 .. self.items.len + data.len]; return data.len; } fn writer(self: *MyByteList) Writer { return .{ .context = self }; } }; test "custom writer" { var bytes = MyByteList{}; _ = try bytes.writer().write("Hello"); _ = try bytes.writer().write(" Writer!"); expect(mem.eql(u8, bytes.items, "Hello Writer!")); } const Place = struct { lat: f32, long: f32 }; test "json parse" { var stream = std.json.TokenStream.init( \\{ "lat": 40.684540, "long": -74.401422 } ); const x = try std.json.parse(Place, &stream, .{}); expect(x.lat == 40.684540); expect(x.long == -74.401422); } test "json stringify" { const x = Place{ .lat = 51.997664, .long = -0.740687, }; var buf: [100]u8 = undefined; var string = std.io.fixedBufferStream(&buf); try std.json.stringify(x, .{}, string.writer()); const result = string.buffer[0..string.pos]; std.log.warn("{s}", .{result}); expect(mem.eql(u8, result, \\{"lat":5.19976654e+01,"long":-7.40687012e-01} )); } test "random numbers" { var prng = std.rand.DefaultPrng.init(blk: { var seed: u64 = undefined; try std.os.getrandom(std.mem.asBytes(&seed)); break :blk seed; }); const rand = &prng.random; const a = rand.float(f32); _ = a; const b = rand.boolean(); _ = b; const c = rand.int(u8); _ = c; const d = rand.intRangeAtMost(u8, 0, 255); _ = d; } test "stack" { const string = "(()())"; var stack = std.ArrayList(usize).init( test_allocator, ); defer stack.deinit(); const Pair = struct { open: usize, close: usize }; var pairs = std.ArrayList(Pair).init( test_allocator, ); defer pairs.deinit(); for (string) |char, i| { if (char == '(') try stack.append(i); if (char == ')') try pairs.append(.{ .open = stack.pop(), .close = i, }); } // var items = pairs.items; // var expected = [_]Pair{ // Pair{ .open = 1, .close = 2 }, // Pair{ .open = 3, .close = 4 }, // Pair{ .open = 0, .close = 5 }, // }; // std.log.warn("items {any}, expected {any}", .{ items, expected }); // expect(mem.eql(Pair, items[0..3], expected[0..3])); for (pairs.items) |pair, i| { expect(std.meta.eql(pair, switch (i) { 0 => Pair{ .open = 1, .close = 2 }, 1 => Pair{ .open = 3, .close = 4 }, 2 => Pair{ .open = 0, .close = 5 }, else => unreachable, })); } } test "sorting" { var data = [_]u8{ 10, 240, 0, 0, 10, 5 }; std.sort.sort(u8, &data, {}, comptime std.sort.asc(u8)); expect(mem.eql(u8, &data, &[_]u8{ 0, 0, 5, 10, 10, 240 })); std.sort.sort(u8, &data, {}, comptime std.sort.desc(u8)); expect(mem.eql(u8, &data, &[_]u8{ 240, 10, 10, 5, 0, 0 })); } test "split iterator" { const text = "robust, optimal, reusable, maintainable, "; var iter = std.mem.split(text, ", "); expect(mem.eql(u8, iter.next().?, "robust")); expect(mem.eql(u8, iter.next().?, "optimal")); expect(mem.eql(u8, iter.next().?, "reusable")); expect(mem.eql(u8, iter.next().?, "maintainable")); expect(mem.eql(u8, iter.next().?, "")); expect(iter.next() == null); } test "iterator looping" { var iter = (try std.fs.cwd().openDir( ".", .{ .iterate = true }, )).iterate(); var file_count: usize = 0; while (try iter.next()) |entry| { if (entry.kind == .File) file_count += 1; } expect(file_count > 0); } test "arg iteration" { var arg_characters: usize = 0; var iter = std.process.args(); while (iter.next(test_allocator)) |arg| { const argument = arg catch break; arg_characters += argument.len; test_allocator.free(argument); } expect(arg_characters > 0); } const ContainsIterator = struct { strings: []const []const u8, needle: []const u8, index: usize = 0, fn next(self: *ContainsIterator) ?[]const u8 { const index = self.index; for (self.strings[index..]) |string| { self.index += 1; if (std.mem.indexOf(u8, string, self.needle)) |_| { return string; } } return null; } }; test "custom iterator" { var iter = ContainsIterator{ .strings = &[_][]const u8{ "one", "two", "three" }, .needle = "e", }; expect(mem.eql(u8, iter.next().?, "one")); expect(mem.eql(u8, iter.next().?, "three")); expect(iter.next() == null); } test "precision" { var b: [4]u8 = undefined; expect(mem.eql( u8, try std.fmt.bufPrint(&b, "{d:.2}", .{3.14159}), "3.14", )); }
src/tests.zig
const std = @import("std"); const expect = std.testing.expect; const Image = @import("image.zig").Image; // ref: https://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf // ref: http://www.paulbourke.net/dataformats/tga/ test "" { std.testing.refAllDecls(@This()); std.testing.refAllDecls(Header); std.testing.refAllDecls(ImageType); } /// ImageType defines known TARGA image types. const ImageType = enum(u8) { noData = 0, uncompressedColormapped = 1, uncompressedTruecolor = 2, uncompressedBlackAndWhite = 3, rleColormapped = 9, rleTruecolor = 10, rleBlackAndWhite = 11, compressedColormapped = 32, // huffman + delta + rle compressedColormapped4 = 33, // huffman + delta + rle -- 4-pass quadtree prcocess. }; /// Header defines the contents of the file header. const Header = packed struct { idLen: u8, colormapType: u8, imageType: ImageType, /// Index of the first color map entry. Index refers to the starting entry in loading the color map. /// Example: If you would have 1024 entries in the entire color map but you only need to store 72 /// of those entries, this field allows you to start in the middle of the color-map (e.g., position 342). colormapOffset: u16, /// Total number of color map entries included. colormapLength: u16, /// Establishes the number of bits per entry. Typically 15, 16, 24 or 32-bit values are used. colormapDepth: u8, /// These bytes specify the absolute horizontal coordinate for the lower left corner of the image /// as it is positioned on a display device having an origin at the lower left of the screen /// (e.g., the TARGA series). imageX: u16, /// These bytes specify the absolute vertical coordinate for the lower left corner of the image /// as it is positioned on a display device having an origin at the lower left of the screen /// (e.g., the TARGA series). imageY: u16, /// This field specifies the width of the image in pixels. imageWidth: u16, /// This field specifies the height of the image in pixels. imageHeight: u16, /// This field indicates the number of bits per pixel. This number includes the Attribute or Alpha channel bits. /// Common values are 8, 16, 24 and 32 but other pixel depths could be used. imageDepth: u8, // Image descriptor fields. imageDescriptor: u8, }; /// decode decodes a TGA image from the given reader into the specified image struct. /// This supports 16-, 24- and 32-bit Truecolor images, optionally RLE-compressed. pub fn decode(img: *Image, reader: anytype) !void { var buf: [18]u8 = undefined; if ((try reader.readAll(&buf)) < buf.len) return error.MissingHeader; var hdr = Header{ .idLen = buf[0], .colormapType = buf[1], .imageType = @intToEnum(ImageType, buf[2]), .colormapOffset = @intCast(u16, buf[3]) | (@intCast(u16, buf[4]) << 8), .colormapLength = @intCast(u16, buf[5]) | (@intCast(u16, buf[6]) << 8), .colormapDepth = buf[7], .imageX = @intCast(u16, buf[8]) | (@intCast(u16, buf[9]) << 8), .imageY = @intCast(u16, buf[10]) | (@intCast(u16, buf[11]) << 8), .imageWidth = @intCast(u16, buf[12]) | (@intCast(u16, buf[13]) << 8), .imageHeight = @intCast(u16, buf[14]) | (@intCast(u16, buf[15]) << 8), .imageDepth = buf[16], .imageDescriptor = buf[17], }; // std.debug.print("{}\n", .{hdr}); switch (hdr.imageDepth) { 16, 24, 32 => {}, else => return error.UnsupportedBitdepth, } // Skip irrelevant stuff. const skip = @intCast(usize, hdr.idLen) + @intCast(usize, hdr.colormapType) * @intCast(usize, hdr.colormapLength) * @intCast(usize, hdr.colormapDepth / 8); try reader.skipBytes(skip, .{}); try img.reinit(@intCast(usize, hdr.imageWidth), @intCast(usize, hdr.imageHeight)); errdefer img.deinit(); switch (hdr.imageType) { .noData => {}, .uncompressedTruecolor => try decodeUncompressedTruecolor(img, &hdr, reader), .rleTruecolor => try decodeRLETruecolor(img, &hdr, reader), else => return error.UnsupportedImageFormat, } } fn decodeUncompressedTruecolor(img: *Image, hdr: *const Header, reader: anytype) !void { const bytesPerPixel = @intCast(usize, hdr.imageDepth) / 8; var buffer: [4]u8 = undefined; var x: usize = 0; while (x < img.pixels.len) : (x += 4) { if ((try reader.readAll(buffer[0..bytesPerPixel])) < bytesPerPixel) return error.UnexpectedEOF; readPixel(img.pixels[x..], buffer[0..bytesPerPixel]); } } fn decodeRLETruecolor(img: *Image, hdr: *const Header, reader: anytype) !void { const bytesPerPixel = @intCast(usize, hdr.imageDepth) / 8; var buffer: [5]u8 = undefined; var dst: usize = 0; var i: usize = 0; while (dst < img.pixels.len) { const packetType = try reader.readByte(); const runLength = @intCast(usize, packetType & 0x7f) + 1; if ((packetType & 0x80) > 0) { // RLE block if ((try reader.readAll(buffer[0..bytesPerPixel])) < bytesPerPixel) return error.UnexpectedEOF; i = 0; while (i < runLength) : (i += 1) { readPixel(img.pixels[dst..], buffer[0..bytesPerPixel]); dst += 4; } } else { // Normal block i = 0; while (i < runLength) : (i += 1) { if ((try reader.readAll(buffer[0..bytesPerPixel])) < bytesPerPixel) return error.UnexpectedEOF; readPixel(img.pixels[dst..], buffer[0..bytesPerPixel]); dst += 4; } } } } /// readPixel copies the given source pixel to the destination buffer, while accounting for source bit depth. /// Destination is always assumed to be 32-bit RGBA. /// Asserts that dst.len >= 4. fn readPixel(dst: []u8, src: []const u8) void { std.debug.assert(dst.len >= 4); switch (src.len) { 2 => { dst[0] = (src[1] & 0x7c) << 1; dst[1] = ((src[1] & 0x03) << 6) | ((src[0] & 0xe0) >> 2); dst[2] = (src[0] & 0x1f) << 3; dst[3] = (src[1] & 0x80); }, 3 => { dst[0] = src[2]; dst[1] = src[1]; dst[2] = src[0]; dst[3] = 0xff; }, 4 => { dst[0] = src[2]; dst[1] = src[1]; dst[2] = src[0]; dst[3] = src[3]; }, else => {}, } } /// encode encodes the given image as TGA data and writes it to the given output stream. /// This writes a 24- or 32-bit Truecolor image which is optionally RLE-compressed. /// The selected bit-depth depends on whether the input image is opaque or not. pub fn encode(writer: anytype, img: *const Image, compress: bool) !void { const it = @enumToInt(if (compress) ImageType.rleTruecolor else ImageType.uncompressedTruecolor); const wlo = @intCast(u8, img.width & 0xff); const whi = @intCast(u8, (img.width >> 8) & 0xff); const hlo = @intCast(u8, img.height & 0xff); const hhi = @intCast(u8, (img.height >> 8) & 0xff); const depth: u8 = if (img.isOpaque()) 24 else 32; // write the file header. try writer.writeAll(&[_]u8{ 0, 0, it, 0, 0, 0, 0, 0, 0, 0, 0, 0, wlo, whi, hlo, hhi, depth, 0 }); // write pixel data. if (compress) { try encodeRLETruecolor(writer, img, depth); } else { try encodeUncompressedTruecolor(writer, img, depth); } // Write footer. Identifies the file as TGA 2. try writer.writeAll(&[_]u8{ 0, 0, 0, 0, // Extension area offset -- ignore it. 0, 0, 0, 0, // Developer area offset -- ignore it. 'T', 'R', 'U', 'E', 'V', 'I', 'S', 'I', 'O', 'N', '-', 'X', 'F', 'I', 'L', 'E', // signature string. '.', 0, }); } fn encodeRLETruecolor(writer: anytype, img: *const Image, depth: u8) !void { const RawPacket = 0x00; const RLEPacket = 0x80; const bytesPerPixel = @intCast(usize, depth) / 8; const maxRunLen = std.math.min(128, img.width); var packet: [5]u8 = undefined; var runLen: usize = 0; var i: usize = 0; while (i < img.pixels.len) : (i += runLen * 4) { runLen = getRunLength(img.pixels[i..], 4, maxRunLen); switch (runLen) { 0 => return error.ZeroRunLength, 1 => { // We don't want to store a full RLE packet for a single unique pixel. This would be rather inefficient. // Instead, find the number of consecutive instances of runLen 1 and encode them all as a single raw packet. var count: usize = 1; var ii: usize = i; while (getRunLength(img.pixels[ii..], 4, maxRunLen) == 1 and count < maxRunLen) : (ii += 4) count += 1; try writer.writeByte(RawPacket | @intCast(u8, (count - 1) & 0x7f)); while (i <= ii) : (i += 4) { packet[0] = img.pixels[i + 2]; packet[1] = img.pixels[i + 1]; packet[2] = img.pixels[i + 0]; packet[3] = img.pixels[i + 3]; try writer.writeAll(packet[0..bytesPerPixel]); } i -= 4; }, else => { packet[0] = RLEPacket | @intCast(u8, (runLen - 1) & 0x7f); packet[1] = img.pixels[i + 2]; packet[2] = img.pixels[i + 1]; packet[3] = img.pixels[i + 0]; packet[4] = img.pixels[i + 3]; try writer.writeAll(packet[1 .. 1 + bytesPerPixel]); }, } } } /// getRunLength returns the length of the next run of pixels in data. /// The returned value will be at most max pixels. fn getRunLength(data: []const u8, pixelSize: usize, max: usize) usize { if (data.len < pixelSize) return 0; const first = data[0..pixelSize]; const maxi = max * pixelSize; var i: usize = pixelSize; while ((i < data.len) and (i <= maxi)) : (i += pixelSize) { if (!std.mem.eql(u8, first, data[i .. i + pixelSize])) break; } return i / pixelSize; } fn encodeUncompressedTruecolor(writer: anytype, img: *const Image, depth: u8) !void { const bytesPerPixel = @intCast(usize, depth) / 8; var pixel: [4]u8 = undefined; var i: usize = 0; while (i < img.pixels.len) : (i += 4) { pixel[0] = img.pixels[i + 2]; pixel[1] = img.pixels[i + 1]; pixel[2] = img.pixels[i + 0]; pixel[3] = img.pixels[i + 3]; try writer.writeAll(pixel[0..bytesPerPixel]); } } test "roundtrip" { const a = try Image.readFilepath(std.testing.allocator, "testdata/10x20-RLE0.tga"); defer a.deinit(); const b = try Image.readFilepath(std.testing.allocator, "testdata/10x20-RLE1.tga"); defer b.deinit(); try a.writeFilepath("testdata/10x20-RLE0-out.tga", false); try b.writeFilepath("testdata/10x20-RLE1-out.tga", true); const c = try Image.readFilepath(std.testing.allocator, "testdata/10x20-RLE0-out.tga"); defer c.deinit(); const d = try Image.readFilepath(std.testing.allocator, "testdata/10x20-RLE1-out.tga"); defer d.deinit(); try imgEql(&a, &b); try imgEql(&a, &c); try imgEql(&a, &d); try imgEql(&b, &c); try imgEql(&b, &d); try imgEql(&c, &d); } fn imgEql(a: *const Image, b: *const Image) !void { try expect(a.width == b.width); try expect(a.height == b.height); try expect(std.mem.eql(u8, a.pixels, b.pixels)); }
src/tga.zig
const std = @import("std"); pub const pkgs = struct { pub const clap = std.build.Pkg{ .name = "clap", .path = .{ .path = ".gyro/clap-mattnite-0.4.0-54d7cbbdb9bc1d8a78583857764d0888/pkg/clap.zig" }, }; pub const zfetch = std.build.Pkg{ .name = "zfetch", .path = .{ .path = ".gyro/zfetch-truemedian-0.0.3-32b5d807a3444ca8d1c76955dc448668/pkg/src/main.zig" }, .dependencies = &[_]std.build.Pkg{ std.build.Pkg{ .name = "iguanaTLS", .path = .{ .path = ".gyro/iguanaTLS-alexnask-0.0.3-cca32353886b38942b73c181aca56cac/pkg/src/main.zig" }, }, std.build.Pkg{ .name = "network", .path = .{ .path = ".gyro/network-mattnite-0.0.1-56b1687581a638461a2847c093576538/pkg/network.zig" }, }, std.build.Pkg{ .name = "uri", .path = .{ .path = ".gyro/uri-mattnite-0.0.0-b13185702852c80a6772a8d1bda35496/pkg/uri.zig" }, }, std.build.Pkg{ .name = "hzzp", .path = .{ .path = ".gyro/hzzp-truemedian-0.0.3-8baaab77884a746b7a2638681cc66144/pkg/src/main.zig" }, }, }, }; pub const zzz = std.build.Pkg{ .name = "zzz", .path = .{ .path = ".gyro/zzz-mattnite-0.0.1-549813427325d6937837db763750658a/pkg/src/main.zig" }, }; pub const glob = std.build.Pkg{ .name = "glob", .path = .{ .path = ".gyro/glob-mattnite-0.0.0-aa0421127a95407237771b289dc32883/pkg/src/main.zig" }, }; pub const tar = std.build.Pkg{ .name = "tar", .path = .{ .path = ".gyro/tar-mattnite-0.0.1-0584a099318b69726aa5c99c7d15c58b/pkg/src/main.zig" }, }; pub const version = std.build.Pkg{ .name = "version", .path = .{ .path = ".gyro/version-mattnite-0.0.3-554ac332599433185d7241275269278a/pkg/src/main.zig" }, .dependencies = &[_]std.build.Pkg{ std.build.Pkg{ .name = "mecha", .path = .{ .path = ".gyro/mecha-mattnite-0.0.1-47b82d9146d42cb9505ac7317488271b/pkg/mecha.zig" }, }, }, }; pub const uri = std.build.Pkg{ .name = "uri", .path = .{ .path = ".gyro/uri-mattnite-0.0.0-b13185702852c80a6772a8d1bda35496/pkg/uri.zig" }, }; pub const @"known-folders" = std.build.Pkg{ .name = "known-folders", .path = .{ .path = ".gyro/known-folders-mattnite-0.0.0-a10b67a6d7187957d537839131b9d1b6/pkg/known-folders.zig" }, }; 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)); } } } }; pub const exports = struct { }; pub const base_dirs = struct { pub const clap = ".gyro/clap-mattnite-0.4.0-54d7cbbdb9bc1d8a78583857764d0888/pkg"; pub const zfetch = ".gyro/zfetch-truemedian-0.0.3-32b5d807a3444ca8d1c76955dc448668/pkg"; pub const zzz = ".gyro/zzz-mattnite-0.0.1-549813427325d6937837db763750658a/pkg"; pub const glob = ".gyro/glob-mattnite-0.0.0-aa0421127a95407237771b289dc32883/pkg"; pub const tar = ".gyro/tar-mattnite-0.0.1-0584a099318b69726aa5c99c7d15c58b/pkg"; pub const version = ".gyro/version-mattnite-0.0.3-554ac332599433185d7241275269278a/pkg"; pub const uri = ".gyro/uri-mattnite-0.0.0-b13185702852c80a6772a8d1bda35496/pkg"; pub const @"known-folders" = ".gyro/known-folders-mattnite-0.0.0-a10b67a6d7187957d537839131b9d1b6/pkg"; };
deps.zig
const std = @import("std"); const utils = @import("utils.zig"); const page_size = std.mem.page_size / 1024; // in KiB const Process = struct { pid: u32, private: u32, shared: u32, swap: u32, counter: u8 = 1, // owned by the process name: []const u8, fn showUsage(self: Process, writer: anytype, show_swap: bool, per_pid: bool) !void { var buffer: [9]u8 = undefined; try writer.print("{s:>9} + ", .{utils.toHuman(&buffer, self.private)}); try writer.print("{s:>9} = ", .{utils.toHuman(&buffer, self.shared)}); try writer.print("{s:>9}", .{utils.toHuman(&buffer, self.private + self.shared)}); if (show_swap) try writer.print(" {s:>9}", .{utils.toHuman(&buffer, self.swap)}); try writer.print("\t{s}", .{self.name}); if (per_pid) { try writer.print(" [{}]\n", .{self.pid}); } else if (self.counter > 1) { try writer.print(" ({})\n", .{self.counter}); } else { try writer.print("\n", .{}); } } fn mergeWith(self: *Process, other: Process) void { self.private += other.private; self.shared += other.shared; self.swap += other.swap; self.counter += 1; } fn cmpByTotalUsage(context: void, proc1: Process, proc2: Process) bool { _ = context; return (proc1.private + proc1.shared) < (proc2.private + proc2.shared); } }; pub fn main() anyerror!u8 { const config = utils.getConfig() catch utils.usageExit(1); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer { const leaked = gpa.deinit(); if (leaked) std.debug.print("Memory leaked.\n", .{}); } var stack_alloc = std.heap.stackFallback(2048, gpa.allocator()); var allocator = stack_alloc.get(); var bufOut = std.io.bufferedWriter(std.io.getStdOut().writer()); if (!config.only_total) try showHeader(bufOut.writer(), config.show_swap, config.per_pid); while (true) { var total_ram: u32 = 0; var total_swap: u32 = 0; const processes = try getProcessesMemUsage( allocator, config.pid_list, &total_ram, if (config.show_swap) &total_swap else null, config.per_pid, config.show_args, config.user_id, ); defer allocator.free(processes); if (config.only_total) { var buffer: [9]u8 = undefined; try bufOut.writer().print("{s}\n", .{utils.toHuman(&buffer, total_ram)}); } else { if (config.reverse) std.mem.reverse(Process, processes); var i: usize = if (config.limit != 0 and config.limit < processes.len) processes.len - config.limit else 0; for (processes[i..]) |proc| { defer allocator.free(proc.name); // deinitializing as we dont need anymore try proc.showUsage(bufOut.writer(), config.show_swap, config.per_pid); } try showFooter( bufOut.writer(), total_ram, if (config.show_swap) total_swap else null, ); } try bufOut.flush(); if (config.watch == 0) { break; } else { std.time.sleep(config.watch * 1000000000); } } return 0; } /// Shows the header fn showHeader(writer: anytype, show_swap: bool, per_pid: bool) !void { try writer.print(" Private + Shared = RAM used", .{}); if (show_swap) try writer.print(" Swap used", .{}); try writer.print("\tProgram", .{}); if (per_pid) try writer.print(" [pid]", .{}); try writer.print("\n\n", .{}); } /// Shows the footer (separators and in the middle the total ram /// and swap, if not null, used) fn showFooter(writer: anytype, total_ram: u32, total_swap: ?u32) !void { try writer.print("{s:->33}", .{""}); if (total_swap != null) { try writer.print("{s:->12}\n", .{""}); } else { try writer.print("\n", .{}); } // show the total ram used var buffer: [9]u8 = undefined; try writer.print("{s:>33}", .{utils.toHuman(&buffer, total_ram)}); if (total_swap) |swap| { try writer.print("{s:>12}\n", .{utils.toHuman(&buffer, swap)}); } else { try writer.print("\n", .{}); } try writer.print("{s:=>33}", .{""}); if (total_swap != null) { try writer.print("{s:=>12}\n\n", .{""}); } else { try writer.print("\n\n", .{}); } } /// Gets the processes memory usage, if pids_list is null then /// gets all the processes that the used has access of /// The processes are sorted in ascending order by total amount of RAM /// that they use fn getProcessesMemUsage( allocator: std.mem.Allocator, pids_list: ?[]const u8, total_ram: *u32, total_swap: ?*u32, per_pid: bool, show_args: bool, user_id: ?std.os.uid_t, ) ![]Process { var array_procs = std.ArrayList(Process).init(allocator); defer array_procs.deinit(); if (pids_list) |pids| { var iter_pids = std.mem.split(u8, pids, ","); while (iter_pids.next()) |pidStr| { const pid = try std.fmt.parseInt(u32, pidStr, 10); if (user_id != null and user_id.? != try utils.getPidOwner(pid)) continue; try addOrMergeProcMemUsage(allocator, &array_procs, pid, total_ram, total_swap, per_pid, show_args); } } else { var proc_dir = try std.fs.cwd().openDir("/proc", .{ .access_sub_paths = false, .iterate = true }); defer proc_dir.close(); var proc_it = proc_dir.iterate(); while (try proc_it.next()) |proc_entry| { if (proc_entry.kind != .Directory) { continue; } // only treat process entries related to PIDs const pid = std.fmt.parseInt(u32, proc_entry.name, 10) catch continue; if (user_id != null and user_id.? != try utils.getPidOwner(pid)) continue; try addOrMergeProcMemUsage(allocator, &array_procs, pid, total_ram, total_swap, per_pid, show_args); } } std.sort.sort(Process, array_procs.items, {}, Process.cmpByTotalUsage); return array_procs.toOwnedSlice(); } // helper function fn addOrMergeProcMemUsage( allocator: std.mem.Allocator, array_procs: *std.ArrayList(Process), pid: u32, total_ram: *u32, total_swap: ?*u32, per_pid: bool, show_args: bool, ) !void { const proc = procMemoryData(allocator, pid, show_args) catch |err| switch (err) { error.skipProc => return, else => return err, }; if (per_pid) { try array_procs.append(proc); } else { // iterate through existings items, if found any, then merge then together var i: usize = 0; while (i < array_procs.items.len) : (i += 1) { if (std.mem.eql(u8, proc.name, array_procs.items[i].name)) { allocator.free(proc.name); // liberates memory, as they are the same array_procs.items[i].mergeWith(proc); break; } } else { try array_procs.append(proc); // if none found, add it to array of processes } } total_ram.* += proc.private + proc.shared; if (total_swap) |swap| swap.* += proc.swap; } /// Creates and return a `Process`, its memory usage data is populated /// based on /proc smaps if exists, if not, uses /proc statm, also gets the cmd name fn procMemoryData(allocator: std.mem.Allocator, pid: u32, show_args: bool) !Process { var buf: [48]u8 = undefined; var private: u32 = 0; var private_huge: u32 = 0; var shared: u32 = 0; var shared_huge: u32 = 0; var swap: u32 = 0; var pss: u32 = 0; var pss_adjust: f32 = 0.0; var swap_pss: u32 = 0; var proc_data_path = try std.fmt.bufPrint(&buf, "/proc/{}/smaps_rollup", .{pid}); if (!utils.fileExistsNotEmpty(proc_data_path)) { proc_data_path = try std.fmt.bufPrint(&buf, "/proc/{}/smaps", .{pid}); } // if cant read smaps, then uses statm if (utils.fileExistsNotEmpty(proc_data_path)) { // if cant read the contents, skip it var iter_smaps = utils.readLines(allocator, proc_data_path) catch return error.skipProc; defer allocator.free(iter_smaps.buffer); // TODO fix shared calc _ = iter_smaps.next(); // ignore first line while (iter_smaps.next()) |line| { if (line.len == 0) continue; const usageValueStr = utils.getColumn(line, 1); if (usageValueStr == null) continue; const usageValue = std.fmt.parseInt(u32, usageValueStr.?, 10) catch { // in smaps there is some lines that references some shared objects, ignore it continue; }; if (utils.startsWith(line, "Private_Hugetlb:")) { private_huge += usageValue; } else if (utils.startsWith(line, "Shared_Hugetlb:")) { shared_huge += usageValue; } else if (utils.startsWith(line, "Shared")) { shared += usageValue; } else if (utils.startsWith(line, "Private")) { private += usageValue; } else if (utils.startsWith(line, "Pss:")) { pss_adjust += 0.5; pss += usageValue; } else if (utils.startsWith(line, "Swap:")) { swap += usageValue; } else if (utils.startsWith(line, "SwapPss:")) { swap_pss += usageValue; } } if (pss != 0) shared += pss + @floatToInt(u32, pss_adjust) - private; private += private_huge; if (swap_pss != 0) swap = swap_pss; } else { proc_data_path = try std.fmt.bufPrint(&buf, "/proc/{}/statm", .{pid}); var iter_statm = try utils.readLines(allocator, proc_data_path); defer allocator.free(iter_statm.buffer); const statm = iter_statm.next().?; var rss: u32 = try std.fmt.parseInt(u32, utils.getColumn(statm, 1).?, 10); rss *= page_size; shared = try std.fmt.parseInt(u32, utils.getColumn(statm, 2).?, 10); shared *= page_size; private = std.math.max(rss, shared) - std.math.min(rss, shared); } return Process{ .private = private, .shared = shared + shared_huge, .swap = swap, .pid = pid, .name = try utils.getCmdName(allocator, pid, show_args), }; } test "utils" { _ = @import("utils.zig"); }
src/main.zig
//-------------------------------------------------------------------------------- // Section: Types (16) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows10.0.15063' const IID_IMFDeviceTransform_Value = Guid.initString("d818fbd8-fc46-42f2-87ac-1ea2d1f9bf32"); pub const IID_IMFDeviceTransform = &IID_IMFDeviceTransform_Value; pub const IMFDeviceTransform = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, InitializeTransform: fn( self: *const IMFDeviceTransform, pAttributes: ?*IMFAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputAvailableType: fn( self: *const IMFDeviceTransform, dwInputStreamID: u32, dwTypeIndex: u32, pMediaType: ?*?*IMFMediaType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputCurrentType: fn( self: *const IMFDeviceTransform, dwInputStreamID: u32, pMediaType: ?*?*IMFMediaType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputStreamAttributes: fn( self: *const IMFDeviceTransform, dwInputStreamID: u32, ppAttributes: ?*?*IMFAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputAvailableType: fn( self: *const IMFDeviceTransform, dwOutputStreamID: u32, dwTypeIndex: u32, pMediaType: ?*?*IMFMediaType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputCurrentType: fn( self: *const IMFDeviceTransform, dwOutputStreamID: u32, pMediaType: ?*?*IMFMediaType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputStreamAttributes: fn( self: *const IMFDeviceTransform, dwOutputStreamID: u32, ppAttributes: ?*?*IMFAttributes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStreamCount: fn( self: *const IMFDeviceTransform, pcInputStreams: ?*u32, pcOutputStreams: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStreamIDs: fn( self: *const IMFDeviceTransform, dwInputIDArraySize: u32, pdwInputStreamIds: ?*u32, dwOutputIDArraySize: u32, pdwOutputStreamIds: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessEvent: fn( self: *const IMFDeviceTransform, dwInputStreamID: u32, pEvent: ?*IMFMediaEvent, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessInput: fn( self: *const IMFDeviceTransform, dwInputStreamID: u32, pSample: ?*IMFSample, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessMessage: fn( self: *const IMFDeviceTransform, eMessage: MFT_MESSAGE_TYPE, ulParam: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ProcessOutput: fn( self: *const IMFDeviceTransform, dwFlags: u32, cOutputBufferCount: u32, pOutputSample: ?*MFT_OUTPUT_DATA_BUFFER, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInputStreamState: fn( self: *const IMFDeviceTransform, dwStreamID: u32, pMediaType: ?*IMFMediaType, value: DeviceStreamState, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputStreamState: fn( self: *const IMFDeviceTransform, dwStreamID: u32, value: ?*DeviceStreamState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOutputStreamState: fn( self: *const IMFDeviceTransform, dwStreamID: u32, pMediaType: ?*IMFMediaType, value: DeviceStreamState, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputStreamState: fn( self: *const IMFDeviceTransform, dwStreamID: u32, value: ?*DeviceStreamState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputStreamPreferredState: fn( self: *const IMFDeviceTransform, dwStreamID: u32, value: ?*DeviceStreamState, ppMediaType: ?*?*IMFMediaType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FlushInputStream: fn( self: *const IMFDeviceTransform, dwStreamIndex: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FlushOutputStream: fn( self: *const IMFDeviceTransform, dwStreamIndex: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_InitializeTransform(self: *const T, pAttributes: ?*IMFAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).InitializeTransform(@ptrCast(*const IMFDeviceTransform, self), pAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetInputAvailableType(self: *const T, dwInputStreamID: u32, dwTypeIndex: u32, pMediaType: ?*?*IMFMediaType) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetInputAvailableType(@ptrCast(*const IMFDeviceTransform, self), dwInputStreamID, dwTypeIndex, pMediaType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetInputCurrentType(self: *const T, dwInputStreamID: u32, pMediaType: ?*?*IMFMediaType) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetInputCurrentType(@ptrCast(*const IMFDeviceTransform, self), dwInputStreamID, pMediaType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetInputStreamAttributes(self: *const T, dwInputStreamID: u32, ppAttributes: ?*?*IMFAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetInputStreamAttributes(@ptrCast(*const IMFDeviceTransform, self), dwInputStreamID, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetOutputAvailableType(self: *const T, dwOutputStreamID: u32, dwTypeIndex: u32, pMediaType: ?*?*IMFMediaType) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetOutputAvailableType(@ptrCast(*const IMFDeviceTransform, self), dwOutputStreamID, dwTypeIndex, pMediaType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetOutputCurrentType(self: *const T, dwOutputStreamID: u32, pMediaType: ?*?*IMFMediaType) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetOutputCurrentType(@ptrCast(*const IMFDeviceTransform, self), dwOutputStreamID, pMediaType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetOutputStreamAttributes(self: *const T, dwOutputStreamID: u32, ppAttributes: ?*?*IMFAttributes) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetOutputStreamAttributes(@ptrCast(*const IMFDeviceTransform, self), dwOutputStreamID, ppAttributes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetStreamCount(self: *const T, pcInputStreams: ?*u32, pcOutputStreams: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetStreamCount(@ptrCast(*const IMFDeviceTransform, self), pcInputStreams, pcOutputStreams); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetStreamIDs(self: *const T, dwInputIDArraySize: u32, pdwInputStreamIds: ?*u32, dwOutputIDArraySize: u32, pdwOutputStreamIds: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetStreamIDs(@ptrCast(*const IMFDeviceTransform, self), dwInputIDArraySize, pdwInputStreamIds, dwOutputIDArraySize, pdwOutputStreamIds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_ProcessEvent(self: *const T, dwInputStreamID: u32, pEvent: ?*IMFMediaEvent) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).ProcessEvent(@ptrCast(*const IMFDeviceTransform, self), dwInputStreamID, pEvent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_ProcessInput(self: *const T, dwInputStreamID: u32, pSample: ?*IMFSample, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).ProcessInput(@ptrCast(*const IMFDeviceTransform, self), dwInputStreamID, pSample, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_ProcessMessage(self: *const T, eMessage: MFT_MESSAGE_TYPE, ulParam: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).ProcessMessage(@ptrCast(*const IMFDeviceTransform, self), eMessage, ulParam); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_ProcessOutput(self: *const T, dwFlags: u32, cOutputBufferCount: u32, pOutputSample: ?*MFT_OUTPUT_DATA_BUFFER, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).ProcessOutput(@ptrCast(*const IMFDeviceTransform, self), dwFlags, cOutputBufferCount, pOutputSample, pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_SetInputStreamState(self: *const T, dwStreamID: u32, pMediaType: ?*IMFMediaType, value: DeviceStreamState, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).SetInputStreamState(@ptrCast(*const IMFDeviceTransform, self), dwStreamID, pMediaType, value, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetInputStreamState(self: *const T, dwStreamID: u32, value: ?*DeviceStreamState) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetInputStreamState(@ptrCast(*const IMFDeviceTransform, self), dwStreamID, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_SetOutputStreamState(self: *const T, dwStreamID: u32, pMediaType: ?*IMFMediaType, value: DeviceStreamState, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).SetOutputStreamState(@ptrCast(*const IMFDeviceTransform, self), dwStreamID, pMediaType, value, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetOutputStreamState(self: *const T, dwStreamID: u32, value: ?*DeviceStreamState) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetOutputStreamState(@ptrCast(*const IMFDeviceTransform, self), dwStreamID, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_GetInputStreamPreferredState(self: *const T, dwStreamID: u32, value: ?*DeviceStreamState, ppMediaType: ?*?*IMFMediaType) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).GetInputStreamPreferredState(@ptrCast(*const IMFDeviceTransform, self), dwStreamID, value, ppMediaType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_FlushInputStream(self: *const T, dwStreamIndex: u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).FlushInputStream(@ptrCast(*const IMFDeviceTransform, self), dwStreamIndex, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMFDeviceTransform_FlushOutputStream(self: *const T, dwStreamIndex: u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransform.VTable, self.vtable).FlushOutputStream(@ptrCast(*const IMFDeviceTransform, self), dwStreamIndex, dwFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.17134' const IID_IMFDeviceTransformCallback_Value = Guid.initString("6d5cb646-29ec-41fb-8179-8c4c6d750811"); pub const IID_IMFDeviceTransformCallback = &IID_IMFDeviceTransformCallback_Value; pub const IMFDeviceTransformCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnBufferSent: fn( self: *const IMFDeviceTransformCallback, pCallbackAttributes: ?*IMFAttributes, pinId: 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 IMFDeviceTransformCallback_OnBufferSent(self: *const T, pCallbackAttributes: ?*IMFAttributes, pinId: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMFDeviceTransformCallback.VTable, self.vtable).OnBufferSent(@ptrCast(*const IMFDeviceTransformCallback, self), pCallbackAttributes, pinId); } };} pub usingnamespace MethodMixin(@This()); }; pub const MF_TRANSFER_VIDEO_FRAME_FLAGS = enum(i32) { DEFAULT = 0, STRETCH = 1, IGNORE_PAR = 2, }; pub const MF_TRANSFER_VIDEO_FRAME_DEFAULT = MF_TRANSFER_VIDEO_FRAME_FLAGS.DEFAULT; pub const MF_TRANSFER_VIDEO_FRAME_STRETCH = MF_TRANSFER_VIDEO_FRAME_FLAGS.STRETCH; pub const MF_TRANSFER_VIDEO_FRAME_IGNORE_PAR = MF_TRANSFER_VIDEO_FRAME_FLAGS.IGNORE_PAR; pub const MF_MEDIASOURCE_STATUS_INFO = enum(i32) { FULLYSUPPORTED = 0, UNKNOWN = 1, }; pub const MF_MEDIASOURCE_STATUS_INFO_FULLYSUPPORTED = MF_MEDIASOURCE_STATUS_INFO.FULLYSUPPORTED; pub const MF_MEDIASOURCE_STATUS_INFO_UNKNOWN = MF_MEDIASOURCE_STATUS_INFO.UNKNOWN; pub const FaceRectInfoBlobHeader = extern struct { Size: u32, Count: u32, }; pub const FaceRectInfo = extern struct { Region: RECT, confidenceLevel: i32, }; pub const FaceCharacterizationBlobHeader = extern struct { Size: u32, Count: u32, }; pub const FaceCharacterization = extern struct { BlinkScoreLeft: u32, BlinkScoreRight: u32, FacialExpression: u32, FacialExpressionScore: u32, }; pub const CapturedMetadataExposureCompensation = extern struct { Flags: u64, Value: i32, }; pub const CapturedMetadataISOGains = extern struct { AnalogGain: f32, DigitalGain: f32, }; pub const CapturedMetadataWhiteBalanceGains = extern struct { R: f32, G: f32, B: f32, }; pub const MetadataTimeStamps = extern struct { Flags: u32, Device: i64, Presentation: i64, }; pub const HistogramGrid = extern struct { Width: u32, Height: u32, Region: RECT, }; pub const HistogramBlobHeader = extern struct { Size: u32, Histograms: u32, }; pub const HistogramHeader = extern struct { Size: u32, Bins: u32, FourCC: u32, ChannelMasks: u32, Grid: HistogramGrid, }; pub const HistogramDataHeader = extern struct { Size: u32, ChannelMask: u32, Linear: u32, }; //-------------------------------------------------------------------------------- // 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 (11) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const DeviceStreamState = @import("../media/media_foundation.zig").DeviceStreamState; const HRESULT = @import("../foundation.zig").HRESULT; const IMFAttributes = @import("../media/media_foundation.zig").IMFAttributes; const IMFMediaEvent = @import("../media/media_foundation.zig").IMFMediaEvent; const IMFMediaType = @import("../media/media_foundation.zig").IMFMediaType; const IMFSample = @import("../media/media_foundation.zig").IMFSample; const IUnknown = @import("../system/com.zig").IUnknown; const MFT_MESSAGE_TYPE = @import("../media/media_foundation.zig").MFT_MESSAGE_TYPE; const MFT_OUTPUT_DATA_BUFFER = @import("../media/media_foundation.zig").MFT_OUTPUT_DATA_BUFFER; const RECT = @import("../foundation.zig").RECT; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/media/streaming.zig
pub const DISPID_RDPSRAPI_METHOD_OPEN = @as(u32, 100); pub const DISPID_RDPSRAPI_METHOD_CLOSE = @as(u32, 101); pub const DISPID_RDPSRAPI_METHOD_SETSHAREDRECT = @as(u32, 102); pub const DISPID_RDPSRAPI_METHOD_GETSHAREDRECT = @as(u32, 103); pub const DISPID_RDPSRAPI_METHOD_VIEWERCONNECT = @as(u32, 104); pub const DISPID_RDPSRAPI_METHOD_VIEWERDISCONNECT = @as(u32, 105); pub const DISPID_RDPSRAPI_METHOD_TERMINATE_CONNECTION = @as(u32, 106); pub const DISPID_RDPSRAPI_METHOD_CREATE_INVITATION = @as(u32, 107); pub const DISPID_RDPSRAPI_METHOD_REQUEST_CONTROL = @as(u32, 108); pub const DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_CREATE = @as(u32, 109); pub const DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SEND_DATA = @as(u32, 110); pub const DISPID_RDPSRAPI_METHOD_VIRTUAL_CHANNEL_SET_ACCESS = @as(u32, 111); pub const DISPID_RDPSRAPI_METHOD_PAUSE = @as(u32, 112); pub const DISPID_RDPSRAPI_METHOD_RESUME = @as(u32, 113); pub const DISPID_RDPSRAPI_METHOD_SHOW_WINDOW = @as(u32, 114); pub const DISPID_RDPSRAPI_METHOD_REQUEST_COLOR_DEPTH_CHANGE = @as(u32, 115); pub const DISPID_RDPSRAPI_METHOD_STARTREVCONNECTLISTENER = @as(u32, 116); pub const DISPID_RDPSRAPI_METHOD_CONNECTTOCLIENT = @as(u32, 117); pub const DISPID_RDPSRAPI_METHOD_SET_RENDERING_SURFACE = @as(u32, 118); pub const DISPID_RDPSRAPI_METHOD_SEND_MOUSE_BUTTON_EVENT = @as(u32, 119); pub const DISPID_RDPSRAPI_METHOD_SEND_MOUSE_MOVE_EVENT = @as(u32, 120); pub const DISPID_RDPSRAPI_METHOD_SEND_MOUSE_WHEEL_EVENT = @as(u32, 121); pub const DISPID_RDPSRAPI_METHOD_SEND_KEYBOARD_EVENT = @as(u32, 122); pub const DISPID_RDPSRAPI_METHOD_SEND_SYNC_EVENT = @as(u32, 123); pub const DISPID_RDPSRAPI_METHOD_BEGIN_TOUCH_FRAME = @as(u32, 124); pub const DISPID_RDPSRAPI_METHOD_ADD_TOUCH_INPUT = @as(u32, 125); pub const DISPID_RDPSRAPI_METHOD_END_TOUCH_FRAME = @as(u32, 126); pub const DISPID_RDPSRAPI_METHOD_CONNECTUSINGTRANSPORTSTREAM = @as(u32, 127); pub const DISPID_RDPSRAPI_METHOD_SENDCONTROLLEVELCHANGERESPONSE = @as(u32, 148); pub const DISPID_RDPSRAPI_METHOD_GETFRAMEBUFFERBITS = @as(u32, 149); pub const DISPID_RDPSRAPI_PROP_DISPIDVALUE = @as(u32, 200); pub const DISPID_RDPSRAPI_PROP_ID = @as(u32, 201); pub const DISPID_RDPSRAPI_PROP_SESSION_PROPERTIES = @as(u32, 202); pub const DISPID_RDPSRAPI_PROP_ATTENDEES = @as(u32, 203); pub const DISPID_RDPSRAPI_PROP_INVITATIONS = @as(u32, 204); pub const DISPID_RDPSRAPI_PROP_INVITATION = @as(u32, 205); pub const DISPID_RDPSRAPI_PROP_CHANNELMANAGER = @as(u32, 206); pub const DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETNAME = @as(u32, 207); pub const DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETFLAGS = @as(u32, 208); pub const DISPID_RDPSRAPI_PROP_VIRTUAL_CHANNEL_GETPRIORITY = @as(u32, 209); pub const DISPID_RDPSRAPI_PROP_WINDOWID = @as(u32, 210); pub const DISPID_RDPSRAPI_PROP_APPLICATION = @as(u32, 211); pub const DISPID_RDPSRAPI_PROP_WINDOWSHARED = @as(u32, 212); pub const DISPID_RDPSRAPI_PROP_WINDOWNAME = @as(u32, 213); pub const DISPID_RDPSRAPI_PROP_APPNAME = @as(u32, 214); pub const DISPID_RDPSRAPI_PROP_APPLICATION_FILTER = @as(u32, 215); pub const DISPID_RDPSRAPI_PROP_WINDOW_LIST = @as(u32, 216); pub const DISPID_RDPSRAPI_PROP_APPLICATION_LIST = @as(u32, 217); pub const DISPID_RDPSRAPI_PROP_APPFILTER_ENABLED = @as(u32, 218); pub const DISPID_RDPSRAPI_PROP_APPFILTERENABLED = @as(u32, 219); pub const DISPID_RDPSRAPI_PROP_SHARED = @as(u32, 220); pub const DISPID_RDPSRAPI_PROP_INVITATIONITEM = @as(u32, 221); pub const DISPID_RDPSRAPI_PROP_DBG_CLX_CMDLINE = @as(u32, 222); pub const DISPID_RDPSRAPI_PROP_APPFLAGS = @as(u32, 223); pub const DISPID_RDPSRAPI_PROP_WNDFLAGS = @as(u32, 224); pub const DISPID_RDPSRAPI_PROP_PROTOCOL_TYPE = @as(u32, 225); pub const DISPID_RDPSRAPI_PROP_LOCAL_PORT = @as(u32, 226); pub const DISPID_RDPSRAPI_PROP_LOCAL_IP = @as(u32, 227); pub const DISPID_RDPSRAPI_PROP_PEER_PORT = @as(u32, 228); pub const DISPID_RDPSRAPI_PROP_PEER_IP = @as(u32, 229); pub const DISPID_RDPSRAPI_PROP_ATTENDEE_FLAGS = @as(u32, 230); pub const DISPID_RDPSRAPI_PROP_CONINFO = @as(u32, 231); pub const DISPID_RDPSRAPI_PROP_CONNECTION_STRING = @as(u32, 232); pub const DISPID_RDPSRAPI_PROP_GROUP_NAME = @as(u32, 233); pub const DISPID_RDPSRAPI_PROP_PASSWORD = @as(u32, 234); pub const DISPID_RDPSRAPI_PROP_ATTENDEELIMIT = @as(u32, 235); pub const DISPID_RDPSRAPI_PROP_REVOKED = @as(u32, 236); pub const DISPID_RDPSRAPI_PROP_DISCONNECTED_STRING = @as(u32, 237); pub const DISPID_RDPSRAPI_PROP_USESMARTSIZING = @as(u32, 238); pub const DISPID_RDPSRAPI_PROP_SESSION_COLORDEPTH = @as(u32, 239); pub const DISPID_RDPSRAPI_PROP_REASON = @as(u32, 240); pub const DISPID_RDPSRAPI_PROP_CODE = @as(u32, 241); pub const DISPID_RDPSRAPI_PROP_CTRL_LEVEL = @as(u32, 242); pub const DISPID_RDPSRAPI_PROP_REMOTENAME = @as(u32, 243); pub const DISPID_RDPSRAPI_PROP_COUNT = @as(u32, 244); pub const DISPID_RDPSRAPI_PROP_FRAMEBUFFER_HEIGHT = @as(u32, 251); pub const DISPID_RDPSRAPI_PROP_FRAMEBUFFER_WIDTH = @as(u32, 252); pub const DISPID_RDPSRAPI_PROP_FRAMEBUFFER_BPP = @as(u32, 253); pub const DISPID_RDPSRAPI_PROP_FRAMEBUFFER = @as(u32, 254); pub const DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_CONNECTED = @as(u32, 301); pub const DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_DISCONNECTED = @as(u32, 302); pub const DISPID_RDPSRAPI_EVENT_ON_ATTENDEE_UPDATE = @as(u32, 303); pub const DISPID_RDPSRAPI_EVENT_ON_ERROR = @as(u32, 304); pub const DISPID_RDPSRAPI_EVENT_ON_VIEWER_CONNECTED = @as(u32, 305); pub const DISPID_RDPSRAPI_EVENT_ON_VIEWER_DISCONNECTED = @as(u32, 306); pub const DISPID_RDPSRAPI_EVENT_ON_VIEWER_AUTHENTICATED = @as(u32, 307); pub const DISPID_RDPSRAPI_EVENT_ON_VIEWER_CONNECTFAILED = @as(u32, 308); pub const DISPID_RDPSRAPI_EVENT_ON_CTRLLEVEL_CHANGE_REQUEST = @as(u32, 309); pub const DISPID_RDPSRAPI_EVENT_ON_GRAPHICS_STREAM_PAUSED = @as(u32, 310); pub const DISPID_RDPSRAPI_EVENT_ON_GRAPHICS_STREAM_RESUMED = @as(u32, 311); pub const DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_JOIN = @as(u32, 312); pub const DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_LEAVE = @as(u32, 313); pub const DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_DATARECEIVED = @as(u32, 314); pub const DISPID_RDPSRAPI_EVENT_ON_VIRTUAL_CHANNEL_SENDCOMPLETED = @as(u32, 315); pub const DISPID_RDPSRAPI_EVENT_ON_APPLICATION_OPEN = @as(u32, 316); pub const DISPID_RDPSRAPI_EVENT_ON_APPLICATION_CLOSE = @as(u32, 317); pub const DISPID_RDPSRAPI_EVENT_ON_APPLICATION_UPDATE = @as(u32, 318); pub const DISPID_RDPSRAPI_EVENT_ON_WINDOW_OPEN = @as(u32, 319); pub const DISPID_RDPSRAPI_EVENT_ON_WINDOW_CLOSE = @as(u32, 320); pub const DISPID_RDPSRAPI_EVENT_ON_WINDOW_UPDATE = @as(u32, 321); pub const DISPID_RDPSRAPI_EVENT_ON_APPFILTER_UPDATE = @as(u32, 322); pub const DISPID_RDPSRAPI_EVENT_ON_SHARED_RECT_CHANGED = @as(u32, 323); pub const DISPID_RDPSRAPI_EVENT_ON_FOCUSRELEASED = @as(u32, 324); pub const DISPID_RDPSRAPI_EVENT_ON_SHARED_DESKTOP_SETTINGS_CHANGED = @as(u32, 325); pub const DISPID_RDPSRAPI_EVENT_ON_CTRLLEVEL_CHANGE_RESPONSE = @as(u32, 338); pub const DISPID_RDPAPI_EVENT_ON_BOUNDING_RECT_CHANGED = @as(u32, 340); pub const DISPID_RDPSRAPI_METHOD_STREAM_ALLOCBUFFER = @as(u32, 421); pub const DISPID_RDPSRAPI_METHOD_STREAM_FREEBUFFER = @as(u32, 422); pub const DISPID_RDPSRAPI_METHOD_STREAMSENDDATA = @as(u32, 423); pub const DISPID_RDPSRAPI_METHOD_STREAMREADDATA = @as(u32, 424); pub const DISPID_RDPSRAPI_METHOD_STREAMOPEN = @as(u32, 425); pub const DISPID_RDPSRAPI_METHOD_STREAMCLOSE = @as(u32, 426); pub const DISPID_RDPSRAPI_PROP_STREAMBUFFER_STORAGE = @as(u32, 555); pub const DISPID_RDPSRAPI_PROP_STREAMBUFFER_PAYLOADSIZE = @as(u32, 558); pub const DISPID_RDPSRAPI_PROP_STREAMBUFFER_PAYLOADOFFSET = @as(u32, 559); pub const DISPID_RDPSRAPI_PROP_STREAMBUFFER_CONTEXT = @as(u32, 560); pub const DISPID_RDPSRAPI_PROP_STREAMBUFFER_FLAGS = @as(u32, 561); pub const DISPID_RDPSRAPI_PROP_STREAMBUFFER_STORESIZE = @as(u32, 562); pub const DISPID_RDPSRAPI_EVENT_ON_STREAM_SENDCOMPLETED = @as(u32, 632); pub const DISPID_RDPSRAPI_EVENT_ON_STREAM_DATARECEIVED = @as(u32, 633); pub const DISPID_RDPSRAPI_EVENT_ON_STREAM_CLOSED = @as(u32, 634); pub const DISPID_RDPSRAPI_EVENT_VIEW_MOUSE_BUTTON_RECEIVED = @as(u32, 700); pub const DISPID_RDPSRAPI_EVENT_VIEW_MOUSE_MOVE_RECEIVED = @as(u32, 701); pub const DISPID_RDPSRAPI_EVENT_VIEW_MOUSE_WHEEL_RECEIVED = @as(u32, 702); //-------------------------------------------------------------------------------- // Section: Types (58) //-------------------------------------------------------------------------------- const CLSID_RDPViewer_Value = Guid.initString("32be5ed2-5c86-480f-a914-0ff8885a1b3f"); pub const CLSID_RDPViewer = &CLSID_RDPViewer_Value; const CLSID_RDPSRAPISessionProperties_Value = Guid.initString("dd7594ff-ea2a-4c06-8fdf-132de48b6510"); pub const CLSID_RDPSRAPISessionProperties = &CLSID_RDPSRAPISessionProperties_Value; const CLSID_RDPSRAPIInvitationManager_Value = Guid.initString("53d9c9db-75ab-4271-948a-4c4eb36a8f2b"); pub const CLSID_RDPSRAPIInvitationManager = &CLSID_RDPSRAPIInvitationManager_Value; const CLSID_RDPSRAPIInvitation_Value = Guid.initString("49174dc6-0731-4b5e-8ee1-83a63d3868fa"); pub const CLSID_RDPSRAPIInvitation = &CLSID_RDPSRAPIInvitation_Value; const CLSID_RDPSRAPIAttendeeManager_Value = Guid.initString("d7b13a01-f7d4-42a6-8595-12fc8c24e851"); pub const CLSID_RDPSRAPIAttendeeManager = &CLSID_RDPSRAPIAttendeeManager_Value; const CLSID_RDPSRAPIAttendee_Value = Guid.initString("74f93bb5-755f-488e-8a29-2390108aef55"); pub const CLSID_RDPSRAPIAttendee = &CLSID_RDPSRAPIAttendee_Value; const CLSID_RDPSRAPIAttendeeDisconnectInfo_Value = Guid.initString("b47d7250-5bdb-405d-b487-caad9c56f4f8"); pub const CLSID_RDPSRAPIAttendeeDisconnectInfo = &CLSID_RDPSRAPIAttendeeDisconnectInfo_Value; const CLSID_RDPSRAPIApplicationFilter_Value = Guid.initString("e35ace89-c7e8-427e-a4f9-b9da072826bd"); pub const CLSID_RDPSRAPIApplicationFilter = &CLSID_RDPSRAPIApplicationFilter_Value; const CLSID_RDPSRAPIApplicationList_Value = Guid.initString("9e31c815-7433-4876-97fb-ed59fe2baa22"); pub const CLSID_RDPSRAPIApplicationList = &CLSID_RDPSRAPIApplicationList_Value; const CLSID_RDPSRAPIApplication_Value = Guid.initString("c116a484-4b25-4b9f-8a54-b934b06e57fa"); pub const CLSID_RDPSRAPIApplication = &CLSID_RDPSRAPIApplication_Value; const CLSID_RDPSRAPIWindowList_Value = Guid.initString("9c21e2b8-5dd4-42cc-81ba-1c099852e6fa"); pub const CLSID_RDPSRAPIWindowList = &CLSID_RDPSRAPIWindowList_Value; const CLSID_RDPSRAPIWindow_Value = Guid.initString("03cf46db-ce45-4d36-86ed-ed28b74398bf"); pub const CLSID_RDPSRAPIWindow = &CLSID_RDPSRAPIWindow_Value; const CLSID_RDPSRAPITcpConnectionInfo_Value = Guid.initString("be49db3f-ebb6-4278-8ce0-d5455833eaee"); pub const CLSID_RDPSRAPITcpConnectionInfo = &CLSID_RDPSRAPITcpConnectionInfo_Value; const CLSID_RDPSession_Value = Guid.initString("9b78f0e6-3e05-4a5b-b2e8-e743a8956b65"); pub const CLSID_RDPSession = &CLSID_RDPSession_Value; const CLSID_RDPSRAPIFrameBuffer_Value = Guid.initString("a4f66bcc-538e-4101-951d-30847adb5101"); pub const CLSID_RDPSRAPIFrameBuffer = &CLSID_RDPSRAPIFrameBuffer_Value; const CLSID_RDPTransportStreamBuffer_Value = Guid.initString("8d4a1c69-f17f-4549-a699-761c6e6b5c0a"); pub const CLSID_RDPTransportStreamBuffer = &CLSID_RDPTransportStreamBuffer_Value; const CLSID_RDPTransportStreamEvents_Value = Guid.initString("31e3ab20-5350-483f-9dc6-6748665efdeb"); pub const CLSID_RDPTransportStreamEvents = &CLSID_RDPTransportStreamEvents_Value; pub const CTRL_LEVEL = enum(i32) { MIN = 0, // INVALID = 0, this enum value conflicts with MIN NONE = 1, VIEW = 2, INTERACTIVE = 3, REQCTRL_VIEW = 4, REQCTRL_INTERACTIVE = 5, // MAX = 5, this enum value conflicts with REQCTRL_INTERACTIVE }; pub const CTRL_LEVEL_MIN = CTRL_LEVEL.MIN; pub const CTRL_LEVEL_INVALID = CTRL_LEVEL.MIN; pub const CTRL_LEVEL_NONE = CTRL_LEVEL.NONE; pub const CTRL_LEVEL_VIEW = CTRL_LEVEL.VIEW; pub const CTRL_LEVEL_INTERACTIVE = CTRL_LEVEL.INTERACTIVE; pub const CTRL_LEVEL_REQCTRL_VIEW = CTRL_LEVEL.REQCTRL_VIEW; pub const CTRL_LEVEL_REQCTRL_INTERACTIVE = CTRL_LEVEL.REQCTRL_INTERACTIVE; pub const CTRL_LEVEL_MAX = CTRL_LEVEL.REQCTRL_INTERACTIVE; pub const ATTENDEE_DISCONNECT_REASON = enum(i32) { MIN = 0, // APP = 0, this enum value conflicts with MIN ERR = 1, CLI = 2, // MAX = 2, this enum value conflicts with CLI }; pub const ATTENDEE_DISCONNECT_REASON_MIN = ATTENDEE_DISCONNECT_REASON.MIN; pub const ATTENDEE_DISCONNECT_REASON_APP = ATTENDEE_DISCONNECT_REASON.MIN; pub const ATTENDEE_DISCONNECT_REASON_ERR = ATTENDEE_DISCONNECT_REASON.ERR; pub const ATTENDEE_DISCONNECT_REASON_CLI = ATTENDEE_DISCONNECT_REASON.CLI; pub const ATTENDEE_DISCONNECT_REASON_MAX = ATTENDEE_DISCONNECT_REASON.CLI; pub const CHANNEL_PRIORITY = enum(i32) { LO = 0, MED = 1, HI = 2, }; pub const CHANNEL_PRIORITY_LO = CHANNEL_PRIORITY.LO; pub const CHANNEL_PRIORITY_MED = CHANNEL_PRIORITY.MED; pub const CHANNEL_PRIORITY_HI = CHANNEL_PRIORITY.HI; pub const CHANNEL_FLAGS = enum(i32) { LEGACY = 1, UNCOMPRESSED = 2, DYNAMIC = 4, }; pub const CHANNEL_FLAGS_LEGACY = CHANNEL_FLAGS.LEGACY; pub const CHANNEL_FLAGS_UNCOMPRESSED = CHANNEL_FLAGS.UNCOMPRESSED; pub const CHANNEL_FLAGS_DYNAMIC = CHANNEL_FLAGS.DYNAMIC; pub const CHANNEL_ACCESS_ENUM = enum(i32) { NONE = 0, SENDRECEIVE = 1, }; pub const CHANNEL_ACCESS_ENUM_NONE = CHANNEL_ACCESS_ENUM.NONE; pub const CHANNEL_ACCESS_ENUM_SENDRECEIVE = CHANNEL_ACCESS_ENUM.SENDRECEIVE; pub const RDPENCOMAPI_ATTENDEE_FLAGS = enum(i32) { L = 1, }; pub const ATTENDEE_FLAGS_LOCAL = RDPENCOMAPI_ATTENDEE_FLAGS.L; pub const RDPSRAPI_WND_FLAGS = enum(i32) { D = 1, }; pub const WND_FLAG_PRIVILEGED = RDPSRAPI_WND_FLAGS.D; pub const RDPSRAPI_APP_FLAGS = enum(i32) { D = 1, }; pub const APP_FLAG_PRIVILEGED = RDPSRAPI_APP_FLAGS.D; pub const RDPSRAPI_MOUSE_BUTTON_TYPE = enum(i32) { BUTTON1 = 0, BUTTON2 = 1, BUTTON3 = 2, XBUTTON1 = 3, XBUTTON2 = 4, XBUTTON3 = 5, }; pub const RDPSRAPI_MOUSE_BUTTON_BUTTON1 = RDPSRAPI_MOUSE_BUTTON_TYPE.BUTTON1; pub const RDPSRAPI_MOUSE_BUTTON_BUTTON2 = RDPSRAPI_MOUSE_BUTTON_TYPE.BUTTON2; pub const RDPSRAPI_MOUSE_BUTTON_BUTTON3 = RDPSRAPI_MOUSE_BUTTON_TYPE.BUTTON3; pub const RDPSRAPI_MOUSE_BUTTON_XBUTTON1 = RDPSRAPI_MOUSE_BUTTON_TYPE.XBUTTON1; pub const RDPSRAPI_MOUSE_BUTTON_XBUTTON2 = RDPSRAPI_MOUSE_BUTTON_TYPE.XBUTTON2; pub const RDPSRAPI_MOUSE_BUTTON_XBUTTON3 = RDPSRAPI_MOUSE_BUTTON_TYPE.XBUTTON3; pub const RDPSRAPI_KBD_CODE_TYPE = enum(i32) { SCANCODE = 0, UNICODE = 1, }; pub const RDPSRAPI_KBD_CODE_SCANCODE = RDPSRAPI_KBD_CODE_TYPE.SCANCODE; pub const RDPSRAPI_KBD_CODE_UNICODE = RDPSRAPI_KBD_CODE_TYPE.UNICODE; pub const RDPSRAPI_KBD_SYNC_FLAG = enum(i32) { SCROLL_LOCK = 1, NUM_LOCK = 2, CAPS_LOCK = 4, KANA_LOCK = 8, }; pub const RDPSRAPI_KBD_SYNC_FLAG_SCROLL_LOCK = RDPSRAPI_KBD_SYNC_FLAG.SCROLL_LOCK; pub const RDPSRAPI_KBD_SYNC_FLAG_NUM_LOCK = RDPSRAPI_KBD_SYNC_FLAG.NUM_LOCK; pub const RDPSRAPI_KBD_SYNC_FLAG_CAPS_LOCK = RDPSRAPI_KBD_SYNC_FLAG.CAPS_LOCK; pub const RDPSRAPI_KBD_SYNC_FLAG_KANA_LOCK = RDPSRAPI_KBD_SYNC_FLAG.KANA_LOCK; const IID_IRDPSRAPIDebug_Value = Guid.initString("aa1e42b5-496d-4ca4-a690-348dcb2ec4ad"); pub const IID_IRDPSRAPIDebug = &IID_IRDPSRAPIDebug_Value; pub const IRDPSRAPIDebug = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? put_CLXCmdLine: fn( self: *const IRDPSRAPIDebug, CLXCmdLine: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CLXCmdLine: fn( self: *const IRDPSRAPIDebug, pCLXCmdLine: ?*?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 IRDPSRAPIDebug_put_CLXCmdLine(self: *const T, CLXCmdLine: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIDebug.VTable, self.vtable).put_CLXCmdLine(@ptrCast(*const IRDPSRAPIDebug, self), CLXCmdLine); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIDebug_get_CLXCmdLine(self: *const T, pCLXCmdLine: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIDebug.VTable, self.vtable).get_CLXCmdLine(@ptrCast(*const IRDPSRAPIDebug, self), pCLXCmdLine); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.1' const IID_IRDPSRAPIPerfCounterLogger_Value = Guid.initString("071c2533-0fa4-4e8f-ae83-9c10b4305ab5"); pub const IID_IRDPSRAPIPerfCounterLogger = &IID_IRDPSRAPIPerfCounterLogger_Value; pub const IRDPSRAPIPerfCounterLogger = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, LogValue: fn( self: *const IRDPSRAPIPerfCounterLogger, lValue: i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIPerfCounterLogger_LogValue(self: *const T, lValue: i64) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIPerfCounterLogger.VTable, self.vtable).LogValue(@ptrCast(*const IRDPSRAPIPerfCounterLogger, self), lValue); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.1' const IID_IRDPSRAPIPerfCounterLoggingManager_Value = Guid.initString("9a512c86-ac6e-4a8e-b1a4-fcef363f6e64"); pub const IID_IRDPSRAPIPerfCounterLoggingManager = &IID_IRDPSRAPIPerfCounterLoggingManager_Value; pub const IRDPSRAPIPerfCounterLoggingManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateLogger: fn( self: *const IRDPSRAPIPerfCounterLoggingManager, bstrCounterName: ?BSTR, ppLogger: ?*?*IRDPSRAPIPerfCounterLogger, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIPerfCounterLoggingManager_CreateLogger(self: *const T, bstrCounterName: ?BSTR, ppLogger: ?*?*IRDPSRAPIPerfCounterLogger) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIPerfCounterLoggingManager.VTable, self.vtable).CreateLogger(@ptrCast(*const IRDPSRAPIPerfCounterLoggingManager, self), bstrCounterName, ppLogger); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.1' const IID_IRDPSRAPIAudioStream_Value = Guid.initString("e3e30ef9-89c6-4541-ba3b-19336ac6d31c"); pub const IID_IRDPSRAPIAudioStream = &IID_IRDPSRAPIAudioStream_Value; pub const IRDPSRAPIAudioStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IRDPSRAPIAudioStream, pnPeriodInHundredNsIntervals: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Start: fn( self: *const IRDPSRAPIAudioStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const IRDPSRAPIAudioStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBuffer: fn( self: *const IRDPSRAPIAudioStream, ppbData: [*]?*u8, pcbData: ?*u32, pTimestamp: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeBuffer: fn( self: *const IRDPSRAPIAudioStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAudioStream_Initialize(self: *const T, pnPeriodInHundredNsIntervals: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAudioStream.VTable, self.vtable).Initialize(@ptrCast(*const IRDPSRAPIAudioStream, self), pnPeriodInHundredNsIntervals); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAudioStream_Start(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAudioStream.VTable, self.vtable).Start(@ptrCast(*const IRDPSRAPIAudioStream, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAudioStream_Stop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAudioStream.VTable, self.vtable).Stop(@ptrCast(*const IRDPSRAPIAudioStream, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAudioStream_GetBuffer(self: *const T, ppbData: [*]?*u8, pcbData: ?*u32, pTimestamp: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAudioStream.VTable, self.vtable).GetBuffer(@ptrCast(*const IRDPSRAPIAudioStream, self), ppbData, pcbData, pTimestamp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAudioStream_FreeBuffer(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAudioStream.VTable, self.vtable).FreeBuffer(@ptrCast(*const IRDPSRAPIAudioStream, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IRDPSRAPIClipboardUseEvents_Value = Guid.initString("d559f59a-7a27-4138-8763-247ce5f659a8"); pub const IID_IRDPSRAPIClipboardUseEvents = &IID_IRDPSRAPIClipboardUseEvents_Value; pub const IRDPSRAPIClipboardUseEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnPasteFromClipboard: fn( self: *const IRDPSRAPIClipboardUseEvents, clipboardFormat: u32, pAttendee: ?*IDispatch, pRetVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIClipboardUseEvents_OnPasteFromClipboard(self: *const T, clipboardFormat: u32, pAttendee: ?*IDispatch, pRetVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIClipboardUseEvents.VTable, self.vtable).OnPasteFromClipboard(@ptrCast(*const IRDPSRAPIClipboardUseEvents, self), clipboardFormat, pAttendee, pRetVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIWindow_Value = Guid.initString("beafe0f9-c77b-4933-ba9f-a24cddcc27cf"); pub const IID_IRDPSRAPIWindow = &IID_IRDPSRAPIWindow_Value; pub const IRDPSRAPIWindow = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IRDPSRAPIWindow, pRetVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Application: fn( self: *const IRDPSRAPIWindow, pApplication: ?*?*IRDPSRAPIApplication, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Shared: fn( self: *const IRDPSRAPIWindow, pRetVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Shared: fn( self: *const IRDPSRAPIWindow, NewVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IRDPSRAPIWindow, pRetVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Show: fn( self: *const IRDPSRAPIWindow, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const IRDPSRAPIWindow, pdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_get_Id(self: *const T, pRetVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).get_Id(@ptrCast(*const IRDPSRAPIWindow, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_get_Application(self: *const T, pApplication: ?*?*IRDPSRAPIApplication) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).get_Application(@ptrCast(*const IRDPSRAPIWindow, self), pApplication); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_get_Shared(self: *const T, pRetVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).get_Shared(@ptrCast(*const IRDPSRAPIWindow, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_put_Shared(self: *const T, NewVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).put_Shared(@ptrCast(*const IRDPSRAPIWindow, self), NewVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_get_Name(self: *const T, pRetVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).get_Name(@ptrCast(*const IRDPSRAPIWindow, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_Show(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).Show(@ptrCast(*const IRDPSRAPIWindow, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindow_get_Flags(self: *const T, pdwFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindow.VTable, self.vtable).get_Flags(@ptrCast(*const IRDPSRAPIWindow, self), pdwFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIWindowList_Value = Guid.initString("8a05ce44-715a-4116-a189-a118f30a07bd"); pub const IID_IRDPSRAPIWindowList = &IID_IRDPSRAPIWindowList_Value; pub const IRDPSRAPIWindowList = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRDPSRAPIWindowList, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRDPSRAPIWindowList, item: i32, pWindow: ?*?*IRDPSRAPIWindow, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindowList_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindowList.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRDPSRAPIWindowList, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIWindowList_get_Item(self: *const T, item: i32, pWindow: ?*?*IRDPSRAPIWindow) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIWindowList.VTable, self.vtable).get_Item(@ptrCast(*const IRDPSRAPIWindowList, self), item, pWindow); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIApplication_Value = Guid.initString("41e7a09d-eb7a-436e-935d-780ca2628324"); pub const IID_IRDPSRAPIApplication = &IID_IRDPSRAPIApplication_Value; pub const IRDPSRAPIApplication = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Windows: fn( self: *const IRDPSRAPIApplication, pWindowList: ?*?*IRDPSRAPIWindowList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IRDPSRAPIApplication, pRetVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Shared: fn( self: *const IRDPSRAPIApplication, pRetVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Shared: fn( self: *const IRDPSRAPIApplication, NewVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IRDPSRAPIApplication, pRetVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const IRDPSRAPIApplication, pdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplication_get_Windows(self: *const T, pWindowList: ?*?*IRDPSRAPIWindowList) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplication.VTable, self.vtable).get_Windows(@ptrCast(*const IRDPSRAPIApplication, self), pWindowList); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplication_get_Id(self: *const T, pRetVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplication.VTable, self.vtable).get_Id(@ptrCast(*const IRDPSRAPIApplication, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplication_get_Shared(self: *const T, pRetVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplication.VTable, self.vtable).get_Shared(@ptrCast(*const IRDPSRAPIApplication, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplication_put_Shared(self: *const T, NewVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplication.VTable, self.vtable).put_Shared(@ptrCast(*const IRDPSRAPIApplication, self), NewVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplication_get_Name(self: *const T, pRetVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplication.VTable, self.vtable).get_Name(@ptrCast(*const IRDPSRAPIApplication, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplication_get_Flags(self: *const T, pdwFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplication.VTable, self.vtable).get_Flags(@ptrCast(*const IRDPSRAPIApplication, self), pdwFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIApplicationList_Value = Guid.initString("d4b4aeb3-22dc-4837-b3b6-42ea2517849a"); pub const IID_IRDPSRAPIApplicationList = &IID_IRDPSRAPIApplicationList_Value; pub const IRDPSRAPIApplicationList = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRDPSRAPIApplicationList, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRDPSRAPIApplicationList, item: i32, pApplication: ?*?*IRDPSRAPIApplication, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplicationList_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplicationList.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRDPSRAPIApplicationList, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplicationList_get_Item(self: *const T, item: i32, pApplication: ?*?*IRDPSRAPIApplication) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplicationList.VTable, self.vtable).get_Item(@ptrCast(*const IRDPSRAPIApplicationList, self), item, pApplication); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIApplicationFilter_Value = Guid.initString("d20f10ca-6637-4f06-b1d5-277ea7e5160d"); pub const IID_IRDPSRAPIApplicationFilter = &IID_IRDPSRAPIApplicationFilter_Value; pub const IRDPSRAPIApplicationFilter = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Applications: fn( self: *const IRDPSRAPIApplicationFilter, pApplications: ?*?*IRDPSRAPIApplicationList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Windows: fn( self: *const IRDPSRAPIApplicationFilter, pWindows: ?*?*IRDPSRAPIWindowList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IRDPSRAPIApplicationFilter, pRetVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IRDPSRAPIApplicationFilter, NewVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplicationFilter_get_Applications(self: *const T, pApplications: ?*?*IRDPSRAPIApplicationList) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplicationFilter.VTable, self.vtable).get_Applications(@ptrCast(*const IRDPSRAPIApplicationFilter, self), pApplications); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplicationFilter_get_Windows(self: *const T, pWindows: ?*?*IRDPSRAPIWindowList) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplicationFilter.VTable, self.vtable).get_Windows(@ptrCast(*const IRDPSRAPIApplicationFilter, self), pWindows); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplicationFilter_get_Enabled(self: *const T, pRetVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplicationFilter.VTable, self.vtable).get_Enabled(@ptrCast(*const IRDPSRAPIApplicationFilter, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIApplicationFilter_put_Enabled(self: *const T, NewVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIApplicationFilter.VTable, self.vtable).put_Enabled(@ptrCast(*const IRDPSRAPIApplicationFilter, self), NewVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPISessionProperties_Value = Guid.initString("339b24f2-9bc0-4f16-9aac-f165433d13d4"); pub const IID_IRDPSRAPISessionProperties = &IID_IRDPSRAPISessionProperties_Value; pub const IRDPSRAPISessionProperties = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Property: fn( self: *const IRDPSRAPISessionProperties, PropertyName: ?BSTR, pVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Property: fn( self: *const IRDPSRAPISessionProperties, PropertyName: ?BSTR, newVal: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISessionProperties_get_Property(self: *const T, PropertyName: ?BSTR, pVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISessionProperties.VTable, self.vtable).get_Property(@ptrCast(*const IRDPSRAPISessionProperties, self), PropertyName, pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISessionProperties_put_Property(self: *const T, PropertyName: ?BSTR, newVal: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISessionProperties.VTable, self.vtable).put_Property(@ptrCast(*const IRDPSRAPISessionProperties, self), PropertyName, newVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIInvitation_Value = Guid.initString("4fac1d43-fc51-45bb-b1b4-2b53aa562fa3"); pub const IID_IRDPSRAPIInvitation = &IID_IRDPSRAPIInvitation_Value; pub const IRDPSRAPIInvitation = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ConnectionString: fn( self: *const IRDPSRAPIInvitation, pbstrVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_GroupName: fn( self: *const IRDPSRAPIInvitation, pbstrVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Password: fn( self: *const IRDPSRAPIInvitation, pbstrVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AttendeeLimit: fn( self: *const IRDPSRAPIInvitation, pRetVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AttendeeLimit: fn( self: *const IRDPSRAPIInvitation, NewVal: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Revoked: fn( self: *const IRDPSRAPIInvitation, pRetVal: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Revoked: fn( self: *const IRDPSRAPIInvitation, NewVal: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_get_ConnectionString(self: *const T, pbstrVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).get_ConnectionString(@ptrCast(*const IRDPSRAPIInvitation, self), pbstrVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_get_GroupName(self: *const T, pbstrVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).get_GroupName(@ptrCast(*const IRDPSRAPIInvitation, self), pbstrVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_get_Password(self: *const T, pbstrVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).get_Password(@ptrCast(*const IRDPSRAPIInvitation, self), pbstrVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_get_AttendeeLimit(self: *const T, pRetVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).get_AttendeeLimit(@ptrCast(*const IRDPSRAPIInvitation, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_put_AttendeeLimit(self: *const T, NewVal: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).put_AttendeeLimit(@ptrCast(*const IRDPSRAPIInvitation, self), NewVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_get_Revoked(self: *const T, pRetVal: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).get_Revoked(@ptrCast(*const IRDPSRAPIInvitation, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitation_put_Revoked(self: *const T, NewVal: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitation.VTable, self.vtable).put_Revoked(@ptrCast(*const IRDPSRAPIInvitation, self), NewVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIInvitationManager_Value = Guid.initString("4722b049-92c3-4c2d-8a65-f7348f644dcf"); pub const IID_IRDPSRAPIInvitationManager = &IID_IRDPSRAPIInvitationManager_Value; pub const IRDPSRAPIInvitationManager = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRDPSRAPIInvitationManager, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRDPSRAPIInvitationManager, item: VARIANT, ppInvitation: ?*?*IRDPSRAPIInvitation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IRDPSRAPIInvitationManager, pRetVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateInvitation: fn( self: *const IRDPSRAPIInvitationManager, bstrAuthString: ?BSTR, bstrGroupName: ?BSTR, bstrPassword: ?BSTR, AttendeeLimit: i32, ppInvitation: ?*?*IRDPSRAPIInvitation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitationManager_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitationManager.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRDPSRAPIInvitationManager, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitationManager_get_Item(self: *const T, item: VARIANT, ppInvitation: ?*?*IRDPSRAPIInvitation) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitationManager.VTable, self.vtable).get_Item(@ptrCast(*const IRDPSRAPIInvitationManager, self), item, ppInvitation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitationManager_get_Count(self: *const T, pRetVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitationManager.VTable, self.vtable).get_Count(@ptrCast(*const IRDPSRAPIInvitationManager, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIInvitationManager_CreateInvitation(self: *const T, bstrAuthString: ?BSTR, bstrGroupName: ?BSTR, bstrPassword: ?BSTR, AttendeeLimit: i32, ppInvitation: ?*?*IRDPSRAPIInvitation) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIInvitationManager.VTable, self.vtable).CreateInvitation(@ptrCast(*const IRDPSRAPIInvitationManager, self), bstrAuthString, bstrGroupName, bstrPassword, AttendeeLimit, ppInvitation); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPITcpConnectionInfo_Value = Guid.initString("f74049a4-3d06-4028-8193-0a8c29bc2452"); pub const IID_IRDPSRAPITcpConnectionInfo = &IID_IRDPSRAPITcpConnectionInfo_Value; pub const IRDPSRAPITcpConnectionInfo = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Protocol: fn( self: *const IRDPSRAPITcpConnectionInfo, plProtocol: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalPort: fn( self: *const IRDPSRAPITcpConnectionInfo, plPort: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LocalIP: fn( self: *const IRDPSRAPITcpConnectionInfo, pbsrLocalIP: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PeerPort: fn( self: *const IRDPSRAPITcpConnectionInfo, plPort: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PeerIP: fn( self: *const IRDPSRAPITcpConnectionInfo, pbstrIP: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITcpConnectionInfo_get_Protocol(self: *const T, plProtocol: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITcpConnectionInfo.VTable, self.vtable).get_Protocol(@ptrCast(*const IRDPSRAPITcpConnectionInfo, self), plProtocol); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITcpConnectionInfo_get_LocalPort(self: *const T, plPort: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITcpConnectionInfo.VTable, self.vtable).get_LocalPort(@ptrCast(*const IRDPSRAPITcpConnectionInfo, self), plPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITcpConnectionInfo_get_LocalIP(self: *const T, pbsrLocalIP: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITcpConnectionInfo.VTable, self.vtable).get_LocalIP(@ptrCast(*const IRDPSRAPITcpConnectionInfo, self), pbsrLocalIP); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITcpConnectionInfo_get_PeerPort(self: *const T, plPort: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITcpConnectionInfo.VTable, self.vtable).get_PeerPort(@ptrCast(*const IRDPSRAPITcpConnectionInfo, self), plPort); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITcpConnectionInfo_get_PeerIP(self: *const T, pbstrIP: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITcpConnectionInfo.VTable, self.vtable).get_PeerIP(@ptrCast(*const IRDPSRAPITcpConnectionInfo, self), pbstrIP); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIAttendee_Value = Guid.initString("ec0671b3-1b78-4b80-a464-9132247543e3"); pub const IID_IRDPSRAPIAttendee = &IID_IRDPSRAPIAttendee_Value; pub const IRDPSRAPIAttendee = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IRDPSRAPIAttendee, pId: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RemoteName: fn( self: *const IRDPSRAPIAttendee, pVal: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ControlLevel: fn( self: *const IRDPSRAPIAttendee, pVal: ?*CTRL_LEVEL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ControlLevel: fn( self: *const IRDPSRAPIAttendee, pNewVal: CTRL_LEVEL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Invitation: fn( self: *const IRDPSRAPIAttendee, ppVal: ?*?*IRDPSRAPIInvitation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TerminateConnection: fn( self: *const IRDPSRAPIAttendee, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const IRDPSRAPIAttendee, plFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ConnectivityInfo: fn( self: *const IRDPSRAPIAttendee, ppVal: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_get_Id(self: *const T, pId: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).get_Id(@ptrCast(*const IRDPSRAPIAttendee, self), pId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_get_RemoteName(self: *const T, pVal: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).get_RemoteName(@ptrCast(*const IRDPSRAPIAttendee, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_get_ControlLevel(self: *const T, pVal: ?*CTRL_LEVEL) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).get_ControlLevel(@ptrCast(*const IRDPSRAPIAttendee, self), pVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_put_ControlLevel(self: *const T, pNewVal: CTRL_LEVEL) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).put_ControlLevel(@ptrCast(*const IRDPSRAPIAttendee, self), pNewVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_get_Invitation(self: *const T, ppVal: ?*?*IRDPSRAPIInvitation) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).get_Invitation(@ptrCast(*const IRDPSRAPIAttendee, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_TerminateConnection(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).TerminateConnection(@ptrCast(*const IRDPSRAPIAttendee, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_get_Flags(self: *const T, plFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).get_Flags(@ptrCast(*const IRDPSRAPIAttendee, self), plFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendee_get_ConnectivityInfo(self: *const T, ppVal: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendee.VTable, self.vtable).get_ConnectivityInfo(@ptrCast(*const IRDPSRAPIAttendee, self), ppVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIAttendeeManager_Value = Guid.initString("ba3a37e8-33da-4749-8da0-07fa34da7944"); pub const IID_IRDPSRAPIAttendeeManager = &IID_IRDPSRAPIAttendeeManager_Value; pub const IRDPSRAPIAttendeeManager = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRDPSRAPIAttendeeManager, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRDPSRAPIAttendeeManager, id: i32, ppItem: ?*?*IRDPSRAPIAttendee, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendeeManager_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendeeManager.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRDPSRAPIAttendeeManager, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendeeManager_get_Item(self: *const T, id: i32, ppItem: ?*?*IRDPSRAPIAttendee) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendeeManager.VTable, self.vtable).get_Item(@ptrCast(*const IRDPSRAPIAttendeeManager, self), id, ppItem); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIAttendeeDisconnectInfo_Value = Guid.initString("c187689f-447c-44a1-9c14-fffbb3b7ec17"); pub const IID_IRDPSRAPIAttendeeDisconnectInfo = &IID_IRDPSRAPIAttendeeDisconnectInfo_Value; pub const IRDPSRAPIAttendeeDisconnectInfo = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attendee: fn( self: *const IRDPSRAPIAttendeeDisconnectInfo, retval: ?*?*IRDPSRAPIAttendee, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Reason: fn( self: *const IRDPSRAPIAttendeeDisconnectInfo, pReason: ?*ATTENDEE_DISCONNECT_REASON, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Code: fn( self: *const IRDPSRAPIAttendeeDisconnectInfo, pVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendeeDisconnectInfo_get_Attendee(self: *const T, retval: ?*?*IRDPSRAPIAttendee) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendeeDisconnectInfo.VTable, self.vtable).get_Attendee(@ptrCast(*const IRDPSRAPIAttendeeDisconnectInfo, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendeeDisconnectInfo_get_Reason(self: *const T, pReason: ?*ATTENDEE_DISCONNECT_REASON) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendeeDisconnectInfo.VTable, self.vtable).get_Reason(@ptrCast(*const IRDPSRAPIAttendeeDisconnectInfo, self), pReason); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIAttendeeDisconnectInfo_get_Code(self: *const T, pVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIAttendeeDisconnectInfo.VTable, self.vtable).get_Code(@ptrCast(*const IRDPSRAPIAttendeeDisconnectInfo, self), pVal); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIVirtualChannel_Value = Guid.initString("05e12f95-28b3-4c9a-8780-d0248574a1e0"); pub const IID_IRDPSRAPIVirtualChannel = &IID_IRDPSRAPIVirtualChannel_Value; pub const IRDPSRAPIVirtualChannel = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, SendData: fn( self: *const IRDPSRAPIVirtualChannel, bstrData: ?BSTR, lAttendeeId: i32, ChannelSendFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAccess: fn( self: *const IRDPSRAPIVirtualChannel, lAttendeeId: i32, AccessType: CHANNEL_ACCESS_ENUM, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IRDPSRAPIVirtualChannel, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const IRDPSRAPIVirtualChannel, plFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Priority: fn( self: *const IRDPSRAPIVirtualChannel, pPriority: ?*CHANNEL_PRIORITY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannel_SendData(self: *const T, bstrData: ?BSTR, lAttendeeId: i32, ChannelSendFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannel.VTable, self.vtable).SendData(@ptrCast(*const IRDPSRAPIVirtualChannel, self), bstrData, lAttendeeId, ChannelSendFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannel_SetAccess(self: *const T, lAttendeeId: i32, AccessType: CHANNEL_ACCESS_ENUM) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannel.VTable, self.vtable).SetAccess(@ptrCast(*const IRDPSRAPIVirtualChannel, self), lAttendeeId, AccessType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannel_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannel.VTable, self.vtable).get_Name(@ptrCast(*const IRDPSRAPIVirtualChannel, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannel_get_Flags(self: *const T, plFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannel.VTable, self.vtable).get_Flags(@ptrCast(*const IRDPSRAPIVirtualChannel, self), plFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannel_get_Priority(self: *const T, pPriority: ?*CHANNEL_PRIORITY) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannel.VTable, self.vtable).get_Priority(@ptrCast(*const IRDPSRAPIVirtualChannel, self), pPriority); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIVirtualChannelManager_Value = Guid.initString("0d11c661-5d0d-4ee4-89df-2166ae1fdfed"); pub const IID_IRDPSRAPIVirtualChannelManager = &IID_IRDPSRAPIVirtualChannelManager_Value; pub const IRDPSRAPIVirtualChannelManager = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRDPSRAPIVirtualChannelManager, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRDPSRAPIVirtualChannelManager, item: VARIANT, pChannel: ?*?*IRDPSRAPIVirtualChannel, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateVirtualChannel: fn( self: *const IRDPSRAPIVirtualChannelManager, bstrChannelName: ?BSTR, Priority: CHANNEL_PRIORITY, ChannelFlags: u32, ppChannel: ?*?*IRDPSRAPIVirtualChannel, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannelManager_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannelManager.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRDPSRAPIVirtualChannelManager, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannelManager_get_Item(self: *const T, item: VARIANT, pChannel: ?*?*IRDPSRAPIVirtualChannel) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannelManager.VTable, self.vtable).get_Item(@ptrCast(*const IRDPSRAPIVirtualChannelManager, self), item, pChannel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIVirtualChannelManager_CreateVirtualChannel(self: *const T, bstrChannelName: ?BSTR, Priority: CHANNEL_PRIORITY, ChannelFlags: u32, ppChannel: ?*?*IRDPSRAPIVirtualChannel) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIVirtualChannelManager.VTable, self.vtable).CreateVirtualChannel(@ptrCast(*const IRDPSRAPIVirtualChannelManager, self), bstrChannelName, Priority, ChannelFlags, ppChannel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPIViewer_Value = Guid.initString("c6bfcd38-8ce9-404d-8ae8-f31d00c65cb5"); pub const IID_IRDPSRAPIViewer = &IID_IRDPSRAPIViewer_Value; pub const IRDPSRAPIViewer = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, Connect: fn( self: *const IRDPSRAPIViewer, bstrConnectionString: ?BSTR, bstrName: ?BSTR, bstrPassword: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const IRDPSRAPIViewer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attendees: fn( self: *const IRDPSRAPIViewer, ppVal: ?*?*IRDPSRAPIAttendeeManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Invitations: fn( self: *const IRDPSRAPIViewer, ppVal: ?*?*IRDPSRAPIInvitationManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ApplicationFilter: fn( self: *const IRDPSRAPIViewer, ppVal: ?*?*IRDPSRAPIApplicationFilter, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_VirtualChannelManager: fn( self: *const IRDPSRAPIViewer, ppVal: ?*?*IRDPSRAPIVirtualChannelManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SmartSizing: fn( self: *const IRDPSRAPIViewer, vbSmartSizing: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SmartSizing: fn( self: *const IRDPSRAPIViewer, pvbSmartSizing: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestControl: fn( self: *const IRDPSRAPIViewer, CtrlLevel: CTRL_LEVEL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisconnectedText: fn( self: *const IRDPSRAPIViewer, bstrDisconnectedText: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisconnectedText: fn( self: *const IRDPSRAPIViewer, pbstrDisconnectedText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestColorDepthChange: fn( self: *const IRDPSRAPIViewer, Bpp: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Properties: fn( self: *const IRDPSRAPIViewer, ppVal: ?*?*IRDPSRAPISessionProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StartReverseConnectListener: fn( self: *const IRDPSRAPIViewer, bstrConnectionString: ?BSTR, bstrUserName: ?BSTR, bstrPassword: ?BSTR, pbstrReverseConnectString: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_Connect(self: *const T, bstrConnectionString: ?BSTR, bstrName: ?BSTR, bstrPassword: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).Connect(@ptrCast(*const IRDPSRAPIViewer, self), bstrConnectionString, bstrName, bstrPassword); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_Disconnect(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).Disconnect(@ptrCast(*const IRDPSRAPIViewer, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_Attendees(self: *const T, ppVal: ?*?*IRDPSRAPIAttendeeManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_Attendees(@ptrCast(*const IRDPSRAPIViewer, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_Invitations(self: *const T, ppVal: ?*?*IRDPSRAPIInvitationManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_Invitations(@ptrCast(*const IRDPSRAPIViewer, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_ApplicationFilter(self: *const T, ppVal: ?*?*IRDPSRAPIApplicationFilter) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_ApplicationFilter(@ptrCast(*const IRDPSRAPIViewer, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_VirtualChannelManager(self: *const T, ppVal: ?*?*IRDPSRAPIVirtualChannelManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_VirtualChannelManager(@ptrCast(*const IRDPSRAPIViewer, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_put_SmartSizing(self: *const T, vbSmartSizing: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).put_SmartSizing(@ptrCast(*const IRDPSRAPIViewer, self), vbSmartSizing); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_SmartSizing(self: *const T, pvbSmartSizing: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_SmartSizing(@ptrCast(*const IRDPSRAPIViewer, self), pvbSmartSizing); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_RequestControl(self: *const T, CtrlLevel: CTRL_LEVEL) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).RequestControl(@ptrCast(*const IRDPSRAPIViewer, self), CtrlLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_put_DisconnectedText(self: *const T, bstrDisconnectedText: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).put_DisconnectedText(@ptrCast(*const IRDPSRAPIViewer, self), bstrDisconnectedText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_DisconnectedText(self: *const T, pbstrDisconnectedText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_DisconnectedText(@ptrCast(*const IRDPSRAPIViewer, self), pbstrDisconnectedText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_RequestColorDepthChange(self: *const T, Bpp: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).RequestColorDepthChange(@ptrCast(*const IRDPSRAPIViewer, self), Bpp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_get_Properties(self: *const T, ppVal: ?*?*IRDPSRAPISessionProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).get_Properties(@ptrCast(*const IRDPSRAPIViewer, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIViewer_StartReverseConnectListener(self: *const T, bstrConnectionString: ?BSTR, bstrUserName: ?BSTR, bstrPassword: ?BSTR, pbstrReverseConnectString: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIViewer.VTable, self.vtable).StartReverseConnectListener(@ptrCast(*const IRDPSRAPIViewer, self), bstrConnectionString, bstrUserName, bstrPassword, pbstrReverseConnectString); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.1' const IID_IRDPViewerInputSink_Value = Guid.initString("bb590853-a6c5-4a7b-8dd4-76b69eea12d5"); pub const IID_IRDPViewerInputSink = &IID_IRDPViewerInputSink_Value; pub const IRDPViewerInputSink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SendMouseButtonEvent: fn( self: *const IRDPViewerInputSink, buttonType: RDPSRAPI_MOUSE_BUTTON_TYPE, vbButtonDown: i16, xPos: u32, yPos: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendMouseMoveEvent: fn( self: *const IRDPViewerInputSink, xPos: u32, yPos: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendMouseWheelEvent: fn( self: *const IRDPViewerInputSink, wheelRotation: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendKeyboardEvent: fn( self: *const IRDPViewerInputSink, codeType: RDPSRAPI_KBD_CODE_TYPE, keycode: u16, vbKeyUp: i16, vbRepeat: i16, vbExtended: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendSyncEvent: fn( self: *const IRDPViewerInputSink, syncFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BeginTouchFrame: fn( self: *const IRDPViewerInputSink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddTouchInput: fn( self: *const IRDPViewerInputSink, contactId: u32, event: u32, x: i32, y: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndTouchFrame: fn( self: *const IRDPViewerInputSink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_SendMouseButtonEvent(self: *const T, buttonType: RDPSRAPI_MOUSE_BUTTON_TYPE, vbButtonDown: i16, xPos: u32, yPos: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).SendMouseButtonEvent(@ptrCast(*const IRDPViewerInputSink, self), buttonType, vbButtonDown, xPos, yPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_SendMouseMoveEvent(self: *const T, xPos: u32, yPos: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).SendMouseMoveEvent(@ptrCast(*const IRDPViewerInputSink, self), xPos, yPos); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_SendMouseWheelEvent(self: *const T, wheelRotation: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).SendMouseWheelEvent(@ptrCast(*const IRDPViewerInputSink, self), wheelRotation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_SendKeyboardEvent(self: *const T, codeType: RDPSRAPI_KBD_CODE_TYPE, keycode: u16, vbKeyUp: i16, vbRepeat: i16, vbExtended: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).SendKeyboardEvent(@ptrCast(*const IRDPViewerInputSink, self), codeType, keycode, vbKeyUp, vbRepeat, vbExtended); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_SendSyncEvent(self: *const T, syncFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).SendSyncEvent(@ptrCast(*const IRDPViewerInputSink, self), syncFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_BeginTouchFrame(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).BeginTouchFrame(@ptrCast(*const IRDPViewerInputSink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_AddTouchInput(self: *const T, contactId: u32, event: u32, x: i32, y: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).AddTouchInput(@ptrCast(*const IRDPViewerInputSink, self), contactId, event, x, y); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPViewerInputSink_EndTouchFrame(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPViewerInputSink.VTable, self.vtable).EndTouchFrame(@ptrCast(*const IRDPViewerInputSink, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IRDPSRAPIFrameBuffer_Value = Guid.initString("3d67e7d2-b27b-448e-81b3-c6110ed8b4be"); pub const IID_IRDPSRAPIFrameBuffer = &IID_IRDPSRAPIFrameBuffer_Value; pub const IRDPSRAPIFrameBuffer = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IRDPSRAPIFrameBuffer, plWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IRDPSRAPIFrameBuffer, plHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Bpp: fn( self: *const IRDPSRAPIFrameBuffer, plBpp: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFrameBufferBits: fn( self: *const IRDPSRAPIFrameBuffer, x: i32, y: i32, Width: i32, Heigth: i32, ppBits: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIFrameBuffer_get_Width(self: *const T, plWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIFrameBuffer.VTable, self.vtable).get_Width(@ptrCast(*const IRDPSRAPIFrameBuffer, self), plWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIFrameBuffer_get_Height(self: *const T, plHeight: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIFrameBuffer.VTable, self.vtable).get_Height(@ptrCast(*const IRDPSRAPIFrameBuffer, self), plHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIFrameBuffer_get_Bpp(self: *const T, plBpp: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIFrameBuffer.VTable, self.vtable).get_Bpp(@ptrCast(*const IRDPSRAPIFrameBuffer, self), plBpp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPIFrameBuffer_GetFrameBufferBits(self: *const T, x: i32, y: i32, Width: i32, Heigth: i32, ppBits: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPIFrameBuffer.VTable, self.vtable).GetFrameBufferBits(@ptrCast(*const IRDPSRAPIFrameBuffer, self), x, y, Width, Heigth, ppBits); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IRDPSRAPITransportStreamBuffer_Value = Guid.initString("81c80290-5085-44b0-b460-f865c39cb4a9"); pub const IID_IRDPSRAPITransportStreamBuffer = &IID_IRDPSRAPITransportStreamBuffer_Value; pub const IRDPSRAPITransportStreamBuffer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Storage: fn( self: *const IRDPSRAPITransportStreamBuffer, ppbStorage: ?*?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StorageSize: fn( self: *const IRDPSRAPITransportStreamBuffer, plMaxStore: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PayloadSize: fn( self: *const IRDPSRAPITransportStreamBuffer, plRetVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PayloadSize: fn( self: *const IRDPSRAPITransportStreamBuffer, lVal: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PayloadOffset: fn( self: *const IRDPSRAPITransportStreamBuffer, plRetVal: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_PayloadOffset: fn( self: *const IRDPSRAPITransportStreamBuffer, lRetVal: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const IRDPSRAPITransportStreamBuffer, plFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Flags: fn( self: *const IRDPSRAPITransportStreamBuffer, lFlags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Context: fn( self: *const IRDPSRAPITransportStreamBuffer, ppContext: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Context: fn( self: *const IRDPSRAPITransportStreamBuffer, pContext: ?*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 IRDPSRAPITransportStreamBuffer_get_Storage(self: *const T, ppbStorage: ?*?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).get_Storage(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), ppbStorage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_get_StorageSize(self: *const T, plMaxStore: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).get_StorageSize(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), plMaxStore); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_get_PayloadSize(self: *const T, plRetVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).get_PayloadSize(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), plRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_put_PayloadSize(self: *const T, lVal: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).put_PayloadSize(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), lVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_get_PayloadOffset(self: *const T, plRetVal: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).get_PayloadOffset(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), plRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_put_PayloadOffset(self: *const T, lRetVal: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).put_PayloadOffset(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), lRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_get_Flags(self: *const T, plFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).get_Flags(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), plFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_put_Flags(self: *const T, lFlags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).put_Flags(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), lFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_get_Context(self: *const T, ppContext: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).get_Context(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), ppContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamBuffer_put_Context(self: *const T, pContext: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStreamBuffer.VTable, self.vtable).put_Context(@ptrCast(*const IRDPSRAPITransportStreamBuffer, self), pContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IRDPSRAPITransportStreamEvents_Value = Guid.initString("ea81c254-f5af-4e40-982e-3e63bb595276"); pub const IID_IRDPSRAPITransportStreamEvents = &IID_IRDPSRAPITransportStreamEvents_Value; pub const IRDPSRAPITransportStreamEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnWriteCompleted: fn( self: *const IRDPSRAPITransportStreamEvents, pBuffer: ?*IRDPSRAPITransportStreamBuffer, ) callconv(@import("std").os.windows.WINAPI) void, OnReadCompleted: fn( self: *const IRDPSRAPITransportStreamEvents, pBuffer: ?*IRDPSRAPITransportStreamBuffer, ) callconv(@import("std").os.windows.WINAPI) void, OnStreamClosed: fn( self: *const IRDPSRAPITransportStreamEvents, hrReason: 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 IRDPSRAPITransportStreamEvents_OnWriteCompleted(self: *const T, pBuffer: ?*IRDPSRAPITransportStreamBuffer) callconv(.Inline) void { return @ptrCast(*const IRDPSRAPITransportStreamEvents.VTable, self.vtable).OnWriteCompleted(@ptrCast(*const IRDPSRAPITransportStreamEvents, self), pBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamEvents_OnReadCompleted(self: *const T, pBuffer: ?*IRDPSRAPITransportStreamBuffer) callconv(.Inline) void { return @ptrCast(*const IRDPSRAPITransportStreamEvents.VTable, self.vtable).OnReadCompleted(@ptrCast(*const IRDPSRAPITransportStreamEvents, self), pBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStreamEvents_OnStreamClosed(self: *const T, hrReason: HRESULT) callconv(.Inline) void { return @ptrCast(*const IRDPSRAPITransportStreamEvents.VTable, self.vtable).OnStreamClosed(@ptrCast(*const IRDPSRAPITransportStreamEvents, self), hrReason); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IRDPSRAPITransportStream_Value = Guid.initString("36cfa065-43bb-4ef7-aed7-9b88a5053036"); pub const IID_IRDPSRAPITransportStream = &IID_IRDPSRAPITransportStream_Value; pub const IRDPSRAPITransportStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AllocBuffer: fn( self: *const IRDPSRAPITransportStream, maxPayload: i32, ppBuffer: ?*?*IRDPSRAPITransportStreamBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeBuffer: fn( self: *const IRDPSRAPITransportStream, pBuffer: ?*IRDPSRAPITransportStreamBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteBuffer: fn( self: *const IRDPSRAPITransportStream, pBuffer: ?*IRDPSRAPITransportStreamBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReadBuffer: fn( self: *const IRDPSRAPITransportStream, pBuffer: ?*IRDPSRAPITransportStreamBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Open: fn( self: *const IRDPSRAPITransportStream, pCallbacks: ?*IRDPSRAPITransportStreamEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IRDPSRAPITransportStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStream_AllocBuffer(self: *const T, maxPayload: i32, ppBuffer: ?*?*IRDPSRAPITransportStreamBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStream.VTable, self.vtable).AllocBuffer(@ptrCast(*const IRDPSRAPITransportStream, self), maxPayload, ppBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStream_FreeBuffer(self: *const T, pBuffer: ?*IRDPSRAPITransportStreamBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStream.VTable, self.vtable).FreeBuffer(@ptrCast(*const IRDPSRAPITransportStream, self), pBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStream_WriteBuffer(self: *const T, pBuffer: ?*IRDPSRAPITransportStreamBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStream.VTable, self.vtable).WriteBuffer(@ptrCast(*const IRDPSRAPITransportStream, self), pBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStream_ReadBuffer(self: *const T, pBuffer: ?*IRDPSRAPITransportStreamBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStream.VTable, self.vtable).ReadBuffer(@ptrCast(*const IRDPSRAPITransportStream, self), pBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStream_Open(self: *const T, pCallbacks: ?*IRDPSRAPITransportStreamEvents) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStream.VTable, self.vtable).Open(@ptrCast(*const IRDPSRAPITransportStream, self), pCallbacks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPITransportStream_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPITransportStream.VTable, self.vtable).Close(@ptrCast(*const IRDPSRAPITransportStream, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRDPSRAPISharingSession_Value = Guid.initString("eeb20886-e470-4cf6-842b-2739c0ec5cfb"); pub const IID_IRDPSRAPISharingSession = &IID_IRDPSRAPISharingSession_Value; pub const IRDPSRAPISharingSession = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, Open: fn( self: *const IRDPSRAPISharingSession, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IRDPSRAPISharingSession, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ColorDepth: fn( self: *const IRDPSRAPISharingSession, colorDepth: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ColorDepth: fn( self: *const IRDPSRAPISharingSession, pColorDepth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Properties: fn( self: *const IRDPSRAPISharingSession, ppVal: ?*?*IRDPSRAPISessionProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attendees: fn( self: *const IRDPSRAPISharingSession, ppVal: ?*?*IRDPSRAPIAttendeeManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Invitations: fn( self: *const IRDPSRAPISharingSession, ppVal: ?*?*IRDPSRAPIInvitationManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ApplicationFilter: fn( self: *const IRDPSRAPISharingSession, ppVal: ?*?*IRDPSRAPIApplicationFilter, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_VirtualChannelManager: fn( self: *const IRDPSRAPISharingSession, ppVal: ?*?*IRDPSRAPIVirtualChannelManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Pause: fn( self: *const IRDPSRAPISharingSession, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resume: fn( self: *const IRDPSRAPISharingSession, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConnectToClient: fn( self: *const IRDPSRAPISharingSession, bstrConnectionString: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDesktopSharedRect: fn( self: *const IRDPSRAPISharingSession, left: i32, top: i32, right: i32, bottom: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDesktopSharedRect: fn( self: *const IRDPSRAPISharingSession, pleft: ?*i32, ptop: ?*i32, pright: ?*i32, pbottom: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_Open(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).Open(@ptrCast(*const IRDPSRAPISharingSession, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).Close(@ptrCast(*const IRDPSRAPISharingSession, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_put_ColorDepth(self: *const T, colorDepth: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).put_ColorDepth(@ptrCast(*const IRDPSRAPISharingSession, self), colorDepth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_get_ColorDepth(self: *const T, pColorDepth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).get_ColorDepth(@ptrCast(*const IRDPSRAPISharingSession, self), pColorDepth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_get_Properties(self: *const T, ppVal: ?*?*IRDPSRAPISessionProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).get_Properties(@ptrCast(*const IRDPSRAPISharingSession, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_get_Attendees(self: *const T, ppVal: ?*?*IRDPSRAPIAttendeeManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).get_Attendees(@ptrCast(*const IRDPSRAPISharingSession, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_get_Invitations(self: *const T, ppVal: ?*?*IRDPSRAPIInvitationManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).get_Invitations(@ptrCast(*const IRDPSRAPISharingSession, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_get_ApplicationFilter(self: *const T, ppVal: ?*?*IRDPSRAPIApplicationFilter) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).get_ApplicationFilter(@ptrCast(*const IRDPSRAPISharingSession, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_get_VirtualChannelManager(self: *const T, ppVal: ?*?*IRDPSRAPIVirtualChannelManager) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).get_VirtualChannelManager(@ptrCast(*const IRDPSRAPISharingSession, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_Pause(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).Pause(@ptrCast(*const IRDPSRAPISharingSession, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_Resume(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).Resume(@ptrCast(*const IRDPSRAPISharingSession, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_ConnectToClient(self: *const T, bstrConnectionString: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).ConnectToClient(@ptrCast(*const IRDPSRAPISharingSession, self), bstrConnectionString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_SetDesktopSharedRect(self: *const T, left: i32, top: i32, right: i32, bottom: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).SetDesktopSharedRect(@ptrCast(*const IRDPSRAPISharingSession, self), left, top, right, bottom); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession_GetDesktopSharedRect(self: *const T, pleft: ?*i32, ptop: ?*i32, pright: ?*i32, pbottom: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession.VTable, self.vtable).GetDesktopSharedRect(@ptrCast(*const IRDPSRAPISharingSession, self), pleft, ptop, pright, pbottom); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IRDPSRAPISharingSession2_Value = Guid.initString("fee4ee57-e3e8-4205-8fb0-8fd1d0675c21"); pub const IID_IRDPSRAPISharingSession2 = &IID_IRDPSRAPISharingSession2_Value; pub const IRDPSRAPISharingSession2 = extern struct { pub const VTable = extern struct { base: IRDPSRAPISharingSession.VTable, ConnectUsingTransportStream: fn( self: *const IRDPSRAPISharingSession2, pStream: ?*IRDPSRAPITransportStream, bstrGroup: ?BSTR, bstrAuthenticatedAttendeeName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FrameBuffer: fn( self: *const IRDPSRAPISharingSession2, ppVal: ?*?*IRDPSRAPIFrameBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendControlLevelChangeResponse: fn( self: *const IRDPSRAPISharingSession2, pAttendee: ?*IRDPSRAPIAttendee, RequestedLevel: CTRL_LEVEL, ReasonCode: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IRDPSRAPISharingSession.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession2_ConnectUsingTransportStream(self: *const T, pStream: ?*IRDPSRAPITransportStream, bstrGroup: ?BSTR, bstrAuthenticatedAttendeeName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession2.VTable, self.vtable).ConnectUsingTransportStream(@ptrCast(*const IRDPSRAPISharingSession2, self), pStream, bstrGroup, bstrAuthenticatedAttendeeName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession2_get_FrameBuffer(self: *const T, ppVal: ?*?*IRDPSRAPIFrameBuffer) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession2.VTable, self.vtable).get_FrameBuffer(@ptrCast(*const IRDPSRAPISharingSession2, self), ppVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRDPSRAPISharingSession2_SendControlLevelChangeResponse(self: *const T, pAttendee: ?*IRDPSRAPIAttendee, RequestedLevel: CTRL_LEVEL, ReasonCode: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRDPSRAPISharingSession2.VTable, self.vtable).SendControlLevelChangeResponse(@ptrCast(*const IRDPSRAPISharingSession2, self), pAttendee, RequestedLevel, ReasonCode); } };} pub usingnamespace MethodMixin(@This()); }; pub const __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001 = enum(i32) { MAX_CHANNEL_MESSAGE_SIZE = 1024, MAX_CHANNEL_NAME_LEN = 8, MAX_LEGACY_CHANNEL_MESSAGE_SIZE = 409600, ATTENDEE_ID_EVERYONE = -1, ATTENDEE_ID_HOST = 0, CONN_INTERVAL = 50, // ATTENDEE_ID_DEFAULT = -1, this enum value conflicts with ATTENDEE_ID_EVERYONE }; pub const CONST_MAX_CHANNEL_MESSAGE_SIZE = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.MAX_CHANNEL_MESSAGE_SIZE; pub const CONST_MAX_CHANNEL_NAME_LEN = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.MAX_CHANNEL_NAME_LEN; pub const CONST_MAX_LEGACY_CHANNEL_MESSAGE_SIZE = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.MAX_LEGACY_CHANNEL_MESSAGE_SIZE; pub const CONST_ATTENDEE_ID_EVERYONE = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.ATTENDEE_ID_EVERYONE; pub const CONST_ATTENDEE_ID_HOST = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.ATTENDEE_ID_HOST; pub const CONST_CONN_INTERVAL = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.CONN_INTERVAL; pub const CONST_ATTENDEE_ID_DEFAULT = __MIDL___MIDL_itf_rdpencomapi_0000_0027_0001.ATTENDEE_ID_EVERYONE; pub const __ReferenceRemainingTypes__ = extern struct { __ctrlLevel__: CTRL_LEVEL, __attendeeDisconnectReason__: ATTENDEE_DISCONNECT_REASON, __channelPriority__: CHANNEL_PRIORITY, __channelFlags__: CHANNEL_FLAGS, __channelAccessEnum__: CHANNEL_ACCESS_ENUM, __rdpencomapiAttendeeFlags__: RDPENCOMAPI_ATTENDEE_FLAGS, __rdpsrapiWndFlags__: RDPSRAPI_WND_FLAGS, __rdpsrapiAppFlags__: RDPSRAPI_APP_FLAGS, }; // TODO: this type is limited to platform 'windows6.0.6000' const IID__IRDPSessionEvents_Value = Guid.initString("98a97042-6698-40e9-8efd-b3200990004b"); pub const IID__IRDPSessionEvents = &IID__IRDPSessionEvents_Value; pub const _IRDPSessionEvents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // 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 (7) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BSTR = @import("../foundation.zig").BSTR; const HRESULT = @import("../foundation.zig").HRESULT; const IDispatch = @import("../system/com.zig").IDispatch; const IUnknown = @import("../system/com.zig").IUnknown; const SAFEARRAY = @import("../system/com.zig").SAFEARRAY; const VARIANT = @import("../system/com.zig").VARIANT; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/desktop_sharing.zig
const std = @import("std"); const builtin = @import("builtin"); const panic = std.debug.panic; const join = std.fs.path.join; usingnamespace @import("c.zig"); const Shader = @import("shader.zig").Shader; // settings const SCR_WIDTH: u32 = 1920; const SCR_HEIGHT: u32 = 1080; pub fn main() !void { const allocator = std.heap.page_allocator; const vertPath = try join(allocator, &[_][]const u8{ "shaders", "1_3_shaders.vert" }); const fragPath = try join(allocator, &[_][]const u8{ "shaders", "1_3_shaders.frag" }); const ok = glfwInit(); if (ok == 0) { panic("Failed to initialise GLFW\n", .{}); } defer glfwTerminate(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); if (builtin.os.tag == .macosx) { glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); } // glfw: initialize and configure var window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "Learn OpenGL", null, null); if (window == null) { panic("Failed to create GLFW window\n", .{}); } glfwMakeContextCurrent(window); const resizeCallback = glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); // glad: load all OpenGL function pointers if (gladLoadGLLoader(@ptrCast(GLADloadproc, glfwGetProcAddress)) == 0) { panic("Failed to initialise GLAD\n", .{}); } // build and compile our shader program const ourShader = try Shader.init(allocator, vertPath, fragPath); // set up vertex data (and buffer(s)) and configure vertex attributes const vertices = [_]f32{ // positions // colors 0.5, -0.5, 0.0, 1.0, 0.0, 0.0, // bottom right -0.5, -0.5, 0.0, 0.0, 1.0, 0.0, // bottom left 0.0, 0.5, 0.0, 0.0, 0.0, 1.0, // top }; var VAO: c_uint = undefined; var VBO: c_uint = undefined; glGenVertexArrays(1, &VAO); defer glDeleteVertexArrays(1, &VAO); glGenBuffers(1, &VBO); defer glDeleteBuffers(1, &VBO); // bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s). glBindVertexArray(VAO); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, vertices.len * @sizeOf(f32), &vertices, GL_STATIC_DRAW); // position attribute glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * @sizeOf(f32), null); glEnableVertexAttribArray(0); // color attribute glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * @sizeOf(f32), @intToPtr(*c_void, 3 * @sizeOf(f32))); glEnableVertexAttribArray(1); // You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other // VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary. // glBindVertexArray(0); // render loop while (glfwWindowShouldClose(window) == 0) { // input processInput(window); // render glClearColor(0.2, 0.3, 0.3, 1.0); glClear(GL_COLOR_BUFFER_BIT); // draw our first triangle ourShader.use(); glBindVertexArray(VAO); glDrawArrays(GL_TRIANGLES, 0, 3); // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.) glfwSwapBuffers(window); glfwPollEvents(); } } // process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly pub fn processInput(window: ?*GLFWwindow) callconv(.C) void { if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) glfwSetWindowShouldClose(window, 1); } // glfw: whenever the window size changed (by OS or user resize) this callback function executes pub fn framebuffer_size_callback(window: ?*GLFWwindow, width: c_int, height: c_int) callconv(.C) void { // make sure the viewport matches the new window dimensions; note that width and // height will be significantly larger than specified on retina displays. glViewport(0, 0, width, height); }
src/1_3_shaders.zig
const std = @import("../std.zig"); const math = std.math; const expect = std.testing.expect; const maxInt = std.math.maxInt; /// Returns the hyperbolic arc-sin of x. /// /// Special Cases: /// - asinh(+-0) = +-0 /// - asinh(+-inf) = +-inf /// - asinh(nan) = nan pub fn asinh(x: anytype) @TypeOf(x) { const T = @TypeOf(x); return switch (T) { f32 => asinh32(x), f64 => asinh64(x), else => @compileError("asinh not implemented for " ++ @typeName(T)), }; } // asinh(x) = sign(x) * log(|x| + sqrt(x * x + 1)) ~= x - x^3/6 + o(x^5) fn asinh32(x: f32) f32 { const u = @bitCast(u32, x); const i = u & 0x7FFFFFFF; const s = i >> 31; var rx = @bitCast(f32, i); // |x| // TODO: Shouldn't need this explicit check. if (math.isNegativeInf(x)) { return x; } // |x| >= 0x1p12 or inf or nan if (i >= 0x3F800000 + (12 << 23)) { rx = @log(rx) + 0.69314718055994530941723212145817656; } // |x| >= 2 else if (i >= 0x3F800000 + (1 << 23)) { rx = @log(2 * x + 1 / (@sqrt(x * x + 1) + x)); } // |x| >= 0x1p-12, up to 1.6ulp error else if (i >= 0x3F800000 - (12 << 23)) { rx = math.log1p(x + x * x / (@sqrt(x * x + 1) + 1)); } // |x| < 0x1p-12, inexact if x != 0 else { math.doNotOptimizeAway(x + 0x1.0p120); } return if (s != 0) -rx else rx; } fn asinh64(x: f64) f64 { const u = @bitCast(u64, x); const e = (u >> 52) & 0x7FF; const s = e >> 63; var rx = @bitCast(f64, u & (maxInt(u64) >> 1)); // |x| if (math.isNegativeInf(x)) { return x; } // |x| >= 0x1p26 or inf or nan if (e >= 0x3FF + 26) { rx = @log(rx) + 0.693147180559945309417232121458176568; } // |x| >= 2 else if (e >= 0x3FF + 1) { rx = @log(2 * x + 1 / (@sqrt(x * x + 1) + x)); } // |x| >= 0x1p-12, up to 1.6ulp error else if (e >= 0x3FF - 26) { rx = math.log1p(x + x * x / (@sqrt(x * x + 1) + 1)); } // |x| < 0x1p-12, inexact if x != 0 else { math.doNotOptimizeAway(x + 0x1.0p120); } return if (s != 0) -rx else rx; } test "math.asinh" { try expect(asinh(@as(f32, 0.0)) == asinh32(0.0)); try expect(asinh(@as(f64, 0.0)) == asinh64(0.0)); } test "math.asinh32" { const epsilon = 0.000001; try expect(math.approxEqAbs(f32, asinh32(0.0), 0.0, epsilon)); try expect(math.approxEqAbs(f32, asinh32(-0.2), -0.198690, epsilon)); try expect(math.approxEqAbs(f32, asinh32(0.2), 0.198690, epsilon)); try expect(math.approxEqAbs(f32, asinh32(0.8923), 0.803133, epsilon)); try expect(math.approxEqAbs(f32, asinh32(1.5), 1.194763, epsilon)); try expect(math.approxEqAbs(f32, asinh32(37.45), 4.316332, epsilon)); try expect(math.approxEqAbs(f32, asinh32(89.123), 5.183196, epsilon)); try expect(math.approxEqAbs(f32, asinh32(123123.234375), 12.414088, epsilon)); } test "math.asinh64" { const epsilon = 0.000001; try expect(math.approxEqAbs(f64, asinh64(0.0), 0.0, epsilon)); try expect(math.approxEqAbs(f64, asinh64(-0.2), -0.198690, epsilon)); try expect(math.approxEqAbs(f64, asinh64(0.2), 0.198690, epsilon)); try expect(math.approxEqAbs(f64, asinh64(0.8923), 0.803133, epsilon)); try expect(math.approxEqAbs(f64, asinh64(1.5), 1.194763, epsilon)); try expect(math.approxEqAbs(f64, asinh64(37.45), 4.316332, epsilon)); try expect(math.approxEqAbs(f64, asinh64(89.123), 5.183196, epsilon)); try expect(math.approxEqAbs(f64, asinh64(123123.234375), 12.414088, epsilon)); } test "math.asinh32.special" { try expect(asinh32(0.0) == 0.0); try expect(asinh32(-0.0) == -0.0); try expect(math.isPositiveInf(asinh32(math.inf(f32)))); try expect(math.isNegativeInf(asinh32(-math.inf(f32)))); try expect(math.isNan(asinh32(math.nan(f32)))); } test "math.asinh64.special" { try expect(asinh64(0.0) == 0.0); try expect(asinh64(-0.0) == -0.0); try expect(math.isPositiveInf(asinh64(math.inf(f64)))); try expect(math.isNegativeInf(asinh64(-math.inf(f64)))); try expect(math.isNan(asinh64(math.nan(f64)))); }
lib/std/math/asinh.zig
const std = @import("std"); const isr = @import("isr.zig"); const scheduler = @import("scheduler.zig"); const syscall = @import("syscall.zig"); const tty = @import("tty.zig"); const x86 = @import("x86.zig"); const send = @import("ipc.zig").send; const MailboxId = std.os.zen.MailboxId; const Message = std.os.zen.Message; // PIC ports. const PIC1_CMD = 0x20; const PIC1_DATA = 0x21; const PIC2_CMD = 0xA0; const PIC2_DATA = 0xA1; // PIC commands: const ISR_READ = 0x0B; // Read the In-Service Register. const EOI = 0x20; // End of Interrupt. // Initialization Control Words commands. const ICW1_INIT = 0x10; const ICW1_ICW4 = 0x01; const ICW4_8086 = 0x01; // Interrupt Vector offsets of exceptions. const EXCEPTION_0 = 0; const EXCEPTION_31 = EXCEPTION_0 + 31; // Interrupt Vector offsets of IRQs. const IRQ_0 = EXCEPTION_31 + 1; const IRQ_15 = IRQ_0 + 15; // Interrupt Vector offsets of syscalls. const SYSCALL = 128; // Registered interrupt handlers. var handlers = []fn()void { unhandled } ** 48; // Registered IRQ subscribers. var irq_subscribers = []MailboxId { MailboxId.Kernel } ** 16; //// // Default interrupt handler. // fn unhandled() noreturn { const n = isr.context.interrupt_n; if (n >= IRQ_0) { tty.panic("unhandled IRQ number {d}", n - IRQ_0); } else { tty.panic("unhandled exception number {d}", n); } } //// // Call the correct handler based on the interrupt number. // export fn interruptDispatch() void { const n = u8(isr.context.interrupt_n); switch (n) { // Exceptions. EXCEPTION_0 ... EXCEPTION_31 => { handlers[n](); }, // IRQs. IRQ_0 ... IRQ_15 => { const irq = n - IRQ_0; if (spuriousIRQ(irq)) return; handlers[n](); endOfInterrupt(irq); }, // Syscalls. SYSCALL => { const syscall_n = isr.context.registers.eax; if (syscall_n < syscall.handlers.len) { syscall.handlers[syscall_n](); } else { syscall.invalid(); } }, else => unreachable } // If no user thread is ready to run, halt here and wait for interrupts. if (scheduler.current() == null) { x86.sti(); x86.hlt(); } } //// // Check whether the fired IRQ was spurious. // // Arguments: // irq: The number of the fired IRQ. // // Returns: // true if the IRQ was spurious, false otherwise. // inline fn spuriousIRQ(irq: u8) bool { // Only IRQ 7 and IRQ 15 can be spurious. if (irq != 7) return false; // TODO: handle spurious IRQ15. // Read the value of the In-Service Register. x86.outb(PIC1_CMD, ISR_READ); const in_service = x86.inb(PIC1_CMD); // Verify whether IRQ7 is set in the ISR. return (in_service & (1 << 7)) == 0; } //// // Signal the end of the IRQ interrupt routine to the PICs. // // Arguments: // irq: The number of the IRQ being handled. // inline fn endOfInterrupt(irq: u8) void { if (irq >= 8) { // Signal to the Slave PIC. x86.outb(PIC2_CMD, EOI); } // Signal to the Master PIC. x86.outb(PIC1_CMD, EOI); } //// // Register an interrupt handler. // // Arguments: // n: Index of the interrupt. // handler: Interrupt handler. // pub fn register(n: u8, handler: fn()void) void { handlers[n] = handler; } //// // Register an IRQ handler. // // Arguments: // irq: Index of the IRQ. // handler: IRQ handler. // pub fn registerIRQ(irq: u8, handler: fn()void) void { register(IRQ_0 + irq, handler); maskIRQ(irq, false); // Unmask the IRQ. } //// // Mask/unmask an IRQ. // // Arguments: // irq: Index of the IRQ. // mask: Whether to mask (true) or unmask (false). // pub fn maskIRQ(irq: u8, mask: bool) void { // Figure out if master or slave PIC owns the IRQ. const port = if (irq < 8) u16(PIC1_DATA) else u16(PIC2_DATA); const old = x86.inb(port); // Retrieve the current mask. // Mask or unmask the interrupt. if (mask) { x86.outb(port, old | (u8(1) << u3(irq % 8))); } else { x86.outb(port, old & ~(u8(1) << u3(irq % 8))); } } //// // Notify the subscribed thread that the IRQ of interest has fired. // fn notifyIRQ() void { const irq = isr.context.interrupt_n - IRQ_0; const subscriber = irq_subscribers[irq]; switch (subscriber) { MailboxId.Port => { send(Message { .sender = MailboxId.Kernel, .receiver = subscriber, .type = 0, .payload = irq, }); }, else => unreachable, } // TODO: support other types of mailboxes. } //// // Subscribe to an IRQ. Every time it fires, the kernel // will send a message to the given mailbox. // // Arguments: // irq: Number of the IRQ to subscribe to. // mailbox_id: Mailbox to send the message to. // pub fn subscribeIRQ(irq: u8, mailbox_id: &const MailboxId) void { // TODO: validate. irq_subscribers[irq] = *mailbox_id; registerIRQ(irq, notifyIRQ); } //// // Remap the PICs so that IRQs don't override software interrupts. // fn remapPIC() void { // ICW1: start initialization sequence. x86.outb(PIC1_CMD, ICW1_INIT | ICW1_ICW4); x86.outb(PIC2_CMD, ICW1_INIT | ICW1_ICW4); // ICW2: Interrupt Vector offsets of IRQs. x86.outb(PIC1_DATA, IRQ_0); // IRQ 0..7 -> Interrupt 32..39 x86.outb(PIC2_DATA, IRQ_0 + 8); // IRQ 8..15 -> Interrupt 40..47 // ICW3: IRQ line 2 to connect master to slave PIC. x86.outb(PIC1_DATA, 1 << 2); x86.outb(PIC2_DATA, 2); // ICW4: 80x86 mode. x86.outb(PIC1_DATA, ICW4_8086); x86.outb(PIC2_DATA, ICW4_8086); // Mask all IRQs. x86.outb(PIC1_DATA, 0xFF); x86.outb(PIC2_DATA, 0xFF); } //// // Initialize interrupts. // pub fn initialize() void { remapPIC(); isr.install(); }
kernel/interrupt.zig
const std = @import("../std.zig"); const debug = std.debug; const testing = std.testing; pub const Polynomial = struct { pub const IEEE = 0xedb88320; pub const Castagnoli = 0x82f63b78; pub const Koopman = 0xeb31d82e; }; // IEEE is by far the most common CRC and so is aliased by default. pub const Crc32 = Crc32WithPoly(Polynomial.IEEE); // slicing-by-8 crc32 implementation. pub fn Crc32WithPoly(comptime poly: u32) type { return struct { const Self = @This(); const lookup_tables = comptime block: { @setEvalBranchQuota(20000); var tables: [8][256]u32 = undefined; for (tables[0]) |*e, i| { var crc = @intCast(u32, i); var j: usize = 0; while (j < 8) : (j += 1) { if (crc & 1 == 1) { crc = (crc >> 1) ^ poly; } else { crc = (crc >> 1); } } e.* = crc; } var i: usize = 0; while (i < 256) : (i += 1) { var crc = tables[0][i]; var j: usize = 1; while (j < 8) : (j += 1) { const index = @truncate(u8, crc); crc = tables[0][index] ^ (crc >> 8); tables[j][i] = crc; } } break :block tables; }; crc: u32, pub fn init() Self { return Self{ .crc = 0xffffffff }; } pub fn update(self: *Self, input: []const u8) void { var i: usize = 0; while (i + 8 <= input.len) : (i += 8) { const p = input[i .. i + 8]; // Unrolling this way gives ~50Mb/s increase self.crc ^= (u32(p[0]) << 0); self.crc ^= (u32(p[1]) << 8); self.crc ^= (u32(p[2]) << 16); self.crc ^= (u32(p[3]) << 24); self.crc = lookup_tables[0][p[7]] ^ lookup_tables[1][p[6]] ^ lookup_tables[2][p[5]] ^ lookup_tables[3][p[4]] ^ lookup_tables[4][@truncate(u8, self.crc >> 24)] ^ lookup_tables[5][@truncate(u8, self.crc >> 16)] ^ lookup_tables[6][@truncate(u8, self.crc >> 8)] ^ lookup_tables[7][@truncate(u8, self.crc >> 0)]; } while (i < input.len) : (i += 1) { const index = @truncate(u8, self.crc) ^ input[i]; self.crc = (self.crc >> 8) ^ lookup_tables[0][index]; } } pub fn final(self: *Self) u32 { return ~self.crc; } pub fn hash(input: []const u8) u32 { var c = Self.init(); c.update(input); return c.final(); } }; } test "crc32 ieee" { const Crc32Ieee = Crc32WithPoly(Polynomial.IEEE); testing.expect(Crc32Ieee.hash("") == 0x00000000); testing.expect(Crc32Ieee.hash("a") == 0xe8b7be43); testing.expect(Crc32Ieee.hash("abc") == 0x352441c2); } test "crc32 castagnoli" { const Crc32Castagnoli = Crc32WithPoly(Polynomial.Castagnoli); testing.expect(Crc32Castagnoli.hash("") == 0x00000000); testing.expect(Crc32Castagnoli.hash("a") == 0xc1d04330); testing.expect(Crc32Castagnoli.hash("abc") == 0x364b3fb7); } // half-byte lookup table implementation. pub fn Crc32SmallWithPoly(comptime poly: u32) type { return struct { const Self = @This(); const lookup_table = comptime block: { var table: [16]u32 = undefined; for (table) |*e, i| { var crc = @intCast(u32, i * 16); var j: usize = 0; while (j < 8) : (j += 1) { if (crc & 1 == 1) { crc = (crc >> 1) ^ poly; } else { crc = (crc >> 1); } } e.* = crc; } break :block table; }; crc: u32, pub fn init() Self { return Self{ .crc = 0xffffffff }; } pub fn update(self: *Self, input: []const u8) void { for (input) |b| { self.crc = lookup_table[@truncate(u4, self.crc ^ (b >> 0))] ^ (self.crc >> 4); self.crc = lookup_table[@truncate(u4, self.crc ^ (b >> 4))] ^ (self.crc >> 4); } } pub fn final(self: *Self) u32 { return ~self.crc; } pub fn hash(input: []const u8) u32 { var c = Self.init(); c.update(input); return c.final(); } }; } test "small crc32 ieee" { const Crc32Ieee = Crc32SmallWithPoly(Polynomial.IEEE); testing.expect(Crc32Ieee.hash("") == 0x00000000); testing.expect(Crc32Ieee.hash("a") == 0xe8b7be43); testing.expect(Crc32Ieee.hash("abc") == 0x352441c2); } test "small crc32 castagnoli" { const Crc32Castagnoli = Crc32SmallWithPoly(Polynomial.Castagnoli); testing.expect(Crc32Castagnoli.hash("") == 0x00000000); testing.expect(Crc32Castagnoli.hash("a") == 0xc1d04330); testing.expect(Crc32Castagnoli.hash("abc") == 0x364b3fb7); }
lib/std/hash/crc.zig
const std = @import("std"); const assert = std.debug.assert; pub const Mode86 = enum { x86_16 = 0, x86_32 = 1, x64 = 2, }; pub const AsmError = error{ InvalidOperand, InvalidMode, InvalidImmediate, InvalidMemoryAddressing, InvalidRegisterCombination, InstructionTooLong, InvalidPrefixes, }; pub const Segment = enum(u8) { ES = 0x00, CS, SS, DS, FS, GS = 0x05, DefaultSeg = 0x10, }; pub const BitSize = enum(u8) { None = 0, Bit8 = 1, Bit16 = 2, Bit32 = 4, Bit64 = 8, Bit80 = 10, Bit128 = 16, Bit256 = 32, Bit512 = 64, pub fn value(self: BitSize) u16 { return 8 * @enumToInt(self); } pub fn valueBytes(self: BitSize) u8 { return @enumToInt(self); } }; pub const Overides = enum(u8) { /// 64 bit mode: /// zero overides, valid /// 32 bit mode: /// zero overides, valid /// 16 bit mode: /// zero overides, valid ZO, /// 64 bit mode: /// 0x66 size overide prefix /// 32 bit mode: /// 0x66 size overide prefix /// 16 bit mode: /// no overide prefix Op16, /// 64 bit mode: /// no overide prefix /// 32 bit mode: /// no overide prefix /// 16 bit mode: /// 0x66 size overide prefix Op32, /// Forces REX.W bit set, only valid in 64 bit mode REX_W, /// Used for instructions that use 0x67 to determine register size /// /// 64 bit mode: /// Invalid /// 32 bit mode: /// address overide prefix 0x67, memory addressing must be 16 bit if used /// 16 bit mode: /// no address overide, memory addressing must be 16 bit if used Addr16, /// 64 bit mode: /// address overide prefix 0x67, memory addressing must be 32 bit if used /// 32 bit mode: /// no prefix /// 16 bit mode: /// address overide prefix 0x67, memory addressing must be 32 bit if used Addr32, /// 64 bit mode: /// no address overide, memory addressing must use 64 bit registers if used /// 32 bit mode: /// invalid /// 16 bit mode: /// invalid Addr64, pub fn is64Default(self: Overides) bool { return switch (self) { .ZO, .Addr64 => true, else => false, }; } }; pub const OpcodePrefixType = enum { /// Opcode permits prefixes Prefixable, /// No Prefix: /// /// Indicates the use of 66/F2/F3 prefixes (beyond those already part of /// the instructions opcode) are not allowed with the instruction. NP, /// No Fx prefix /// /// Indicates the use of F2/F3 prefixes (beyond those already part of the /// instructions opcode) are not allowed with the instruction. NFx, /// Mandatory prefix Mandatory, /// Opcode is composed of multiple separate instructions Compound, /// 3DNow! opcode, uses imm8 after instruction to extend the opcode Postfix, }; pub const OpcodePrefix = enum(u8) { Any = 0x00, NFx = 0x01, _NP = 0x02, _66 = 0x66, _F3 = 0xF3, _F2 = 0xF2, _, pub fn byte(op: u8) OpcodePrefix { return @intToEnum(OpcodePrefix, op); } }; pub const CompoundInstruction = enum(u8) { None = 0x66, FWAIT = 0x9B, }; pub const Opcode = struct { const max_length: u8 = 3; opcode: [max_length]u8 = undefined, len: u8 = 0, compound_op: CompoundInstruction = .None, /// Note: can also be used to store the postfix for 3DNow opcodes prefix: OpcodePrefix = .Any, prefix_type: OpcodePrefixType = .Prefixable, reg_bits: ?u3 = null, pub fn asSlice(self: Opcode) []const u8 { return self.opcode[0..self.len]; } pub fn prefixesAsSlice(self: Opcode) []const u8 { return self.prefixes[0..self.prefix_count]; } pub fn isPrefixable(self: Opcode) bool { return self.prefix_type == .Prefixable; } pub fn hasPrefixByte(self: Opcode) bool { return switch (self.prefix_type) { .Mandatory, .Compound => true, else => false, }; } pub fn hasPostfix(self: Opcode) bool { return self.prefix_type == .Postfix; } pub fn getPostfix(self: Opcode) u8 { return @enumToInt(self.prefix); } /// Calculate how many bytes are in the opcode excluding mandatory prefixes. pub fn byteCount(self: Opcode) u8 { const extra: u8 = switch (self.prefix_type) { .Compound, .Postfix => 1, else => 0, }; return self.len + extra; } fn create_generic( prefix: OpcodePrefix, opcode_bytes: [3]u8, len: u8, reg_bits: ?u3, ) Opcode { const prefix_type = switch (prefix) { .Any => OpcodePrefixType.Prefixable, .NFx => OpcodePrefixType.NFx, ._NP => OpcodePrefixType.NP, ._66, ._F3, ._F2 => OpcodePrefixType.Mandatory, else => OpcodePrefixType.Compound, }; return Opcode{ .opcode = opcode_bytes, .len = len, .prefix = prefix, .prefix_type = prefix_type, .reg_bits = reg_bits, }; } pub fn op1(byte0: u8) Opcode { return create_generic(.Any, [_]u8{ byte0, 0, 0 }, 1, null); } pub fn op2(byte0: u8, byte1: u8) Opcode { return create_generic(.Any, [_]u8{ byte0, byte1, 0 }, 2, null); } pub fn op3(byte0: u8, byte1: u8, byte2: u8) Opcode { return create_generic(.Any, [_]u8{ byte0, byte1, byte2 }, 3, null); } pub fn op1r(byte0: u8, reg_bits: u3) Opcode { return create_generic(.Any, [_]u8{ byte0, 0, 0 }, 1, reg_bits); } pub fn op2r(byte0: u8, byte1: u8, reg_bits: u3) Opcode { return create_generic(.Any, [_]u8{ byte0, byte1, 0 }, 2, reg_bits); } pub fn op3r(byte0: u8, byte1: u8, byte2: u8, reg_bits: u3) Opcode { return create_generic(.Any, [_]u8{ byte0, byte1, byte2 }, 3, reg_bits); } pub fn preOp1r(prefix: OpcodePrefix, byte0: u8, reg_bits: u3) Opcode { return create_generic(prefix, [_]u8{ byte0, 0, 0 }, 1, reg_bits); } pub fn preOp2r(prefix: OpcodePrefix, byte0: u8, byte1: u8, reg_bits: u3) Opcode { return create_generic(prefix, [_]u8{ byte0, byte1, 0 }, 2, reg_bits); } pub fn preOp3r(prefix: OpcodePrefix, byte0: u8, byte1: u8, byte2: u8, reg_bits: u3) Opcode { return create_generic(prefix, [_]u8{ byte0, byte1, byte2 }, 3, reg_bits); } pub fn preOp1(prefix: OpcodePrefix, byte0: u8) Opcode { return create_generic(prefix, [_]u8{ byte0, 0, 0 }, 1, null); } pub fn preOp2(prefix: OpcodePrefix, byte0: u8, byte1: u8) Opcode { return create_generic(prefix, [_]u8{ byte0, byte1, 0 }, 2, null); } pub fn preOp3(prefix: OpcodePrefix, byte0: u8, byte1: u8, byte2: u8) Opcode { return create_generic(prefix, [_]u8{ byte0, byte1, byte2 }, 3, null); } pub fn compOp1r(compound_op: CompoundInstruction, byte0: u8, reg_bits: u3) Opcode { var res = create_generic(.Any, [_]u8{ byte0, 0, 0 }, 1, reg_bits); res.compound_op = compound_op; return res; } pub fn compOp2(compound_op: CompoundInstruction, byte0: u8, byte1: u8) Opcode { var res = create_generic(.Any, [_]u8{ byte0, byte1, 0 }, 2, null); res.compound_op = compound_op; return res; } pub fn op3DNow(byte0: u8, byte1: u8, imm_byte: u8) Opcode { var res = create_generic(OpcodePrefix.byte(imm_byte), [_]u8{ byte0, byte1, 0 }, 2, null); res.prefix_type = .Postfix; return res; } }; pub const DataType = enum(u16) { NormalMemory = 0x0000, FarAddress = 0x01000, FloatingPoint = 0x0200, VoidPointer = 0x0300, Broadcast = 0x0400, Vector = 0x0500, Register = 0x0F00, }; pub const DataSize = enum(u16) { const tag_mask: u16 = 0xFF00; const size_mask: u16 = 0x00FF; const normal_tag: u16 = @enumToInt(DataType.NormalMemory); const far_address_tag: u16 = @enumToInt(DataType.FarAddress); const floating_point_tag: u16 = @enumToInt(DataType.FloatingPoint); const void_tag: u16 = @enumToInt(DataType.VoidPointer); const broadcast_tag: u16 = @enumToInt(DataType.Broadcast); const vector_tag: u16 = @enumToInt(DataType.Vector); /// 8 bit data size BYTE = 1 | normal_tag, /// 16 bit data size WORD = 2 | normal_tag, /// 32 bit data size DWORD = 4 | normal_tag, /// 64 bit data size QWORD = 8 | normal_tag, /// 80 bit data size TBYTE = 10 | normal_tag, /// 128 bit data size (DQWORD) OWORD = 16 | normal_tag, /// 128 bit data size XMM_WORD = 16 | vector_tag, /// 256 bit data size YMM_WORD = 32 | vector_tag, /// 512 bit data size ZMM_WORD = 64 | vector_tag, /// 32 bit broadcast for AVX512 DWORD_BCST = 4 | broadcast_tag, /// 64 bit broadcast for AVX512 QWORD_BCST = 8 | broadcast_tag, // FIXME: // // Right now this doesn't represent the real size of the data. Rather it // contains the size of how the value behaves with respect to the operand // size overide and the REX.W prefixes. // // It would be better to encode this data into the type, and then the // data size can be include correctly as well. /// 16:16 bit data size (16 bit addr followed by 16 bit segment) FAR_WORD = 2 | far_address_tag, /// 16:32 bit data size (32 bit addr followed by 16 bit segment) FAR_DWORD = 4 | far_address_tag, /// 16:64 bit data size (64 bit addr followed by 16 bit segment) FAR_QWORD = 8 | far_address_tag, Void = 0 | void_tag, Default = @enumToInt(BitSize.None), pub fn fromByteValue(bytes: u16) DataSize { return @intToEnum(DataSize, bytes | normal_tag); } pub fn bitSize(self: DataSize) BitSize { return @intToEnum(BitSize, @intCast(u8, @enumToInt(self) & size_mask)); } pub fn dataType(self: DataSize) DataType { return @intToEnum(DataType, @enumToInt(self) & tag_mask); } }; pub const PrefixGroup = enum { const count = 6; Group0 = 0, Group1 = 1, Group2 = 2, Group3 = 3, Group4 = 4, Rex = 5, None, }; pub const Prefix = enum(u8) { None = 0x00, // Group 1 Lock = 0xF0, Repne = 0xF2, Rep = 0xF3, // Bnd = 0xF2, // BND prefix aliases with Repne // Xacquire = 0xF2, // XACQUIRE prefix aliases with Repne // Xrelease = 0xF3, // XRELEASE prefix aliases with Rep // Group 2 // BranchTaken = 0x2E, // aliases with SegmentCS // BranchNotTaken = 0x3E, // aliases with SegmentDS SegmentCS = 0x2E, SegmentDS = 0x3E, SegmentES = 0x26, SegmentSS = 0x36, SegmentFS = 0x64, SegmentGS = 0x65, // Group 3 OpSize = 0x66, // Group 4 AddrSize = 0x67, REX = 0x40, REX_B = 0x41, REX_X = 0x42, REX_XB = 0x43, REX_R = 0x44, REX_RB = 0x45, REX_RX = 0x46, REX_RXB = 0x47, REX_W = 0x48, REX_WB = 0x49, REX_WX = 0x4A, REX_WXB = 0x4B, REX_WR = 0x4C, REX_WRB = 0x4D, REX_WRX = 0x4E, REX_WRXB = 0x4F, pub fn getGroupNumber(self: Prefix) u8 { return @enumToInt(self.getGroup()); } pub fn getGroup(self: Prefix) PrefixGroup { return switch (self) { .Lock => .Group0, .Repne, .Rep => .Group1, .SegmentCS, .SegmentDS, .SegmentES, .SegmentSS, .SegmentFS, .SegmentGS => .Group2, .OpSize => .Group2, .AddrSize => .Group3, .REX, .REX_B, .REX_X, .REX_XB, .REX_R, .REX_RB, .REX_RX, .REX_RXB, .REX_W, .REX_WB, .REX_WX, .REX_WXB, .REX_WR, .REX_WRB, .REX_WRX, .REX_WRXB => .Rex, .None => .None, }; } pub fn value(self: Prefix) u8 { return @enumToInt(self); } }; /// Prefixes pub const Prefixes = struct { const max_count = 4; prefixes: [max_count]Prefix = [1]Prefix{.None} ** max_count, len: u8 = 0, pub fn addSegmentOveride(self: *Prefixes, seg: Segment) void { switch (seg) { .ES => self.addPrefix(.SegmentES), .CS => self.addPrefix(.SegmentCS), .SS => self.addPrefix(.SegmentSS), .DS => self.addPrefix(.SegmentDS), .FS => self.addPrefix(.SegmentFS), .GS => self.addPrefix(.SegmentGS), .DefaultSeg => {}, } } pub fn addPrefix(self: *Prefixes, prefix: Prefix) void { assert(!self.hasPrefix(prefix)); assert(self.len < max_count); assert(prefix != .None); self.prefixes[self.len] = prefix; self.len += 1; } pub fn hasPrefix(self: Prefixes, prefix: Prefix) bool { for (self.prefixes[0..self.len]) |p| { if (p == prefix) { return true; } } return false; } pub fn asSlice(self: Prefixes) []const u8 { return std.mem.asBytes(&self.prefixes)[0..self.len]; } pub fn addOverides64( self: *Prefixes, rex_w: *u1, addressing_size: BitSize, overides: Overides, ) AsmError!void { switch (overides) { // zero overides .ZO => {}, // size overide, 16 bit .Op16 => self.addPrefix(.OpSize), // size overide, 32 bit .Op32 => {}, // .REX_W => rex_w.* = 1, .Addr16 => return AsmError.InvalidOperand, .Addr32 => { if (addressing_size == .None) { self.addPrefix(.AddrSize); } else if (addressing_size != .Bit32) { // Using this mode the addressing size must match register size return AsmError.InvalidOperand; } }, .Addr64 => { if (addressing_size == .None) { // okay } else if (addressing_size != .Bit64) { // Using this mode the addressing size must match register size return AsmError.InvalidOperand; } }, } switch (addressing_size) { .None => {}, .Bit32 => self.addPrefix(.AddrSize), .Bit64 => {}, // default, no prefix needed else => return AsmError.InvalidOperand, } } pub fn addOverides32( self: *Prefixes, rex_w: *u1, addressing_size: BitSize, overides: Overides, ) AsmError!void { switch (overides) { // zero overides .ZO => {}, // size overide, 16 bit .Op16 => self.addPrefix(.OpSize), // size overide, 32 bit .Op32 => {}, // .REX_W => return AsmError.InvalidOperand, .Addr16 => { if (addressing_size == .None) { self.addPrefix(.AddrSize); } else if (addressing_size != .Bit16) { // Using this mode the addressing size must match register size return AsmError.InvalidOperand; } }, .Addr32 => { if (addressing_size == .None) { // okay } else if (addressing_size != .Bit32) { // Using this mode the addressing size must match register size return AsmError.InvalidOperand; } }, .Addr64 => unreachable, } switch (addressing_size) { .None => {}, .Bit16 => self.addPrefix(.AddrSize), .Bit32 => {}, // default else => return AsmError.InvalidOperand, } } pub fn addOverides16( self: *Prefixes, rex_w: *u1, addressing_size: BitSize, overides: Overides, ) AsmError!void { switch (overides) { // zero overides .ZO => {}, // size overide, 16 bit .Op16 => {}, // size overide, 32 bit .Op32 => self.addPrefix(.OpSize), // .REX_W => return AsmError.InvalidOperand, .Addr16 => { if (addressing_size == .None) { // okay } else if (addressing_size != .Bit16) { // Using this mode the addressing size must match register size return AsmError.InvalidOperand; } }, .Addr32 => { if (addressing_size == .None) { self.addPrefix(.AddrSize); } else if (addressing_size != .Bit32) { // Using this mode the addressing size must match register size return AsmError.InvalidOperand; } }, .Addr64 => unreachable, } switch (addressing_size) { .None => {}, .Bit16 => {}, .Bit32 => self.addPrefix(.AddrSize), // default else => return AsmError.InvalidOperand, } } pub fn addOverides( self: *Prefixes, mode: Mode86, rex_w: *u1, addressing_size: BitSize, overides: Overides, ) AsmError!void { switch (mode) { .x86_16 => try self.addOverides16(rex_w, addressing_size, overides), .x86_32 => try self.addOverides32(rex_w, addressing_size, overides), .x64 => try self.addOverides64(rex_w, addressing_size, overides), } } }; pub const EncodingHint = enum(u8) { NoHint, /// For AVX instructions use 2 Byte VEX encoding Vex2, /// For AVX instructions use 3 Byte VEX encoding Vex3, /// For AVX instructions use EVEX encoding Evex, }; pub const PrefixingTechnique = enum { AddPrefixes, ExactPrefixes, }; pub const EncodingControl = struct { const max_prefix_count = 14; prefixes: [max_prefix_count]Prefix = [1]Prefix{.None} ** max_prefix_count, encoding_hint: EncodingHint = .NoHint, /// Provide the prefixes in the exact order given and do not generate any /// other prefixes automatically. prefixing_technique: PrefixingTechnique = .AddPrefixes, pub fn init( hint: EncodingHint, prefixing_technique: PrefixingTechnique, prefixes: []const Prefix, ) EncodingControl { var res: EncodingControl = undefined; assert(prefixes.len <= max_prefix_count); for (prefixes) |pre, i| { res.prefixes[i] = pre; } if (prefixes.len < max_prefix_count) { res.prefixes[prefixes.len] = .None; } res.encoding_hint = hint; res.prefixing_technique = prefixing_technique; return res; } pub fn useExactPrefixes(self: EncodingControl) bool { return self.prefixing_technique == .ExactPrefixes; } pub fn prefix(pre: Prefix) EncodingControl { var res = EncodingControl{}; res.prefixes[0] = pre; return res; } pub fn prefix2(pre1: Prefix, pre2: Prefix) EncodingControl { var res = EncodingControl{}; res.prefixes[0] = pre1; res.prefixes[1] = pre2; return res; } pub fn encodingHint(hint: EncodingHint) EncodingControl { var res = EncodingControl{}; res.encoding_hint = hint; return res; } /// If multiple prefixes from the same group are used then only the one /// closest to the instruction is actually effective. pub fn calcEffectivePrefixes(self: EncodingControl) [PrefixGroup.count]Prefix { var res = [1]Prefix{.None} ** PrefixGroup.count; for (self.prefixes) |pre| { if (pre == .None) { break; } const group = pre.getGroupNumber(); res[group] = pre; } return res; } pub fn prefixCount(self: EncodingControl) u8 { var res: u8 = 0; for (self.prefixes) |pre| { if (pre == .None) { break; } res += 1; } return res; } pub fn hasNecessaryPrefixes(self: EncodingControl, prefixes: Prefixes) bool { const effective_prefixes = self.calcEffectivePrefixes(); for (prefixes.prefixes) |pre| { if (pre == .None) { break; } const group = pre.getGroupNumber(); if (effective_prefixes[group] != pre) { return false; } } return true; } };
src/x86/types.zig
const zlm = @import("zlm.zig"); const struct__iobuf = extern struct { _ptr: [*c]u8, _cnt: c_int, _base: [*c]u8, _flag: c_int, _file: c_int, _charbuf: c_int, _bufsiz: c_int, _tmpfname: [*c]u8, }; const FILE = struct__iobuf; const int_least8_t = i8; const uint_least8_t = u8; const int_least16_t = c_short; const uint_least16_t = c_ushort; const int_least32_t = c_int; const uint_least32_t = c_uint; const int_least64_t = c_longlong; const uint_least64_t = c_ulonglong; const int_fast8_t = i8; const uint_fast8_t = u8; const int_fast16_t = c_short; const uint_fast16_t = c_ushort; const int_fast32_t = c_int; const uint_fast32_t = c_uint; const int_fast64_t = c_longlong; const uint_fast64_t = c_ulonglong; const intmax_t = c_longlong; const uintmax_t = c_ulonglong; pub const ImGuiID = c_uint; pub const ImS8 = i8; pub const ImGuiTableColumnIdx = ImS8; pub const struct_ImGuiTableColumnSettings = opaque {}; pub const ImGuiTableColumnSettings = struct_ImGuiTableColumnSettings; pub const ImU32 = c_uint; pub const struct_ImGuiTableCellData = extern struct { BgColor: ImU32, Column: ImGuiTableColumnIdx, }; pub const ImGuiTableCellData = struct_ImGuiTableCellData; pub const ImGuiViewportFlags = c_int; pub const struct_ImVec2 = zlm.Vec2; pub const ImVec2 = struct_ImVec2; pub const struct_ImVec4 = zlm.Vec4; pub const ImVec4 = struct_ImVec4; pub const ImTextureID = ?*c_void; pub const ImDrawCallback = ?fn ([*c]const ImDrawList, [*c]const ImDrawCmd) callconv(.C) void; pub const struct_ImDrawCmd = extern struct { ClipRect: ImVec4, TextureId: ImTextureID, VtxOffset: c_uint, IdxOffset: c_uint, ElemCount: c_uint, UserCallback: ImDrawCallback, UserCallbackData: ?*c_void, }; pub const ImDrawCmd = struct_ImDrawCmd; pub const struct_ImVector_ImDrawCmd = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImDrawCmd, }; pub const ImVector_ImDrawCmd = struct_ImVector_ImDrawCmd; pub const ImDrawIdx = c_ushort; pub const struct_ImVector_ImDrawIdx = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImDrawIdx, }; pub const ImVector_ImDrawIdx = struct_ImVector_ImDrawIdx; pub const struct_ImDrawVert = extern struct { pos: ImVec2, uv: ImVec2, col: ImU32, }; pub const ImDrawVert = struct_ImDrawVert; pub const struct_ImVector_ImDrawVert = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImDrawVert, }; pub const ImVector_ImDrawVert = struct_ImVector_ImDrawVert; pub const ImDrawListFlags = c_int; pub const struct_ImVector_float = extern struct { Size: c_int, Capacity: c_int, Data: [*c]f32, }; pub const ImVector_float = struct_ImVector_float; pub const ImWchar16 = c_ushort; pub const ImWchar = ImWchar16; pub const struct_ImVector_ImWchar = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImWchar, }; pub const ImVector_ImWchar = struct_ImVector_ImWchar; pub const struct_ImFontGlyph = opaque {}; pub const ImFontGlyph = struct_ImFontGlyph; pub const struct_ImVector_ImFontGlyph = extern struct { Size: c_int, Capacity: c_int, Data: ?*ImFontGlyph, }; pub const ImVector_ImFontGlyph = struct_ImVector_ImFontGlyph; pub const ImFontAtlasFlags = c_int; pub const struct_ImVector_ImFontPtr = extern struct { Size: c_int, Capacity: c_int, Data: [*c][*c]ImFont, }; pub const ImVector_ImFontPtr = struct_ImVector_ImFontPtr; pub const struct_ImFontAtlasCustomRect = extern struct { Width: c_ushort, Height: c_ushort, X: c_ushort, Y: c_ushort, GlyphID: c_uint, GlyphAdvanceX: f32, GlyphOffset: ImVec2, Font: [*c]ImFont, }; pub const ImFontAtlasCustomRect = struct_ImFontAtlasCustomRect; pub const struct_ImVector_ImFontAtlasCustomRect = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImFontAtlasCustomRect, }; pub const ImVector_ImFontAtlasCustomRect = struct_ImVector_ImFontAtlasCustomRect; pub const struct_ImFontConfig = extern struct { FontData: ?*c_void, FontDataSize: c_int, FontDataOwnedByAtlas: bool, FontNo: c_int, SizePixels: f32, OversampleH: c_int, OversampleV: c_int, PixelSnapH: bool, GlyphExtraSpacing: ImVec2, GlyphOffset: ImVec2, GlyphRanges: [*c]const ImWchar, GlyphMinAdvanceX: f32, GlyphMaxAdvanceX: f32, MergeMode: bool, FontBuilderFlags: c_uint, RasterizerMultiply: f32, EllipsisChar: ImWchar, Name: [40]u8, DstFont: [*c]ImFont, }; pub const ImFontConfig = struct_ImFontConfig; pub const struct_ImVector_ImFontConfig = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImFontConfig, }; pub const ImVector_ImFontConfig = struct_ImVector_ImFontConfig; pub const struct_ImFontBuilderIO = extern struct { FontBuilder_Build: ?fn ([*c]ImFontAtlas) callconv(.C) bool, }; pub const ImFontBuilderIO = struct_ImFontBuilderIO; pub const struct_ImFontAtlas = extern struct { Flags: ImFontAtlasFlags, TexID: ImTextureID, TexDesiredWidth: c_int, TexGlyphPadding: c_int, Locked: bool, TexPixelsUseColors: bool, TexPixelsAlpha8: [*c]u8, TexPixelsRGBA32: [*c]c_uint, TexWidth: c_int, TexHeight: c_int, TexUvScale: ImVec2, TexUvWhitePixel: ImVec2, Fonts: ImVector_ImFontPtr, CustomRects: ImVector_ImFontAtlasCustomRect, ConfigData: ImVector_ImFontConfig, TexUvLines: [64]ImVec4, FontBuilderIO: [*c]const ImFontBuilderIO, FontBuilderFlags: c_uint, PackIdMouseCursors: c_int, PackIdLines: c_int, }; pub const ImFontAtlas = struct_ImFontAtlas; pub const ImU8 = u8; pub const struct_ImFont = extern struct { IndexAdvanceX: ImVector_float, FallbackAdvanceX: f32, FontSize: f32, IndexLookup: ImVector_ImWchar, Glyphs: ImVector_ImFontGlyph, FallbackGlyph: ?*const ImFontGlyph, ContainerAtlas: [*c]ImFontAtlas, ConfigData: [*c]const ImFontConfig, ConfigDataCount: c_short, FallbackChar: ImWchar, EllipsisChar: ImWchar, DirtyLookupTables: bool, Scale: f32, Ascent: f32, Descent: f32, MetricsTotalSurface: c_int, Used4kPagesMap: [2]ImU8, }; pub const ImFont = struct_ImFont; pub const struct_ImDrawListSharedData = extern struct { TexUvWhitePixel: ImVec2, Font: [*c]ImFont, FontSize: f32, CurveTessellationTol: f32, CircleSegmentMaxError: f32, ClipRectFullscreen: ImVec4, InitialFlags: ImDrawListFlags, ArcFastVtx: [48]ImVec2, ArcFastRadiusCutoff: f32, CircleSegmentCounts: [64]ImU8, TexUvLines: [*c]const ImVec4, }; pub const ImDrawListSharedData = struct_ImDrawListSharedData; pub const struct_ImVector_ImVec4 = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImVec4, }; pub const ImVector_ImVec4 = struct_ImVector_ImVec4; pub const struct_ImVector_ImTextureID = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImTextureID, }; pub const ImVector_ImTextureID = struct_ImVector_ImTextureID; pub const struct_ImVector_ImVec2 = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImVec2, }; pub const ImVector_ImVec2 = struct_ImVector_ImVec2; pub const struct_ImDrawCmdHeader = extern struct { ClipRect: ImVec4, TextureId: ImTextureID, VtxOffset: c_uint, }; pub const ImDrawCmdHeader = struct_ImDrawCmdHeader; pub const struct_ImDrawChannel = extern struct { _CmdBuffer: ImVector_ImDrawCmd, _IdxBuffer: ImVector_ImDrawIdx, }; pub const ImDrawChannel = struct_ImDrawChannel; pub const struct_ImVector_ImDrawChannel = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImDrawChannel, }; pub const ImVector_ImDrawChannel = struct_ImVector_ImDrawChannel; pub const struct_ImDrawListSplitter = extern struct { _Current: c_int, _Count: c_int, _Channels: ImVector_ImDrawChannel, }; pub const ImDrawListSplitter = struct_ImDrawListSplitter; pub const struct_ImDrawList = extern struct { CmdBuffer: ImVector_ImDrawCmd, IdxBuffer: ImVector_ImDrawIdx, VtxBuffer: ImVector_ImDrawVert, Flags: ImDrawListFlags, _VtxCurrentIdx: c_uint, _Data: [*c]const ImDrawListSharedData, _OwnerName: [*c]const u8, _VtxWritePtr: [*c]ImDrawVert, _IdxWritePtr: [*c]ImDrawIdx, _ClipRectStack: ImVector_ImVec4, _TextureIdStack: ImVector_ImTextureID, _Path: ImVector_ImVec2, _CmdHeader: ImDrawCmdHeader, _Splitter: ImDrawListSplitter, _FringeScale: f32, }; pub const ImDrawList = struct_ImDrawList; pub const struct_ImDrawData = extern struct { Valid: bool, CmdListsCount: c_int, TotalIdxCount: c_int, TotalVtxCount: c_int, CmdLists: [*c][*c]ImDrawList, DisplayPos: ImVec2, DisplaySize: ImVec2, FramebufferScale: ImVec2, OwnerViewport: [*c]ImGuiViewport, }; pub const ImDrawData = struct_ImDrawData; pub const struct_ImGuiViewport = extern struct { ID: ImGuiID, Flags: ImGuiViewportFlags, Pos: ImVec2, Size: ImVec2, WorkPos: ImVec2, WorkSize: ImVec2, DpiScale: f32, ParentViewportId: ImGuiID, DrawData: [*c]ImDrawData, RendererUserData: ?*c_void, PlatformUserData: ?*c_void, PlatformHandle: ?*c_void, PlatformHandleRaw: ?*c_void, PlatformRequestMove: bool, PlatformRequestResize: bool, PlatformRequestClose: bool, }; pub const ImGuiViewport = struct_ImGuiViewport; pub const ImGuiWindowFlags = c_int; pub const ImGuiTabItemFlags = c_int; pub const ImGuiDockNodeFlags = c_int; pub const struct_ImGuiWindowClass = extern struct { ClassId: ImGuiID, ParentViewportId: ImGuiID, ViewportFlagsOverrideSet: ImGuiViewportFlags, ViewportFlagsOverrideClear: ImGuiViewportFlags, TabItemFlagsOverrideSet: ImGuiTabItemFlags, DockNodeFlagsOverrideSet: ImGuiDockNodeFlags, DockNodeFlagsOverrideClear: ImGuiDockNodeFlags, DockingAlwaysTabBar: bool, DockingAllowUnclassed: bool, }; pub const ImGuiWindowClass = struct_ImGuiWindowClass; pub const ImGuiViewportP = struct_ImGuiViewportP; pub const ImGuiDir = c_int; pub const struct_ImGuiWindow = opaque {}; pub const ImGuiWindow = struct_ImGuiWindow; pub const struct_ImVector_ImDrawListPtr = extern struct { Size: c_int, Capacity: c_int, Data: [*c][*c]ImDrawList, }; pub const ImVector_ImDrawListPtr = struct_ImVector_ImDrawListPtr; pub const struct_ImDrawDataBuilder = extern struct { Layers: [2]ImVector_ImDrawListPtr, }; pub const ImDrawDataBuilder = struct_ImDrawDataBuilder; pub const struct_ImGuiViewportP = extern struct { _ImGuiViewport: ImGuiViewport, Idx: c_int, LastFrameActive: c_int, LastFrontMostStampCount: c_int, LastNameHash: ImGuiID, LastPos: ImVec2, Alpha: f32, LastAlpha: f32, PlatformMonitor: c_short, PlatformWindowCreated: bool, Window: ?*ImGuiWindow, DrawListsLastFrame: [2]c_int, DrawLists: [2][*c]ImDrawList, DrawDataP: ImDrawData, DrawDataBuilder: ImDrawDataBuilder, LastPlatformPos: ImVec2, LastPlatformSize: ImVec2, LastRendererSize: ImVec2, WorkOffsetMin: ImVec2, WorkOffsetMax: ImVec2, BuildWorkOffsetMin: ImVec2, BuildWorkOffsetMax: ImVec2, }; pub const struct_ImGuiWindowDockStyle = extern struct { Colors: [6]ImU32, }; pub const ImGuiWindowDockStyle = struct_ImGuiWindowDockStyle; pub const struct_ImGuiPtrOrIndex = extern struct { Ptr: ?*c_void, Index: c_int, }; pub const ImGuiPtrOrIndex = struct_ImGuiPtrOrIndex; pub const struct_ImGuiShrinkWidthItem = extern struct { Index: c_int, Width: f32, }; pub const ImGuiShrinkWidthItem = struct_ImGuiShrinkWidthItem; pub const struct_ImGuiDataTypeTempStorage = extern struct { Data: [8]ImU8, }; pub const ImGuiDataTypeTempStorage = struct_ImGuiDataTypeTempStorage; pub const struct_ImVec2ih = extern struct { x: c_short, y: c_short, }; pub const ImVec2ih = struct_ImVec2ih; pub const struct_ImVec1 = extern struct { x: f32, }; pub const ImVec1 = struct_ImVec1; pub const struct_StbTexteditRow = extern struct { x0: f32, x1: f32, baseline_y_delta: f32, ymin: f32, ymax: f32, num_chars: c_int, }; pub const StbTexteditRow = struct_StbTexteditRow; pub const struct_StbUndoRecord = extern struct { where: c_int, insert_length: c_int, delete_length: c_int, char_storage: c_int, }; pub const StbUndoRecord = struct_StbUndoRecord; pub const struct_StbUndoState = extern struct { undo_rec: [99]StbUndoRecord, undo_char: [999]ImWchar, undo_point: c_short, redo_point: c_short, undo_char_point: c_int, redo_char_point: c_int, }; pub const StbUndoState = struct_StbUndoState; pub const struct_STB_TexteditState = extern struct { cursor: c_int, select_start: c_int, select_end: c_int, insert_mode: u8, row_count_per_page: c_int, cursor_at_end_of_line: u8, initialized: u8, has_preferred_x: u8, single_line: u8, padding1: u8, padding2: u8, padding3: u8, preferred_x: f32, undostate: StbUndoState, }; pub const STB_TexteditState = struct_STB_TexteditState; pub const struct_ImGuiWindowSettings = extern struct { ID: ImGuiID, Pos: ImVec2ih, Size: ImVec2ih, ViewportPos: ImVec2ih, ViewportId: ImGuiID, DockId: ImGuiID, ClassId: ImGuiID, DockOrder: c_short, Collapsed: bool, WantApply: bool, }; pub const ImGuiWindowSettings = struct_ImGuiWindowSettings; pub const ImGuiItemStatusFlags = c_int; pub const struct_ImRect = extern struct { Min: ImVec2, Max: ImVec2, pub fn init(x: f32, y: f32, w: f32, h: f32) @This() { return .{ .Min = .{ .x = x, .y = y }, .Max = .{ .x = w, .y = h } }; } }; pub const ImRect = struct_ImRect; pub const struct_ImGuiMenuColumns = extern struct { Spacing: f32, Width: f32, NextWidth: f32, Pos: [3]f32, NextWidths: [3]f32, }; pub const ImGuiMenuColumns = struct_ImGuiMenuColumns; pub const struct_ImVector_ImGuiWindowPtr = extern struct { Size: c_int, Capacity: c_int, Data: [*c]?*ImGuiWindow, }; pub const ImVector_ImGuiWindowPtr = struct_ImVector_ImGuiWindowPtr; const union_unnamed_2 = extern union { val_i: c_int, val_f: f32, val_p: ?*c_void, }; pub const struct_ImGuiStoragePair = extern struct { key: ImGuiID, unnamed_0: union_unnamed_2, }; pub const ImGuiStoragePair = struct_ImGuiStoragePair; pub const struct_ImVector_ImGuiStoragePair = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiStoragePair, }; pub const ImVector_ImGuiStoragePair = struct_ImVector_ImGuiStoragePair; pub const struct_ImGuiStorage = extern struct { Data: ImVector_ImGuiStoragePair, }; pub const ImGuiStorage = struct_ImGuiStorage; pub const ImGuiOldColumnFlags = c_int; pub const struct_ImGuiOldColumnData = extern struct { OffsetNorm: f32, OffsetNormBeforeResize: f32, Flags: ImGuiOldColumnFlags, ClipRect: ImRect, }; pub const ImGuiOldColumnData = struct_ImGuiOldColumnData; pub const struct_ImVector_ImGuiOldColumnData = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiOldColumnData, }; pub const ImVector_ImGuiOldColumnData = struct_ImVector_ImGuiOldColumnData; pub const struct_ImGuiOldColumns = extern struct { ID: ImGuiID, Flags: ImGuiOldColumnFlags, IsFirstFrame: bool, IsBeingResized: bool, Current: c_int, Count: c_int, OffMinX: f32, OffMaxX: f32, LineMinY: f32, LineMaxY: f32, HostCursorPosY: f32, HostCursorMaxPosX: f32, HostInitialClipRect: ImRect, HostBackupClipRect: ImRect, HostBackupParentWorkRect: ImRect, Columns: ImVector_ImGuiOldColumnData, Splitter: ImDrawListSplitter, }; pub const ImGuiOldColumns = struct_ImGuiOldColumns; pub const ImGuiLayoutType = c_int; pub const struct_ImGuiStackSizes = extern struct { SizeOfIDStack: c_short, SizeOfColorStack: c_short, SizeOfStyleVarStack: c_short, SizeOfFontStack: c_short, SizeOfFocusScopeStack: c_short, SizeOfGroupStack: c_short, SizeOfBeginPopupStack: c_short, }; pub const ImGuiStackSizes = struct_ImGuiStackSizes; pub const struct_ImGuiWindowTempData = extern struct { CursorPos: ImVec2, CursorPosPrevLine: ImVec2, CursorStartPos: ImVec2, CursorMaxPos: ImVec2, IdealMaxPos: ImVec2, CurrLineSize: ImVec2, PrevLineSize: ImVec2, CurrLineTextBaseOffset: f32, PrevLineTextBaseOffset: f32, Indent: ImVec1, ColumnsOffset: ImVec1, GroupOffset: ImVec1, LastItemId: ImGuiID, LastItemStatusFlags: ImGuiItemStatusFlags, LastItemRect: ImRect, LastItemDisplayRect: ImRect, NavLayerCurrent: ImGuiNavLayer, NavLayersActiveMask: c_short, NavLayersActiveMaskNext: c_short, NavFocusScopeIdCurrent: ImGuiID, NavHideHighlightOneFrame: bool, NavHasScroll: bool, MenuBarAppending: bool, MenuBarOffset: ImVec2, MenuColumns: ImGuiMenuColumns, TreeDepth: c_int, TreeJumpToParentOnPopMask: ImU32, ChildWindows: ImVector_ImGuiWindowPtr, StateStorage: [*c]ImGuiStorage, CurrentColumns: [*c]ImGuiOldColumns, CurrentTableIdx: c_int, LayoutType: ImGuiLayoutType, ParentLayoutType: ImGuiLayoutType, FocusCounterRegular: c_int, FocusCounterTabStop: c_int, ItemWidth: f32, TextWrapPos: f32, ItemWidthStack: ImVector_float, TextWrapPosStack: ImVector_float, StackSizesOnBegin: ImGuiStackSizes, }; pub const ImGuiWindowTempData = struct_ImGuiWindowTempData; pub const struct_ImGuiTableColumnsSettings = opaque {}; pub const ImGuiTableColumnsSettings = struct_ImGuiTableColumnsSettings; pub const ImGuiTableFlags = c_int; pub const struct_ImGuiTableSettings = extern struct { ID: ImGuiID, SaveFlags: ImGuiTableFlags, RefScale: f32, ColumnsCount: ImGuiTableColumnIdx, ColumnsCountMax: ImGuiTableColumnIdx, WantApply: bool, }; pub const ImGuiTableSettings = struct_ImGuiTableSettings; pub const ImS16 = c_short; pub const struct_ImGuiTableColumnSortSpecs = opaque {}; pub const ImGuiTableColumnSortSpecs = struct_ImGuiTableColumnSortSpecs; pub const struct_ImVector_ImGuiTableColumnSortSpecs = extern struct { Size: c_int, Capacity: c_int, Data: ?*ImGuiTableColumnSortSpecs, }; pub const ImVector_ImGuiTableColumnSortSpecs = struct_ImVector_ImGuiTableColumnSortSpecs; pub const struct_ImGuiTableTempData = extern struct { TableIndex: c_int, LastTimeActive: f32, UserOuterSize: ImVec2, DrawSplitter: ImDrawListSplitter, //SortSpecsSingle: ImGuiTableColumnSortSpecs, //SortSpecsMulti: ImVector_ImGuiTableColumnSortSpecs, HostBackupWorkRect: ImRect, HostBackupParentWorkRect: ImRect, HostBackupPrevLineSize: ImVec2, HostBackupCurrLineSize: ImVec2, HostBackupCursorMaxPos: ImVec2, HostBackupColumnsOffset: ImVec1, HostBackupItemWidth: f32, HostBackupItemWidthStackSize: c_int, }; pub const ImGuiTableTempData = struct_ImGuiTableTempData; pub const ImGuiTableColumnFlags = c_int; pub const ImGuiTableDrawChannelIdx = ImU8; pub const struct_ImGuiTableColumn = opaque {}; pub const ImGuiTableColumn = struct_ImGuiTableColumn; pub const struct_ImSpan_ImGuiTableColumn = extern struct { Data: ?*ImGuiTableColumn, DataEnd: ?*ImGuiTableColumn, }; pub const ImSpan_ImGuiTableColumn = struct_ImSpan_ImGuiTableColumn; pub const struct_ImSpan_ImGuiTableColumnIdx = extern struct { Data: [*c]ImGuiTableColumnIdx, DataEnd: [*c]ImGuiTableColumnIdx, }; pub const ImSpan_ImGuiTableColumnIdx = struct_ImSpan_ImGuiTableColumnIdx; pub const struct_ImSpan_ImGuiTableCellData = extern struct { Data: [*c]ImGuiTableCellData, DataEnd: [*c]ImGuiTableCellData, }; pub const ImSpan_ImGuiTableCellData = struct_ImSpan_ImGuiTableCellData; pub const ImU64 = u64; pub const struct_ImGuiTable = opaque {}; pub const ImGuiTable = struct_ImGuiTable; pub const struct_ImGuiTabItem = extern struct { ID: ImGuiID, Flags: ImGuiTabItemFlags, Window: ?*ImGuiWindow, LastFrameVisible: c_int, LastFrameSelected: c_int, Offset: f32, Width: f32, ContentWidth: f32, NameOffset: ImS16, BeginOrder: ImS16, IndexDuringLayout: ImS16, WantClose: bool, }; pub const ImGuiTabItem = struct_ImGuiTabItem; pub const struct_ImVector_ImGuiTabItem = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiTabItem, }; pub const ImVector_ImGuiTabItem = struct_ImVector_ImGuiTabItem; pub const ImGuiTabBarFlags = c_int; pub const struct_ImVector_char = extern struct { Size: c_int, Capacity: c_int, Data: [*c]u8, }; pub const ImVector_char = struct_ImVector_char; pub const struct_ImGuiTextBuffer = extern struct { Buf: ImVector_char, }; pub const ImGuiTextBuffer = struct_ImGuiTextBuffer; pub const struct_ImGuiTabBar = extern struct { Tabs: ImVector_ImGuiTabItem, Flags: ImGuiTabBarFlags, ID: ImGuiID, SelectedTabId: ImGuiID, NextSelectedTabId: ImGuiID, VisibleTabId: ImGuiID, CurrFrameVisible: c_int, PrevFrameVisible: c_int, BarRect: ImRect, CurrTabsContentsHeight: f32, PrevTabsContentsHeight: f32, WidthAllTabs: f32, WidthAllTabsIdeal: f32, ScrollingAnim: f32, ScrollingTarget: f32, ScrollingTargetDistToVisibility: f32, ScrollingSpeed: f32, ScrollingRectMinX: f32, ScrollingRectMaxX: f32, ReorderRequestTabId: ImGuiID, ReorderRequestOffset: ImS16, BeginCount: ImS8, WantLayout: bool, VisibleTabWasSubmitted: bool, TabsAddedNew: bool, TabsActiveCount: ImS16, LastTabItemIdx: ImS16, ItemSpacingY: f32, FramePadding: ImVec2, BackupCursorPos: ImVec2, TabsNames: ImGuiTextBuffer, }; pub const ImGuiTabBar = struct_ImGuiTabBar; pub const ImGuiStyleVar = c_int; const union_unnamed_3 = extern union { BackupInt: [2]c_int, BackupFloat: [2]f32, }; pub const struct_ImGuiStyleMod = extern struct { VarIdx: ImGuiStyleVar, unnamed_0: union_unnamed_3, }; pub const ImGuiStyleMod = struct_ImGuiStyleMod; pub const ImGuiConfigFlags = c_int; pub const ImGuiBackendFlags = c_int; pub const ImGuiKeyModFlags = c_int; pub const struct_ImGuiIO = extern struct { ConfigFlags: ImGuiConfigFlags, BackendFlags: ImGuiBackendFlags, DisplaySize: ImVec2, DeltaTime: f32, IniSavingRate: f32, IniFilename: [*c]const u8, LogFilename: [*c]const u8, MouseDoubleClickTime: f32, MouseDoubleClickMaxDist: f32, MouseDragThreshold: f32, KeyMap: [22]c_int, KeyRepeatDelay: f32, KeyRepeatRate: f32, UserData: ?*c_void, Fonts: [*c]ImFontAtlas, FontGlobalScale: f32, FontAllowUserScaling: bool, FontDefault: [*c]ImFont, DisplayFramebufferScale: ImVec2, ConfigDockingNoSplit: bool, ConfigDockingAlwaysTabBar: bool, ConfigDockingTransparentPayload: bool, ConfigViewportsNoAutoMerge: bool, ConfigViewportsNoTaskBarIcon: bool, ConfigViewportsNoDecoration: bool, ConfigViewportsNoDefaultParent: bool, MouseDrawCursor: bool, ConfigMacOSXBehaviors: bool, ConfigInputTextCursorBlink: bool, ConfigDragClickToInputText: bool, ConfigWindowsResizeFromEdges: bool, ConfigWindowsMoveFromTitleBarOnly: bool, ConfigMemoryCompactTimer: f32, BackendPlatformName: [*c]const u8, BackendRendererName: [*c]const u8, BackendPlatformUserData: ?*c_void, BackendRendererUserData: ?*c_void, BackendLanguageUserData: ?*c_void, GetClipboardTextFn: ?fn (?*c_void) callconv(.C) [*c]const u8, SetClipboardTextFn: ?fn (?*c_void, [*c]const u8) callconv(.C) void, ClipboardUserData: ?*c_void, MousePos: ImVec2, MouseDown: [5]bool, MouseWheel: f32, MouseWheelH: f32, MouseHoveredViewport: ImGuiID, KeyCtrl: bool, KeyShift: bool, KeyAlt: bool, KeySuper: bool, KeysDown: [512]bool, NavInputs: [21]f32, WantCaptureMouse: bool, WantCaptureKeyboard: bool, WantTextInput: bool, WantSetMousePos: bool, WantSaveIniSettings: bool, NavActive: bool, NavVisible: bool, Framerate: f32, MetricsRenderVertices: c_int, MetricsRenderIndices: c_int, MetricsRenderWindows: c_int, MetricsActiveWindows: c_int, MetricsActiveAllocations: c_int, MouseDelta: ImVec2, KeyMods: ImGuiKeyModFlags, MousePosPrev: ImVec2, MouseClickedPos: [5]ImVec2, MouseClickedTime: [5]f64, MouseClicked: [5]bool, MouseDoubleClicked: [5]bool, MouseReleased: [5]bool, MouseDownOwned: [5]bool, MouseDownWasDoubleClick: [5]bool, MouseDownDuration: [5]f32, MouseDownDurationPrev: [5]f32, MouseDragMaxDistanceAbs: [5]ImVec2, MouseDragMaxDistanceSqr: [5]f32, KeysDownDuration: [512]f32, KeysDownDurationPrev: [512]f32, NavInputsDownDuration: [21]f32, NavInputsDownDurationPrev: [21]f32, PenPressure: f32, InputQueueSurrogate: ImWchar16, InputQueueCharacters: ImVector_ImWchar, }; pub const ImGuiIO = struct_ImGuiIO; pub const struct_ImGuiPlatformMonitor = extern struct { MainPos: ImVec2, MainSize: ImVec2, WorkPos: ImVec2, WorkSize: ImVec2, DpiScale: f32, }; pub const ImGuiPlatformMonitor = struct_ImGuiPlatformMonitor; pub const struct_ImVector_ImGuiPlatformMonitor = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiPlatformMonitor, }; pub const ImVector_ImGuiPlatformMonitor = struct_ImVector_ImGuiPlatformMonitor; pub const struct_ImVector_ImGuiViewportPtr = extern struct { Size: c_int, Capacity: c_int, Data: [*c][*c]ImGuiViewport, }; pub const ImVector_ImGuiViewportPtr = struct_ImVector_ImGuiViewportPtr; pub const struct_ImGuiPlatformIO = extern struct { Platform_CreateWindow: ?fn ([*c]ImGuiViewport) callconv(.C) void, Platform_DestroyWindow: ?fn ([*c]ImGuiViewport) callconv(.C) void, Platform_ShowWindow: ?fn ([*c]ImGuiViewport) callconv(.C) void, Platform_SetWindowPos: ?fn ([*c]ImGuiViewport, ImVec2) callconv(.C) void, Platform_GetWindowPos: ?fn ([*c]ImGuiViewport) callconv(.C) ImVec2, Platform_SetWindowSize: ?fn ([*c]ImGuiViewport, ImVec2) callconv(.C) void, Platform_GetWindowSize: ?fn ([*c]ImGuiViewport) callconv(.C) ImVec2, Platform_SetWindowFocus: ?fn ([*c]ImGuiViewport) callconv(.C) void, Platform_GetWindowFocus: ?fn ([*c]ImGuiViewport) callconv(.C) bool, Platform_GetWindowMinimized: ?fn ([*c]ImGuiViewport) callconv(.C) bool, Platform_SetWindowTitle: ?fn ([*c]ImGuiViewport, [*c]const u8) callconv(.C) void, Platform_SetWindowAlpha: ?fn ([*c]ImGuiViewport, f32) callconv(.C) void, Platform_UpdateWindow: ?fn ([*c]ImGuiViewport) callconv(.C) void, Platform_RenderWindow: ?fn ([*c]ImGuiViewport, ?*c_void) callconv(.C) void, Platform_SwapBuffers: ?fn ([*c]ImGuiViewport, ?*c_void) callconv(.C) void, Platform_GetWindowDpiScale: ?fn ([*c]ImGuiViewport) callconv(.C) f32, Platform_OnChangedViewport: ?fn ([*c]ImGuiViewport) callconv(.C) void, Platform_SetImeInputPos: ?fn ([*c]ImGuiViewport, ImVec2) callconv(.C) void, Platform_CreateVkSurface: ?fn ([*c]ImGuiViewport, ImU64, ?*const c_void, [*c]ImU64) callconv(.C) c_int, Renderer_CreateWindow: ?fn ([*c]ImGuiViewport) callconv(.C) void, Renderer_DestroyWindow: ?fn ([*c]ImGuiViewport) callconv(.C) void, Renderer_SetWindowSize: ?fn ([*c]ImGuiViewport, ImVec2) callconv(.C) void, Renderer_RenderWindow: ?fn ([*c]ImGuiViewport, ?*c_void) callconv(.C) void, Renderer_SwapBuffers: ?fn ([*c]ImGuiViewport, ?*c_void) callconv(.C) void, Monitors: ImVector_ImGuiPlatformMonitor, Viewports: ImVector_ImGuiViewportPtr, }; pub const ImGuiPlatformIO = struct_ImGuiPlatformIO; pub const struct_ImGuiStyle = extern struct { Alpha: f32, WindowPadding: ImVec2, WindowRounding: f32, WindowBorderSize: f32, WindowMinSize: ImVec2, WindowTitleAlign: ImVec2, WindowMenuButtonPosition: ImGuiDir, ChildRounding: f32, ChildBorderSize: f32, PopupRounding: f32, PopupBorderSize: f32, FramePadding: ImVec2, FrameRounding: f32, FrameBorderSize: f32, ItemSpacing: ImVec2, ItemInnerSpacing: ImVec2, CellPadding: ImVec2, TouchExtraPadding: ImVec2, IndentSpacing: f32, ColumnsMinSpacing: f32, ScrollbarSize: f32, ScrollbarRounding: f32, GrabMinSize: f32, GrabRounding: f32, LogSliderDeadzone: f32, TabRounding: f32, TabBorderSize: f32, TabMinWidthForCloseButton: f32, ColorButtonPosition: ImGuiDir, ButtonTextAlign: ImVec2, SelectableTextAlign: ImVec2, DisplayWindowPadding: ImVec2, DisplaySafeAreaPadding: ImVec2, MouseCursorScale: f32, AntiAliasedLines: bool, AntiAliasedLinesUseTex: bool, AntiAliasedFill: bool, CurveTessellationTol: f32, CircleTessellationMaxError: f32, Colors: [55]ImVec4, }; pub const ImGuiStyle = struct_ImGuiStyle; pub const struct_ImGuiDockNode = opaque {}; pub const ImGuiDockNode = struct_ImGuiDockNode; pub const ImGuiItemFlags = c_int; pub const ImGuiNextWindowDataFlags = c_int; pub const ImGuiCond = c_int; pub const struct_ImGuiSizeCallbackData = extern struct { UserData: ?*c_void, Pos: ImVec2, CurrentSize: ImVec2, DesiredSize: ImVec2, }; pub const ImGuiSizeCallbackData = struct_ImGuiSizeCallbackData; pub const ImGuiSizeCallback = ?fn ([*c]ImGuiSizeCallbackData) callconv(.C) void; pub const struct_ImGuiNextWindowData = extern struct { Flags: ImGuiNextWindowDataFlags, PosCond: ImGuiCond, SizeCond: ImGuiCond, CollapsedCond: ImGuiCond, DockCond: ImGuiCond, PosVal: ImVec2, PosPivotVal: ImVec2, SizeVal: ImVec2, ContentSizeVal: ImVec2, ScrollVal: ImVec2, PosUndock: bool, CollapsedVal: bool, SizeConstraintRect: ImRect, SizeCallback: ImGuiSizeCallback, SizeCallbackUserData: ?*c_void, BgAlphaVal: f32, ViewportId: ImGuiID, DockId: ImGuiID, WindowClass: ImGuiWindowClass, MenuBarOffsetMinVal: ImVec2, }; pub const ImGuiNextWindowData = struct_ImGuiNextWindowData; pub const ImGuiNextItemDataFlags = c_int; pub const struct_ImGuiNextItemData = extern struct { Flags: ImGuiNextItemDataFlags, Width: f32, FocusScopeId: ImGuiID, OpenCond: ImGuiCond, OpenVal: bool, }; pub const ImGuiNextItemData = struct_ImGuiNextItemData; pub const ImGuiCol = c_int; pub const struct_ImGuiColorMod = extern struct { Col: ImGuiCol, BackupValue: ImVec4, }; pub const ImGuiColorMod = struct_ImGuiColorMod; pub const struct_ImVector_ImGuiColorMod = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiColorMod, }; pub const ImVector_ImGuiColorMod = struct_ImVector_ImGuiColorMod; pub const struct_ImVector_ImGuiStyleMod = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiStyleMod, }; pub const ImVector_ImGuiStyleMod = struct_ImVector_ImGuiStyleMod; pub const struct_ImVector_ImGuiID = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiID, }; pub const ImVector_ImGuiID = struct_ImVector_ImGuiID; pub const struct_ImVector_ImGuiItemFlags = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiItemFlags, }; pub const ImVector_ImGuiItemFlags = struct_ImVector_ImGuiItemFlags; pub const struct_ImGuiGroupData = extern struct { WindowID: ImGuiID, BackupCursorPos: ImVec2, BackupCursorMaxPos: ImVec2, BackupIndent: ImVec1, BackupGroupOffset: ImVec1, BackupCurrLineSize: ImVec2, BackupCurrLineTextBaseOffset: f32, BackupActiveIdIsAlive: ImGuiID, BackupActiveIdPreviousFrameIsAlive: bool, BackupHoveredIdIsAlive: bool, EmitItem: bool, }; pub const ImGuiGroupData = struct_ImGuiGroupData; pub const struct_ImVector_ImGuiGroupData = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiGroupData, }; pub const ImVector_ImGuiGroupData = struct_ImVector_ImGuiGroupData; pub const struct_ImGuiPopupData = extern struct { PopupId: ImGuiID, Window: ?*ImGuiWindow, SourceWindow: ?*ImGuiWindow, OpenFrameCount: c_int, OpenParentId: ImGuiID, OpenPopupPos: ImVec2, OpenMousePos: ImVec2, }; pub const ImGuiPopupData = struct_ImGuiPopupData; pub const struct_ImVector_ImGuiPopupData = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiPopupData, }; pub const ImVector_ImGuiPopupData = struct_ImVector_ImGuiPopupData; pub const struct_ImVector_ImGuiViewportPPtr = extern struct { Size: c_int, Capacity: c_int, Data: [*c][*c]ImGuiViewportP, }; pub const ImVector_ImGuiViewportPPtr = struct_ImVector_ImGuiViewportPPtr; pub const ImGuiNavMoveFlags = c_int; pub const struct_ImGuiNavItemData = extern struct { Window: ?*ImGuiWindow, ID: ImGuiID, FocusScopeId: ImGuiID, RectRel: ImRect, DistBox: f32, DistCenter: f32, DistAxial: f32, }; pub const ImGuiNavItemData = struct_ImGuiNavItemData; pub const ImGuiMouseCursor = c_int; pub const ImGuiDragDropFlags = c_int; pub const struct_ImGuiPayload = extern struct { Data: ?*c_void, DataSize: c_int, SourceId: ImGuiID, SourceParentId: ImGuiID, DataFrameCount: c_int, DataType: [33]u8, Preview: bool, Delivery: bool, }; pub const ImGuiPayload = struct_ImGuiPayload; pub const struct_ImVector_unsigned_char = extern struct { Size: c_int, Capacity: c_int, Data: [*c]u8, }; pub const ImVector_unsigned_char = struct_ImVector_unsigned_char; pub const struct_ImVector_ImGuiTable = extern struct { Size: c_int, Capacity: c_int, Data: ?*ImGuiTable, }; pub const ImVector_ImGuiTable = struct_ImVector_ImGuiTable; pub const ImPoolIdx = c_int; pub const struct_ImPool_ImGuiTable = extern struct { Buf: ImVector_ImGuiTable, Map: ImGuiStorage, FreeIdx: ImPoolIdx, }; pub const ImPool_ImGuiTable = struct_ImPool_ImGuiTable; pub const struct_ImVector_ImGuiTableTempData = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiTableTempData, }; pub const ImVector_ImGuiTableTempData = struct_ImVector_ImGuiTableTempData; pub const struct_ImVector_ImGuiTabBar = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiTabBar, }; pub const ImVector_ImGuiTabBar = struct_ImVector_ImGuiTabBar; pub const struct_ImPool_ImGuiTabBar = extern struct { Buf: ImVector_ImGuiTabBar, Map: ImGuiStorage, FreeIdx: ImPoolIdx, }; pub const ImPool_ImGuiTabBar = struct_ImPool_ImGuiTabBar; pub const struct_ImVector_ImGuiPtrOrIndex = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiPtrOrIndex, }; pub const ImVector_ImGuiPtrOrIndex = struct_ImVector_ImGuiPtrOrIndex; pub const struct_ImVector_ImGuiShrinkWidthItem = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiShrinkWidthItem, }; pub const ImVector_ImGuiShrinkWidthItem = struct_ImVector_ImGuiShrinkWidthItem; pub const ImGuiInputTextFlags = c_int; pub const ImGuiKey = c_int; pub const struct_ImGuiInputTextCallbackData = extern struct { EventFlag: ImGuiInputTextFlags, Flags: ImGuiInputTextFlags, UserData: ?*c_void, EventChar: ImWchar, EventKey: ImGuiKey, Buf: [*c]u8, BufTextLen: c_int, BufSize: c_int, BufDirty: bool, CursorPos: c_int, SelectionStart: c_int, SelectionEnd: c_int, }; pub const ImGuiInputTextCallbackData = struct_ImGuiInputTextCallbackData; pub const ImGuiInputTextCallback = ?fn ([*c]ImGuiInputTextCallbackData) callconv(.C) c_int; pub const struct_ImGuiInputTextState = extern struct { ID: ImGuiID, CurLenW: c_int, CurLenA: c_int, TextW: ImVector_ImWchar, TextA: ImVector_char, InitialTextA: ImVector_char, TextAIsValid: bool, BufCapacityA: c_int, ScrollX: f32, Stb: STB_TexteditState, CursorAnim: f32, CursorFollow: bool, SelectedAllMouseLock: bool, Edited: bool, Flags: ImGuiInputTextFlags, UserCallback: ImGuiInputTextCallback, UserCallbackData: ?*c_void, }; pub const ImGuiInputTextState = struct_ImGuiInputTextState; pub const ImGuiColorEditFlags = c_int; pub const struct_ImGuiDockRequest = opaque {}; pub const ImGuiDockRequest = struct_ImGuiDockRequest; pub const struct_ImVector_ImGuiDockRequest = extern struct { Size: c_int, Capacity: c_int, Data: ?*ImGuiDockRequest, }; pub const ImVector_ImGuiDockRequest = struct_ImVector_ImGuiDockRequest; pub const struct_ImGuiDockNodeSettings = opaque {}; pub const ImGuiDockNodeSettings = struct_ImGuiDockNodeSettings; pub const struct_ImVector_ImGuiDockNodeSettings = extern struct { Size: c_int, Capacity: c_int, Data: ?*ImGuiDockNodeSettings, }; pub const ImVector_ImGuiDockNodeSettings = struct_ImVector_ImGuiDockNodeSettings; pub const struct_ImGuiDockContext = extern struct { Nodes: ImGuiStorage, Requests: ImVector_ImGuiDockRequest, NodesSettings: ImVector_ImGuiDockNodeSettings, WantFullRebuild: bool, }; pub const ImGuiDockContext = struct_ImGuiDockContext; pub const ImGuiSettingsHandler = struct_ImGuiSettingsHandler; pub const struct_ImVector_ImGuiSettingsHandler = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiSettingsHandler, }; pub const ImVector_ImGuiSettingsHandler = struct_ImVector_ImGuiSettingsHandler; pub const struct_ImVector_ImGuiWindowSettings = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiWindowSettings, }; pub const ImVector_ImGuiWindowSettings = struct_ImVector_ImGuiWindowSettings; pub const struct_ImChunkStream_ImGuiWindowSettings = extern struct { Buf: ImVector_ImGuiWindowSettings, }; pub const ImChunkStream_ImGuiWindowSettings = struct_ImChunkStream_ImGuiWindowSettings; pub const struct_ImVector_ImGuiTableSettings = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiTableSettings, }; pub const ImVector_ImGuiTableSettings = struct_ImVector_ImGuiTableSettings; pub const struct_ImChunkStream_ImGuiTableSettings = extern struct { Buf: ImVector_ImGuiTableSettings, }; pub const ImChunkStream_ImGuiTableSettings = struct_ImChunkStream_ImGuiTableSettings; pub const ImGuiContextHookCallback = ?fn ([*c]ImGuiContext, [*c]ImGuiContextHook) callconv(.C) void; pub const struct_ImGuiContextHook = extern struct { HookId: ImGuiID, Type: ImGuiContextHookType, Owner: ImGuiID, Callback: ImGuiContextHookCallback, UserData: ?*c_void, }; pub const ImGuiContextHook = struct_ImGuiContextHook; pub const struct_ImVector_ImGuiContextHook = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiContextHook, }; pub const ImVector_ImGuiContextHook = struct_ImVector_ImGuiContextHook; pub const ImFileHandle = [*c]FILE; pub const struct_ImGuiMetricsConfig = extern struct { ShowWindowsRects: bool, ShowWindowsBeginOrder: bool, ShowTablesRects: bool, ShowDrawCmdMesh: bool, ShowDrawCmdBoundingBoxes: bool, ShowDockingNodes: bool, ShowWindowsRectsType: c_int, ShowTablesRectsType: c_int, }; pub const ImGuiMetricsConfig = struct_ImGuiMetricsConfig; pub const struct_ImGuiContext = extern struct { Initialized: bool, FontAtlasOwnedByContext: bool, IO: ImGuiIO, PlatformIO: ImGuiPlatformIO, Style: ImGuiStyle, ConfigFlagsCurrFrame: ImGuiConfigFlags, ConfigFlagsLastFrame: ImGuiConfigFlags, Font: [*c]ImFont, FontSize: f32, FontBaseSize: f32, DrawListSharedData: ImDrawListSharedData, Time: f64, FrameCount: c_int, FrameCountEnded: c_int, FrameCountPlatformEnded: c_int, FrameCountRendered: c_int, WithinFrameScope: bool, WithinFrameScopeWithImplicitWindow: bool, WithinEndChild: bool, GcCompactAll: bool, TestEngineHookItems: bool, TestEngineHookIdInfo: ImGuiID, TestEngine: ?*c_void, Windows: ImVector_ImGuiWindowPtr, WindowsFocusOrder: ImVector_ImGuiWindowPtr, WindowsTempSortBuffer: ImVector_ImGuiWindowPtr, CurrentWindowStack: ImVector_ImGuiWindowPtr, WindowsById: ImGuiStorage, WindowsActiveCount: c_int, WindowsHoverPadding: ImVec2, CurrentWindow: ?*ImGuiWindow, HoveredWindow: ?*ImGuiWindow, HoveredWindowUnderMovingWindow: ?*ImGuiWindow, HoveredDockNode: ?*ImGuiDockNode, MovingWindow: ?*ImGuiWindow, WheelingWindow: ?*ImGuiWindow, WheelingWindowRefMousePos: ImVec2, WheelingWindowTimer: f32, CurrentItemFlags: ImGuiItemFlags, HoveredId: ImGuiID, HoveredIdPreviousFrame: ImGuiID, HoveredIdAllowOverlap: bool, HoveredIdUsingMouseWheel: bool, HoveredIdPreviousFrameUsingMouseWheel: bool, HoveredIdDisabled: bool, HoveredIdTimer: f32, HoveredIdNotActiveTimer: f32, ActiveId: ImGuiID, ActiveIdIsAlive: ImGuiID, ActiveIdTimer: f32, ActiveIdIsJustActivated: bool, ActiveIdAllowOverlap: bool, ActiveIdNoClearOnFocusLoss: bool, ActiveIdHasBeenPressedBefore: bool, ActiveIdHasBeenEditedBefore: bool, ActiveIdHasBeenEditedThisFrame: bool, ActiveIdUsingMouseWheel: bool, ActiveIdUsingNavDirMask: ImU32, ActiveIdUsingNavInputMask: ImU32, ActiveIdUsingKeyInputMask: ImU64, ActiveIdClickOffset: ImVec2, ActiveIdWindow: ?*ImGuiWindow, ActiveIdSource: ImGuiInputSource, ActiveIdMouseButton: c_int, ActiveIdPreviousFrame: ImGuiID, ActiveIdPreviousFrameIsAlive: bool, ActiveIdPreviousFrameHasBeenEditedBefore: bool, ActiveIdPreviousFrameWindow: ?*ImGuiWindow, LastActiveId: ImGuiID, LastActiveIdTimer: f32, NextWindowData: ImGuiNextWindowData, NextItemData: ImGuiNextItemData, ColorStack: ImVector_ImGuiColorMod, StyleVarStack: ImVector_ImGuiStyleMod, FontStack: ImVector_ImFontPtr, FocusScopeStack: ImVector_ImGuiID, ItemFlagsStack: ImVector_ImGuiItemFlags, GroupStack: ImVector_ImGuiGroupData, OpenPopupStack: ImVector_ImGuiPopupData, BeginPopupStack: ImVector_ImGuiPopupData, Viewports: ImVector_ImGuiViewportPPtr, CurrentDpiScale: f32, CurrentViewport: [*c]ImGuiViewportP, MouseViewport: [*c]ImGuiViewportP, MouseLastHoveredViewport: [*c]ImGuiViewportP, PlatformLastFocusedViewportId: ImGuiID, FallbackMonitor: ImGuiPlatformMonitor, ViewportFrontMostStampCount: c_int, NavWindow: ?*ImGuiWindow, NavId: ImGuiID, NavFocusScopeId: ImGuiID, NavActivateId: ImGuiID, NavActivateDownId: ImGuiID, NavActivatePressedId: ImGuiID, NavInputId: ImGuiID, NavJustTabbedId: ImGuiID, NavJustMovedToId: ImGuiID, NavJustMovedToFocusScopeId: ImGuiID, NavJustMovedToKeyMods: ImGuiKeyModFlags, NavNextActivateId: ImGuiID, NavInputSource: ImGuiInputSource, NavScoringRect: ImRect, NavScoringCount: c_int, NavLayer: ImGuiNavLayer, NavIdTabCounter: c_int, NavIdIsAlive: bool, NavMousePosDirty: bool, NavDisableHighlight: bool, NavDisableMouseHover: bool, NavAnyRequest: bool, NavInitRequest: bool, NavInitRequestFromMove: bool, NavInitResultId: ImGuiID, NavInitResultRectRel: ImRect, NavMoveRequest: bool, NavMoveRequestFlags: ImGuiNavMoveFlags, NavMoveRequestForward: ImGuiNavForward, NavMoveRequestKeyMods: ImGuiKeyModFlags, NavMoveDir: ImGuiDir, NavMoveDirLast: ImGuiDir, NavMoveClipDir: ImGuiDir, NavMoveResultLocal: ImGuiNavItemData, NavMoveResultLocalVisibleSet: ImGuiNavItemData, NavMoveResultOther: ImGuiNavItemData, NavWrapRequestWindow: ?*ImGuiWindow, NavWrapRequestFlags: ImGuiNavMoveFlags, NavWindowingTarget: ?*ImGuiWindow, NavWindowingTargetAnim: ?*ImGuiWindow, NavWindowingListWindow: ?*ImGuiWindow, NavWindowingTimer: f32, NavWindowingHighlightAlpha: f32, NavWindowingToggleLayer: bool, TabFocusRequestCurrWindow: ?*ImGuiWindow, TabFocusRequestNextWindow: ?*ImGuiWindow, TabFocusRequestCurrCounterRegular: c_int, TabFocusRequestCurrCounterTabStop: c_int, TabFocusRequestNextCounterRegular: c_int, TabFocusRequestNextCounterTabStop: c_int, TabFocusPressed: bool, DimBgRatio: f32, MouseCursor: ImGuiMouseCursor, DragDropActive: bool, DragDropWithinSource: bool, DragDropWithinTarget: bool, DragDropSourceFlags: ImGuiDragDropFlags, DragDropSourceFrameCount: c_int, DragDropMouseButton: c_int, DragDropPayload: ImGuiPayload, DragDropTargetRect: ImRect, DragDropTargetId: ImGuiID, DragDropAcceptFlags: ImGuiDragDropFlags, DragDropAcceptIdCurrRectSurface: f32, DragDropAcceptIdCurr: ImGuiID, DragDropAcceptIdPrev: ImGuiID, DragDropAcceptFrameCount: c_int, DragDropHoldJustPressedId: ImGuiID, DragDropPayloadBufHeap: ImVector_unsigned_char, DragDropPayloadBufLocal: [16]u8, CurrentTable: ?*ImGuiTable, CurrentTableStackIdx: c_int, Tables: ImPool_ImGuiTable, TablesTempDataStack: ImVector_ImGuiTableTempData, TablesLastTimeActive: ImVector_float, DrawChannelsTempMergeBuffer: ImVector_ImDrawChannel, CurrentTabBar: [*c]ImGuiTabBar, TabBars: ImPool_ImGuiTabBar, CurrentTabBarStack: ImVector_ImGuiPtrOrIndex, ShrinkWidthBuffer: ImVector_ImGuiShrinkWidthItem, LastValidMousePos: ImVec2, InputTextState: ImGuiInputTextState, InputTextPasswordFont: ImFont, TempInputId: ImGuiID, ColorEditOptions: ImGuiColorEditFlags, ColorEditLastHue: f32, ColorEditLastSat: f32, ColorEditLastColor: [3]f32, ColorPickerRef: ImVec4, SliderCurrentAccum: f32, SliderCurrentAccumDirty: bool, DragCurrentAccumDirty: bool, DragCurrentAccum: f32, DragSpeedDefaultRatio: f32, ScrollbarClickDeltaToGrabCenter: f32, TooltipOverrideCount: c_int, TooltipSlowDelay: f32, ClipboardHandlerData: ImVector_char, MenusIdSubmittedThisFrame: ImVector_ImGuiID, PlatformImePos: ImVec2, PlatformImeLastPos: ImVec2, PlatformImePosViewport: [*c]ImGuiViewportP, PlatformLocaleDecimalPoint: u8, DockContext: ImGuiDockContext, SettingsLoaded: bool, SettingsDirtyTimer: f32, SettingsIniData: ImGuiTextBuffer, SettingsHandlers: ImVector_ImGuiSettingsHandler, SettingsWindows: ImChunkStream_ImGuiWindowSettings, SettingsTables: ImChunkStream_ImGuiTableSettings, Hooks: ImVector_ImGuiContextHook, HookIdNext: ImGuiID, LogEnabled: bool, LogType: ImGuiLogType, LogFile: ImFileHandle, LogBuffer: ImGuiTextBuffer, LogNextPrefix: [*c]const u8, LogNextSuffix: [*c]const u8, LogLinePosY: f32, LogLineFirstItem: bool, LogDepthRef: c_int, LogDepthToExpand: c_int, LogDepthToExpandDefault: c_int, DebugItemPickerActive: bool, DebugItemPickerBreakId: ImGuiID, DebugMetricsConfig: ImGuiMetricsConfig, FramerateSecPerFrame: [120]f32, FramerateSecPerFrameIdx: c_int, FramerateSecPerFrameCount: c_int, FramerateSecPerFrameAccum: f32, WantCaptureMouseNextFrame: c_int, WantCaptureKeyboardNextFrame: c_int, WantTextInputNextFrame: c_int, TempBuffer: [3073]u8, }; pub const ImGuiContext = struct_ImGuiContext; pub const struct_ImGuiSettingsHandler = extern struct { TypeName: [*c]const u8, TypeHash: ImGuiID, ClearAllFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler) callconv(.C) void, ReadInitFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler) callconv(.C) void, ReadOpenFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler, [*c]const u8) callconv(.C) ?*c_void, ReadLineFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler, ?*c_void, [*c]const u8) callconv(.C) void, ApplyAllFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler) callconv(.C) void, WriteAllFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler, [*c]ImGuiTextBuffer) callconv(.C) void, UserData: ?*c_void, }; pub const struct_ImGuiLastItemDataBackup = extern struct { LastItemId: ImGuiID, LastItemStatusFlags: ImGuiItemStatusFlags, LastItemRect: ImRect, LastItemDisplayRect: ImRect, }; pub const ImGuiLastItemDataBackup = struct_ImGuiLastItemDataBackup; pub const struct_ImGuiDataTypeInfo = extern struct { Size: usize, Name: [*c]const u8, PrintFmt: [*c]const u8, ScanFmt: [*c]const u8, }; pub const ImGuiDataTypeInfo = struct_ImGuiDataTypeInfo; pub const struct_ImVector_ImU32 = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImU32, }; pub const ImVector_ImU32 = struct_ImVector_ImU32; pub const struct_ImBitVector = extern struct { Storage: ImVector_ImU32, }; pub const ImBitVector = struct_ImBitVector; pub const struct_ImGuiTextRange = extern struct { b: [*c]const u8, e: [*c]const u8, }; pub const ImGuiTextRange = struct_ImGuiTextRange; pub const struct_ImVector_ImGuiTextRange = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiTextRange, }; pub const ImVector_ImGuiTextRange = struct_ImVector_ImGuiTextRange; pub const struct_ImGuiTextFilter = extern struct { InputBuf: [256]u8, Filters: ImVector_ImGuiTextRange, CountGrep: c_int, }; pub const ImGuiTextFilter = struct_ImGuiTextFilter; pub const struct_ImGuiTableSortSpecs = extern struct { Specs: ?*const ImGuiTableColumnSortSpecs, SpecsCount: c_int, SpecsDirty: bool, }; pub const ImGuiTableSortSpecs = struct_ImGuiTableSortSpecs; pub const struct_ImGuiOnceUponAFrame = extern struct { RefFrame: c_int, }; pub const ImGuiOnceUponAFrame = struct_ImGuiOnceUponAFrame; pub const struct_ImGuiListClipper = extern struct { DisplayStart: c_int, DisplayEnd: c_int, ItemsCount: c_int, StepNo: c_int, ItemsFrozen: c_int, ItemsHeight: f32, StartPosY: f32, }; pub const ImGuiListClipper = struct_ImGuiListClipper; pub const struct_ImColor = extern struct { Value: ImVec4, }; pub const ImColor = struct_ImColor; pub const struct_ImFontGlyphRangesBuilder = extern struct { UsedChars: ImVector_ImU32, }; pub const ImFontGlyphRangesBuilder = struct_ImFontGlyphRangesBuilder; pub const ImGuiDataType = c_int; pub const ImGuiNavInput = c_int; pub const ImGuiMouseButton = c_int; pub const ImGuiSortDirection = c_int; pub const ImGuiTableBgTarget = c_int; pub const ImDrawFlags = c_int; pub const ImGuiButtonFlags = c_int; pub const ImGuiComboFlags = c_int; pub const ImGuiFocusedFlags = c_int; pub const ImGuiHoveredFlags = c_int; pub const ImGuiPopupFlags = c_int; pub const ImGuiSelectableFlags = c_int; pub const ImGuiSliderFlags = c_int; pub const ImGuiTableRowFlags = c_int; pub const ImGuiTreeNodeFlags = c_int; pub const ImGuiMemAllocFunc = ?fn (usize, ?*c_void) callconv(.C) ?*c_void; pub const ImGuiMemFreeFunc = ?fn (?*c_void, ?*c_void) callconv(.C) void; pub const ImWchar32 = c_uint; pub const ImU16 = c_ushort; pub const ImS32 = c_int; pub const ImS64 = i64; pub const ImGuiDataAuthority = c_int; pub const ImGuiItemAddFlags = c_int; pub const ImGuiNavHighlightFlags = c_int; pub const ImGuiNavDirSourceFlags = c_int; pub const ImGuiSeparatorFlags = c_int; pub const ImGuiTextFlags = c_int; pub const ImGuiTooltipFlags = c_int; pub const ImGuiErrorLogCallback = ?fn (?*c_void, [*c]const u8, ...) callconv(.C) void; pub extern var GImGui: [*c]ImGuiContext; pub const struct_ImVector = extern struct { Size: c_int, Capacity: c_int, Data: ?*c_void, }; pub const ImVector = struct_ImVector; pub const struct_ImVector_ImGuiOldColumns = extern struct { Size: c_int, Capacity: c_int, Data: [*c]ImGuiOldColumns, }; pub const ImVector_ImGuiOldColumns = struct_ImVector_ImGuiOldColumns; pub const struct_ImVector_const_charPtr = extern struct { Size: c_int, Capacity: c_int, Data: [*c][*c]const u8, }; pub const ImVector_const_charPtr = struct_ImVector_const_charPtr; pub const ImGuiWindowFlags_ = enum(c_int) { None = 0, NoTitleBar = 1, NoResize = 2, NoMove = 4, NoScrollbar = 8, NoScrollWithMouse = 16, NoCollapse = 32, AlwaysAutoResize = 64, NoBackground = 128, NoSavedSettings = 256, NoMouseInputs = 512, MenuBar = 1024, HorizontalScrollbar = 2048, NoFocusOnAppearing = 4096, NoBringToFrontOnFocus = 8192, AlwaysVerticalScrollbar = 16384, AlwaysHorizontalScrollbar = 32768, AlwaysUseWindowPadding = 65536, NoNavInputs = 262144, NoNavFocus = 524288, UnsavedDocument = 1048576, NoDocking = 2097152, NoNav = 786432, NoDecoration = 43, NoInputs = 786944, NavFlattened = 8388608, ChildWindow = 16777216, Tooltip = 33554432, Popup = 67108864, Modal = 134217728, ChildMenu = 268435456, DockNodeHost = 536870912, _, }; pub const ImGuiWindowFlags_None = @enumToInt(ImGuiWindowFlags_.None); pub const ImGuiWindowFlags_NoTitleBar = @enumToInt(ImGuiWindowFlags_.NoTitleBar); pub const ImGuiWindowFlags_NoResize = @enumToInt(ImGuiWindowFlags_.NoResize); pub const ImGuiWindowFlags_NoMove = @enumToInt(ImGuiWindowFlags_.NoMove); pub const ImGuiWindowFlags_NoScrollbar = @enumToInt(ImGuiWindowFlags_.NoScrollbar); pub const ImGuiWindowFlags_NoScrollWithMouse = @enumToInt(ImGuiWindowFlags_.NoScrollWithMouse); pub const ImGuiWindowFlags_NoCollapse = @enumToInt(ImGuiWindowFlags_.NoCollapse); pub const ImGuiWindowFlags_AlwaysAutoResize = @enumToInt(ImGuiWindowFlags_.AlwaysAutoResize); pub const ImGuiWindowFlags_NoBackground = @enumToInt(ImGuiWindowFlags_.NoBackground); pub const ImGuiWindowFlags_NoSavedSettings = @enumToInt(ImGuiWindowFlags_.NoSavedSettings); pub const ImGuiWindowFlags_NoMouseInputs = @enumToInt(ImGuiWindowFlags_.NoMouseInputs); pub const ImGuiWindowFlags_MenuBar = @enumToInt(ImGuiWindowFlags_.MenuBar); pub const ImGuiWindowFlags_HorizontalScrollbar = @enumToInt(ImGuiWindowFlags_.HorizontalScrollbar); pub const ImGuiWindowFlags_NoFocusOnAppearing = @enumToInt(ImGuiWindowFlags_.NoFocusOnAppearing); pub const ImGuiWindowFlags_NoBringToFrontOnFocus = @enumToInt(ImGuiWindowFlags_.NoBringToFrontOnFocus); pub const ImGuiWindowFlags_AlwaysVerticalScrollbar = @enumToInt(ImGuiWindowFlags_.AlwaysVerticalScrollbar); pub const ImGuiWindowFlags_AlwaysHorizontalScrollbar = @enumToInt(ImGuiWindowFlags_.AlwaysHorizontalScrollbar); pub const ImGuiWindowFlags_AlwaysUseWindowPadding = @enumToInt(ImGuiWindowFlags_.AlwaysUseWindowPadding); pub const ImGuiWindowFlags_NoNavInputs = @enumToInt(ImGuiWindowFlags_.NoNavInputs); pub const ImGuiWindowFlags_NoNavFocus = @enumToInt(ImGuiWindowFlags_.NoNavFocus); pub const ImGuiWindowFlags_UnsavedDocument = @enumToInt(ImGuiWindowFlags_.UnsavedDocument); pub const ImGuiWindowFlags_NoDocking = @enumToInt(ImGuiWindowFlags_.NoDocking); pub const ImGuiWindowFlags_NoNav = @enumToInt(ImGuiWindowFlags_.NoNav); pub const ImGuiWindowFlags_NoDecoration = @enumToInt(ImGuiWindowFlags_.NoDecoration); pub const ImGuiWindowFlags_NoInputs = @enumToInt(ImGuiWindowFlags_.NoInputs); pub const ImGuiWindowFlags_NavFlattened = @enumToInt(ImGuiWindowFlags_.NavFlattened); pub const ImGuiWindowFlags_ChildWindow = @enumToInt(ImGuiWindowFlags_.ChildWindow); pub const ImGuiWindowFlags_Tooltip = @enumToInt(ImGuiWindowFlags_.Tooltip); pub const ImGuiWindowFlags_Popup = @enumToInt(ImGuiWindowFlags_.Popup); pub const ImGuiWindowFlags_Modal = @enumToInt(ImGuiWindowFlags_.Modal); pub const ImGuiWindowFlags_ChildMenu = @enumToInt(ImGuiWindowFlags_.ChildMenu); pub const ImGuiWindowFlags_DockNodeHost = @enumToInt(ImGuiWindowFlags_.DockNodeHost); pub const ImGuiInputTextFlags_ = enum(c_int) { None = 0, CharsDecimal = 1, CharsHexadecimal = 2, CharsUppercase = 4, CharsNoBlank = 8, AutoSelectAll = 16, EnterReturnsTrue = 32, CallbackCompletion = 64, CallbackHistory = 128, CallbackAlways = 256, CallbackCharFilter = 512, AllowTabInput = 1024, CtrlEnterForNewLine = 2048, NoHorizontalScroll = 4096, AlwaysOverwrite = 8192, ReadOnly = 16384, Password = <PASSWORD>, NoUndoRedo = 65536, CharsScientific = 131072, CallbackResize = 262144, CallbackEdit = 524288, _, }; pub const ImGuiInputTextFlags_None = @enumToInt(ImGuiInputTextFlags_.None); pub const ImGuiInputTextFlags_CharsDecimal = @enumToInt(ImGuiInputTextFlags_.CharsDecimal); pub const ImGuiInputTextFlags_CharsHexadecimal = @enumToInt(ImGuiInputTextFlags_.CharsHexadecimal); pub const ImGuiInputTextFlags_CharsUppercase = @enumToInt(ImGuiInputTextFlags_.CharsUppercase); pub const ImGuiInputTextFlags_CharsNoBlank = @enumToInt(ImGuiInputTextFlags_.CharsNoBlank); pub const ImGuiInputTextFlags_AutoSelectAll = @enumToInt(ImGuiInputTextFlags_.AutoSelectAll); pub const ImGuiInputTextFlags_EnterReturnsTrue = @enumToInt(ImGuiInputTextFlags_.EnterReturnsTrue); pub const ImGuiInputTextFlags_CallbackCompletion = @enumToInt(ImGuiInputTextFlags_.CallbackCompletion); pub const ImGuiInputTextFlags_CallbackHistory = @enumToInt(ImGuiInputTextFlags_.CallbackHistory); pub const ImGuiInputTextFlags_CallbackAlways = @enumToInt(ImGuiInputTextFlags_.CallbackAlways); pub const ImGuiInputTextFlags_CallbackCharFilter = @enumToInt(ImGuiInputTextFlags_.CallbackCharFilter); pub const ImGuiInputTextFlags_AllowTabInput = @enumToInt(ImGuiInputTextFlags_.AllowTabInput); pub const ImGuiInputTextFlags_CtrlEnterForNewLine = @enumToInt(ImGuiInputTextFlags_.CtrlEnterForNewLine); pub const ImGuiInputTextFlags_NoHorizontalScroll = @enumToInt(ImGuiInputTextFlags_.NoHorizontalScroll); pub const ImGuiInputTextFlags_AlwaysOverwrite = @enumToInt(ImGuiInputTextFlags_.AlwaysOverwrite); pub const ImGuiInputTextFlags_ReadOnly = @enumToInt(ImGuiInputTextFlags_.ReadOnly); pub const ImGuiInputTextFlags_Password = @enumToInt(ImGuiInputTextFlags_.Password); pub const ImGuiInputTextFlags_NoUndoRedo = @enumToInt(ImGuiInputTextFlags_.NoUndoRedo); pub const ImGuiInputTextFlags_CharsScientific = @enumToInt(ImGuiInputTextFlags_.CharsScientific); pub const ImGuiInputTextFlags_CallbackResize = @enumToInt(ImGuiInputTextFlags_.CallbackResize); pub const ImGuiInputTextFlags_CallbackEdit = @enumToInt(ImGuiInputTextFlags_.CallbackEdit); pub const ImGuiTreeNodeFlags_ = enum(c_int) { None = 0, Selected = 1, Framed = 2, AllowItemOverlap = 4, NoTreePushOnOpen = 8, NoAutoOpenOnLog = 16, DefaultOpen = 32, OpenOnDoubleClick = 64, OpenOnArrow = 128, Leaf = 256, Bullet = 512, FramePadding = 1024, SpanAvailWidth = 2048, SpanFullWidth = 4096, NavLeftJumpsBackHere = 8192, CollapsingHeader = 26, _, }; pub const ImGuiTreeNodeFlags_None = @enumToInt(ImGuiTreeNodeFlags_.None); pub const ImGuiTreeNodeFlags_Selected = @enumToInt(ImGuiTreeNodeFlags_.Selected); pub const ImGuiTreeNodeFlags_Framed = @enumToInt(ImGuiTreeNodeFlags_.Framed); pub const ImGuiTreeNodeFlags_AllowItemOverlap = @enumToInt(ImGuiTreeNodeFlags_.AllowItemOverlap); pub const ImGuiTreeNodeFlags_NoTreePushOnOpen = @enumToInt(ImGuiTreeNodeFlags_.NoTreePushOnOpen); pub const ImGuiTreeNodeFlags_NoAutoOpenOnLog = @enumToInt(ImGuiTreeNodeFlags_.NoAutoOpenOnLog); pub const ImGuiTreeNodeFlags_DefaultOpen = @enumToInt(ImGuiTreeNodeFlags_.DefaultOpen); pub const ImGuiTreeNodeFlags_OpenOnDoubleClick = @enumToInt(ImGuiTreeNodeFlags_.OpenOnDoubleClick); pub const ImGuiTreeNodeFlags_OpenOnArrow = @enumToInt(ImGuiTreeNodeFlags_.OpenOnArrow); pub const ImGuiTreeNodeFlags_Leaf = @enumToInt(ImGuiTreeNodeFlags_.Leaf); pub const ImGuiTreeNodeFlags_Bullet = @enumToInt(ImGuiTreeNodeFlags_.Bullet); pub const ImGuiTreeNodeFlags_FramePadding = @enumToInt(ImGuiTreeNodeFlags_.FramePadding); pub const ImGuiTreeNodeFlags_SpanAvailWidth = @enumToInt(ImGuiTreeNodeFlags_.SpanAvailWidth); pub const ImGuiTreeNodeFlags_SpanFullWidth = @enumToInt(ImGuiTreeNodeFlags_.SpanFullWidth); pub const ImGuiTreeNodeFlags_NavLeftJumpsBackHere = @enumToInt(ImGuiTreeNodeFlags_.NavLeftJumpsBackHere); pub const ImGuiTreeNodeFlags_CollapsingHeader = @enumToInt(ImGuiTreeNodeFlags_.CollapsingHeader); pub const ImGuiPopupFlags_ = enum(c_int) { MouseButtonLeft = 0, MouseButtonRight = 1, MouseButtonMiddle = 2, MouseButtonMask_ = 31, NoOpenOverExistingPopup = 32, NoOpenOverItems = 64, AnyPopupId = 128, AnyPopupLevel = 256, AnyPopup = 384, _, }; pub const ImGuiPopupFlags_None: c_int = 0; pub const ImGuiPopupFlags_MouseButtonLeft = @enumToInt(ImGuiPopupFlags_.MouseButtonLeft); pub const ImGuiPopupFlags_MouseButtonRight = @enumToInt(ImGuiPopupFlags_.MouseButtonRight); pub const ImGuiPopupFlags_MouseButtonMiddle = @enumToInt(ImGuiPopupFlags_.MouseButtonMiddle); pub const ImGuiPopupFlags_MouseButtonMask_ = @enumToInt(ImGuiPopupFlags_.MouseButtonMask_); pub const ImGuiPopupFlags_MouseButtonDefault_: c_int = 1; pub const ImGuiPopupFlags_NoOpenOverExistingPopup = @enumToInt(ImGuiPopupFlags_.NoOpenOverExistingPopup); pub const ImGuiPopupFlags_NoOpenOverItems = @enumToInt(ImGuiPopupFlags_.NoOpenOverItems); pub const ImGuiPopupFlags_AnyPopupId = @enumToInt(ImGuiPopupFlags_.AnyPopupId); pub const ImGuiPopupFlags_AnyPopupLevel = @enumToInt(ImGuiPopupFlags_.AnyPopupLevel); pub const ImGuiPopupFlags_AnyPopup = @enumToInt(ImGuiPopupFlags_.AnyPopup); pub const ImGuiSelectableFlags_ = enum(c_int) { None = 0, DontClosePopups = 1, SpanAllColumns = 2, AllowDoubleClick = 4, Disabled = 8, AllowItemOverlap = 16, _, }; pub const ImGuiSelectableFlags_None = @enumToInt(ImGuiSelectableFlags_.None); pub const ImGuiSelectableFlags_DontClosePopups = @enumToInt(ImGuiSelectableFlags_.DontClosePopups); pub const ImGuiSelectableFlags_SpanAllColumns = @enumToInt(ImGuiSelectableFlags_.SpanAllColumns); pub const ImGuiSelectableFlags_AllowDoubleClick = @enumToInt(ImGuiSelectableFlags_.AllowDoubleClick); pub const ImGuiSelectableFlags_Disabled = @enumToInt(ImGuiSelectableFlags_.Disabled); pub const ImGuiSelectableFlags_AllowItemOverlap = @enumToInt(ImGuiSelectableFlags_.AllowItemOverlap); pub const ImGuiComboFlags_ = enum(c_int) { None = 0, PopupAlignLeft = 1, HeightSmall = 2, HeightRegular = 4, HeightLarge = 8, HeightLargest = 16, NoArrowButton = 32, NoPreview = 64, HeightMask_ = 30, _, }; pub const ImGuiComboFlags_None = @enumToInt(ImGuiComboFlags_.None); pub const ImGuiComboFlags_PopupAlignLeft = @enumToInt(ImGuiComboFlags_.PopupAlignLeft); pub const ImGuiComboFlags_HeightSmall = @enumToInt(ImGuiComboFlags_.HeightSmall); pub const ImGuiComboFlags_HeightRegular = @enumToInt(ImGuiComboFlags_.HeightRegular); pub const ImGuiComboFlags_HeightLarge = @enumToInt(ImGuiComboFlags_.HeightLarge); pub const ImGuiComboFlags_HeightLargest = @enumToInt(ImGuiComboFlags_.HeightLargest); pub const ImGuiComboFlags_NoArrowButton = @enumToInt(ImGuiComboFlags_.NoArrowButton); pub const ImGuiComboFlags_NoPreview = @enumToInt(ImGuiComboFlags_.NoPreview); pub const ImGuiComboFlags_HeightMask_ = @enumToInt(ImGuiComboFlags_.HeightMask_); pub const ImGuiTabBarFlags_ = enum(c_int) { None = 0, Reorderable = 1, AutoSelectNewTabs = 2, TabListPopupButton = 4, NoCloseWithMiddleMouseButton = 8, NoTabListScrollingButtons = 16, NoTooltip = 32, FittingPolicyResizeDown = 64, FittingPolicyScroll = 128, FittingPolicyMask_ = 192, FittingPolicyDefault_ = 64, _, }; pub const ImGuiTabBarFlags_None = @enumToInt(ImGuiTabBarFlags_.None); pub const ImGuiTabBarFlags_Reorderable = @enumToInt(ImGuiTabBarFlags_.Reorderable); pub const ImGuiTabBarFlags_AutoSelectNewTabs = @enumToInt(ImGuiTabBarFlags_.AutoSelectNewTabs); pub const ImGuiTabBarFlags_TabListPopupButton = @enumToInt(ImGuiTabBarFlags_.TabListPopupButton); pub const ImGuiTabBarFlags_NoCloseWithMiddleMouseButton = @enumToInt(ImGuiTabBarFlags_.NoCloseWithMiddleMouseButton); pub const ImGuiTabBarFlags_NoTabListScrollingButtons = @enumToInt(ImGuiTabBarFlags_.NoTabListScrollingButtons); pub const ImGuiTabBarFlags_NoTooltip = @enumToInt(ImGuiTabBarFlags_.NoTooltip); pub const ImGuiTabBarFlags_FittingPolicyResizeDown = @enumToInt(ImGuiTabBarFlags_.FittingPolicyResizeDown); pub const ImGuiTabBarFlags_FittingPolicyScroll = @enumToInt(ImGuiTabBarFlags_.FittingPolicyScroll); pub const ImGuiTabBarFlags_FittingPolicyMask_ = @enumToInt(ImGuiTabBarFlags_.FittingPolicyMask_); pub const ImGuiTabBarFlags_FittingPolicyDefault_ = @enumToInt(ImGuiTabBarFlags_.FittingPolicyDefault_); pub const ImGuiTabItemFlags_ = enum(c_int) { None = 0, UnsavedDocument = 1, SetSelected = 2, NoCloseWithMiddleMouseButton = 4, NoPushId = 8, NoTooltip = 16, NoReorder = 32, Leading = 64, Trailing = 128, _, }; pub const ImGuiTabItemFlags_None = @enumToInt(ImGuiTabItemFlags_.None); pub const ImGuiTabItemFlags_UnsavedDocument = @enumToInt(ImGuiTabItemFlags_.UnsavedDocument); pub const ImGuiTabItemFlags_SetSelected = @enumToInt(ImGuiTabItemFlags_.SetSelected); pub const ImGuiTabItemFlags_NoCloseWithMiddleMouseButton = @enumToInt(ImGuiTabItemFlags_.NoCloseWithMiddleMouseButton); pub const ImGuiTabItemFlags_NoPushId = @enumToInt(ImGuiTabItemFlags_.NoPushId); pub const ImGuiTabItemFlags_NoTooltip = @enumToInt(ImGuiTabItemFlags_.NoTooltip); pub const ImGuiTabItemFlags_NoReorder = @enumToInt(ImGuiTabItemFlags_.NoReorder); pub const ImGuiTabItemFlags_Leading = @enumToInt(ImGuiTabItemFlags_.Leading); pub const ImGuiTabItemFlags_Trailing = @enumToInt(ImGuiTabItemFlags_.Trailing); pub const ImGuiTableFlags_ = enum(c_int) { None = 0, Resizable = 1, Reorderable = 2, Hideable = 4, Sortable = 8, NoSavedSettings = 16, ContextMenuInBody = 32, RowBg = 64, BordersInnerH = 128, BordersOuterH = 256, BordersInnerV = 512, BordersOuterV = 1024, BordersH = 384, BordersV = 1536, BordersInner = 640, BordersOuter = 1280, Borders = 1920, NoBordersInBody = 2048, NoBordersInBodyUntilResize = 4096, SizingFixedFit = 8192, SizingFixedSame = 16384, SizingStretchProp = 24576, SizingStretchSame = 32768, NoHostExtendX = 65536, NoHostExtendY = 131072, NoKeepColumnsVisible = 262144, PreciseWidths = 524288, NoClip = 1048576, PadOuterX = 2097152, NoPadOuterX = 4194304, NoPadInnerX = 8388608, ScrollX = 16777216, ScrollY = 33554432, SortMulti = 67108864, SortTristate = 134217728, SizingMask_ = 57344, _, }; pub const ImGuiTableFlags_None = @enumToInt(ImGuiTableFlags_.None); pub const ImGuiTableFlags_Resizable = @enumToInt(ImGuiTableFlags_.Resizable); pub const ImGuiTableFlags_Reorderable = @enumToInt(ImGuiTableFlags_.Reorderable); pub const ImGuiTableFlags_Hideable = @enumToInt(ImGuiTableFlags_.Hideable); pub const ImGuiTableFlags_Sortable = @enumToInt(ImGuiTableFlags_.Sortable); pub const ImGuiTableFlags_NoSavedSettings = @enumToInt(ImGuiTableFlags_.NoSavedSettings); pub const ImGuiTableFlags_ContextMenuInBody = @enumToInt(ImGuiTableFlags_.ContextMenuInBody); pub const ImGuiTableFlags_RowBg = @enumToInt(ImGuiTableFlags_.RowBg); pub const ImGuiTableFlags_BordersInnerH = @enumToInt(ImGuiTableFlags_.BordersInnerH); pub const ImGuiTableFlags_BordersOuterH = @enumToInt(ImGuiTableFlags_.BordersOuterH); pub const ImGuiTableFlags_BordersInnerV = @enumToInt(ImGuiTableFlags_.BordersInnerV); pub const ImGuiTableFlags_BordersOuterV = @enumToInt(ImGuiTableFlags_.BordersOuterV); pub const ImGuiTableFlags_BordersH = @enumToInt(ImGuiTableFlags_.BordersH); pub const ImGuiTableFlags_BordersV = @enumToInt(ImGuiTableFlags_.BordersV); pub const ImGuiTableFlags_BordersInner = @enumToInt(ImGuiTableFlags_.BordersInner); pub const ImGuiTableFlags_BordersOuter = @enumToInt(ImGuiTableFlags_.BordersOuter); pub const ImGuiTableFlags_Borders = @enumToInt(ImGuiTableFlags_.Borders); pub const ImGuiTableFlags_NoBordersInBody = @enumToInt(ImGuiTableFlags_.NoBordersInBody); pub const ImGuiTableFlags_NoBordersInBodyUntilResize = @enumToInt(ImGuiTableFlags_.NoBordersInBodyUntilResize); pub const ImGuiTableFlags_SizingFixedFit = @enumToInt(ImGuiTableFlags_.SizingFixedFit); pub const ImGuiTableFlags_SizingFixedSame = @enumToInt(ImGuiTableFlags_.SizingFixedSame); pub const ImGuiTableFlags_SizingStretchProp = @enumToInt(ImGuiTableFlags_.SizingStretchProp); pub const ImGuiTableFlags_SizingStretchSame = @enumToInt(ImGuiTableFlags_.SizingStretchSame); pub const ImGuiTableFlags_NoHostExtendX = @enumToInt(ImGuiTableFlags_.NoHostExtendX); pub const ImGuiTableFlags_NoHostExtendY = @enumToInt(ImGuiTableFlags_.NoHostExtendY); pub const ImGuiTableFlags_NoKeepColumnsVisible = @enumToInt(ImGuiTableFlags_.NoKeepColumnsVisible); pub const ImGuiTableFlags_PreciseWidths = @enumToInt(ImGuiTableFlags_.PreciseWidths); pub const ImGuiTableFlags_NoClip = @enumToInt(ImGuiTableFlags_.NoClip); pub const ImGuiTableFlags_PadOuterX = @enumToInt(ImGuiTableFlags_.PadOuterX); pub const ImGuiTableFlags_NoPadOuterX = @enumToInt(ImGuiTableFlags_.NoPadOuterX); pub const ImGuiTableFlags_NoPadInnerX = @enumToInt(ImGuiTableFlags_.NoPadInnerX); pub const ImGuiTableFlags_ScrollX = @enumToInt(ImGuiTableFlags_.ScrollX); pub const ImGuiTableFlags_ScrollY = @enumToInt(ImGuiTableFlags_.ScrollY); pub const ImGuiTableFlags_SortMulti = @enumToInt(ImGuiTableFlags_.SortMulti); pub const ImGuiTableFlags_SortTristate = @enumToInt(ImGuiTableFlags_.SortTristate); pub const ImGuiTableFlags_SizingMask_ = @enumToInt(ImGuiTableFlags_.SizingMask_); pub const ImGuiTableColumnFlags_ = enum(c_int) { None = 0, DefaultHide = 1, DefaultSort = 2, WidthStretch = 4, WidthFixed = 8, NoResize = 16, NoReorder = 32, NoHide = 64, NoClip = 128, NoSort = 256, NoSortAscending = 512, NoSortDescending = 1024, NoHeaderWidth = 2048, PreferSortAscending = 4096, PreferSortDescending = 8192, IndentEnable = 16384, IndentDisable = 32768, IsEnabled = 1048576, IsVisible = 2097152, IsSorted = 4194304, IsHovered = 8388608, WidthMask_ = 12, IndentMask_ = 49152, StatusMask_ = 15728640, NoDirectResize_ = 1073741824, _, }; pub const ImGuiTableColumnFlags_None = @enumToInt(ImGuiTableColumnFlags_.None); pub const ImGuiTableColumnFlags_DefaultHide = @enumToInt(ImGuiTableColumnFlags_.DefaultHide); pub const ImGuiTableColumnFlags_DefaultSort = @enumToInt(ImGuiTableColumnFlags_.DefaultSort); pub const ImGuiTableColumnFlags_WidthStretch = @enumToInt(ImGuiTableColumnFlags_.WidthStretch); pub const ImGuiTableColumnFlags_WidthFixed = @enumToInt(ImGuiTableColumnFlags_.WidthFixed); pub const ImGuiTableColumnFlags_NoResize = @enumToInt(ImGuiTableColumnFlags_.NoResize); pub const ImGuiTableColumnFlags_NoReorder = @enumToInt(ImGuiTableColumnFlags_.NoReorder); pub const ImGuiTableColumnFlags_NoHide = @enumToInt(ImGuiTableColumnFlags_.NoHide); pub const ImGuiTableColumnFlags_NoClip = @enumToInt(ImGuiTableColumnFlags_.NoClip); pub const ImGuiTableColumnFlags_NoSort = @enumToInt(ImGuiTableColumnFlags_.NoSort); pub const ImGuiTableColumnFlags_NoSortAscending = @enumToInt(ImGuiTableColumnFlags_.NoSortAscending); pub const ImGuiTableColumnFlags_NoSortDescending = @enumToInt(ImGuiTableColumnFlags_.NoSortDescending); pub const ImGuiTableColumnFlags_NoHeaderWidth = @enumToInt(ImGuiTableColumnFlags_.NoHeaderWidth); pub const ImGuiTableColumnFlags_PreferSortAscending = @enumToInt(ImGuiTableColumnFlags_.PreferSortAscending); pub const ImGuiTableColumnFlags_PreferSortDescending = @enumToInt(ImGuiTableColumnFlags_.PreferSortDescending); pub const ImGuiTableColumnFlags_IndentEnable = @enumToInt(ImGuiTableColumnFlags_.IndentEnable); pub const ImGuiTableColumnFlags_IndentDisable = @enumToInt(ImGuiTableColumnFlags_.IndentDisable); pub const ImGuiTableColumnFlags_IsEnabled = @enumToInt(ImGuiTableColumnFlags_.IsEnabled); pub const ImGuiTableColumnFlags_IsVisible = @enumToInt(ImGuiTableColumnFlags_.IsVisible); pub const ImGuiTableColumnFlags_IsSorted = @enumToInt(ImGuiTableColumnFlags_.IsSorted); pub const ImGuiTableColumnFlags_IsHovered = @enumToInt(ImGuiTableColumnFlags_.IsHovered); pub const ImGuiTableColumnFlags_WidthMask_ = @enumToInt(ImGuiTableColumnFlags_.WidthMask_); pub const ImGuiTableColumnFlags_IndentMask_ = @enumToInt(ImGuiTableColumnFlags_.IndentMask_); pub const ImGuiTableColumnFlags_StatusMask_ = @enumToInt(ImGuiTableColumnFlags_.StatusMask_); pub const ImGuiTableColumnFlags_NoDirectResize_ = @enumToInt(ImGuiTableColumnFlags_.NoDirectResize_); pub const ImGuiTableRowFlags_ = enum(c_int) { None = 0, Headers = 1, _, }; pub const ImGuiTableRowFlags_None = @enumToInt(ImGuiTableRowFlags_.None); pub const ImGuiTableRowFlags_Headers = @enumToInt(ImGuiTableRowFlags_.Headers); pub const ImGuiTableBgTarget_ = enum(c_int) { None = 0, RowBg0 = 1, RowBg1 = 2, CellBg = 3, _, }; pub const ImGuiTableBgTarget_None = @enumToInt(ImGuiTableBgTarget_.None); pub const ImGuiTableBgTarget_RowBg0 = @enumToInt(ImGuiTableBgTarget_.RowBg0); pub const ImGuiTableBgTarget_RowBg1 = @enumToInt(ImGuiTableBgTarget_.RowBg1); pub const ImGuiTableBgTarget_CellBg = @enumToInt(ImGuiTableBgTarget_.CellBg); pub const ImGuiFocusedFlags_ = enum(c_int) { None = 0, ChildWindows = 1, RootWindow = 2, AnyWindow = 4, RootAndChildWindows = 3, _, }; pub const ImGuiFocusedFlags_None = @enumToInt(ImGuiFocusedFlags_.None); pub const ImGuiFocusedFlags_ChildWindows = @enumToInt(ImGuiFocusedFlags_.ChildWindows); pub const ImGuiFocusedFlags_RootWindow = @enumToInt(ImGuiFocusedFlags_.RootWindow); pub const ImGuiFocusedFlags_AnyWindow = @enumToInt(ImGuiFocusedFlags_.AnyWindow); pub const ImGuiFocusedFlags_RootAndChildWindows = @enumToInt(ImGuiFocusedFlags_.RootAndChildWindows); pub const ImGuiHoveredFlags_ = enum(c_int) { None = 0, ChildWindows = 1, RootWindow = 2, AnyWindow = 4, AllowWhenBlockedByPopup = 8, AllowWhenBlockedByActiveItem = 32, AllowWhenOverlapped = 64, AllowWhenDisabled = 128, RectOnly = 104, RootAndChildWindows = 3, _, }; pub const ImGuiHoveredFlags_None = @enumToInt(ImGuiHoveredFlags_.None); pub const ImGuiHoveredFlags_ChildWindows = @enumToInt(ImGuiHoveredFlags_.ChildWindows); pub const ImGuiHoveredFlags_RootWindow = @enumToInt(ImGuiHoveredFlags_.RootWindow); pub const ImGuiHoveredFlags_AnyWindow = @enumToInt(ImGuiHoveredFlags_.AnyWindow); pub const ImGuiHoveredFlags_AllowWhenBlockedByPopup = @enumToInt(ImGuiHoveredFlags_.AllowWhenBlockedByPopup); pub const ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = @enumToInt(ImGuiHoveredFlags_.AllowWhenBlockedByActiveItem); pub const ImGuiHoveredFlags_AllowWhenOverlapped = @enumToInt(ImGuiHoveredFlags_.AllowWhenOverlapped); pub const ImGuiHoveredFlags_AllowWhenDisabled = @enumToInt(ImGuiHoveredFlags_.AllowWhenDisabled); pub const ImGuiHoveredFlags_RectOnly = @enumToInt(ImGuiHoveredFlags_.RectOnly); pub const ImGuiHoveredFlags_RootAndChildWindows = @enumToInt(ImGuiHoveredFlags_.RootAndChildWindows); pub const ImGuiDockNodeFlags_ = enum(c_int) { None = 0, KeepAliveOnly = 1, NoDockingInCentralNode = 4, PassthruCentralNode = 8, NoSplit = 16, NoResize = 32, AutoHideTabBar = 64, _, }; pub const ImGuiDockNodeFlags_None = @enumToInt(ImGuiDockNodeFlags_.None); pub const ImGuiDockNodeFlags_KeepAliveOnly = @enumToInt(ImGuiDockNodeFlags_.KeepAliveOnly); pub const ImGuiDockNodeFlags_NoDockingInCentralNode = @enumToInt(ImGuiDockNodeFlags_.NoDockingInCentralNode); pub const ImGuiDockNodeFlags_PassthruCentralNode = @enumToInt(ImGuiDockNodeFlags_.PassthruCentralNode); pub const ImGuiDockNodeFlags_NoSplit = @enumToInt(ImGuiDockNodeFlags_.NoSplit); pub const ImGuiDockNodeFlags_NoResize = @enumToInt(ImGuiDockNodeFlags_.NoResize); pub const ImGuiDockNodeFlags_AutoHideTabBar = @enumToInt(ImGuiDockNodeFlags_.AutoHideTabBar); pub const ImGuiDragDropFlags_ = enum(c_int) { None = 0, SourceNoPreviewTooltip = 1, SourceNoDisableHover = 2, SourceNoHoldToOpenOthers = 4, SourceAllowNullID = 8, SourceExtern = 16, SourceAutoExpirePayload = 32, AcceptBeforeDelivery = 1024, AcceptNoDrawDefaultRect = 2048, AcceptNoPreviewTooltip = 4096, AcceptPeekOnly = 3072, _, }; pub const ImGuiDragDropFlags_None = @enumToInt(ImGuiDragDropFlags_.None); pub const ImGuiDragDropFlags_SourceNoPreviewTooltip = @enumToInt(ImGuiDragDropFlags_.SourceNoPreviewTooltip); pub const ImGuiDragDropFlags_SourceNoDisableHover = @enumToInt(ImGuiDragDropFlags_.SourceNoDisableHover); pub const ImGuiDragDropFlags_SourceNoHoldToOpenOthers = @enumToInt(ImGuiDragDropFlags_.SourceNoHoldToOpenOthers); pub const ImGuiDragDropFlags_SourceAllowNullID = @enumToInt(ImGuiDragDropFlags_.SourceAllowNullID); pub const ImGuiDragDropFlags_SourceExtern = @enumToInt(ImGuiDragDropFlags_.SourceExtern); pub const ImGuiDragDropFlags_SourceAutoExpirePayload = @enumToInt(ImGuiDragDropFlags_.SourceAutoExpirePayload); pub const ImGuiDragDropFlags_AcceptBeforeDelivery = @enumToInt(ImGuiDragDropFlags_.AcceptBeforeDelivery); pub const ImGuiDragDropFlags_AcceptNoDrawDefaultRect = @enumToInt(ImGuiDragDropFlags_.AcceptNoDrawDefaultRect); pub const ImGuiDragDropFlags_AcceptNoPreviewTooltip = @enumToInt(ImGuiDragDropFlags_.AcceptNoPreviewTooltip); pub const ImGuiDragDropFlags_AcceptPeekOnly = @enumToInt(ImGuiDragDropFlags_.AcceptPeekOnly); pub const ImGuiDataType_ = enum(c_int) { S8, U8, S16, U16, S32, U32, S64, U64, Float, Double, COUNT, _, }; pub const ImGuiDataType_S8 = @enumToInt(ImGuiDataType_.S8); pub const ImGuiDataType_U8 = @enumToInt(ImGuiDataType_.U8); pub const ImGuiDataType_S16 = @enumToInt(ImGuiDataType_.S16); pub const ImGuiDataType_U16 = @enumToInt(ImGuiDataType_.U16); pub const ImGuiDataType_S32 = @enumToInt(ImGuiDataType_.S32); pub const ImGuiDataType_U32 = @enumToInt(ImGuiDataType_.U32); pub const ImGuiDataType_S64 = @enumToInt(ImGuiDataType_.S64); pub const ImGuiDataType_U64 = @enumToInt(ImGuiDataType_.U64); pub const ImGuiDataType_Float = @enumToInt(ImGuiDataType_.Float); pub const ImGuiDataType_Double = @enumToInt(ImGuiDataType_.Double); pub const ImGuiDataType_COUNT = @enumToInt(ImGuiDataType_.COUNT); pub const ImGuiDir_ = enum(c_int) { None = -1, Left = 0, Right = 1, Up = 2, Down = 3, COUNT = 4, _, }; pub const ImGuiDir_None = @enumToInt(ImGuiDir_.None); pub const ImGuiDir_Left = @enumToInt(ImGuiDir_.Left); pub const ImGuiDir_Right = @enumToInt(ImGuiDir_.Right); pub const ImGuiDir_Up = @enumToInt(ImGuiDir_.Up); pub const ImGuiDir_Down = @enumToInt(ImGuiDir_.Down); pub const ImGuiDir_COUNT = @enumToInt(ImGuiDir_.COUNT); pub const ImGuiSortDirection_ = enum(c_int) { None = 0, Ascending = 1, Descending = 2, _, }; pub const ImGuiSortDirection_None = @enumToInt(ImGuiSortDirection_.None); pub const ImGuiSortDirection_Ascending = @enumToInt(ImGuiSortDirection_.Ascending); pub const ImGuiSortDirection_Descending = @enumToInt(ImGuiSortDirection_.Descending); pub const ImGuiKey_ = enum(c_int) { Tab, LeftArrow, RightArrow, UpArrow, DownArrow, PageUp, PageDown, Home, End, Insert, Delete, Backspace, Space, Enter, Escape, KeyPadEnter, A, C, V, X, Y, Z, COUNT, _, }; pub const ImGuiKey_Tab = @enumToInt(ImGuiKey_.Tab); pub const ImGuiKey_LeftArrow = @enumToInt(ImGuiKey_.LeftArrow); pub const ImGuiKey_RightArrow = @enumToInt(ImGuiKey_.RightArrow); pub const ImGuiKey_UpArrow = @enumToInt(ImGuiKey_.UpArrow); pub const ImGuiKey_DownArrow = @enumToInt(ImGuiKey_.DownArrow); pub const ImGuiKey_PageUp = @enumToInt(ImGuiKey_.PageUp); pub const ImGuiKey_PageDown = @enumToInt(ImGuiKey_.PageDown); pub const ImGuiKey_Home = @enumToInt(ImGuiKey_.Home); pub const ImGuiKey_End = @enumToInt(ImGuiKey_.End); pub const ImGuiKey_Insert = @enumToInt(ImGuiKey_.Insert); pub const ImGuiKey_Delete = @enumToInt(ImGuiKey_.Delete); pub const ImGuiKey_Backspace = @enumToInt(ImGuiKey_.Backspace); pub const ImGuiKey_Space = @enumToInt(ImGuiKey_.Space); pub const ImGuiKey_Enter = @enumToInt(ImGuiKey_.Enter); pub const ImGuiKey_Escape = @enumToInt(ImGuiKey_.Escape); pub const ImGuiKey_KeyPadEnter = @enumToInt(ImGuiKey_.KeyPadEnter); pub const ImGuiKey_A = @enumToInt(ImGuiKey_.A); pub const ImGuiKey_C = @enumToInt(ImGuiKey_.C); pub const ImGuiKey_V = @enumToInt(ImGuiKey_.V); pub const ImGuiKey_X = @enumToInt(ImGuiKey_.X); pub const ImGuiKey_Y = @enumToInt(ImGuiKey_.Y); pub const ImGuiKey_Z = @enumToInt(ImGuiKey_.Z); pub const ImGuiKey_COUNT = @enumToInt(ImGuiKey_.COUNT); pub const ImGuiKeyModFlags_ = enum(c_int) { None = 0, Ctrl = 1, Shift = 2, Alt = 4, Super = 8, _, }; pub const ImGuiKeyModFlags_None = @enumToInt(ImGuiKeyModFlags_.None); pub const ImGuiKeyModFlags_Ctrl = @enumToInt(ImGuiKeyModFlags_.Ctrl); pub const ImGuiKeyModFlags_Shift = @enumToInt(ImGuiKeyModFlags_.Shift); pub const ImGuiKeyModFlags_Alt = @enumToInt(ImGuiKeyModFlags_.Alt); pub const ImGuiKeyModFlags_Super = @enumToInt(ImGuiKeyModFlags_.Super); pub const ImGuiNavInput_ = enum(c_int) { Activate = 0, Cancel = 1, Input = 2, Menu = 3, DpadLeft = 4, DpadRight = 5, DpadUp = 6, DpadDown = 7, LStickLeft = 8, LStickRight = 9, LStickUp = 10, LStickDown = 11, FocusPrev = 12, FocusNext = 13, TweakSlow = 14, TweakFast = 15, KeyMenu_ = 16, KeyLeft_ = 17, KeyRight_ = 18, KeyUp_ = 19, KeyDown_ = 20, COUNT = 21, InternalStart_ = 16, _, }; pub const ImGuiNavInput_Activate = @enumToInt(ImGuiNavInput_.Activate); pub const ImGuiNavInput_Cancel = @enumToInt(ImGuiNavInput_.Cancel); pub const ImGuiNavInput_Input = @enumToInt(ImGuiNavInput_.Input); pub const ImGuiNavInput_Menu = @enumToInt(ImGuiNavInput_.Menu); pub const ImGuiNavInput_DpadLeft = @enumToInt(ImGuiNavInput_.DpadLeft); pub const ImGuiNavInput_DpadRight = @enumToInt(ImGuiNavInput_.DpadRight); pub const ImGuiNavInput_DpadUp = @enumToInt(ImGuiNavInput_.DpadUp); pub const ImGuiNavInput_DpadDown = @enumToInt(ImGuiNavInput_.DpadDown); pub const ImGuiNavInput_LStickLeft = @enumToInt(ImGuiNavInput_.LStickLeft); pub const ImGuiNavInput_LStickRight = @enumToInt(ImGuiNavInput_.LStickRight); pub const ImGuiNavInput_LStickUp = @enumToInt(ImGuiNavInput_.LStickUp); pub const ImGuiNavInput_LStickDown = @enumToInt(ImGuiNavInput_.LStickDown); pub const ImGuiNavInput_FocusPrev = @enumToInt(ImGuiNavInput_.FocusPrev); pub const ImGuiNavInput_FocusNext = @enumToInt(ImGuiNavInput_.FocusNext); pub const ImGuiNavInput_TweakSlow = @enumToInt(ImGuiNavInput_.TweakSlow); pub const ImGuiNavInput_TweakFast = @enumToInt(ImGuiNavInput_.TweakFast); pub const ImGuiNavInput_KeyMenu_ = @enumToInt(ImGuiNavInput_.KeyMenu_); pub const ImGuiNavInput_KeyLeft_ = @enumToInt(ImGuiNavInput_.KeyLeft_); pub const ImGuiNavInput_KeyRight_ = @enumToInt(ImGuiNavInput_.KeyRight_); pub const ImGuiNavInput_KeyUp_ = @enumToInt(ImGuiNavInput_.KeyUp_); pub const ImGuiNavInput_KeyDown_ = @enumToInt(ImGuiNavInput_.KeyDown_); pub const ImGuiNavInput_COUNT = @enumToInt(ImGuiNavInput_.COUNT); pub const ImGuiNavInput_InternalStart_ = @enumToInt(ImGuiNavInput_.InternalStart_); pub const ImGuiConfigFlags_ = enum(c_int) { None = 0, NavEnableKeyboard = 1, NavEnableGamepad = 2, NavEnableSetMousePos = 4, NavNoCaptureKeyboard = 8, NoMouse = 16, NoMouseCursorChange = 32, DockingEnable = 64, ViewportsEnable = 1024, DpiEnableScaleViewports = 16384, DpiEnableScaleFonts = 32768, IsSRGB = 1048576, IsTouchScreen = 2097152, _, }; pub const ImGuiConfigFlags_None = @enumToInt(ImGuiConfigFlags_.None); pub const ImGuiConfigFlags_NavEnableKeyboard = @enumToInt(ImGuiConfigFlags_.NavEnableKeyboard); pub const ImGuiConfigFlags_NavEnableGamepad = @enumToInt(ImGuiConfigFlags_.NavEnableGamepad); pub const ImGuiConfigFlags_NavEnableSetMousePos = @enumToInt(ImGuiConfigFlags_.NavEnableSetMousePos); pub const ImGuiConfigFlags_NavNoCaptureKeyboard = @enumToInt(ImGuiConfigFlags_.NavNoCaptureKeyboard); pub const ImGuiConfigFlags_NoMouse = @enumToInt(ImGuiConfigFlags_.NoMouse); pub const ImGuiConfigFlags_NoMouseCursorChange = @enumToInt(ImGuiConfigFlags_.NoMouseCursorChange); pub const ImGuiConfigFlags_DockingEnable = @enumToInt(ImGuiConfigFlags_.DockingEnable); pub const ImGuiConfigFlags_ViewportsEnable = @enumToInt(ImGuiConfigFlags_.ViewportsEnable); pub const ImGuiConfigFlags_DpiEnableScaleViewports = @enumToInt(ImGuiConfigFlags_.DpiEnableScaleViewports); pub const ImGuiConfigFlags_DpiEnableScaleFonts = @enumToInt(ImGuiConfigFlags_.DpiEnableScaleFonts); pub const ImGuiConfigFlags_IsSRGB = @enumToInt(ImGuiConfigFlags_.IsSRGB); pub const ImGuiConfigFlags_IsTouchScreen = @enumToInt(ImGuiConfigFlags_.IsTouchScreen); pub const ImGuiBackendFlags_ = enum(c_int) { None = 0, HasGamepad = 1, HasMouseCursors = 2, HasSetMousePos = 4, RendererHasVtxOffset = 8, PlatformHasViewports = 1024, HasMouseHoveredViewport = 2048, RendererHasViewports = 4096, _, }; pub const ImGuiBackendFlags_None = @enumToInt(ImGuiBackendFlags_.None); pub const ImGuiBackendFlags_HasGamepad = @enumToInt(ImGuiBackendFlags_.HasGamepad); pub const ImGuiBackendFlags_HasMouseCursors = @enumToInt(ImGuiBackendFlags_.HasMouseCursors); pub const ImGuiBackendFlags_HasSetMousePos = @enumToInt(ImGuiBackendFlags_.HasSetMousePos); pub const ImGuiBackendFlags_RendererHasVtxOffset = @enumToInt(ImGuiBackendFlags_.RendererHasVtxOffset); pub const ImGuiBackendFlags_PlatformHasViewports = @enumToInt(ImGuiBackendFlags_.PlatformHasViewports); pub const ImGuiBackendFlags_HasMouseHoveredViewport = @enumToInt(ImGuiBackendFlags_.HasMouseHoveredViewport); pub const ImGuiBackendFlags_RendererHasViewports = @enumToInt(ImGuiBackendFlags_.RendererHasViewports); pub const ImGuiCol_ = enum(c_int) { Text, TextDisabled, WindowBg, ChildBg, PopupBg, Border, BorderShadow, FrameBg, FrameBgHovered, FrameBgActive, TitleBg, TitleBgActive, TitleBgCollapsed, MenuBarBg, ScrollbarBg, ScrollbarGrab, ScrollbarGrabHovered, ScrollbarGrabActive, CheckMark, SliderGrab, SliderGrabActive, Button, ButtonHovered, ButtonActive, Header, HeaderHovered, HeaderActive, Separator, SeparatorHovered, SeparatorActive, ResizeGrip, ResizeGripHovered, ResizeGripActive, Tab, TabHovered, TabActive, TabUnfocused, TabUnfocusedActive, DockingPreview, DockingEmptyBg, PlotLines, PlotLinesHovered, PlotHistogram, PlotHistogramHovered, TableHeaderBg, TableBorderStrong, TableBorderLight, TableRowBg, TableRowBgAlt, TextSelectedBg, DragDropTarget, NavHighlight, NavWindowingHighlight, NavWindowingDimBg, ModalWindowDimBg, COUNT, _, }; pub const ImGuiCol_Text = @enumToInt(ImGuiCol_.Text); pub const ImGuiCol_TextDisabled = @enumToInt(ImGuiCol_.TextDisabled); pub const ImGuiCol_WindowBg = @enumToInt(ImGuiCol_.WindowBg); pub const ImGuiCol_ChildBg = @enumToInt(ImGuiCol_.ChildBg); pub const ImGuiCol_PopupBg = @enumToInt(ImGuiCol_.PopupBg); pub const ImGuiCol_Border = @enumToInt(ImGuiCol_.Border); pub const ImGuiCol_BorderShadow = @enumToInt(ImGuiCol_.BorderShadow); pub const ImGuiCol_FrameBg = @enumToInt(ImGuiCol_.FrameBg); pub const ImGuiCol_FrameBgHovered = @enumToInt(ImGuiCol_.FrameBgHovered); pub const ImGuiCol_FrameBgActive = @enumToInt(ImGuiCol_.FrameBgActive); pub const ImGuiCol_TitleBg = @enumToInt(ImGuiCol_.TitleBg); pub const ImGuiCol_TitleBgActive = @enumToInt(ImGuiCol_.TitleBgActive); pub const ImGuiCol_TitleBgCollapsed = @enumToInt(ImGuiCol_.TitleBgCollapsed); pub const ImGuiCol_MenuBarBg = @enumToInt(ImGuiCol_.MenuBarBg); pub const ImGuiCol_ScrollbarBg = @enumToInt(ImGuiCol_.ScrollbarBg); pub const ImGuiCol_ScrollbarGrab = @enumToInt(ImGuiCol_.ScrollbarGrab); pub const ImGuiCol_ScrollbarGrabHovered = @enumToInt(ImGuiCol_.ScrollbarGrabHovered); pub const ImGuiCol_ScrollbarGrabActive = @enumToInt(ImGuiCol_.ScrollbarGrabActive); pub const ImGuiCol_CheckMark = @enumToInt(ImGuiCol_.CheckMark); pub const ImGuiCol_SliderGrab = @enumToInt(ImGuiCol_.SliderGrab); pub const ImGuiCol_SliderGrabActive = @enumToInt(ImGuiCol_.SliderGrabActive); pub const ImGuiCol_Button = @enumToInt(ImGuiCol_.Button); pub const ImGuiCol_ButtonHovered = @enumToInt(ImGuiCol_.ButtonHovered); pub const ImGuiCol_ButtonActive = @enumToInt(ImGuiCol_.ButtonActive); pub const ImGuiCol_Header = @enumToInt(ImGuiCol_.Header); pub const ImGuiCol_HeaderHovered = @enumToInt(ImGuiCol_.HeaderHovered); pub const ImGuiCol_HeaderActive = @enumToInt(ImGuiCol_.HeaderActive); pub const ImGuiCol_Separator = @enumToInt(ImGuiCol_.Separator); pub const ImGuiCol_SeparatorHovered = @enumToInt(ImGuiCol_.SeparatorHovered); pub const ImGuiCol_SeparatorActive = @enumToInt(ImGuiCol_.SeparatorActive); pub const ImGuiCol_ResizeGrip = @enumToInt(ImGuiCol_.ResizeGrip); pub const ImGuiCol_ResizeGripHovered = @enumToInt(ImGuiCol_.ResizeGripHovered); pub const ImGuiCol_ResizeGripActive = @enumToInt(ImGuiCol_.ResizeGripActive); pub const ImGuiCol_Tab = @enumToInt(ImGuiCol_.Tab); pub const ImGuiCol_TabHovered = @enumToInt(ImGuiCol_.TabHovered); pub const ImGuiCol_TabActive = @enumToInt(ImGuiCol_.TabActive); pub const ImGuiCol_TabUnfocused = @enumToInt(ImGuiCol_.TabUnfocused); pub const ImGuiCol_TabUnfocusedActive = @enumToInt(ImGuiCol_.TabUnfocusedActive); pub const ImGuiCol_DockingPreview = @enumToInt(ImGuiCol_.DockingPreview); pub const ImGuiCol_DockingEmptyBg = @enumToInt(ImGuiCol_.DockingEmptyBg); pub const ImGuiCol_PlotLines = @enumToInt(ImGuiCol_.PlotLines); pub const ImGuiCol_PlotLinesHovered = @enumToInt(ImGuiCol_.PlotLinesHovered); pub const ImGuiCol_PlotHistogram = @enumToInt(ImGuiCol_.PlotHistogram); pub const ImGuiCol_PlotHistogramHovered = @enumToInt(ImGuiCol_.PlotHistogramHovered); pub const ImGuiCol_TableHeaderBg = @enumToInt(ImGuiCol_.TableHeaderBg); pub const ImGuiCol_TableBorderStrong = @enumToInt(ImGuiCol_.TableBorderStrong); pub const ImGuiCol_TableBorderLight = @enumToInt(ImGuiCol_.TableBorderLight); pub const ImGuiCol_TableRowBg = @enumToInt(ImGuiCol_.TableRowBg); pub const ImGuiCol_TableRowBgAlt = @enumToInt(ImGuiCol_.TableRowBgAlt); pub const ImGuiCol_TextSelectedBg = @enumToInt(ImGuiCol_.TextSelectedBg); pub const ImGuiCol_DragDropTarget = @enumToInt(ImGuiCol_.DragDropTarget); pub const ImGuiCol_NavHighlight = @enumToInt(ImGuiCol_.NavHighlight); pub const ImGuiCol_NavWindowingHighlight = @enumToInt(ImGuiCol_.NavWindowingHighlight); pub const ImGuiCol_NavWindowingDimBg = @enumToInt(ImGuiCol_.NavWindowingDimBg); pub const ImGuiCol_ModalWindowDimBg = @enumToInt(ImGuiCol_.ModalWindowDimBg); pub const ImGuiCol_COUNT = @enumToInt(ImGuiCol_.COUNT); pub const ImGuiStyleVar_ = enum(c_int) { Alpha, WindowPadding, WindowRounding, WindowBorderSize, WindowMinSize, WindowTitleAlign, ChildRounding, ChildBorderSize, PopupRounding, PopupBorderSize, FramePadding, FrameRounding, FrameBorderSize, ItemSpacing, ItemInnerSpacing, IndentSpacing, CellPadding, ScrollbarSize, ScrollbarRounding, GrabMinSize, GrabRounding, TabRounding, ButtonTextAlign, SelectableTextAlign, COUNT, _, }; pub const ImGuiStyleVar_Alpha = @enumToInt(ImGuiStyleVar_.Alpha); pub const ImGuiStyleVar_WindowPadding = @enumToInt(ImGuiStyleVar_.WindowPadding); pub const ImGuiStyleVar_WindowRounding = @enumToInt(ImGuiStyleVar_.WindowRounding); pub const ImGuiStyleVar_WindowBorderSize = @enumToInt(ImGuiStyleVar_.WindowBorderSize); pub const ImGuiStyleVar_WindowMinSize = @enumToInt(ImGuiStyleVar_.WindowMinSize); pub const ImGuiStyleVar_WindowTitleAlign = @enumToInt(ImGuiStyleVar_.WindowTitleAlign); pub const ImGuiStyleVar_ChildRounding = @enumToInt(ImGuiStyleVar_.ChildRounding); pub const ImGuiStyleVar_ChildBorderSize = @enumToInt(ImGuiStyleVar_.ChildBorderSize); pub const ImGuiStyleVar_PopupRounding = @enumToInt(ImGuiStyleVar_.PopupRounding); pub const ImGuiStyleVar_PopupBorderSize = @enumToInt(ImGuiStyleVar_.PopupBorderSize); pub const ImGuiStyleVar_FramePadding = @enumToInt(ImGuiStyleVar_.FramePadding); pub const ImGuiStyleVar_FrameRounding = @enumToInt(ImGuiStyleVar_.FrameRounding); pub const ImGuiStyleVar_FrameBorderSize = @enumToInt(ImGuiStyleVar_.FrameBorderSize); pub const ImGuiStyleVar_ItemSpacing = @enumToInt(ImGuiStyleVar_.ItemSpacing); pub const ImGuiStyleVar_ItemInnerSpacing = @enumToInt(ImGuiStyleVar_.ItemInnerSpacing); pub const ImGuiStyleVar_IndentSpacing = @enumToInt(ImGuiStyleVar_.IndentSpacing); pub const ImGuiStyleVar_CellPadding = @enumToInt(ImGuiStyleVar_.CellPadding); pub const ImGuiStyleVar_ScrollbarSize = @enumToInt(ImGuiStyleVar_.ScrollbarSize); pub const ImGuiStyleVar_ScrollbarRounding = @enumToInt(ImGuiStyleVar_.ScrollbarRounding); pub const ImGuiStyleVar_GrabMinSize = @enumToInt(ImGuiStyleVar_.GrabMinSize); pub const ImGuiStyleVar_GrabRounding = @enumToInt(ImGuiStyleVar_.GrabRounding); pub const ImGuiStyleVar_TabRounding = @enumToInt(ImGuiStyleVar_.TabRounding); pub const ImGuiStyleVar_ButtonTextAlign = @enumToInt(ImGuiStyleVar_.ButtonTextAlign); pub const ImGuiStyleVar_SelectableTextAlign = @enumToInt(ImGuiStyleVar_.SelectableTextAlign); pub const ImGuiStyleVar_COUNT = @enumToInt(ImGuiStyleVar_.COUNT); pub const ImGuiButtonFlags_ = enum(c_int) { None = 0, MouseButtonLeft = 1, MouseButtonRight = 2, MouseButtonMiddle = 4, MouseButtonMask_ = 7, _, }; pub const ImGuiButtonFlags_None = @enumToInt(ImGuiButtonFlags_.None); pub const ImGuiButtonFlags_MouseButtonLeft = @enumToInt(ImGuiButtonFlags_.MouseButtonLeft); pub const ImGuiButtonFlags_MouseButtonRight = @enumToInt(ImGuiButtonFlags_.MouseButtonRight); pub const ImGuiButtonFlags_MouseButtonMiddle = @enumToInt(ImGuiButtonFlags_.MouseButtonMiddle); pub const ImGuiButtonFlags_MouseButtonMask_ = @enumToInt(ImGuiButtonFlags_.MouseButtonMask_); pub const ImGuiButtonFlags_MouseButtonDefault_: c_int = 1; pub const ImGuiColorEditFlags_ = enum(c_int) { None = 0, NoAlpha = 2, NoPicker = 4, NoOptions = 8, NoSmallPreview = 16, NoInputs = 32, NoTooltip = 64, NoLabel = 128, NoSidePreview = 256, NoDragDrop = 512, NoBorder = 1024, AlphaBar = 65536, AlphaPreview = 131072, AlphaPreviewHalf = 262144, HDR = 524288, DisplayRGB = 1048576, DisplayHSV = 2097152, DisplayHex = 4194304, Uint8 = 8388608, Float = 16777216, PickerHueBar = 33554432, PickerHueWheel = 67108864, InputRGB = 134217728, InputHSV = 268435456, _OptionsDefault = 177209344, _DisplayMask = 7340032, _DataTypeMask = 25165824, _PickerMask = 100663296, _InputMask = 402653184, _, }; pub const ImGuiColorEditFlags_None = @enumToInt(ImGuiColorEditFlags_.None); pub const ImGuiColorEditFlags_NoAlpha = @enumToInt(ImGuiColorEditFlags_.NoAlpha); pub const ImGuiColorEditFlags_NoPicker = @enumToInt(ImGuiColorEditFlags_.NoPicker); pub const ImGuiColorEditFlags_NoOptions = @enumToInt(ImGuiColorEditFlags_.NoOptions); pub const ImGuiColorEditFlags_NoSmallPreview = @enumToInt(ImGuiColorEditFlags_.NoSmallPreview); pub const ImGuiColorEditFlags_NoInputs = @enumToInt(ImGuiColorEditFlags_.NoInputs); pub const ImGuiColorEditFlags_NoTooltip = @enumToInt(ImGuiColorEditFlags_.NoTooltip); pub const ImGuiColorEditFlags_NoLabel = @enumToInt(ImGuiColorEditFlags_.NoLabel); pub const ImGuiColorEditFlags_NoSidePreview = @enumToInt(ImGuiColorEditFlags_.NoSidePreview); pub const ImGuiColorEditFlags_NoDragDrop = @enumToInt(ImGuiColorEditFlags_.NoDragDrop); pub const ImGuiColorEditFlags_NoBorder = @enumToInt(ImGuiColorEditFlags_.NoBorder); pub const ImGuiColorEditFlags_AlphaBar = @enumToInt(ImGuiColorEditFlags_.AlphaBar); pub const ImGuiColorEditFlags_AlphaPreview = @enumToInt(ImGuiColorEditFlags_.AlphaPreview); pub const ImGuiColorEditFlags_AlphaPreviewHalf = @enumToInt(ImGuiColorEditFlags_.AlphaPreviewHalf); pub const ImGuiColorEditFlags_HDR = @enumToInt(ImGuiColorEditFlags_.HDR); pub const ImGuiColorEditFlags_DisplayRGB = @enumToInt(ImGuiColorEditFlags_.DisplayRGB); pub const ImGuiColorEditFlags_DisplayHSV = @enumToInt(ImGuiColorEditFlags_.DisplayHSV); pub const ImGuiColorEditFlags_DisplayHex = @enumToInt(ImGuiColorEditFlags_.DisplayHex); pub const ImGuiColorEditFlags_Uint8 = @enumToInt(ImGuiColorEditFlags_.Uint8); pub const ImGuiColorEditFlags_Float = @enumToInt(ImGuiColorEditFlags_.Float); pub const ImGuiColorEditFlags_PickerHueBar = @enumToInt(ImGuiColorEditFlags_.PickerHueBar); pub const ImGuiColorEditFlags_PickerHueWheel = @enumToInt(ImGuiColorEditFlags_.PickerHueWheel); pub const ImGuiColorEditFlags_InputRGB = @enumToInt(ImGuiColorEditFlags_.InputRGB); pub const ImGuiColorEditFlags_InputHSV = @enumToInt(ImGuiColorEditFlags_.InputHSV); pub const ImGuiColorEditFlags__OptionsDefault = @enumToInt(ImGuiColorEditFlags_._OptionsDefault); pub const ImGuiColorEditFlags__DisplayMask = @enumToInt(ImGuiColorEditFlags_._DisplayMask); pub const ImGuiColorEditFlags__DataTypeMask = @enumToInt(ImGuiColorEditFlags_._DataTypeMask); pub const ImGuiColorEditFlags__PickerMask = @enumToInt(ImGuiColorEditFlags_._PickerMask); pub const ImGuiColorEditFlags__InputMask = @enumToInt(ImGuiColorEditFlags_._InputMask); pub const ImGuiSliderFlags_ = enum(c_int) { None = 0, AlwaysClamp = 16, Logarithmic = 32, NoRoundToFormat = 64, NoInput = 128, InvalidMask_ = 1879048207, _, }; pub const ImGuiSliderFlags_None = @enumToInt(ImGuiSliderFlags_.None); pub const ImGuiSliderFlags_AlwaysClamp = @enumToInt(ImGuiSliderFlags_.AlwaysClamp); pub const ImGuiSliderFlags_Logarithmic = @enumToInt(ImGuiSliderFlags_.Logarithmic); pub const ImGuiSliderFlags_NoRoundToFormat = @enumToInt(ImGuiSliderFlags_.NoRoundToFormat); pub const ImGuiSliderFlags_NoInput = @enumToInt(ImGuiSliderFlags_.NoInput); pub const ImGuiSliderFlags_InvalidMask_ = @enumToInt(ImGuiSliderFlags_.InvalidMask_); pub const ImGuiMouseButton_ = enum(c_int) { Left = 0, Right = 1, Middle = 2, COUNT = 5, _, }; pub const ImGuiMouseButton_Left = @enumToInt(ImGuiMouseButton_.Left); pub const ImGuiMouseButton_Right = @enumToInt(ImGuiMouseButton_.Right); pub const ImGuiMouseButton_Middle = @enumToInt(ImGuiMouseButton_.Middle); pub const ImGuiMouseButton_COUNT = @enumToInt(ImGuiMouseButton_.COUNT); pub const ImGuiMouseCursor_ = enum(c_int) { None = -1, Arrow = 0, TextInput = 1, ResizeAll = 2, ResizeNS = 3, ResizeEW = 4, ResizeNESW = 5, ResizeNWSE = 6, Hand = 7, NotAllowed = 8, COUNT = 9, _, }; pub const ImGuiMouseCursor_None = @enumToInt(ImGuiMouseCursor_.None); pub const ImGuiMouseCursor_Arrow = @enumToInt(ImGuiMouseCursor_.Arrow); pub const ImGuiMouseCursor_TextInput = @enumToInt(ImGuiMouseCursor_.TextInput); pub const ImGuiMouseCursor_ResizeAll = @enumToInt(ImGuiMouseCursor_.ResizeAll); pub const ImGuiMouseCursor_ResizeNS = @enumToInt(ImGuiMouseCursor_.ResizeNS); pub const ImGuiMouseCursor_ResizeEW = @enumToInt(ImGuiMouseCursor_.ResizeEW); pub const ImGuiMouseCursor_ResizeNESW = @enumToInt(ImGuiMouseCursor_.ResizeNESW); pub const ImGuiMouseCursor_ResizeNWSE = @enumToInt(ImGuiMouseCursor_.ResizeNWSE); pub const ImGuiMouseCursor_Hand = @enumToInt(ImGuiMouseCursor_.Hand); pub const ImGuiMouseCursor_NotAllowed = @enumToInt(ImGuiMouseCursor_.NotAllowed); pub const ImGuiMouseCursor_COUNT = @enumToInt(ImGuiMouseCursor_.COUNT); pub const ImGuiCond_ = enum(c_int) { None = 0, Always = 1, Once = 2, FirstUseEver = 4, Appearing = 8, _, }; pub const ImGuiCond_None = @enumToInt(ImGuiCond_.None); pub const ImGuiCond_Always = @enumToInt(ImGuiCond_.Always); pub const ImGuiCond_Once = @enumToInt(ImGuiCond_.Once); pub const ImGuiCond_FirstUseEver = @enumToInt(ImGuiCond_.FirstUseEver); pub const ImGuiCond_Appearing = @enumToInt(ImGuiCond_.Appearing); pub const ImDrawFlags_ = enum(c_int) { None = 0, Closed = 1, RoundCornersTopLeft = 16, RoundCornersTopRight = 32, RoundCornersBottomLeft = 64, RoundCornersBottomRight = 128, RoundCornersNone = 256, RoundCornersTop = 48, RoundCornersBottom = 192, RoundCornersLeft = 80, RoundCornersRight = 160, RoundCornersAll = 240, RoundCornersDefault_ = 240, RoundCornersMask_ = 496, _, }; pub const ImDrawFlags_None = @enumToInt(ImDrawFlags_.None); pub const ImDrawFlags_Closed = @enumToInt(ImDrawFlags_.Closed); pub const ImDrawFlags_RoundCornersTopLeft = @enumToInt(ImDrawFlags_.RoundCornersTopLeft); pub const ImDrawFlags_RoundCornersTopRight = @enumToInt(ImDrawFlags_.RoundCornersTopRight); pub const ImDrawFlags_RoundCornersBottomLeft = @enumToInt(ImDrawFlags_.RoundCornersBottomLeft); pub const ImDrawFlags_RoundCornersBottomRight = @enumToInt(ImDrawFlags_.RoundCornersBottomRight); pub const ImDrawFlags_RoundCornersNone = @enumToInt(ImDrawFlags_.RoundCornersNone); pub const ImDrawFlags_RoundCornersTop = @enumToInt(ImDrawFlags_.RoundCornersTop); pub const ImDrawFlags_RoundCornersBottom = @enumToInt(ImDrawFlags_.RoundCornersBottom); pub const ImDrawFlags_RoundCornersLeft = @enumToInt(ImDrawFlags_.RoundCornersLeft); pub const ImDrawFlags_RoundCornersRight = @enumToInt(ImDrawFlags_.RoundCornersRight); pub const ImDrawFlags_RoundCornersAll = @enumToInt(ImDrawFlags_.RoundCornersAll); pub const ImDrawFlags_RoundCornersDefault_ = @enumToInt(ImDrawFlags_.RoundCornersDefault_); pub const ImDrawFlags_RoundCornersMask_ = @enumToInt(ImDrawFlags_.RoundCornersMask_); pub const ImDrawListFlags_ = enum(c_int) { None = 0, AntiAliasedLines = 1, AntiAliasedLinesUseTex = 2, AntiAliasedFill = 4, AllowVtxOffset = 8, _, }; pub const ImDrawListFlags_None = @enumToInt(ImDrawListFlags_.None); pub const ImDrawListFlags_AntiAliasedLines = @enumToInt(ImDrawListFlags_.AntiAliasedLines); pub const ImDrawListFlags_AntiAliasedLinesUseTex = @enumToInt(ImDrawListFlags_.AntiAliasedLinesUseTex); pub const ImDrawListFlags_AntiAliasedFill = @enumToInt(ImDrawListFlags_.AntiAliasedFill); pub const ImDrawListFlags_AllowVtxOffset = @enumToInt(ImDrawListFlags_.AllowVtxOffset); pub const ImFontAtlasFlags_ = enum(c_int) { None = 0, NoPowerOfTwoHeight = 1, NoMouseCursors = 2, NoBakedLines = 4, _, }; pub const ImFontAtlasFlags_None = @enumToInt(ImFontAtlasFlags_.None); pub const ImFontAtlasFlags_NoPowerOfTwoHeight = @enumToInt(ImFontAtlasFlags_.NoPowerOfTwoHeight); pub const ImFontAtlasFlags_NoMouseCursors = @enumToInt(ImFontAtlasFlags_.NoMouseCursors); pub const ImFontAtlasFlags_NoBakedLines = @enumToInt(ImFontAtlasFlags_.NoBakedLines); pub const ImGuiViewportFlags_ = enum(c_int) { None = 0, IsPlatformWindow = 1, IsPlatformMonitor = 2, OwnedByApp = 4, NoDecoration = 8, NoTaskBarIcon = 16, NoFocusOnAppearing = 32, NoFocusOnClick = 64, NoInputs = 128, NoRendererClear = 256, TopMost = 512, Minimized = 1024, NoAutoMerge = 2048, CanHostOtherWindows = 4096, _, }; pub const ImGuiViewportFlags_None = @enumToInt(ImGuiViewportFlags_.None); pub const ImGuiViewportFlags_IsPlatformWindow = @enumToInt(ImGuiViewportFlags_.IsPlatformWindow); pub const ImGuiViewportFlags_IsPlatformMonitor = @enumToInt(ImGuiViewportFlags_.IsPlatformMonitor); pub const ImGuiViewportFlags_OwnedByApp = @enumToInt(ImGuiViewportFlags_.OwnedByApp); pub const ImGuiViewportFlags_NoDecoration = @enumToInt(ImGuiViewportFlags_.NoDecoration); pub const ImGuiViewportFlags_NoTaskBarIcon = @enumToInt(ImGuiViewportFlags_.NoTaskBarIcon); pub const ImGuiViewportFlags_NoFocusOnAppearing = @enumToInt(ImGuiViewportFlags_.NoFocusOnAppearing); pub const ImGuiViewportFlags_NoFocusOnClick = @enumToInt(ImGuiViewportFlags_.NoFocusOnClick); pub const ImGuiViewportFlags_NoInputs = @enumToInt(ImGuiViewportFlags_.NoInputs); pub const ImGuiViewportFlags_NoRendererClear = @enumToInt(ImGuiViewportFlags_.NoRendererClear); pub const ImGuiViewportFlags_TopMost = @enumToInt(ImGuiViewportFlags_.TopMost); pub const ImGuiViewportFlags_Minimized = @enumToInt(ImGuiViewportFlags_.Minimized); pub const ImGuiViewportFlags_NoAutoMerge = @enumToInt(ImGuiViewportFlags_.NoAutoMerge); pub const ImGuiViewportFlags_CanHostOtherWindows = @enumToInt(ImGuiViewportFlags_.CanHostOtherWindows); pub const ImGuiItemFlags_ = enum(c_int) { None = 0, NoTabStop = 1, ButtonRepeat = 2, Disabled = 4, NoNav = 8, NoNavDefaultFocus = 16, SelectableDontClosePopup = 32, MixedValue = 64, ReadOnly = 128, _, }; pub const ImGuiItemFlags_None = @enumToInt(ImGuiItemFlags_.None); pub const ImGuiItemFlags_NoTabStop = @enumToInt(ImGuiItemFlags_.NoTabStop); pub const ImGuiItemFlags_ButtonRepeat = @enumToInt(ImGuiItemFlags_.ButtonRepeat); pub const ImGuiItemFlags_Disabled = @enumToInt(ImGuiItemFlags_.Disabled); pub const ImGuiItemFlags_NoNav = @enumToInt(ImGuiItemFlags_.NoNav); pub const ImGuiItemFlags_NoNavDefaultFocus = @enumToInt(ImGuiItemFlags_.NoNavDefaultFocus); pub const ImGuiItemFlags_SelectableDontClosePopup = @enumToInt(ImGuiItemFlags_.SelectableDontClosePopup); pub const ImGuiItemFlags_MixedValue = @enumToInt(ImGuiItemFlags_.MixedValue); pub const ImGuiItemFlags_ReadOnly = @enumToInt(ImGuiItemFlags_.ReadOnly); pub const ImGuiItemAddFlags_ = enum(c_int) { None = 0, Focusable = 1, _, }; pub const ImGuiItemAddFlags_None = @enumToInt(ImGuiItemAddFlags_.None); pub const ImGuiItemAddFlags_Focusable = @enumToInt(ImGuiItemAddFlags_.Focusable); pub const ImGuiItemStatusFlags_ = enum(c_int) { None = 0, HoveredRect = 1, HasDisplayRect = 2, Edited = 4, ToggledSelection = 8, ToggledOpen = 16, HasDeactivated = 32, Deactivated = 64, HoveredWindow = 128, FocusedByCode = 256, FocusedByTabbing = 512, Focused = 768, _, }; pub const ImGuiItemStatusFlags_None = @enumToInt(ImGuiItemStatusFlags_.None); pub const ImGuiItemStatusFlags_HoveredRect = @enumToInt(ImGuiItemStatusFlags_.HoveredRect); pub const ImGuiItemStatusFlags_HasDisplayRect = @enumToInt(ImGuiItemStatusFlags_.HasDisplayRect); pub const ImGuiItemStatusFlags_Edited = @enumToInt(ImGuiItemStatusFlags_.Edited); pub const ImGuiItemStatusFlags_ToggledSelection = @enumToInt(ImGuiItemStatusFlags_.ToggledSelection); pub const ImGuiItemStatusFlags_ToggledOpen = @enumToInt(ImGuiItemStatusFlags_.ToggledOpen); pub const ImGuiItemStatusFlags_HasDeactivated = @enumToInt(ImGuiItemStatusFlags_.HasDeactivated); pub const ImGuiItemStatusFlags_Deactivated = @enumToInt(ImGuiItemStatusFlags_.Deactivated); pub const ImGuiItemStatusFlags_HoveredWindow = @enumToInt(ImGuiItemStatusFlags_.HoveredWindow); pub const ImGuiItemStatusFlags_FocusedByCode = @enumToInt(ImGuiItemStatusFlags_.FocusedByCode); pub const ImGuiItemStatusFlags_FocusedByTabbing = @enumToInt(ImGuiItemStatusFlags_.FocusedByTabbing); pub const ImGuiItemStatusFlags_Focused = @enumToInt(ImGuiItemStatusFlags_.Focused); pub const ImGuiInputTextFlagsPrivate_ = enum(c_int) { ImGuiInputTextFlags_Multiline = 67108864, ImGuiInputTextFlags_NoMarkEdited = 134217728, ImGuiInputTextFlags_MergedItem = 268435456, _, }; pub const ImGuiInputTextFlags_Multiline = @enumToInt(ImGuiInputTextFlagsPrivate_.ImGuiInputTextFlags_Multiline); pub const ImGuiInputTextFlags_NoMarkEdited = @enumToInt(ImGuiInputTextFlagsPrivate_.ImGuiInputTextFlags_NoMarkEdited); pub const ImGuiInputTextFlags_MergedItem = @enumToInt(ImGuiInputTextFlagsPrivate_.ImGuiInputTextFlags_MergedItem); pub const ImGuiButtonFlagsPrivate_ = enum(c_int) { ImGuiButtonFlags_PressedOnClick = 16, ImGuiButtonFlags_PressedOnClickRelease = 32, ImGuiButtonFlags_PressedOnClickReleaseAnywhere = 64, ImGuiButtonFlags_PressedOnRelease = 128, ImGuiButtonFlags_PressedOnDoubleClick = 256, ImGuiButtonFlags_PressedOnDragDropHold = 512, ImGuiButtonFlags_Repeat = 1024, ImGuiButtonFlags_FlattenChildren = 2048, ImGuiButtonFlags_AllowItemOverlap = 4096, ImGuiButtonFlags_DontClosePopups = 8192, ImGuiButtonFlags_Disabled = 16384, ImGuiButtonFlags_AlignTextBaseLine = 32768, ImGuiButtonFlags_NoKeyModifiers = 65536, ImGuiButtonFlags_NoHoldingActiveId = 131072, ImGuiButtonFlags_NoNavFocus = 262144, ImGuiButtonFlags_NoHoveredOnFocus = 524288, ImGuiButtonFlags_PressedOnMask_ = 1008, ImGuiButtonFlags_PressedOnDefault_ = 32, _, }; pub const ImGuiButtonFlags_PressedOnClick = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnClick); pub const ImGuiButtonFlags_PressedOnClickRelease = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnClickRelease); pub const ImGuiButtonFlags_PressedOnClickReleaseAnywhere = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnClickReleaseAnywhere); pub const ImGuiButtonFlags_PressedOnRelease = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnRelease); pub const ImGuiButtonFlags_PressedOnDoubleClick = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnDoubleClick); pub const ImGuiButtonFlags_PressedOnDragDropHold = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnDragDropHold); pub const ImGuiButtonFlags_Repeat = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_Repeat); pub const ImGuiButtonFlags_FlattenChildren = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_FlattenChildren); pub const ImGuiButtonFlags_AllowItemOverlap = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_AllowItemOverlap); pub const ImGuiButtonFlags_DontClosePopups = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_DontClosePopups); pub const ImGuiButtonFlags_Disabled = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_Disabled); pub const ImGuiButtonFlags_AlignTextBaseLine = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_AlignTextBaseLine); pub const ImGuiButtonFlags_NoKeyModifiers = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_NoKeyModifiers); pub const ImGuiButtonFlags_NoHoldingActiveId = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_NoHoldingActiveId); pub const ImGuiButtonFlags_NoNavFocus = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_NoNavFocus); pub const ImGuiButtonFlags_NoHoveredOnFocus = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_NoHoveredOnFocus); pub const ImGuiButtonFlags_PressedOnMask_ = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnMask_); pub const ImGuiButtonFlags_PressedOnDefault_ = @enumToInt(ImGuiButtonFlagsPrivate_.ImGuiButtonFlags_PressedOnDefault_); pub const ImGuiSliderFlagsPrivate_ = enum(c_int) { ImGuiSliderFlags_Vertical = 1048576, ImGuiSliderFlags_ReadOnly = 2097152, _, }; pub const ImGuiSliderFlags_Vertical = @enumToInt(ImGuiSliderFlagsPrivate_.ImGuiSliderFlags_Vertical); pub const ImGuiSliderFlags_ReadOnly = @enumToInt(ImGuiSliderFlagsPrivate_.ImGuiSliderFlags_ReadOnly); pub const ImGuiSelectableFlagsPrivate_ = enum(c_int) { ImGuiSelectableFlags_NoHoldingActiveID = 1048576, ImGuiSelectableFlags_SelectOnClick = 2097152, ImGuiSelectableFlags_SelectOnRelease = 4194304, ImGuiSelectableFlags_SpanAvailWidth = 8388608, ImGuiSelectableFlags_DrawHoveredWhenHeld = 16777216, ImGuiSelectableFlags_SetNavIdOnHover = 33554432, ImGuiSelectableFlags_NoPadWithHalfSpacing = 67108864, _, }; pub const ImGuiSelectableFlags_NoHoldingActiveID = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_NoHoldingActiveID); pub const ImGuiSelectableFlags_SelectOnClick = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_SelectOnClick); pub const ImGuiSelectableFlags_SelectOnRelease = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_SelectOnRelease); pub const ImGuiSelectableFlags_SpanAvailWidth = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_SpanAvailWidth); pub const ImGuiSelectableFlags_DrawHoveredWhenHeld = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_DrawHoveredWhenHeld); pub const ImGuiSelectableFlags_SetNavIdOnHover = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_SetNavIdOnHover); pub const ImGuiSelectableFlags_NoPadWithHalfSpacing = @enumToInt(ImGuiSelectableFlagsPrivate_.ImGuiSelectableFlags_NoPadWithHalfSpacing); pub const ImGuiTreeNodeFlagsPrivate_ = enum(c_int) { ImGuiTreeNodeFlags_ClipLabelForTrailingButton = 1048576, _, }; pub const ImGuiTreeNodeFlags_ClipLabelForTrailingButton = @enumToInt(ImGuiTreeNodeFlagsPrivate_.ImGuiTreeNodeFlags_ClipLabelForTrailingButton); pub const ImGuiSeparatorFlags_ = enum(c_int) { None = 0, Horizontal = 1, Vertical = 2, SpanAllColumns = 4, _, }; pub const ImGuiSeparatorFlags_None = @enumToInt(ImGuiSeparatorFlags_.None); pub const ImGuiSeparatorFlags_Horizontal = @enumToInt(ImGuiSeparatorFlags_.Horizontal); pub const ImGuiSeparatorFlags_Vertical = @enumToInt(ImGuiSeparatorFlags_.Vertical); pub const ImGuiSeparatorFlags_SpanAllColumns = @enumToInt(ImGuiSeparatorFlags_.SpanAllColumns); pub const ImGuiTextFlags_ = enum(c_int) { None = 0, NoWidthForLargeClippedText = 1, _, }; pub const ImGuiTextFlags_None = @enumToInt(ImGuiTextFlags_.None); pub const ImGuiTextFlags_NoWidthForLargeClippedText = @enumToInt(ImGuiTextFlags_.NoWidthForLargeClippedText); pub const ImGuiTooltipFlags_ = enum(c_int) { None = 0, OverridePreviousTooltip = 1, _, }; pub const ImGuiTooltipFlags_None = @enumToInt(ImGuiTooltipFlags_.None); pub const ImGuiTooltipFlags_OverridePreviousTooltip = @enumToInt(ImGuiTooltipFlags_.OverridePreviousTooltip); pub const ImGuiLayoutType_ = enum(c_int) { Horizontal = 0, Vertical = 1, _, }; pub const ImGuiLayoutType_Horizontal = @enumToInt(ImGuiLayoutType_.Horizontal); pub const ImGuiLayoutType_Vertical = @enumToInt(ImGuiLayoutType_.Vertical); pub const ImGuiLogType = enum(c_int) { _None = 0, _TTY = 1, _File = 2, _Buffer = 3, _Clipboard = 4, _, }; pub const ImGuiLogType_None = @enumToInt(ImGuiLogType._None); pub const ImGuiLogType_TTY = @enumToInt(ImGuiLogType._TTY); pub const ImGuiLogType_File = @enumToInt(ImGuiLogType._File); pub const ImGuiLogType_Buffer = @enumToInt(ImGuiLogType._Buffer); pub const ImGuiLogType_Clipboard = @enumToInt(ImGuiLogType._Clipboard); pub const ImGuiAxis = enum(c_int) { _None = -1, _X = 0, _Y = 1, _, }; pub const ImGuiAxis_None = @enumToInt(ImGuiAxis._None); pub const ImGuiAxis_X = @enumToInt(ImGuiAxis._X); pub const ImGuiAxis_Y = @enumToInt(ImGuiAxis._Y); pub const ImGuiPlotType = enum(c_int) { _Lines, _Histogram, _, }; pub const ImGuiPlotType_Lines = @enumToInt(ImGuiPlotType._Lines); pub const ImGuiPlotType_Histogram = @enumToInt(ImGuiPlotType._Histogram); pub const ImGuiInputSource = enum(c_int) { _None = 0, _Mouse = 1, _Keyboard = 2, _Gamepad = 3, _Nav = 4, _Clipboard = 5, _COUNT = 6, _, }; pub const ImGuiInputSource_None = @enumToInt(ImGuiInputSource._None); pub const ImGuiInputSource_Mouse = @enumToInt(ImGuiInputSource._Mouse); pub const ImGuiInputSource_Keyboard = @enumToInt(ImGuiInputSource._Keyboard); pub const ImGuiInputSource_Gamepad = @enumToInt(ImGuiInputSource._Gamepad); pub const ImGuiInputSource_Nav = @enumToInt(ImGuiInputSource._Nav); pub const ImGuiInputSource_Clipboard = @enumToInt(ImGuiInputSource._Clipboard); pub const ImGuiInputSource_COUNT = @enumToInt(ImGuiInputSource._COUNT); pub const ImGuiInputReadMode = enum(c_int) { _Down, _Pressed, _Released, _Repeat, _RepeatSlow, _RepeatFast, _, }; pub const ImGuiInputReadMode_Down = @enumToInt(ImGuiInputReadMode._Down); pub const ImGuiInputReadMode_Pressed = @enumToInt(ImGuiInputReadMode._Pressed); pub const ImGuiInputReadMode_Released = @enumToInt(ImGuiInputReadMode._Released); pub const ImGuiInputReadMode_Repeat = @enumToInt(ImGuiInputReadMode._Repeat); pub const ImGuiInputReadMode_RepeatSlow = @enumToInt(ImGuiInputReadMode._RepeatSlow); pub const ImGuiInputReadMode_RepeatFast = @enumToInt(ImGuiInputReadMode._RepeatFast); pub const ImGuiNavHighlightFlags_ = enum(c_int) { None = 0, TypeDefault = 1, TypeThin = 2, AlwaysDraw = 4, NoRounding = 8, _, }; pub const ImGuiNavHighlightFlags_None = @enumToInt(ImGuiNavHighlightFlags_.None); pub const ImGuiNavHighlightFlags_TypeDefault = @enumToInt(ImGuiNavHighlightFlags_.TypeDefault); pub const ImGuiNavHighlightFlags_TypeThin = @enumToInt(ImGuiNavHighlightFlags_.TypeThin); pub const ImGuiNavHighlightFlags_AlwaysDraw = @enumToInt(ImGuiNavHighlightFlags_.AlwaysDraw); pub const ImGuiNavHighlightFlags_NoRounding = @enumToInt(ImGuiNavHighlightFlags_.NoRounding); pub const ImGuiNavDirSourceFlags_ = enum(c_int) { None = 0, Keyboard = 1, PadDPad = 2, PadLStick = 4, _, }; pub const ImGuiNavDirSourceFlags_None = @enumToInt(ImGuiNavDirSourceFlags_.None); pub const ImGuiNavDirSourceFlags_Keyboard = @enumToInt(ImGuiNavDirSourceFlags_.Keyboard); pub const ImGuiNavDirSourceFlags_PadDPad = @enumToInt(ImGuiNavDirSourceFlags_.PadDPad); pub const ImGuiNavDirSourceFlags_PadLStick = @enumToInt(ImGuiNavDirSourceFlags_.PadLStick); pub const ImGuiNavMoveFlags_ = enum(c_int) { None = 0, LoopX = 1, LoopY = 2, WrapX = 4, WrapY = 8, AllowCurrentNavId = 16, AlsoScoreVisibleSet = 32, ScrollToEdge = 64, _, }; pub const ImGuiNavMoveFlags_None = @enumToInt(ImGuiNavMoveFlags_.None); pub const ImGuiNavMoveFlags_LoopX = @enumToInt(ImGuiNavMoveFlags_.LoopX); pub const ImGuiNavMoveFlags_LoopY = @enumToInt(ImGuiNavMoveFlags_.LoopY); pub const ImGuiNavMoveFlags_WrapX = @enumToInt(ImGuiNavMoveFlags_.WrapX); pub const ImGuiNavMoveFlags_WrapY = @enumToInt(ImGuiNavMoveFlags_.WrapY); pub const ImGuiNavMoveFlags_AllowCurrentNavId = @enumToInt(ImGuiNavMoveFlags_.AllowCurrentNavId); pub const ImGuiNavMoveFlags_AlsoScoreVisibleSet = @enumToInt(ImGuiNavMoveFlags_.AlsoScoreVisibleSet); pub const ImGuiNavMoveFlags_ScrollToEdge = @enumToInt(ImGuiNavMoveFlags_.ScrollToEdge); pub const ImGuiNavForward = enum(c_int) { _None, _ForwardQueued, _ForwardActive, _, }; pub const ImGuiNavForward_None = @enumToInt(ImGuiNavForward._None); pub const ImGuiNavForward_ForwardQueued = @enumToInt(ImGuiNavForward._ForwardQueued); pub const ImGuiNavForward_ForwardActive = @enumToInt(ImGuiNavForward._ForwardActive); pub const ImGuiNavLayer = enum(c_int) { _Main = 0, _Menu = 1, _COUNT = 2, _, }; pub const ImGuiNavLayer_Main = @enumToInt(ImGuiNavLayer._Main); pub const ImGuiNavLayer_Menu = @enumToInt(ImGuiNavLayer._Menu); pub const ImGuiNavLayer_COUNT = @enumToInt(ImGuiNavLayer._COUNT); pub const ImGuiPopupPositionPolicy = enum(c_int) { _Default, _ComboBox, _Tooltip, _, }; pub const ImGuiPopupPositionPolicy_Default = @enumToInt(ImGuiPopupPositionPolicy._Default); pub const ImGuiPopupPositionPolicy_ComboBox = @enumToInt(ImGuiPopupPositionPolicy._ComboBox); pub const ImGuiPopupPositionPolicy_Tooltip = @enumToInt(ImGuiPopupPositionPolicy._Tooltip); pub const ImGuiDataTypePrivate_ = enum(c_int) { ImGuiDataType_String = 11, ImGuiDataType_Pointer = 12, ImGuiDataType_ID = 13, _, }; pub const ImGuiDataType_String = @enumToInt(ImGuiDataTypePrivate_.ImGuiDataType_String); pub const ImGuiDataType_Pointer = @enumToInt(ImGuiDataTypePrivate_.ImGuiDataType_Pointer); pub const ImGuiDataType_ID = @enumToInt(ImGuiDataTypePrivate_.ImGuiDataType_ID); pub const ImGuiNextWindowDataFlags_ = enum(c_int) { None = 0, HasPos = 1, HasSize = 2, HasContentSize = 4, HasCollapsed = 8, HasSizeConstraint = 16, HasFocus = 32, HasBgAlpha = 64, HasScroll = 128, HasViewport = 256, HasDock = 512, HasWindowClass = 1024, _, }; pub const ImGuiNextWindowDataFlags_None = @enumToInt(ImGuiNextWindowDataFlags_.None); pub const ImGuiNextWindowDataFlags_HasPos = @enumToInt(ImGuiNextWindowDataFlags_.HasPos); pub const ImGuiNextWindowDataFlags_HasSize = @enumToInt(ImGuiNextWindowDataFlags_.HasSize); pub const ImGuiNextWindowDataFlags_HasContentSize = @enumToInt(ImGuiNextWindowDataFlags_.HasContentSize); pub const ImGuiNextWindowDataFlags_HasCollapsed = @enumToInt(ImGuiNextWindowDataFlags_.HasCollapsed); pub const ImGuiNextWindowDataFlags_HasSizeConstraint = @enumToInt(ImGuiNextWindowDataFlags_.HasSizeConstraint); pub const ImGuiNextWindowDataFlags_HasFocus = @enumToInt(ImGuiNextWindowDataFlags_.HasFocus); pub const ImGuiNextWindowDataFlags_HasBgAlpha = @enumToInt(ImGuiNextWindowDataFlags_.HasBgAlpha); pub const ImGuiNextWindowDataFlags_HasScroll = @enumToInt(ImGuiNextWindowDataFlags_.HasScroll); pub const ImGuiNextWindowDataFlags_HasViewport = @enumToInt(ImGuiNextWindowDataFlags_.HasViewport); pub const ImGuiNextWindowDataFlags_HasDock = @enumToInt(ImGuiNextWindowDataFlags_.HasDock); pub const ImGuiNextWindowDataFlags_HasWindowClass = @enumToInt(ImGuiNextWindowDataFlags_.HasWindowClass); pub const ImGuiNextItemDataFlags_ = enum(c_int) { None = 0, HasWidth = 1, HasOpen = 2, _, }; pub const ImGuiNextItemDataFlags_None = @enumToInt(ImGuiNextItemDataFlags_.None); pub const ImGuiNextItemDataFlags_HasWidth = @enumToInt(ImGuiNextItemDataFlags_.HasWidth); pub const ImGuiNextItemDataFlags_HasOpen = @enumToInt(ImGuiNextItemDataFlags_.HasOpen); pub const ImGuiOldColumnFlags_ = enum(c_int) { None = 0, NoBorder = 1, NoResize = 2, NoPreserveWidths = 4, NoForceWithinWindow = 8, GrowParentContentsSize = 16, _, }; pub const ImGuiOldColumnFlags_None = @enumToInt(ImGuiOldColumnFlags_.None); pub const ImGuiOldColumnFlags_NoBorder = @enumToInt(ImGuiOldColumnFlags_.NoBorder); pub const ImGuiOldColumnFlags_NoResize = @enumToInt(ImGuiOldColumnFlags_.NoResize); pub const ImGuiOldColumnFlags_NoPreserveWidths = @enumToInt(ImGuiOldColumnFlags_.NoPreserveWidths); pub const ImGuiOldColumnFlags_NoForceWithinWindow = @enumToInt(ImGuiOldColumnFlags_.NoForceWithinWindow); pub const ImGuiOldColumnFlags_GrowParentContentsSize = @enumToInt(ImGuiOldColumnFlags_.GrowParentContentsSize); pub const ImGuiDockNodeFlagsPrivate_ = enum(c_int) { ImGuiDockNodeFlags_DockSpace = 1024, ImGuiDockNodeFlags_CentralNode = 2048, ImGuiDockNodeFlags_NoTabBar = 4096, ImGuiDockNodeFlags_HiddenTabBar = 8192, ImGuiDockNodeFlags_NoWindowMenuButton = 16384, ImGuiDockNodeFlags_NoCloseButton = 32768, ImGuiDockNodeFlags_NoDocking = 65536, ImGuiDockNodeFlags_NoDockingSplitMe = 131072, ImGuiDockNodeFlags_NoDockingSplitOther = 262144, ImGuiDockNodeFlags_NoDockingOverMe = 524288, ImGuiDockNodeFlags_NoDockingOverOther = 1048576, ImGuiDockNodeFlags_NoResizeX = 2097152, ImGuiDockNodeFlags_NoResizeY = 4194304, ImGuiDockNodeFlags_SharedFlagsInheritMask_ = -1, ImGuiDockNodeFlags_NoResizeFlagsMask_ = 6291488, ImGuiDockNodeFlags_LocalFlagsMask_ = 6421616, ImGuiDockNodeFlags_LocalFlagsTransferMask_ = 6420592, ImGuiDockNodeFlags_SavedFlagsMask_ = 6421536, _, }; pub const ImGuiDockNodeFlags_DockSpace = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_DockSpace); pub const ImGuiDockNodeFlags_CentralNode = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_CentralNode); pub const ImGuiDockNodeFlags_NoTabBar = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoTabBar); pub const ImGuiDockNodeFlags_HiddenTabBar = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_HiddenTabBar); pub const ImGuiDockNodeFlags_NoWindowMenuButton = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoWindowMenuButton); pub const ImGuiDockNodeFlags_NoCloseButton = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoCloseButton); pub const ImGuiDockNodeFlags_NoDocking = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoDocking); pub const ImGuiDockNodeFlags_NoDockingSplitMe = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoDockingSplitMe); pub const ImGuiDockNodeFlags_NoDockingSplitOther = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoDockingSplitOther); pub const ImGuiDockNodeFlags_NoDockingOverMe = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoDockingOverMe); pub const ImGuiDockNodeFlags_NoDockingOverOther = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoDockingOverOther); pub const ImGuiDockNodeFlags_NoResizeX = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoResizeX); pub const ImGuiDockNodeFlags_NoResizeY = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoResizeY); pub const ImGuiDockNodeFlags_SharedFlagsInheritMask_ = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_SharedFlagsInheritMask_); pub const ImGuiDockNodeFlags_NoResizeFlagsMask_ = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_NoResizeFlagsMask_); pub const ImGuiDockNodeFlags_LocalFlagsMask_ = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_LocalFlagsMask_); pub const ImGuiDockNodeFlags_LocalFlagsTransferMask_ = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_LocalFlagsTransferMask_); pub const ImGuiDockNodeFlags_SavedFlagsMask_ = @enumToInt(ImGuiDockNodeFlagsPrivate_.ImGuiDockNodeFlags_SavedFlagsMask_); pub const ImGuiDataAuthority_ = enum(c_int) { Auto, DockNode, Window, _, }; pub const ImGuiDataAuthority_Auto = @enumToInt(ImGuiDataAuthority_.Auto); pub const ImGuiDataAuthority_DockNode = @enumToInt(ImGuiDataAuthority_.DockNode); pub const ImGuiDataAuthority_Window = @enumToInt(ImGuiDataAuthority_.Window); pub const ImGuiDockNodeState = enum(c_int) { _Unknown, _HostWindowHiddenBecauseSingleWindow, _HostWindowHiddenBecauseWindowsAreResizing, _HostWindowVisible, _, }; pub const ImGuiDockNodeState_Unknown = @enumToInt(ImGuiDockNodeState._Unknown); pub const ImGuiDockNodeState_HostWindowHiddenBecauseSingleWindow = @enumToInt(ImGuiDockNodeState._HostWindowHiddenBecauseSingleWindow); pub const ImGuiDockNodeState_HostWindowHiddenBecauseWindowsAreResizing = @enumToInt(ImGuiDockNodeState._HostWindowHiddenBecauseWindowsAreResizing); pub const ImGuiDockNodeState_HostWindowVisible = @enumToInt(ImGuiDockNodeState._HostWindowVisible); pub const ImGuiWindowDockStyleCol = enum(c_int) { _Text, _Tab, _TabHovered, _TabActive, _TabUnfocused, _TabUnfocusedActive, _COUNT, _, }; pub const ImGuiWindowDockStyleCol_Text = @enumToInt(ImGuiWindowDockStyleCol._Text); pub const ImGuiWindowDockStyleCol_Tab = @enumToInt(ImGuiWindowDockStyleCol._Tab); pub const ImGuiWindowDockStyleCol_TabHovered = @enumToInt(ImGuiWindowDockStyleCol._TabHovered); pub const ImGuiWindowDockStyleCol_TabActive = @enumToInt(ImGuiWindowDockStyleCol._TabActive); pub const ImGuiWindowDockStyleCol_TabUnfocused = @enumToInt(ImGuiWindowDockStyleCol._TabUnfocused); pub const ImGuiWindowDockStyleCol_TabUnfocusedActive = @enumToInt(ImGuiWindowDockStyleCol._TabUnfocusedActive); pub const ImGuiWindowDockStyleCol_COUNT = @enumToInt(ImGuiWindowDockStyleCol._COUNT); pub const ImGuiContextHookType = enum(c_int) { _NewFramePre, _NewFramePost, _EndFramePre, _EndFramePost, _RenderPre, _RenderPost, _Shutdown, _PendingRemoval_, _, }; pub const ImGuiContextHookType_NewFramePre = @enumToInt(ImGuiContextHookType._NewFramePre); pub const ImGuiContextHookType_NewFramePost = @enumToInt(ImGuiContextHookType._NewFramePost); pub const ImGuiContextHookType_EndFramePre = @enumToInt(ImGuiContextHookType._EndFramePre); pub const ImGuiContextHookType_EndFramePost = @enumToInt(ImGuiContextHookType._EndFramePost); pub const ImGuiContextHookType_RenderPre = @enumToInt(ImGuiContextHookType._RenderPre); pub const ImGuiContextHookType_RenderPost = @enumToInt(ImGuiContextHookType._RenderPost); pub const ImGuiContextHookType_Shutdown = @enumToInt(ImGuiContextHookType._Shutdown); pub const ImGuiContextHookType_PendingRemoval_ = @enumToInt(ImGuiContextHookType._PendingRemoval_); pub const ImGuiTabBarFlagsPrivate_ = enum(c_int) { ImGuiTabBarFlags_DockNode = 1048576, ImGuiTabBarFlags_IsFocused = 2097152, ImGuiTabBarFlags_SaveSettings = 4194304, _, }; pub const ImGuiTabBarFlags_DockNode = @enumToInt(ImGuiTabBarFlagsPrivate_.ImGuiTabBarFlags_DockNode); pub const ImGuiTabBarFlags_IsFocused = @enumToInt(ImGuiTabBarFlagsPrivate_.ImGuiTabBarFlags_IsFocused); pub const ImGuiTabBarFlags_SaveSettings = @enumToInt(ImGuiTabBarFlagsPrivate_.ImGuiTabBarFlags_SaveSettings); pub const ImGuiTabItemFlagsPrivate_ = enum(c_int) { ImGuiTabItemFlags_SectionMask_ = 192, ImGuiTabItemFlags_NoCloseButton = 1048576, ImGuiTabItemFlags_Button = 2097152, ImGuiTabItemFlags_Unsorted = 4194304, ImGuiTabItemFlags_Preview = 8388608, _, }; pub const ImGuiTabItemFlags_SectionMask_ = @enumToInt(ImGuiTabItemFlagsPrivate_.ImGuiTabItemFlags_SectionMask_); pub const ImGuiTabItemFlags_NoCloseButton = @enumToInt(ImGuiTabItemFlagsPrivate_.ImGuiTabItemFlags_NoCloseButton); pub const ImGuiTabItemFlags_Button = @enumToInt(ImGuiTabItemFlagsPrivate_.ImGuiTabItemFlags_Button); pub const ImGuiTabItemFlags_Unsorted = @enumToInt(ImGuiTabItemFlagsPrivate_.ImGuiTabItemFlags_Unsorted); pub const ImGuiTabItemFlags_Preview = @enumToInt(ImGuiTabItemFlagsPrivate_.ImGuiTabItemFlags_Preview); pub extern fn ImVec2_ImVec2_Nil() [*c]ImVec2; pub extern fn ImVec2_destroy(self: [*c]ImVec2) void; pub extern fn ImVec2_ImVec2_Float(_x: f32, _y: f32) [*c]ImVec2; pub extern fn ImVec4_ImVec4_Nil() [*c]ImVec4; pub extern fn ImVec4_destroy(self: [*c]ImVec4) void; pub extern fn ImVec4_ImVec4_Float(_x: f32, _y: f32, _z: f32, _w: f32) [*c]ImVec4; pub extern fn igCreateContext(shared_font_atlas: [*c]ImFontAtlas) [*c]ImGuiContext; pub extern fn igDestroyContext(ctx: [*c]ImGuiContext) void; pub extern fn igGetCurrentContext() [*c]ImGuiContext; pub extern fn igSetCurrentContext(ctx: [*c]ImGuiContext) void; pub extern fn igGetIO() [*c]ImGuiIO; pub extern fn igGetStyle() [*c]ImGuiStyle; pub extern fn igNewFrame() void; pub extern fn igEndFrame() void; pub extern fn igRender() void; pub extern fn igGetDrawData() [*c]ImDrawData; pub extern fn igShowDemoWindow(p_open: [*c]bool) void; pub extern fn igShowMetricsWindow(p_open: [*c]bool) void; pub extern fn igShowAboutWindow(p_open: [*c]bool) void; pub extern fn igShowStyleEditor(ref: [*c]ImGuiStyle) void; pub extern fn igShowStyleSelector(label: [*c]const u8) bool; pub extern fn igShowFontSelector(label: [*c]const u8) void; pub extern fn igShowUserGuide() void; pub extern fn igGetVersion() [*c]const u8; pub extern fn igStyleColorsDark(dst: [*c]ImGuiStyle) void; pub extern fn igStyleColorsLight(dst: [*c]ImGuiStyle) void; pub extern fn igStyleColorsClassic(dst: [*c]ImGuiStyle) void; pub extern fn igBegin(name: [*c]const u8, p_open: [*c]bool, flags: ImGuiWindowFlags) bool; pub extern fn igEnd() void; pub extern fn igBeginChild_Str(str_id: [*c]const u8, size: ImVec2, border: bool, flags: ImGuiWindowFlags) bool; pub extern fn igBeginChild_ID(id: ImGuiID, size: ImVec2, border: bool, flags: ImGuiWindowFlags) bool; pub extern fn igEndChild() void; pub extern fn igIsWindowAppearing() bool; pub extern fn igIsWindowCollapsed() bool; pub extern fn igIsWindowFocused(flags: ImGuiFocusedFlags) bool; pub extern fn igIsWindowHovered(flags: ImGuiHoveredFlags) bool; pub extern fn igGetWindowDrawList() [*c]ImDrawList; pub extern fn igGetWindowDpiScale() f32; pub extern fn igGetWindowPos(pOut: [*c]ImVec2) void; pub extern fn igGetWindowSize(pOut: [*c]ImVec2) void; pub extern fn igGetWindowWidth() f32; pub extern fn igGetWindowHeight() f32; pub extern fn igGetWindowViewport() [*c]ImGuiViewport; pub extern fn igSetNextWindowPos(pos: ImVec2, cond: ImGuiCond, pivot: ImVec2) void; pub extern fn igSetNextWindowSize(size: ImVec2, cond: ImGuiCond) void; pub extern fn igSetNextWindowSizeConstraints(size_min: ImVec2, size_max: ImVec2, custom_callback: ImGuiSizeCallback, custom_callback_data: ?*c_void) void; pub extern fn igSetNextWindowContentSize(size: ImVec2) void; pub extern fn igSetNextWindowCollapsed(collapsed: bool, cond: ImGuiCond) void; pub extern fn igSetNextWindowFocus() void; pub extern fn igSetNextWindowBgAlpha(alpha: f32) void; pub extern fn igSetNextWindowViewport(viewport_id: ImGuiID) void; pub extern fn igSetWindowPos_Vec2(pos: ImVec2, cond: ImGuiCond) void; pub extern fn igSetWindowSize_Vec2(size: ImVec2, cond: ImGuiCond) void; pub extern fn igSetWindowCollapsed_Bool(collapsed: bool, cond: ImGuiCond) void; pub extern fn igSetWindowFocus_Nil() void; pub extern fn igSetWindowFontScale(scale: f32) void; pub extern fn igSetWindowPos_Str(name: [*c]const u8, pos: ImVec2, cond: ImGuiCond) void; pub extern fn igSetWindowSize_Str(name: [*c]const u8, size: ImVec2, cond: ImGuiCond) void; pub extern fn igSetWindowCollapsed_Str(name: [*c]const u8, collapsed: bool, cond: ImGuiCond) void; pub extern fn igSetWindowFocus_Str(name: [*c]const u8) void; pub extern fn igGetContentRegionAvail(pOut: [*c]ImVec2) void; pub extern fn igGetContentRegionMax(pOut: [*c]ImVec2) void; pub extern fn igGetWindowContentRegionMin(pOut: [*c]ImVec2) void; pub extern fn igGetWindowContentRegionMax(pOut: [*c]ImVec2) void; pub extern fn igGetWindowContentRegionWidth() f32; pub extern fn igGetScrollX() f32; pub extern fn igGetScrollY() f32; pub extern fn igSetScrollX_Float(scroll_x: f32) void; pub extern fn igSetScrollY_Float(scroll_y: f32) void; pub extern fn igGetScrollMaxX() f32; pub extern fn igGetScrollMaxY() f32; pub extern fn igSetScrollHereX(center_x_ratio: f32) void; pub extern fn igSetScrollHereY(center_y_ratio: f32) void; pub extern fn igSetScrollFromPosX_Float(local_x: f32, center_x_ratio: f32) void; pub extern fn igSetScrollFromPosY_Float(local_y: f32, center_y_ratio: f32) void; pub extern fn igPushFont(font: [*c]ImFont) void; pub extern fn igPopFont() void; pub extern fn igPushStyleColor_U32(idx: ImGuiCol, col: ImU32) void; pub extern fn igPushStyleColor_Vec4(idx: ImGuiCol, col: ImVec4) void; pub extern fn igPopStyleColor(count: c_int) void; pub extern fn igPushStyleVar_Float(idx: ImGuiStyleVar, val: f32) void; pub extern fn igPushStyleVar_Vec2(idx: ImGuiStyleVar, val: ImVec2) void; pub extern fn igPopStyleVar(count: c_int) void; pub extern fn igPushAllowKeyboardFocus(allow_keyboard_focus: bool) void; pub extern fn igPopAllowKeyboardFocus() void; pub extern fn igPushButtonRepeat(repeat: bool) void; pub extern fn igPopButtonRepeat() void; pub extern fn igPushItemWidth(item_width: f32) void; pub extern fn igPopItemWidth() void; pub extern fn igSetNextItemWidth(item_width: f32) void; pub extern fn igCalcItemWidth() f32; pub extern fn igPushTextWrapPos(wrap_local_pos_x: f32) void; pub extern fn igPopTextWrapPos() void; pub extern fn igGetFont() [*c]ImFont; pub extern fn igGetFontSize() f32; pub extern fn igGetFontTexUvWhitePixel(pOut: [*c]ImVec2) void; pub extern fn igGetColorU32_Col(idx: ImGuiCol, alpha_mul: f32) ImU32; pub extern fn igGetColorU32_Vec4(col: ImVec4) ImU32; pub extern fn igGetColorU32_U32(col: ImU32) ImU32; pub extern fn igGetStyleColorVec4(idx: ImGuiCol) [*c]const ImVec4; pub extern fn igSeparator() void; pub extern fn igSameLine(offset_from_start_x: f32, spacing: f32) void; pub extern fn igNewLine() void; pub extern fn igSpacing() void; pub extern fn igDummy(size: ImVec2) void; pub extern fn igIndent(indent_w: f32) void; pub extern fn igUnindent(indent_w: f32) void; pub extern fn igBeginGroup() void; pub extern fn igEndGroup() void; pub extern fn igGetCursorPos(pOut: [*c]ImVec2) void; pub extern fn igGetCursorPosX() f32; pub extern fn igGetCursorPosY() f32; pub extern fn igSetCursorPos(local_pos: ImVec2) void; pub extern fn igSetCursorPosX(local_x: f32) void; pub extern fn igSetCursorPosY(local_y: f32) void; pub extern fn igGetCursorStartPos(pOut: [*c]ImVec2) void; pub extern fn igGetCursorScreenPos(pOut: [*c]ImVec2) void; pub extern fn igSetCursorScreenPos(pos: ImVec2) void; pub extern fn igAlignTextToFramePadding() void; pub extern fn igGetTextLineHeight() f32; pub extern fn igGetTextLineHeightWithSpacing() f32; pub extern fn igGetFrameHeight() f32; pub extern fn igGetFrameHeightWithSpacing() f32; pub extern fn igPushID_Str(str_id: [*c]const u8) void; pub extern fn igPushID_StrStr(str_id_begin: [*c]const u8, str_id_end: [*c]const u8) void; pub extern fn igPushID_Ptr(ptr_id: ?*const c_void) void; pub extern fn igPushID_Int(int_id: c_int) void; pub extern fn igPopID() void; pub extern fn igGetID_Str(str_id: [*c]const u8) ImGuiID; pub extern fn igGetID_StrStr(str_id_begin: [*c]const u8, str_id_end: [*c]const u8) ImGuiID; pub extern fn igGetID_Ptr(ptr_id: ?*const c_void) ImGuiID; pub extern fn igTextUnformatted(text: [*c]const u8, text_end: [*c]const u8) void; pub extern fn igText(fmt: [*c]const u8, ...) void; pub extern fn igTextV(fmt: [*c]const u8, args: va_list) void; pub extern fn igTextColored(col: ImVec4, fmt: [*c]const u8, ...) void; pub extern fn igTextColoredV(col: ImVec4, fmt: [*c]const u8, args: va_list) void; pub extern fn igTextDisabled(fmt: [*c]const u8, ...) void; pub extern fn igTextDisabledV(fmt: [*c]const u8, args: va_list) void; pub extern fn igTextWrapped(fmt: [*c]const u8, ...) void; pub extern fn igTextWrappedV(fmt: [*c]const u8, args: va_list) void; pub extern fn igLabelText(label: [*c]const u8, fmt: [*c]const u8, ...) void; pub extern fn igLabelTextV(label: [*c]const u8, fmt: [*c]const u8, args: va_list) void; pub extern fn igBulletText(fmt: [*c]const u8, ...) void; pub extern fn igBulletTextV(fmt: [*c]const u8, args: va_list) void; pub extern fn igButton(label: [*c]const u8, size: ImVec2) bool; pub extern fn igSmallButton(label: [*c]const u8) bool; pub extern fn igInvisibleButton(str_id: [*c]const u8, size: ImVec2, flags: ImGuiButtonFlags) bool; pub extern fn igArrowButton(str_id: [*c]const u8, dir: ImGuiDir) bool; pub extern fn igImage(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, tint_col: ImVec4, border_col: ImVec4) void; pub extern fn igImageButton(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, frame_padding: c_int, bg_col: ImVec4, tint_col: ImVec4) bool; pub extern fn igCheckbox(label: [*c]const u8, v: [*c]bool) bool; pub extern fn igCheckboxFlags_IntPtr(label: [*c]const u8, flags: [*c]c_int, flags_value: c_int) bool; pub extern fn igCheckboxFlags_UintPtr(label: [*c]const u8, flags: [*c]c_uint, flags_value: c_uint) bool; pub extern fn igRadioButton_Bool(label: [*c]const u8, active: bool) bool; pub extern fn igRadioButton_IntPtr(label: [*c]const u8, v: [*c]c_int, v_button: c_int) bool; pub extern fn igProgressBar(fraction: f32, size_arg: ImVec2, overlay: [*c]const u8) void; pub extern fn igBullet() void; pub extern fn igBeginCombo(label: [*c]const u8, preview_value: [*c]const u8, flags: ImGuiComboFlags) bool; pub extern fn igEndCombo() void; pub extern fn igCombo_Str_arr(label: [*c]const u8, current_item: [*c]c_int, items: [*c]const [*c]const u8, items_count: c_int, popup_max_height_in_items: c_int) bool; pub extern fn igCombo_Str(label: [*c]const u8, current_item: [*c]c_int, items_separated_by_zeros: [*c]const u8, popup_max_height_in_items: c_int) bool; pub extern fn igCombo_FnBoolPtr(label: [*c]const u8, current_item: [*c]c_int, items_getter: ?fn (?*c_void, c_int, [*c][*c]const u8) callconv(.C) bool, data: ?*c_void, items_count: c_int, popup_max_height_in_items: c_int) bool; pub extern fn igDragFloat(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragFloat2(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragFloat3(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragFloat4(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragFloatRange2(label: [*c]const u8, v_current_min: [*c]f32, v_current_max: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, format_max: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragInt(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragInt2(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragInt3(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragInt4(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragIntRange2(label: [*c]const u8, v_current_min: [*c]c_int, v_current_max: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, format_max: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragScalar(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igDragScalarN(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, components: c_int, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderFloat(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderFloat2(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderFloat3(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderFloat4(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderAngle(label: [*c]const u8, v_rad: [*c]f32, v_degrees_min: f32, v_degrees_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderInt(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderInt2(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderInt3(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderInt4(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderScalar(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderScalarN(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, components: c_int, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igVSliderFloat(label: [*c]const u8, size: ImVec2, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igVSliderInt(label: [*c]const u8, size: ImVec2, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igVSliderScalar(label: [*c]const u8, size: ImVec2, data_type: ImGuiDataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igInputText(label: [*c]const u8, buf: [*c]u8, buf_size: usize, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*c_void) bool; pub extern fn igInputTextMultiline(label: [*c]const u8, buf: [*c]u8, buf_size: usize, size: ImVec2, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*c_void) bool; pub extern fn igInputTextWithHint(label: [*c]const u8, hint: [*c]const u8, buf: [*c]u8, buf_size: usize, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*c_void) bool; pub extern fn igInputFloat(label: [*c]const u8, v: [*c]f32, step: f32, step_fast: f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igInputFloat2(label: [*c]const u8, v: [*c]f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igInputFloat3(label: [*c]const u8, v: [*c]f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igInputFloat4(label: [*c]const u8, v: [*c]f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igInputInt(label: [*c]const u8, v: [*c]c_int, step: c_int, step_fast: c_int, flags: ImGuiInputTextFlags) bool; pub extern fn igInputInt2(label: [*c]const u8, v: [*c]c_int, flags: ImGuiInputTextFlags) bool; pub extern fn igInputInt3(label: [*c]const u8, v: [*c]c_int, flags: ImGuiInputTextFlags) bool; pub extern fn igInputInt4(label: [*c]const u8, v: [*c]c_int, flags: ImGuiInputTextFlags) bool; pub extern fn igInputDouble(label: [*c]const u8, v: [*c]f64, step: f64, step_fast: f64, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igInputScalar(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, p_step: ?*const c_void, p_step_fast: ?*const c_void, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igInputScalarN(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, components: c_int, p_step: ?*const c_void, p_step_fast: ?*const c_void, format: [*c]const u8, flags: ImGuiInputTextFlags) bool; pub extern fn igColorEdit3(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags) bool; pub extern fn igColorEdit4(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags) bool; pub extern fn igColorPicker3(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags) bool; pub extern fn igColorPicker4(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags, ref_col: [*c]const f32) bool; pub extern fn igColorButton(desc_id: [*c]const u8, col: ImVec4, flags: ImGuiColorEditFlags, size: ImVec2) bool; pub extern fn igSetColorEditOptions(flags: ImGuiColorEditFlags) void; pub extern fn igTreeNode_Str(label: [*c]const u8) bool; pub extern fn igTreeNode_StrStr(str_id: [*c]const u8, fmt: [*c]const u8, ...) bool; pub extern fn igTreeNode_Ptr(ptr_id: ?*const c_void, fmt: [*c]const u8, ...) bool; pub extern fn igTreeNodeV_Str(str_id: [*c]const u8, fmt: [*c]const u8, args: va_list) bool; pub extern fn igTreeNodeV_Ptr(ptr_id: ?*const c_void, fmt: [*c]const u8, args: va_list) bool; pub extern fn igTreeNodeEx_Str(label: [*c]const u8, flags: ImGuiTreeNodeFlags) bool; pub extern fn igTreeNodeEx_StrStr(str_id: [*c]const u8, flags: ImGuiTreeNodeFlags, fmt: [*c]const u8, ...) bool; pub extern fn igTreeNodeEx_Ptr(ptr_id: ?*const c_void, flags: ImGuiTreeNodeFlags, fmt: [*c]const u8, ...) bool; pub extern fn igTreeNodeExV_Str(str_id: [*c]const u8, flags: ImGuiTreeNodeFlags, fmt: [*c]const u8, args: va_list) bool; pub extern fn igTreeNodeExV_Ptr(ptr_id: ?*const c_void, flags: ImGuiTreeNodeFlags, fmt: [*c]const u8, args: va_list) bool; pub extern fn igTreePush_Str(str_id: [*c]const u8) void; pub extern fn igTreePush_Ptr(ptr_id: ?*const c_void) void; pub extern fn igTreePop() void; pub extern fn igGetTreeNodeToLabelSpacing() f32; pub extern fn igCollapsingHeader_TreeNodeFlags(label: [*c]const u8, flags: ImGuiTreeNodeFlags) bool; pub extern fn igCollapsingHeader_BoolPtr(label: [*c]const u8, p_visible: [*c]bool, flags: ImGuiTreeNodeFlags) bool; pub extern fn igSetNextItemOpen(is_open: bool, cond: ImGuiCond) void; pub extern fn igSelectable_Bool(label: [*c]const u8, selected: bool, flags: ImGuiSelectableFlags, size: ImVec2) bool; pub extern fn igSelectable_BoolPtr(label: [*c]const u8, p_selected: [*c]bool, flags: ImGuiSelectableFlags, size: ImVec2) bool; pub extern fn igBeginListBox(label: [*c]const u8, size: ImVec2) bool; pub extern fn igEndListBox() void; pub extern fn igListBox_Str_arr(label: [*c]const u8, current_item: [*c]c_int, items: [*c]const [*c]const u8, items_count: c_int, height_in_items: c_int) bool; pub extern fn igListBox_FnBoolPtr(label: [*c]const u8, current_item: [*c]c_int, items_getter: ?fn (?*c_void, c_int, [*c][*c]const u8) callconv(.C) bool, data: ?*c_void, items_count: c_int, height_in_items: c_int) bool; pub extern fn igPlotLines_FloatPtr(label: [*c]const u8, values: [*c]const f32, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2, stride: c_int) void; pub extern fn igPlotLines_FnFloatPtr(label: [*c]const u8, values_getter: ?fn (?*c_void, c_int) callconv(.C) f32, data: ?*c_void, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2) void; pub extern fn igPlotHistogram_FloatPtr(label: [*c]const u8, values: [*c]const f32, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2, stride: c_int) void; pub extern fn igPlotHistogram_FnFloatPtr(label: [*c]const u8, values_getter: ?fn (?*c_void, c_int) callconv(.C) f32, data: ?*c_void, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2) void; pub extern fn igValue_Bool(prefix: [*c]const u8, b: bool) void; pub extern fn igValue_Int(prefix: [*c]const u8, v: c_int) void; pub extern fn igValue_Uint(prefix: [*c]const u8, v: c_uint) void; pub extern fn igValue_Float(prefix: [*c]const u8, v: f32, float_format: [*c]const u8) void; pub extern fn igBeginMenuBar() bool; pub extern fn igEndMenuBar() void; pub extern fn igBeginMainMenuBar() bool; pub extern fn igEndMainMenuBar() void; pub extern fn igBeginMenu(label: [*c]const u8, enabled: bool) bool; pub extern fn igEndMenu() void; pub extern fn igMenuItem_Bool(label: [*c]const u8, shortcut: [*c]const u8, selected: bool, enabled: bool) bool; pub extern fn igMenuItem_BoolPtr(label: [*c]const u8, shortcut: [*c]const u8, p_selected: [*c]bool, enabled: bool) bool; pub extern fn igBeginTooltip() void; pub extern fn igEndTooltip() void; pub extern fn igSetTooltip(fmt: [*c]const u8, ...) void; pub extern fn igSetTooltipV(fmt: [*c]const u8, args: va_list) void; pub extern fn igBeginPopup(str_id: [*c]const u8, flags: ImGuiWindowFlags) bool; pub extern fn igBeginPopupModal(name: [*c]const u8, p_open: [*c]bool, flags: ImGuiWindowFlags) bool; pub extern fn igEndPopup() void; pub extern fn igOpenPopup_Str(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) void; pub extern fn igOpenPopup_ID(id: ImGuiID, popup_flags: ImGuiPopupFlags) void; pub extern fn igOpenPopupOnItemClick(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) void; pub extern fn igCloseCurrentPopup() void; pub extern fn igBeginPopupContextItem(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) bool; pub extern fn igBeginPopupContextWindow(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) bool; pub extern fn igBeginPopupContextVoid(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) bool; pub extern fn igIsPopupOpen_Str(str_id: [*c]const u8, flags: ImGuiPopupFlags) bool; pub extern fn igBeginTable(str_id: [*c]const u8, column: c_int, flags: ImGuiTableFlags, outer_size: ImVec2, inner_width: f32) bool; pub extern fn igEndTable() void; pub extern fn igTableNextRow(row_flags: ImGuiTableRowFlags, min_row_height: f32) void; pub extern fn igTableNextColumn() bool; pub extern fn igTableSetColumnIndex(column_n: c_int) bool; pub extern fn igTableSetupColumn(label: [*c]const u8, flags: ImGuiTableColumnFlags, init_width_or_weight: f32, user_id: ImGuiID) void; pub extern fn igTableSetupScrollFreeze(cols: c_int, rows: c_int) void; pub extern fn igTableHeadersRow() void; pub extern fn igTableHeader(label: [*c]const u8) void; pub extern fn igTableGetSortSpecs() [*c]ImGuiTableSortSpecs; pub extern fn igTableGetColumnCount() c_int; pub extern fn igTableGetColumnIndex() c_int; pub extern fn igTableGetRowIndex() c_int; pub extern fn igTableGetColumnName_Int(column_n: c_int) [*c]const u8; pub extern fn igTableGetColumnFlags(column_n: c_int) ImGuiTableColumnFlags; pub extern fn igTableSetColumnEnabled(column_n: c_int, v: bool) void; pub extern fn igTableSetBgColor(target: ImGuiTableBgTarget, color: ImU32, column_n: c_int) void; pub extern fn igColumns(count: c_int, id: [*c]const u8, border: bool) void; pub extern fn igNextColumn() void; pub extern fn igGetColumnIndex() c_int; pub extern fn igGetColumnWidth(column_index: c_int) f32; pub extern fn igSetColumnWidth(column_index: c_int, width: f32) void; pub extern fn igGetColumnOffset(column_index: c_int) f32; pub extern fn igSetColumnOffset(column_index: c_int, offset_x: f32) void; pub extern fn igGetColumnsCount() c_int; pub extern fn igBeginTabBar(str_id: [*c]const u8, flags: ImGuiTabBarFlags) bool; pub extern fn igEndTabBar() void; pub extern fn igBeginTabItem(label: [*c]const u8, p_open: [*c]bool, flags: ImGuiTabItemFlags) bool; pub extern fn igEndTabItem() void; pub extern fn igTabItemButton(label: [*c]const u8, flags: ImGuiTabItemFlags) bool; pub extern fn igSetTabItemClosed(tab_or_docked_window_label: [*c]const u8) void; pub extern fn igDockSpace(id: ImGuiID, size: ImVec2, flags: ImGuiDockNodeFlags, window_class: [*c]const ImGuiWindowClass) ImGuiID; pub extern fn igDockSpaceOverViewport(viewport: [*c]const ImGuiViewport, flags: ImGuiDockNodeFlags, window_class: [*c]const ImGuiWindowClass) ImGuiID; pub extern fn igSetNextWindowDockID(dock_id: ImGuiID, cond: ImGuiCond) void; pub extern fn igSetNextWindowClass(window_class: [*c]const ImGuiWindowClass) void; pub extern fn igGetWindowDockID() ImGuiID; pub extern fn igIsWindowDocked() bool; pub extern fn igLogToTTY(auto_open_depth: c_int) void; pub extern fn igLogToFile(auto_open_depth: c_int, filename: [*c]const u8) void; pub extern fn igLogToClipboard(auto_open_depth: c_int) void; pub extern fn igLogFinish() void; pub extern fn igLogButtons() void; pub extern fn igLogTextV(fmt: [*c]const u8, args: va_list) void; pub extern fn igBeginDragDropSource(flags: ImGuiDragDropFlags) bool; pub extern fn igSetDragDropPayload(type: [*c]const u8, data: ?*const c_void, sz: usize, cond: ImGuiCond) bool; pub extern fn igEndDragDropSource() void; pub extern fn igBeginDragDropTarget() bool; pub extern fn igAcceptDragDropPayload(type: [*c]const u8, flags: ImGuiDragDropFlags) [*c]const ImGuiPayload; pub extern fn igEndDragDropTarget() void; pub extern fn igGetDragDropPayload() [*c]const ImGuiPayload; pub extern fn igPushClipRect(clip_rect_min: ImVec2, clip_rect_max: ImVec2, intersect_with_current_clip_rect: bool) void; pub extern fn igPopClipRect() void; pub extern fn igSetItemDefaultFocus() void; pub extern fn igSetKeyboardFocusHere(offset: c_int) void; pub extern fn igIsItemHovered(flags: ImGuiHoveredFlags) bool; pub extern fn igIsItemActive() bool; pub extern fn igIsItemFocused() bool; pub extern fn igIsItemClicked(mouse_button: ImGuiMouseButton) bool; pub extern fn igIsItemVisible() bool; pub extern fn igIsItemEdited() bool; pub extern fn igIsItemActivated() bool; pub extern fn igIsItemDeactivated() bool; pub extern fn igIsItemDeactivatedAfterEdit() bool; pub extern fn igIsItemToggledOpen() bool; pub extern fn igIsAnyItemHovered() bool; pub extern fn igIsAnyItemActive() bool; pub extern fn igIsAnyItemFocused() bool; pub extern fn igGetItemRectMin(pOut: [*c]ImVec2) void; pub extern fn igGetItemRectMax(pOut: [*c]ImVec2) void; pub extern fn igGetItemRectSize(pOut: [*c]ImVec2) void; pub extern fn igSetItemAllowOverlap() void; pub extern fn igGetMainViewport() [*c]ImGuiViewport; pub extern fn igIsRectVisible_Nil(size: ImVec2) bool; pub extern fn igIsRectVisible_Vec2(rect_min: ImVec2, rect_max: ImVec2) bool; pub extern fn igGetTime() f64; pub extern fn igGetFrameCount() c_int; pub extern fn igGetBackgroundDrawList_Nil() [*c]ImDrawList; pub extern fn igGetForegroundDrawList_Nil() [*c]ImDrawList; pub extern fn igGetBackgroundDrawList_ViewportPtr(viewport: [*c]ImGuiViewport) [*c]ImDrawList; pub extern fn igGetForegroundDrawList_ViewportPtr(viewport: [*c]ImGuiViewport) [*c]ImDrawList; pub extern fn igGetDrawListSharedData() [*c]ImDrawListSharedData; pub extern fn igGetStyleColorName(idx: ImGuiCol) [*c]const u8; pub extern fn igSetStateStorage(storage: [*c]ImGuiStorage) void; pub extern fn igGetStateStorage() [*c]ImGuiStorage; pub extern fn igCalcListClipping(items_count: c_int, items_height: f32, out_items_display_start: [*c]c_int, out_items_display_end: [*c]c_int) void; pub extern fn igBeginChildFrame(id: ImGuiID, size: ImVec2, flags: ImGuiWindowFlags) bool; pub extern fn igEndChildFrame() void; pub extern fn igCalcTextSize(pOut: [*c]ImVec2, text: [*c]const u8, text_end: [*c]const u8, hide_text_after_double_hash: bool, wrap_width: f32) void; pub extern fn igColorConvertU32ToFloat4(pOut: [*c]ImVec4, in: ImU32) void; pub extern fn igColorConvertFloat4ToU32(in: ImVec4) ImU32; pub extern fn igColorConvertRGBtoHSV(r: f32, g: f32, b: f32, out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32) void; pub extern fn igColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: [*c]f32, out_g: [*c]f32, out_b: [*c]f32) void; pub extern fn igGetKeyIndex(imgui_key: ImGuiKey) c_int; pub extern fn igIsKeyDown(user_key_index: c_int) bool; pub extern fn igIsKeyPressed(user_key_index: c_int, repeat: bool) bool; pub extern fn igIsKeyReleased(user_key_index: c_int) bool; pub extern fn igGetKeyPressedAmount(key_index: c_int, repeat_delay: f32, rate: f32) c_int; pub extern fn igCaptureKeyboardFromApp(want_capture_keyboard_value: bool) void; pub extern fn igIsMouseDown(button: ImGuiMouseButton) bool; pub extern fn igIsMouseClicked(button: ImGuiMouseButton, repeat: bool) bool; pub extern fn igIsMouseReleased(button: ImGuiMouseButton) bool; pub extern fn igIsMouseDoubleClicked(button: ImGuiMouseButton) bool; pub extern fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) bool; pub extern fn igIsMousePosValid(mouse_pos: [*c]const ImVec2) bool; pub extern fn igIsAnyMouseDown() bool; pub extern fn igGetMousePos(pOut: [*c]ImVec2) void; pub extern fn igGetMousePosOnOpeningCurrentPopup(pOut: [*c]ImVec2) void; pub extern fn igIsMouseDragging(button: ImGuiMouseButton, lock_threshold: f32) bool; pub extern fn igGetMouseDragDelta(pOut: [*c]ImVec2, button: ImGuiMouseButton, lock_threshold: f32) void; pub extern fn igResetMouseDragDelta(button: ImGuiMouseButton) void; pub extern fn igGetMouseCursor() ImGuiMouseCursor; pub extern fn igSetMouseCursor(cursor_type: ImGuiMouseCursor) void; pub extern fn igCaptureMouseFromApp(want_capture_mouse_value: bool) void; pub extern fn igGetClipboardText() [*c]const u8; pub extern fn igSetClipboardText(text: [*c]const u8) void; pub extern fn igLoadIniSettingsFromDisk(ini_filename: [*c]const u8) void; pub extern fn igLoadIniSettingsFromMemory(ini_data: [*c]const u8, ini_size: usize) void; pub extern fn igSaveIniSettingsToDisk(ini_filename: [*c]const u8) void; pub extern fn igSaveIniSettingsToMemory(out_ini_size: [*c]usize) [*c]const u8; pub extern fn igDebugCheckVersionAndDataLayout(version_str: [*c]const u8, sz_io: usize, sz_style: usize, sz_vec2: usize, sz_vec4: usize, sz_drawvert: usize, sz_drawidx: usize) bool; pub extern fn igSetAllocatorFunctions(alloc_func: ImGuiMemAllocFunc, free_func: ImGuiMemFreeFunc, user_data: ?*c_void) void; pub extern fn igGetAllocatorFunctions(p_alloc_func: [*c]ImGuiMemAllocFunc, p_free_func: [*c]ImGuiMemFreeFunc, p_user_data: [*c]?*c_void) void; pub extern fn igMemAlloc(size: usize) ?*c_void; pub extern fn igMemFree(ptr: ?*c_void) void; pub extern fn igGetPlatformIO() [*c]ImGuiPlatformIO; pub extern fn igUpdatePlatformWindows() void; pub extern fn igRenderPlatformWindowsDefault(platform_render_arg: ?*c_void, renderer_render_arg: ?*c_void) void; pub extern fn igDestroyPlatformWindows() void; pub extern fn igFindViewportByID(id: ImGuiID) [*c]ImGuiViewport; pub extern fn igFindViewportByPlatformHandle(platform_handle: ?*c_void) [*c]ImGuiViewport; pub extern fn ImGuiStyle_ImGuiStyle() [*c]ImGuiStyle; pub extern fn ImGuiStyle_destroy(self: [*c]ImGuiStyle) void; pub extern fn ImGuiStyle_ScaleAllSizes(self: [*c]ImGuiStyle, scale_factor: f32) void; pub extern fn ImGuiIO_AddInputCharacter(self: [*c]ImGuiIO, c: c_uint) void; pub extern fn ImGuiIO_AddInputCharacterUTF16(self: [*c]ImGuiIO, c: ImWchar16) void; pub extern fn ImGuiIO_AddInputCharactersUTF8(self: [*c]ImGuiIO, str: [*c]const u8) void; pub extern fn ImGuiIO_ClearInputCharacters(self: [*c]ImGuiIO) void; pub extern fn ImGuiIO_ImGuiIO() [*c]ImGuiIO; pub extern fn ImGuiIO_destroy(self: [*c]ImGuiIO) void; pub extern fn ImGuiInputTextCallbackData_ImGuiInputTextCallbackData() [*c]ImGuiInputTextCallbackData; pub extern fn ImGuiInputTextCallbackData_destroy(self: [*c]ImGuiInputTextCallbackData) void; pub extern fn ImGuiInputTextCallbackData_DeleteChars(self: [*c]ImGuiInputTextCallbackData, pos: c_int, bytes_count: c_int) void; pub extern fn ImGuiInputTextCallbackData_InsertChars(self: [*c]ImGuiInputTextCallbackData, pos: c_int, text: [*c]const u8, text_end: [*c]const u8) void; pub extern fn ImGuiInputTextCallbackData_SelectAll(self: [*c]ImGuiInputTextCallbackData) void; pub extern fn ImGuiInputTextCallbackData_ClearSelection(self: [*c]ImGuiInputTextCallbackData) void; pub extern fn ImGuiInputTextCallbackData_HasSelection(self: [*c]ImGuiInputTextCallbackData) bool; pub extern fn ImGuiWindowClass_ImGuiWindowClass() [*c]ImGuiWindowClass; pub extern fn ImGuiWindowClass_destroy(self: [*c]ImGuiWindowClass) void; pub extern fn ImGuiPayload_ImGuiPayload() [*c]ImGuiPayload; pub extern fn ImGuiPayload_destroy(self: [*c]ImGuiPayload) void; pub extern fn ImGuiPayload_Clear(self: [*c]ImGuiPayload) void; pub extern fn ImGuiPayload_IsDataType(self: [*c]ImGuiPayload, type: [*c]const u8) bool; pub extern fn ImGuiPayload_IsPreview(self: [*c]ImGuiPayload) bool; pub extern fn ImGuiPayload_IsDelivery(self: [*c]ImGuiPayload) bool; pub extern fn ImGuiTableColumnSortSpecs_ImGuiTableColumnSortSpecs() ?*ImGuiTableColumnSortSpecs; pub extern fn ImGuiTableColumnSortSpecs_destroy(self: ?*ImGuiTableColumnSortSpecs) void; pub extern fn ImGuiTableSortSpecs_ImGuiTableSortSpecs() [*c]ImGuiTableSortSpecs; pub extern fn ImGuiTableSortSpecs_destroy(self: [*c]ImGuiTableSortSpecs) void; pub extern fn ImGuiOnceUponAFrame_ImGuiOnceUponAFrame() [*c]ImGuiOnceUponAFrame; pub extern fn ImGuiOnceUponAFrame_destroy(self: [*c]ImGuiOnceUponAFrame) void; pub extern fn ImGuiTextFilter_ImGuiTextFilter(default_filter: [*c]const u8) [*c]ImGuiTextFilter; pub extern fn ImGuiTextFilter_destroy(self: [*c]ImGuiTextFilter) void; pub extern fn ImGuiTextFilter_Draw(self: [*c]ImGuiTextFilter, label: [*c]const u8, width: f32) bool; pub extern fn ImGuiTextFilter_PassFilter(self: [*c]ImGuiTextFilter, text: [*c]const u8, text_end: [*c]const u8) bool; pub extern fn ImGuiTextFilter_Build(self: [*c]ImGuiTextFilter) void; pub extern fn ImGuiTextFilter_Clear(self: [*c]ImGuiTextFilter) void; pub extern fn ImGuiTextFilter_IsActive(self: [*c]ImGuiTextFilter) bool; pub extern fn ImGuiTextRange_ImGuiTextRange_Nil() [*c]ImGuiTextRange; pub extern fn ImGuiTextRange_destroy(self: [*c]ImGuiTextRange) void; pub extern fn ImGuiTextRange_ImGuiTextRange_Str(_b: [*c]const u8, _e: [*c]const u8) [*c]ImGuiTextRange; pub extern fn ImGuiTextRange_empty(self: [*c]ImGuiTextRange) bool; pub extern fn ImGuiTextRange_split(self: [*c]ImGuiTextRange, separator: u8, out: [*c]ImVector_ImGuiTextRange) void; pub extern fn ImGuiTextBuffer_ImGuiTextBuffer() [*c]ImGuiTextBuffer; pub extern fn ImGuiTextBuffer_destroy(self: [*c]ImGuiTextBuffer) void; pub extern fn ImGuiTextBuffer_begin(self: [*c]ImGuiTextBuffer) [*c]const u8; pub extern fn ImGuiTextBuffer_end(self: [*c]ImGuiTextBuffer) [*c]const u8; pub extern fn ImGuiTextBuffer_size(self: [*c]ImGuiTextBuffer) c_int; pub extern fn ImGuiTextBuffer_empty(self: [*c]ImGuiTextBuffer) bool; pub extern fn ImGuiTextBuffer_clear(self: [*c]ImGuiTextBuffer) void; pub extern fn ImGuiTextBuffer_reserve(self: [*c]ImGuiTextBuffer, capacity: c_int) void; pub extern fn ImGuiTextBuffer_c_str(self: [*c]ImGuiTextBuffer) [*c]const u8; pub extern fn ImGuiTextBuffer_append(self: [*c]ImGuiTextBuffer, str: [*c]const u8, str_end: [*c]const u8) void; pub extern fn ImGuiTextBuffer_appendfv(self: [*c]ImGuiTextBuffer, fmt: [*c]const u8, args: va_list) void; pub extern fn ImGuiStoragePair_ImGuiStoragePair_Int(_key: ImGuiID, _val_i: c_int) [*c]ImGuiStoragePair; pub extern fn ImGuiStoragePair_destroy(self: [*c]ImGuiStoragePair) void; pub extern fn ImGuiStoragePair_ImGuiStoragePair_Float(_key: ImGuiID, _val_f: f32) [*c]ImGuiStoragePair; pub extern fn ImGuiStoragePair_ImGuiStoragePair_Ptr(_key: ImGuiID, _val_p: ?*c_void) [*c]ImGuiStoragePair; pub extern fn ImGuiStorage_Clear(self: [*c]ImGuiStorage) void; pub extern fn ImGuiStorage_GetInt(self: [*c]ImGuiStorage, key: ImGuiID, default_val: c_int) c_int; pub extern fn ImGuiStorage_SetInt(self: [*c]ImGuiStorage, key: ImGuiID, val: c_int) void; pub extern fn ImGuiStorage_GetBool(self: [*c]ImGuiStorage, key: ImGuiID, default_val: bool) bool; pub extern fn ImGuiStorage_SetBool(self: [*c]ImGuiStorage, key: ImGuiID, val: bool) void; pub extern fn ImGuiStorage_GetFloat(self: [*c]ImGuiStorage, key: ImGuiID, default_val: f32) f32; pub extern fn ImGuiStorage_SetFloat(self: [*c]ImGuiStorage, key: ImGuiID, val: f32) void; pub extern fn ImGuiStorage_GetVoidPtr(self: [*c]ImGuiStorage, key: ImGuiID) ?*c_void; pub extern fn ImGuiStorage_SetVoidPtr(self: [*c]ImGuiStorage, key: ImGuiID, val: ?*c_void) void; pub extern fn ImGuiStorage_GetIntRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: c_int) [*c]c_int; pub extern fn ImGuiStorage_GetBoolRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: bool) [*c]bool; pub extern fn ImGuiStorage_GetFloatRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: f32) [*c]f32; pub extern fn ImGuiStorage_GetVoidPtrRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: ?*c_void) [*c]?*c_void; pub extern fn ImGuiStorage_SetAllInt(self: [*c]ImGuiStorage, val: c_int) void; pub extern fn ImGuiStorage_BuildSortByKey(self: [*c]ImGuiStorage) void; pub extern fn ImGuiListClipper_ImGuiListClipper() [*c]ImGuiListClipper; pub extern fn ImGuiListClipper_destroy(self: [*c]ImGuiListClipper) void; pub extern fn ImGuiListClipper_Begin(self: [*c]ImGuiListClipper, items_count: c_int, items_height: f32) void; pub extern fn ImGuiListClipper_End(self: [*c]ImGuiListClipper) void; pub extern fn ImGuiListClipper_Step(self: [*c]ImGuiListClipper) bool; pub extern fn ImColor_ImColor_Nil() [*c]ImColor; pub extern fn ImColor_destroy(self: [*c]ImColor) void; pub extern fn ImColor_ImColor_Int(r: c_int, g: c_int, b: c_int, a: c_int) [*c]ImColor; pub extern fn ImColor_ImColor_U32(rgba: ImU32) [*c]ImColor; pub extern fn ImColor_ImColor_Float(r: f32, g: f32, b: f32, a: f32) [*c]ImColor; pub extern fn ImColor_ImColor_Vec4(col: ImVec4) [*c]ImColor; pub extern fn ImColor_SetHSV(self: [*c]ImColor, h: f32, s: f32, v: f32, a: f32) void; pub extern fn ImColor_HSV(pOut: [*c]ImColor, h: f32, s: f32, v: f32, a: f32) void; pub extern fn ImDrawCmd_ImDrawCmd() [*c]ImDrawCmd; pub extern fn ImDrawCmd_destroy(self: [*c]ImDrawCmd) void; pub extern fn ImDrawCmd_GetTexID(self: [*c]ImDrawCmd) ImTextureID; pub extern fn ImDrawListSplitter_ImDrawListSplitter() [*c]ImDrawListSplitter; pub extern fn ImDrawListSplitter_destroy(self: [*c]ImDrawListSplitter) void; pub extern fn ImDrawListSplitter_Clear(self: [*c]ImDrawListSplitter) void; pub extern fn ImDrawListSplitter_ClearFreeMemory(self: [*c]ImDrawListSplitter) void; pub extern fn ImDrawListSplitter_Split(self: [*c]ImDrawListSplitter, draw_list: [*c]ImDrawList, count: c_int) void; pub extern fn ImDrawListSplitter_Merge(self: [*c]ImDrawListSplitter, draw_list: [*c]ImDrawList) void; pub extern fn ImDrawListSplitter_SetCurrentChannel(self: [*c]ImDrawListSplitter, draw_list: [*c]ImDrawList, channel_idx: c_int) void; pub extern fn ImDrawList_ImDrawList(shared_data: [*c]const ImDrawListSharedData) [*c]ImDrawList; pub extern fn ImDrawList_destroy(self: [*c]ImDrawList) void; pub extern fn ImDrawList_PushClipRect(self: [*c]ImDrawList, clip_rect_min: ImVec2, clip_rect_max: ImVec2, intersect_with_current_clip_rect: bool) void; pub extern fn ImDrawList_PushClipRectFullScreen(self: [*c]ImDrawList) void; pub extern fn ImDrawList_PopClipRect(self: [*c]ImDrawList) void; pub extern fn ImDrawList_PushTextureID(self: [*c]ImDrawList, texture_id: ImTextureID) void; pub extern fn ImDrawList_PopTextureID(self: [*c]ImDrawList) void; pub extern fn ImDrawList_GetClipRectMin(pOut: [*c]ImVec2, self: [*c]ImDrawList) void; pub extern fn ImDrawList_GetClipRectMax(pOut: [*c]ImVec2, self: [*c]ImDrawList) void; pub extern fn ImDrawList_AddLine(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, col: ImU32, thickness: f32) void; pub extern fn ImDrawList_AddRect(self: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, col: ImU32, rounding: f32, flags: ImDrawFlags, thickness: f32) void; pub extern fn ImDrawList_AddRectFilled(self: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, col: ImU32, rounding: f32, flags: ImDrawFlags) void; pub extern fn ImDrawList_AddRectFilledMultiColor(self: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, col_upr_left: ImU32, col_upr_right: ImU32, col_bot_right: ImU32, col_bot_left: ImU32) void; pub extern fn ImDrawList_AddQuad(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, col: ImU32, thickness: f32) void; pub extern fn ImDrawList_AddQuadFilled(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, col: ImU32) void; pub extern fn ImDrawList_AddTriangle(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, col: ImU32, thickness: f32) void; pub extern fn ImDrawList_AddTriangleFilled(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, col: ImU32) void; pub extern fn ImDrawList_AddCircle(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int, thickness: f32) void; pub extern fn ImDrawList_AddCircleFilled(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int) void; pub extern fn ImDrawList_AddNgon(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int, thickness: f32) void; pub extern fn ImDrawList_AddNgonFilled(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int) void; pub extern fn ImDrawList_AddText_Vec2(self: [*c]ImDrawList, pos: ImVec2, col: ImU32, text_begin: [*c]const u8, text_end: [*c]const u8) void; pub extern fn ImDrawList_AddText_FontPtr(self: [*c]ImDrawList, font: [*c]const ImFont, font_size: f32, pos: ImVec2, col: ImU32, text_begin: [*c]const u8, text_end: [*c]const u8, wrap_width: f32, cpu_fine_clip_rect: [*c]const ImVec4) void; pub extern fn ImDrawList_AddPolyline(self: [*c]ImDrawList, points: [*c]const ImVec2, num_points: c_int, col: ImU32, flags: ImDrawFlags, thickness: f32) void; pub extern fn ImDrawList_AddConvexPolyFilled(self: [*c]ImDrawList, points: [*c]const ImVec2, num_points: c_int, col: ImU32) void; pub extern fn ImDrawList_AddBezierCubic(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, col: ImU32, thickness: f32, num_segments: c_int) void; pub extern fn ImDrawList_AddBezierQuadratic(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, col: ImU32, thickness: f32, num_segments: c_int) void; pub extern fn ImDrawList_AddImage(self: [*c]ImDrawList, user_texture_id: ImTextureID, p_min: ImVec2, p_max: ImVec2, uv_min: ImVec2, uv_max: ImVec2, col: ImU32) void; pub extern fn ImDrawList_AddImageQuad(self: [*c]ImDrawList, user_texture_id: ImTextureID, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, uv1: ImVec2, uv2: ImVec2, uv3: ImVec2, uv4: ImVec2, col: ImU32) void; pub extern fn ImDrawList_AddImageRounded(self: [*c]ImDrawList, user_texture_id: ImTextureID, p_min: ImVec2, p_max: ImVec2, uv_min: ImVec2, uv_max: ImVec2, col: ImU32, rounding: f32, flags: ImDrawFlags) void; pub extern fn ImDrawList_PathClear(self: [*c]ImDrawList) void; pub extern fn ImDrawList_PathLineTo(self: [*c]ImDrawList, pos: ImVec2) void; pub extern fn ImDrawList_PathLineToMergeDuplicate(self: [*c]ImDrawList, pos: ImVec2) void; pub extern fn ImDrawList_PathFillConvex(self: [*c]ImDrawList, col: ImU32) void; pub extern fn ImDrawList_PathStroke(self: [*c]ImDrawList, col: ImU32, flags: ImDrawFlags, thickness: f32) void; pub extern fn ImDrawList_PathArcTo(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min: f32, a_max: f32, num_segments: c_int) void; pub extern fn ImDrawList_PathArcToFast(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min_of_12: c_int, a_max_of_12: c_int) void; pub extern fn ImDrawList_PathBezierCubicCurveTo(self: [*c]ImDrawList, p2: ImVec2, p3: ImVec2, p4: ImVec2, num_segments: c_int) void; pub extern fn ImDrawList_PathBezierQuadraticCurveTo(self: [*c]ImDrawList, p2: ImVec2, p3: ImVec2, num_segments: c_int) void; pub extern fn ImDrawList_PathRect(self: [*c]ImDrawList, rect_min: ImVec2, rect_max: ImVec2, rounding: f32, flags: ImDrawFlags) void; pub extern fn ImDrawList_AddCallback(self: [*c]ImDrawList, callback: ImDrawCallback, callback_data: ?*c_void) void; pub extern fn ImDrawList_AddDrawCmd(self: [*c]ImDrawList) void; pub extern fn ImDrawList_CloneOutput(self: [*c]ImDrawList) [*c]ImDrawList; pub extern fn ImDrawList_ChannelsSplit(self: [*c]ImDrawList, count: c_int) void; pub extern fn ImDrawList_ChannelsMerge(self: [*c]ImDrawList) void; pub extern fn ImDrawList_ChannelsSetCurrent(self: [*c]ImDrawList, n: c_int) void; pub extern fn ImDrawList_PrimReserve(self: [*c]ImDrawList, idx_count: c_int, vtx_count: c_int) void; pub extern fn ImDrawList_PrimUnreserve(self: [*c]ImDrawList, idx_count: c_int, vtx_count: c_int) void; pub extern fn ImDrawList_PrimRect(self: [*c]ImDrawList, a: ImVec2, b: ImVec2, col: ImU32) void; pub extern fn ImDrawList_PrimRectUV(self: [*c]ImDrawList, a: ImVec2, b: ImVec2, uv_a: ImVec2, uv_b: ImVec2, col: ImU32) void; pub extern fn ImDrawList_PrimQuadUV(self: [*c]ImDrawList, a: ImVec2, b: ImVec2, c: ImVec2, d: ImVec2, uv_a: ImVec2, uv_b: ImVec2, uv_c: ImVec2, uv_d: ImVec2, col: ImU32) void; pub extern fn ImDrawList_PrimWriteVtx(self: [*c]ImDrawList, pos: ImVec2, uv: ImVec2, col: ImU32) void; pub extern fn ImDrawList_PrimWriteIdx(self: [*c]ImDrawList, idx: ImDrawIdx) void; pub extern fn ImDrawList_PrimVtx(self: [*c]ImDrawList, pos: ImVec2, uv: ImVec2, col: ImU32) void; pub extern fn ImDrawList__ResetForNewFrame(self: [*c]ImDrawList) void; pub extern fn ImDrawList__ClearFreeMemory(self: [*c]ImDrawList) void; pub extern fn ImDrawList__PopUnusedDrawCmd(self: [*c]ImDrawList) void; pub extern fn ImDrawList__OnChangedClipRect(self: [*c]ImDrawList) void; pub extern fn ImDrawList__OnChangedTextureID(self: [*c]ImDrawList) void; pub extern fn ImDrawList__OnChangedVtxOffset(self: [*c]ImDrawList) void; pub extern fn ImDrawList__CalcCircleAutoSegmentCount(self: [*c]ImDrawList, radius: f32) c_int; pub extern fn ImDrawList__PathArcToFastEx(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min_sample: c_int, a_max_sample: c_int, a_step: c_int) void; pub extern fn ImDrawList__PathArcToN(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min: f32, a_max: f32, num_segments: c_int) void; pub extern fn ImDrawData_ImDrawData() [*c]ImDrawData; pub extern fn ImDrawData_destroy(self: [*c]ImDrawData) void; pub extern fn ImDrawData_Clear(self: [*c]ImDrawData) void; pub extern fn ImDrawData_DeIndexAllBuffers(self: [*c]ImDrawData) void; pub extern fn ImDrawData_ScaleClipRects(self: [*c]ImDrawData, fb_scale: ImVec2) void; pub extern fn ImFontConfig_ImFontConfig() [*c]ImFontConfig; pub extern fn ImFontConfig_destroy(self: [*c]ImFontConfig) void; pub extern fn ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder() [*c]ImFontGlyphRangesBuilder; pub extern fn ImFontGlyphRangesBuilder_destroy(self: [*c]ImFontGlyphRangesBuilder) void; pub extern fn ImFontGlyphRangesBuilder_Clear(self: [*c]ImFontGlyphRangesBuilder) void; pub extern fn ImFontGlyphRangesBuilder_GetBit(self: [*c]ImFontGlyphRangesBuilder, n: usize) bool; pub extern fn ImFontGlyphRangesBuilder_SetBit(self: [*c]ImFontGlyphRangesBuilder, n: usize) void; pub extern fn ImFontGlyphRangesBuilder_AddChar(self: [*c]ImFontGlyphRangesBuilder, c: ImWchar) void; pub extern fn ImFontGlyphRangesBuilder_AddText(self: [*c]ImFontGlyphRangesBuilder, text: [*c]const u8, text_end: [*c]const u8) void; pub extern fn ImFontGlyphRangesBuilder_AddRanges(self: [*c]ImFontGlyphRangesBuilder, ranges: [*c]const ImWchar) void; pub extern fn ImFontGlyphRangesBuilder_BuildRanges(self: [*c]ImFontGlyphRangesBuilder, out_ranges: [*c]ImVector_ImWchar) void; pub extern fn ImFontAtlasCustomRect_ImFontAtlasCustomRect() [*c]ImFontAtlasCustomRect; pub extern fn ImFontAtlasCustomRect_destroy(self: [*c]ImFontAtlasCustomRect) void; pub extern fn ImFontAtlasCustomRect_IsPacked(self: [*c]ImFontAtlasCustomRect) bool; pub extern fn ImFontAtlas_ImFontAtlas() [*c]ImFontAtlas; pub extern fn ImFontAtlas_destroy(self: [*c]ImFontAtlas) void; pub extern fn ImFontAtlas_AddFont(self: [*c]ImFontAtlas, font_cfg: [*c]const ImFontConfig) [*c]ImFont; pub extern fn ImFontAtlas_AddFontDefault(self: [*c]ImFontAtlas, font_cfg: [*c]const ImFontConfig) [*c]ImFont; pub extern fn ImFontAtlas_AddFontFromFileTTF(self: [*c]ImFontAtlas, filename: [*c]const u8, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont; pub extern fn ImFontAtlas_AddFontFromMemoryTTF(self: [*c]ImFontAtlas, font_data: ?*c_void, font_size: c_int, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont; pub extern fn ImFontAtlas_AddFontFromMemoryCompressedTTF(self: [*c]ImFontAtlas, compressed_font_data: ?*const c_void, compressed_font_size: c_int, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont; pub extern fn ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(self: [*c]ImFontAtlas, compressed_font_data_base85: [*c]const u8, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont; pub extern fn ImFontAtlas_ClearInputData(self: [*c]ImFontAtlas) void; pub extern fn ImFontAtlas_ClearTexData(self: [*c]ImFontAtlas) void; pub extern fn ImFontAtlas_ClearFonts(self: [*c]ImFontAtlas) void; pub extern fn ImFontAtlas_Clear(self: [*c]ImFontAtlas) void; pub extern fn ImFontAtlas_Build(self: [*c]ImFontAtlas) bool; pub extern fn ImFontAtlas_GetTexDataAsAlpha8(self: [*c]ImFontAtlas, out_pixels: [*c][*c]u8, out_width: [*c]c_int, out_height: [*c]c_int, out_bytes_per_pixel: [*c]c_int) void; pub extern fn ImFontAtlas_GetTexDataAsRGBA32(self: [*c]ImFontAtlas, out_pixels: [*c][*c]u8, out_width: [*c]c_int, out_height: [*c]c_int, out_bytes_per_pixel: [*c]c_int) void; pub extern fn ImFontAtlas_IsBuilt(self: [*c]ImFontAtlas) bool; pub extern fn ImFontAtlas_SetTexID(self: [*c]ImFontAtlas, id: ImTextureID) void; pub extern fn ImFontAtlas_GetGlyphRangesDefault(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesKorean(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesJapanese(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesChineseFull(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesCyrillic(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesThai(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_GetGlyphRangesVietnamese(self: [*c]ImFontAtlas) [*c]const ImWchar; pub extern fn ImFontAtlas_AddCustomRectRegular(self: [*c]ImFontAtlas, width: c_int, height: c_int) c_int; pub extern fn ImFontAtlas_AddCustomRectFontGlyph(self: [*c]ImFontAtlas, font: [*c]ImFont, id: ImWchar, width: c_int, height: c_int, advance_x: f32, offset: ImVec2) c_int; pub extern fn ImFontAtlas_GetCustomRectByIndex(self: [*c]ImFontAtlas, index: c_int) [*c]ImFontAtlasCustomRect; pub extern fn ImFontAtlas_CalcCustomRectUV(self: [*c]ImFontAtlas, rect: [*c]const ImFontAtlasCustomRect, out_uv_min: [*c]ImVec2, out_uv_max: [*c]ImVec2) void; pub extern fn ImFontAtlas_GetMouseCursorTexData(self: [*c]ImFontAtlas, cursor: ImGuiMouseCursor, out_offset: [*c]ImVec2, out_size: [*c]ImVec2, out_uv_border: [*c]ImVec2, out_uv_fill: [*c]ImVec2) bool; pub extern fn ImFont_ImFont() [*c]ImFont; pub extern fn ImFont_destroy(self: [*c]ImFont) void; pub extern fn ImFont_FindGlyph(self: [*c]ImFont, c: ImWchar) ?*const ImFontGlyph; pub extern fn ImFont_FindGlyphNoFallback(self: [*c]ImFont, c: ImWchar) ?*const ImFontGlyph; pub extern fn ImFont_GetCharAdvance(self: [*c]ImFont, c: ImWchar) f32; pub extern fn ImFont_IsLoaded(self: [*c]ImFont) bool; pub extern fn ImFont_GetDebugName(self: [*c]ImFont) [*c]const u8; pub extern fn ImFont_CalcTextSizeA(pOut: [*c]ImVec2, self: [*c]ImFont, size: f32, max_width: f32, wrap_width: f32, text_begin: [*c]const u8, text_end: [*c]const u8, remaining: [*c][*c]const u8) void; pub extern fn ImFont_CalcWordWrapPositionA(self: [*c]ImFont, scale: f32, text: [*c]const u8, text_end: [*c]const u8, wrap_width: f32) [*c]const u8; pub extern fn ImFont_RenderChar(self: [*c]ImFont, draw_list: [*c]ImDrawList, size: f32, pos: ImVec2, col: ImU32, c: ImWchar) void; pub extern fn ImFont_RenderText(self: [*c]ImFont, draw_list: [*c]ImDrawList, size: f32, pos: ImVec2, col: ImU32, clip_rect: ImVec4, text_begin: [*c]const u8, text_end: [*c]const u8, wrap_width: f32, cpu_fine_clip: bool) void; pub extern fn ImFont_BuildLookupTable(self: [*c]ImFont) void; pub extern fn ImFont_ClearOutputData(self: [*c]ImFont) void; pub extern fn ImFont_GrowIndex(self: [*c]ImFont, new_size: c_int) void; pub extern fn ImFont_AddGlyph(self: [*c]ImFont, src_cfg: [*c]const ImFontConfig, c: ImWchar, x0: f32, y0: f32, x1: f32, y1: f32, u0: f32, v0: f32, u1: f32, v1: f32, advance_x: f32) void; pub extern fn ImFont_AddRemapChar(self: [*c]ImFont, dst: ImWchar, src: ImWchar, overwrite_dst: bool) void; pub extern fn ImFont_SetGlyphVisible(self: [*c]ImFont, c: ImWchar, visible: bool) void; pub extern fn ImFont_SetFallbackChar(self: [*c]ImFont, c: ImWchar) void; pub extern fn ImFont_IsGlyphRangeUnused(self: [*c]ImFont, c_begin: c_uint, c_last: c_uint) bool; pub extern fn ImGuiViewport_ImGuiViewport() [*c]ImGuiViewport; pub extern fn ImGuiViewport_destroy(self: [*c]ImGuiViewport) void; pub extern fn ImGuiViewport_GetCenter(pOut: [*c]ImVec2, self: [*c]ImGuiViewport) void; pub extern fn ImGuiViewport_GetWorkCenter(pOut: [*c]ImVec2, self: [*c]ImGuiViewport) void; pub extern fn ImGuiPlatformIO_ImGuiPlatformIO() [*c]ImGuiPlatformIO; pub extern fn ImGuiPlatformIO_destroy(self: [*c]ImGuiPlatformIO) void; pub extern fn ImGuiPlatformMonitor_ImGuiPlatformMonitor() [*c]ImGuiPlatformMonitor; pub extern fn ImGuiPlatformMonitor_destroy(self: [*c]ImGuiPlatformMonitor) void; pub extern fn igImHashData(data: ?*const c_void, data_size: usize, seed: ImU32) ImGuiID; pub extern fn igImHashStr(data: [*c]const u8, data_size: usize, seed: ImU32) ImGuiID; pub extern fn igImAlphaBlendColors(col_a: ImU32, col_b: ImU32) ImU32; pub extern fn igImIsPowerOfTwo_Int(v: c_int) bool; pub extern fn igImIsPowerOfTwo_U64(v: ImU64) bool; pub extern fn igImUpperPowerOfTwo(v: c_int) c_int; pub extern fn igImStricmp(str1: [*c]const u8, str2: [*c]const u8) c_int; pub extern fn igImStrnicmp(str1: [*c]const u8, str2: [*c]const u8, count: usize) c_int; pub extern fn igImStrncpy(dst: [*c]u8, src: [*c]const u8, count: usize) void; pub extern fn igImStrdup(str: [*c]const u8) [*c]u8; pub extern fn igImStrdupcpy(dst: [*c]u8, p_dst_size: [*c]usize, str: [*c]const u8) [*c]u8; pub extern fn igImStrchrRange(str_begin: [*c]const u8, str_end: [*c]const u8, c: u8) [*c]const u8; pub extern fn igImStrlenW(str: [*c]const ImWchar) c_int; pub extern fn igImStreolRange(str: [*c]const u8, str_end: [*c]const u8) [*c]const u8; pub extern fn igImStrbolW(buf_mid_line: [*c]const ImWchar, buf_begin: [*c]const ImWchar) [*c]const ImWchar; pub extern fn igImStristr(haystack: [*c]const u8, haystack_end: [*c]const u8, needle: [*c]const u8, needle_end: [*c]const u8) [*c]const u8; pub extern fn igImStrTrimBlanks(str: [*c]u8) void; pub extern fn igImStrSkipBlank(str: [*c]const u8) [*c]const u8; pub extern fn igImFormatString(buf: [*c]u8, buf_size: usize, fmt: [*c]const u8, ...) c_int; pub extern fn igImFormatStringV(buf: [*c]u8, buf_size: usize, fmt: [*c]const u8, args: va_list) c_int; pub extern fn igImParseFormatFindStart(format: [*c]const u8) [*c]const u8; pub extern fn igImParseFormatFindEnd(format: [*c]const u8) [*c]const u8; pub extern fn igImParseFormatTrimDecorations(format: [*c]const u8, buf: [*c]u8, buf_size: usize) [*c]const u8; pub extern fn igImParseFormatPrecision(format: [*c]const u8, default_value: c_int) c_int; pub extern fn igImCharIsBlankA(c: u8) bool; pub extern fn igImCharIsBlankW(c: c_uint) bool; pub extern fn igImTextStrToUtf8(buf: [*c]u8, buf_size: c_int, in_text: [*c]const ImWchar, in_text_end: [*c]const ImWchar) c_int; pub extern fn igImTextCharFromUtf8(out_char: [*c]c_uint, in_text: [*c]const u8, in_text_end: [*c]const u8) c_int; pub extern fn igImTextStrFromUtf8(buf: [*c]ImWchar, buf_size: c_int, in_text: [*c]const u8, in_text_end: [*c]const u8, in_remaining: [*c][*c]const u8) c_int; pub extern fn igImTextCountCharsFromUtf8(in_text: [*c]const u8, in_text_end: [*c]const u8) c_int; pub extern fn igImTextCountUtf8BytesFromChar(in_text: [*c]const u8, in_text_end: [*c]const u8) c_int; pub extern fn igImTextCountUtf8BytesFromStr(in_text: [*c]const ImWchar, in_text_end: [*c]const ImWchar) c_int; pub extern fn igImFileOpen(filename: [*c]const u8, mode: [*c]const u8) ImFileHandle; pub extern fn igImFileClose(file: ImFileHandle) bool; pub extern fn igImFileGetSize(file: ImFileHandle) ImU64; pub extern fn igImFileRead(data: ?*c_void, size: ImU64, count: ImU64, file: ImFileHandle) ImU64; pub extern fn igImFileWrite(data: ?*const c_void, size: ImU64, count: ImU64, file: ImFileHandle) ImU64; pub extern fn igImFileLoadToMemory(filename: [*c]const u8, mode: [*c]const u8, out_file_size: [*c]usize, padding_bytes: c_int) ?*c_void; pub extern fn igImPow_Float(x: f32, y: f32) f32; pub extern fn igImPow_double(x: f64, y: f64) f64; pub extern fn igImLog_Float(x: f32) f32; pub extern fn igImLog_double(x: f64) f64; pub extern fn igImAbs_Int(x: c_int) c_int; pub extern fn igImAbs_Float(x: f32) f32; pub extern fn igImAbs_double(x: f64) f64; pub extern fn igImSign_Float(x: f32) f32; pub extern fn igImSign_double(x: f64) f64; pub extern fn igImRsqrt_Float(x: f32) f32; pub extern fn igImRsqrt_double(x: f64) f64; pub extern fn igImMin(pOut: [*c]ImVec2, lhs: ImVec2, rhs: ImVec2) void; pub extern fn igImMax(pOut: [*c]ImVec2, lhs: ImVec2, rhs: ImVec2) void; pub extern fn igImClamp(pOut: [*c]ImVec2, v: ImVec2, mn: ImVec2, mx: ImVec2) void; pub extern fn igImLerp_Vec2Float(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, t: f32) void; pub extern fn igImLerp_Vec2Vec2(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, t: ImVec2) void; pub extern fn igImLerp_Vec4(pOut: [*c]ImVec4, a: ImVec4, b: ImVec4, t: f32) void; pub extern fn igImSaturate(f: f32) f32; pub extern fn igImLengthSqr_Vec2(lhs: ImVec2) f32; pub extern fn igImLengthSqr_Vec4(lhs: ImVec4) f32; pub extern fn igImInvLength(lhs: ImVec2, fail_value: f32) f32; pub extern fn igImFloor_Float(f: f32) f32; pub extern fn igImFloorSigned(f: f32) f32; pub extern fn igImFloor_Vec2(pOut: [*c]ImVec2, v: ImVec2) void; pub extern fn igImModPositive(a: c_int, b: c_int) c_int; pub extern fn igImDot(a: ImVec2, b: ImVec2) f32; pub extern fn igImRotate(pOut: [*c]ImVec2, v: ImVec2, cos_a: f32, sin_a: f32) void; pub extern fn igImLinearSweep(current: f32, target: f32, speed: f32) f32; pub extern fn igImMul(pOut: [*c]ImVec2, lhs: ImVec2, rhs: ImVec2) void; pub extern fn igImBezierCubicCalc(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, t: f32) void; pub extern fn igImBezierCubicClosestPoint(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, p: ImVec2, num_segments: c_int) void; pub extern fn igImBezierCubicClosestPointCasteljau(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, p: ImVec2, tess_tol: f32) void; pub extern fn igImBezierQuadraticCalc(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, t: f32) void; pub extern fn igImLineClosestPoint(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, p: ImVec2) void; pub extern fn igImTriangleContainsPoint(a: ImVec2, b: ImVec2, c: ImVec2, p: ImVec2) bool; pub extern fn igImTriangleClosestPoint(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, c: ImVec2, p: ImVec2) void; pub extern fn igImTriangleBarycentricCoords(a: ImVec2, b: ImVec2, c: ImVec2, p: ImVec2, out_u: [*c]f32, out_v: [*c]f32, out_w: [*c]f32) void; pub extern fn igImTriangleArea(a: ImVec2, b: ImVec2, c: ImVec2) f32; pub extern fn igImGetDirQuadrantFromDelta(dx: f32, dy: f32) ImGuiDir; pub extern fn ImVec1_ImVec1_Nil() [*c]ImVec1; pub extern fn ImVec1_destroy(self: [*c]ImVec1) void; pub extern fn ImVec1_ImVec1_Float(_x: f32) [*c]ImVec1; pub extern fn ImVec2ih_ImVec2ih_Nil() [*c]ImVec2ih; pub extern fn ImVec2ih_destroy(self: [*c]ImVec2ih) void; pub extern fn ImVec2ih_ImVec2ih_short(_x: c_short, _y: c_short) [*c]ImVec2ih; pub extern fn ImVec2ih_ImVec2ih_Vec2(rhs: ImVec2) [*c]ImVec2ih; pub extern fn ImRect_ImRect_Nil() [*c]ImRect; pub extern fn ImRect_destroy(self: [*c]ImRect) void; pub extern fn ImRect_ImRect_Vec2(min: ImVec2, max: ImVec2) [*c]ImRect; pub extern fn ImRect_ImRect_Vec4(v: ImVec4) [*c]ImRect; pub extern fn ImRect_ImRect_Float(x1: f32, y1: f32, x2: f32, y2: f32) [*c]ImRect; pub extern fn ImRect_GetCenter(pOut: [*c]ImVec2, self: [*c]ImRect) void; pub extern fn ImRect_GetSize(pOut: [*c]ImVec2, self: [*c]ImRect) void; pub extern fn ImRect_GetWidth(self: [*c]ImRect) f32; pub extern fn ImRect_GetHeight(self: [*c]ImRect) f32; pub extern fn ImRect_GetArea(self: [*c]ImRect) f32; pub extern fn ImRect_GetTL(pOut: [*c]ImVec2, self: [*c]ImRect) void; pub extern fn ImRect_GetTR(pOut: [*c]ImVec2, self: [*c]ImRect) void; pub extern fn ImRect_GetBL(pOut: [*c]ImVec2, self: [*c]ImRect) void; pub extern fn ImRect_GetBR(pOut: [*c]ImVec2, self: [*c]ImRect) void; pub extern fn ImRect_Contains_Vec2(self: [*c]ImRect, p: ImVec2) bool; pub extern fn ImRect_Contains_Rect(self: [*c]ImRect, r: ImRect) bool; pub extern fn ImRect_Overlaps(self: [*c]ImRect, r: ImRect) bool; pub extern fn ImRect_Add_Vec2(self: [*c]ImRect, p: ImVec2) void; pub extern fn ImRect_Add_Rect(self: [*c]ImRect, r: ImRect) void; pub extern fn ImRect_Expand_Float(self: [*c]ImRect, amount: f32) void; pub extern fn ImRect_Expand_Vec2(self: [*c]ImRect, amount: ImVec2) void; pub extern fn ImRect_Translate(self: [*c]ImRect, d: ImVec2) void; pub extern fn ImRect_TranslateX(self: [*c]ImRect, dx: f32) void; pub extern fn ImRect_TranslateY(self: [*c]ImRect, dy: f32) void; pub extern fn ImRect_ClipWith(self: [*c]ImRect, r: ImRect) void; pub extern fn ImRect_ClipWithFull(self: [*c]ImRect, r: ImRect) void; pub extern fn ImRect_Floor(self: [*c]ImRect) void; pub extern fn ImRect_IsInverted(self: [*c]ImRect) bool; pub extern fn ImRect_ToVec4(pOut: [*c]ImVec4, self: [*c]ImRect) void; pub extern fn igImBitArrayTestBit(arr: [*c]const ImU32, n: c_int) bool; pub extern fn igImBitArrayClearBit(arr: [*c]ImU32, n: c_int) void; pub extern fn igImBitArraySetBit(arr: [*c]ImU32, n: c_int) void; pub extern fn igImBitArraySetBitRange(arr: [*c]ImU32, n: c_int, n2: c_int) void; pub extern fn ImBitVector_Create(self: [*c]ImBitVector, sz: c_int) void; pub extern fn ImBitVector_Clear(self: [*c]ImBitVector) void; pub extern fn ImBitVector_TestBit(self: [*c]ImBitVector, n: c_int) bool; pub extern fn ImBitVector_SetBit(self: [*c]ImBitVector, n: c_int) void; pub extern fn ImBitVector_ClearBit(self: [*c]ImBitVector, n: c_int) void; pub extern fn ImDrawListSharedData_ImDrawListSharedData() [*c]ImDrawListSharedData; pub extern fn ImDrawListSharedData_destroy(self: [*c]ImDrawListSharedData) void; pub extern fn ImDrawListSharedData_SetCircleTessellationMaxError(self: [*c]ImDrawListSharedData, max_error: f32) void; pub extern fn ImDrawDataBuilder_Clear(self: [*c]ImDrawDataBuilder) void; pub extern fn ImDrawDataBuilder_ClearFreeMemory(self: [*c]ImDrawDataBuilder) void; pub extern fn ImDrawDataBuilder_GetDrawListCount(self: [*c]ImDrawDataBuilder) c_int; pub extern fn ImDrawDataBuilder_FlattenIntoSingleLayer(self: [*c]ImDrawDataBuilder) void; pub extern fn ImGuiStyleMod_ImGuiStyleMod_Int(idx: ImGuiStyleVar, v: c_int) [*c]ImGuiStyleMod; pub extern fn ImGuiStyleMod_destroy(self: [*c]ImGuiStyleMod) void; pub extern fn ImGuiStyleMod_ImGuiStyleMod_Float(idx: ImGuiStyleVar, v: f32) [*c]ImGuiStyleMod; pub extern fn ImGuiStyleMod_ImGuiStyleMod_Vec2(idx: ImGuiStyleVar, v: ImVec2) [*c]ImGuiStyleMod; pub extern fn ImGuiMenuColumns_ImGuiMenuColumns() [*c]ImGuiMenuColumns; pub extern fn ImGuiMenuColumns_destroy(self: [*c]ImGuiMenuColumns) void; pub extern fn ImGuiMenuColumns_Update(self: [*c]ImGuiMenuColumns, count: c_int, spacing: f32, clear: bool) void; pub extern fn ImGuiMenuColumns_DeclColumns(self: [*c]ImGuiMenuColumns, w0: f32, w1: f32, w2: f32) f32; pub extern fn ImGuiMenuColumns_CalcExtraSpace(self: [*c]ImGuiMenuColumns, avail_w: f32) f32; pub extern fn ImGuiInputTextState_ImGuiInputTextState() [*c]ImGuiInputTextState; pub extern fn ImGuiInputTextState_destroy(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiInputTextState_ClearText(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiInputTextState_ClearFreeMemory(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiInputTextState_GetUndoAvailCount(self: [*c]ImGuiInputTextState) c_int; pub extern fn ImGuiInputTextState_GetRedoAvailCount(self: [*c]ImGuiInputTextState) c_int; pub extern fn ImGuiInputTextState_OnKeyPressed(self: [*c]ImGuiInputTextState, key: c_int) void; pub extern fn ImGuiInputTextState_CursorAnimReset(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiInputTextState_CursorClamp(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiInputTextState_HasSelection(self: [*c]ImGuiInputTextState) bool; pub extern fn ImGuiInputTextState_ClearSelection(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiInputTextState_SelectAll(self: [*c]ImGuiInputTextState) void; pub extern fn ImGuiPopupData_ImGuiPopupData() [*c]ImGuiPopupData; pub extern fn ImGuiPopupData_destroy(self: [*c]ImGuiPopupData) void; pub extern fn ImGuiNavItemData_ImGuiNavItemData() [*c]ImGuiNavItemData; pub extern fn ImGuiNavItemData_destroy(self: [*c]ImGuiNavItemData) void; pub extern fn ImGuiNavItemData_Clear(self: [*c]ImGuiNavItemData) void; pub extern fn ImGuiNextWindowData_ImGuiNextWindowData() [*c]ImGuiNextWindowData; pub extern fn ImGuiNextWindowData_destroy(self: [*c]ImGuiNextWindowData) void; pub extern fn ImGuiNextWindowData_ClearFlags(self: [*c]ImGuiNextWindowData) void; pub extern fn ImGuiNextItemData_ImGuiNextItemData() [*c]ImGuiNextItemData; pub extern fn ImGuiNextItemData_destroy(self: [*c]ImGuiNextItemData) void; pub extern fn ImGuiNextItemData_ClearFlags(self: [*c]ImGuiNextItemData) void; pub extern fn ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(ptr: ?*c_void) [*c]ImGuiPtrOrIndex; pub extern fn ImGuiPtrOrIndex_destroy(self: [*c]ImGuiPtrOrIndex) void; pub extern fn ImGuiPtrOrIndex_ImGuiPtrOrIndex_Int(index: c_int) [*c]ImGuiPtrOrIndex; pub extern fn ImGuiOldColumnData_ImGuiOldColumnData() [*c]ImGuiOldColumnData; pub extern fn ImGuiOldColumnData_destroy(self: [*c]ImGuiOldColumnData) void; pub extern fn ImGuiOldColumns_ImGuiOldColumns() [*c]ImGuiOldColumns; pub extern fn ImGuiOldColumns_destroy(self: [*c]ImGuiOldColumns) void; pub extern fn ImGuiDockNode_ImGuiDockNode(id: ImGuiID) ?*ImGuiDockNode; pub extern fn ImGuiDockNode_destroy(self: ?*ImGuiDockNode) void; pub extern fn ImGuiDockNode_IsRootNode(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsDockSpace(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsFloatingNode(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsCentralNode(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsHiddenTabBar(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsNoTabBar(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsSplitNode(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsLeafNode(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_IsEmpty(self: ?*ImGuiDockNode) bool; pub extern fn ImGuiDockNode_GetMergedFlags(self: ?*ImGuiDockNode) ImGuiDockNodeFlags; pub extern fn ImGuiDockNode_Rect(pOut: [*c]ImRect, self: ?*ImGuiDockNode) void; pub extern fn ImGuiDockContext_ImGuiDockContext() [*c]ImGuiDockContext; pub extern fn ImGuiDockContext_destroy(self: [*c]ImGuiDockContext) void; pub extern fn ImGuiViewportP_ImGuiViewportP() [*c]ImGuiViewportP; pub extern fn ImGuiViewportP_destroy(self: [*c]ImGuiViewportP) void; pub extern fn ImGuiViewportP_ClearRequestFlags(self: [*c]ImGuiViewportP) void; pub extern fn ImGuiViewportP_CalcWorkRectPos(pOut: [*c]ImVec2, self: [*c]ImGuiViewportP, off_min: ImVec2) void; pub extern fn ImGuiViewportP_CalcWorkRectSize(pOut: [*c]ImVec2, self: [*c]ImGuiViewportP, off_min: ImVec2, off_max: ImVec2) void; pub extern fn ImGuiViewportP_UpdateWorkRect(self: [*c]ImGuiViewportP) void; pub extern fn ImGuiViewportP_GetMainRect(pOut: [*c]ImRect, self: [*c]ImGuiViewportP) void; pub extern fn ImGuiViewportP_GetWorkRect(pOut: [*c]ImRect, self: [*c]ImGuiViewportP) void; pub extern fn ImGuiViewportP_GetBuildWorkRect(pOut: [*c]ImRect, self: [*c]ImGuiViewportP) void; pub extern fn ImGuiWindowSettings_ImGuiWindowSettings() [*c]ImGuiWindowSettings; pub extern fn ImGuiWindowSettings_destroy(self: [*c]ImGuiWindowSettings) void; pub extern fn ImGuiWindowSettings_GetName(self: [*c]ImGuiWindowSettings) [*c]u8; pub extern fn ImGuiSettingsHandler_ImGuiSettingsHandler() [*c]ImGuiSettingsHandler; pub extern fn ImGuiSettingsHandler_destroy(self: [*c]ImGuiSettingsHandler) void; pub extern fn ImGuiMetricsConfig_ImGuiMetricsConfig() [*c]ImGuiMetricsConfig; pub extern fn ImGuiMetricsConfig_destroy(self: [*c]ImGuiMetricsConfig) void; pub extern fn ImGuiStackSizes_ImGuiStackSizes() [*c]ImGuiStackSizes; pub extern fn ImGuiStackSizes_destroy(self: [*c]ImGuiStackSizes) void; pub extern fn ImGuiStackSizes_SetToCurrentState(self: [*c]ImGuiStackSizes) void; pub extern fn ImGuiStackSizes_CompareWithCurrentState(self: [*c]ImGuiStackSizes) void; pub extern fn ImGuiContextHook_ImGuiContextHook() [*c]ImGuiContextHook; pub extern fn ImGuiContextHook_destroy(self: [*c]ImGuiContextHook) void; pub extern fn ImGuiContext_ImGuiContext(shared_font_atlas: [*c]ImFontAtlas) [*c]ImGuiContext; pub extern fn ImGuiContext_destroy(self: [*c]ImGuiContext) void; pub extern fn ImGuiWindow_ImGuiWindow(context: [*c]ImGuiContext, name: [*c]const u8) ?*ImGuiWindow; pub extern fn ImGuiWindow_destroy(self: ?*ImGuiWindow) void; pub extern fn ImGuiWindow_GetID_Str(self: ?*ImGuiWindow, str: [*c]const u8, str_end: [*c]const u8) ImGuiID; pub extern fn ImGuiWindow_GetID_Ptr(self: ?*ImGuiWindow, ptr: ?*const c_void) ImGuiID; pub extern fn ImGuiWindow_GetID_Int(self: ?*ImGuiWindow, n: c_int) ImGuiID; pub extern fn ImGuiWindow_GetIDNoKeepAlive_Str(self: ?*ImGuiWindow, str: [*c]const u8, str_end: [*c]const u8) ImGuiID; pub extern fn ImGuiWindow_GetIDNoKeepAlive_Ptr(self: ?*ImGuiWindow, ptr: ?*const c_void) ImGuiID; pub extern fn ImGuiWindow_GetIDNoKeepAlive_Int(self: ?*ImGuiWindow, n: c_int) ImGuiID; pub extern fn ImGuiWindow_GetIDFromRectangle(self: ?*ImGuiWindow, r_abs: ImRect) ImGuiID; pub extern fn ImGuiWindow_Rect(pOut: [*c]ImRect, self: ?*ImGuiWindow) void; pub extern fn ImGuiWindow_CalcFontSize(self: ?*ImGuiWindow) f32; pub extern fn ImGuiWindow_TitleBarHeight(self: ?*ImGuiWindow) f32; pub extern fn ImGuiWindow_TitleBarRect(pOut: [*c]ImRect, self: ?*ImGuiWindow) void; pub extern fn ImGuiWindow_MenuBarHeight(self: ?*ImGuiWindow) f32; pub extern fn ImGuiWindow_MenuBarRect(pOut: [*c]ImRect, self: ?*ImGuiWindow) void; pub extern fn ImGuiLastItemDataBackup_ImGuiLastItemDataBackup() [*c]ImGuiLastItemDataBackup; pub extern fn ImGuiLastItemDataBackup_destroy(self: [*c]ImGuiLastItemDataBackup) void; pub extern fn ImGuiLastItemDataBackup_Backup(self: [*c]ImGuiLastItemDataBackup) void; pub extern fn ImGuiLastItemDataBackup_Restore(self: [*c]ImGuiLastItemDataBackup) void; pub extern fn ImGuiTabItem_ImGuiTabItem() [*c]ImGuiTabItem; pub extern fn ImGuiTabItem_destroy(self: [*c]ImGuiTabItem) void; pub extern fn ImGuiTabBar_ImGuiTabBar() [*c]ImGuiTabBar; pub extern fn ImGuiTabBar_destroy(self: [*c]ImGuiTabBar) void; pub extern fn ImGuiTabBar_GetTabOrder(self: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem) c_int; pub extern fn ImGuiTabBar_GetTabName(self: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem) [*c]const u8; pub extern fn ImGuiTableColumn_ImGuiTableColumn() ?*ImGuiTableColumn; pub extern fn ImGuiTableColumn_destroy(self: ?*ImGuiTableColumn) void; pub extern fn ImGuiTable_ImGuiTable() ?*ImGuiTable; pub extern fn ImGuiTable_destroy(self: ?*ImGuiTable) void; pub extern fn ImGuiTableTempData_ImGuiTableTempData() [*c]ImGuiTableTempData; pub extern fn ImGuiTableTempData_destroy(self: [*c]ImGuiTableTempData) void; pub extern fn ImGuiTableColumnSettings_ImGuiTableColumnSettings() ?*ImGuiTableColumnSettings; pub extern fn ImGuiTableColumnSettings_destroy(self: ?*ImGuiTableColumnSettings) void; pub extern fn ImGuiTableSettings_ImGuiTableSettings() [*c]ImGuiTableSettings; pub extern fn ImGuiTableSettings_destroy(self: [*c]ImGuiTableSettings) void; pub extern fn ImGuiTableSettings_GetColumnSettings(self: [*c]ImGuiTableSettings) ?*ImGuiTableColumnSettings; pub extern fn igGetCurrentWindowRead() ?*ImGuiWindow; pub extern fn igGetCurrentWindow() ?*ImGuiWindow; pub extern fn igFindWindowByID(id: ImGuiID) ?*ImGuiWindow; pub extern fn igFindWindowByName(name: [*c]const u8) ?*ImGuiWindow; pub extern fn igUpdateWindowParentAndRootLinks(window: ?*ImGuiWindow, flags: ImGuiWindowFlags, parent_window: ?*ImGuiWindow) void; pub extern fn igCalcWindowNextAutoFitSize(pOut: [*c]ImVec2, window: ?*ImGuiWindow) void; pub extern fn igIsWindowChildOf(window: ?*ImGuiWindow, potential_parent: ?*ImGuiWindow) bool; pub extern fn igIsWindowAbove(potential_above: ?*ImGuiWindow, potential_below: ?*ImGuiWindow) bool; pub extern fn igIsWindowNavFocusable(window: ?*ImGuiWindow) bool; pub extern fn igGetWindowAllowedExtentRect(pOut: [*c]ImRect, window: ?*ImGuiWindow) void; pub extern fn igSetWindowPos_WindowPtr(window: ?*ImGuiWindow, pos: ImVec2, cond: ImGuiCond) void; pub extern fn igSetWindowSize_WindowPtr(window: ?*ImGuiWindow, size: ImVec2, cond: ImGuiCond) void; pub extern fn igSetWindowCollapsed_WindowPtr(window: ?*ImGuiWindow, collapsed: bool, cond: ImGuiCond) void; pub extern fn igSetWindowHitTestHole(window: ?*ImGuiWindow, pos: ImVec2, size: ImVec2) void; pub extern fn igFocusWindow(window: ?*ImGuiWindow) void; pub extern fn igFocusTopMostWindowUnderOne(under_this_window: ?*ImGuiWindow, ignore_window: ?*ImGuiWindow) void; pub extern fn igBringWindowToFocusFront(window: ?*ImGuiWindow) void; pub extern fn igBringWindowToDisplayFront(window: ?*ImGuiWindow) void; pub extern fn igBringWindowToDisplayBack(window: ?*ImGuiWindow) void; pub extern fn igSetCurrentFont(font: [*c]ImFont) void; pub extern fn igGetDefaultFont() [*c]ImFont; pub extern fn igGetForegroundDrawList_WindowPtr(window: ?*ImGuiWindow) [*c]ImDrawList; pub extern fn igInitialize(context: [*c]ImGuiContext) void; pub extern fn igShutdown(context: [*c]ImGuiContext) void; pub extern fn igUpdateHoveredWindowAndCaptureFlags() void; pub extern fn igStartMouseMovingWindow(window: ?*ImGuiWindow) void; pub extern fn igStartMouseMovingWindowOrNode(window: ?*ImGuiWindow, node: ?*ImGuiDockNode, undock_floating_node: bool) void; pub extern fn igUpdateMouseMovingWindowNewFrame() void; pub extern fn igUpdateMouseMovingWindowEndFrame() void; pub extern fn igAddContextHook(context: [*c]ImGuiContext, hook: [*c]const ImGuiContextHook) ImGuiID; pub extern fn igRemoveContextHook(context: [*c]ImGuiContext, hook_to_remove: ImGuiID) void; pub extern fn igCallContextHooks(context: [*c]ImGuiContext, type: ImGuiContextHookType) void; pub extern fn igTranslateWindowsInViewport(viewport: [*c]ImGuiViewportP, old_pos: ImVec2, new_pos: ImVec2) void; pub extern fn igScaleWindowsInViewport(viewport: [*c]ImGuiViewportP, scale: f32) void; pub extern fn igDestroyPlatformWindow(viewport: [*c]ImGuiViewportP) void; pub extern fn igSetCurrentViewport(window: ?*ImGuiWindow, viewport: [*c]ImGuiViewportP) void; pub extern fn igGetViewportPlatformMonitor(viewport: [*c]ImGuiViewport) [*c]const ImGuiPlatformMonitor; pub extern fn igMarkIniSettingsDirty_Nil() void; pub extern fn igMarkIniSettingsDirty_WindowPtr(window: ?*ImGuiWindow) void; pub extern fn igClearIniSettings() void; pub extern fn igCreateNewWindowSettings(name: [*c]const u8) [*c]ImGuiWindowSettings; pub extern fn igFindWindowSettings(id: ImGuiID) [*c]ImGuiWindowSettings; pub extern fn igFindOrCreateWindowSettings(name: [*c]const u8) [*c]ImGuiWindowSettings; pub extern fn igFindSettingsHandler(type_name: [*c]const u8) [*c]ImGuiSettingsHandler; pub extern fn igSetNextWindowScroll(scroll: ImVec2) void; pub extern fn igSetScrollX_WindowPtr(window: ?*ImGuiWindow, scroll_x: f32) void; pub extern fn igSetScrollY_WindowPtr(window: ?*ImGuiWindow, scroll_y: f32) void; pub extern fn igSetScrollFromPosX_WindowPtr(window: ?*ImGuiWindow, local_x: f32, center_x_ratio: f32) void; pub extern fn igSetScrollFromPosY_WindowPtr(window: ?*ImGuiWindow, local_y: f32, center_y_ratio: f32) void; pub extern fn igScrollToBringRectIntoView(pOut: [*c]ImVec2, window: ?*ImGuiWindow, item_rect: ImRect) void; pub extern fn igGetItemID() ImGuiID; pub extern fn igGetItemStatusFlags() ImGuiItemStatusFlags; pub extern fn igGetActiveID() ImGuiID; pub extern fn igGetFocusID() ImGuiID; pub extern fn igGetItemFlags() ImGuiItemFlags; pub extern fn igSetActiveID(id: ImGuiID, window: ?*ImGuiWindow) void; pub extern fn igSetFocusID(id: ImGuiID, window: ?*ImGuiWindow) void; pub extern fn igClearActiveID() void; pub extern fn igGetHoveredID() ImGuiID; pub extern fn igSetHoveredID(id: ImGuiID) void; pub extern fn igKeepAliveID(id: ImGuiID) void; pub extern fn igMarkItemEdited(id: ImGuiID) void; pub extern fn igPushOverrideID(id: ImGuiID) void; pub extern fn igGetIDWithSeed(str_id_begin: [*c]const u8, str_id_end: [*c]const u8, seed: ImGuiID) ImGuiID; pub extern fn igItemSize_Vec2(size: ImVec2, text_baseline_y: f32) void; pub extern fn igItemSize_Rect(bb: ImRect, text_baseline_y: f32) void; pub extern fn igItemAdd(bb: ImRect, id: ImGuiID, nav_bb: [*c]const ImRect, flags: ImGuiItemAddFlags) bool; pub extern fn igItemHoverable(bb: ImRect, id: ImGuiID) bool; pub extern fn igItemFocusable(window: ?*ImGuiWindow, id: ImGuiID) void; pub extern fn igIsClippedEx(bb: ImRect, id: ImGuiID, clip_even_when_logged: bool) bool; pub extern fn igSetLastItemData(window: ?*ImGuiWindow, item_id: ImGuiID, status_flags: ImGuiItemStatusFlags, item_rect: ImRect) void; pub extern fn igCalcItemSize(pOut: [*c]ImVec2, size: ImVec2, default_w: f32, default_h: f32) void; pub extern fn igCalcWrapWidthForPos(pos: ImVec2, wrap_pos_x: f32) f32; pub extern fn igPushMultiItemsWidths(components: c_int, width_full: f32) void; pub extern fn igPushItemFlag(option: ImGuiItemFlags, enabled: bool) void; pub extern fn igPopItemFlag() void; pub extern fn igIsItemToggledSelection() bool; pub extern fn igGetContentRegionMaxAbs(pOut: [*c]ImVec2) void; pub extern fn igShrinkWidths(items: [*c]ImGuiShrinkWidthItem, count: c_int, width_excess: f32) void; pub extern fn igLogBegin(type: ImGuiLogType, auto_open_depth: c_int) void; pub extern fn igLogToBuffer(auto_open_depth: c_int) void; pub extern fn igLogRenderedText(ref_pos: [*c]const ImVec2, text: [*c]const u8, text_end: [*c]const u8) void; pub extern fn igLogSetNextTextDecoration(prefix: [*c]const u8, suffix: [*c]const u8) void; pub extern fn igBeginChildEx(name: [*c]const u8, id: ImGuiID, size_arg: ImVec2, border: bool, flags: ImGuiWindowFlags) bool; pub extern fn igOpenPopupEx(id: ImGuiID, popup_flags: ImGuiPopupFlags) void; pub extern fn igClosePopupToLevel(remaining: c_int, restore_focus_to_window_under_popup: bool) void; pub extern fn igClosePopupsOverWindow(ref_window: ?*ImGuiWindow, restore_focus_to_window_under_popup: bool) void; pub extern fn igIsPopupOpen_ID(id: ImGuiID, popup_flags: ImGuiPopupFlags) bool; pub extern fn igBeginPopupEx(id: ImGuiID, extra_flags: ImGuiWindowFlags) bool; pub extern fn igBeginTooltipEx(extra_flags: ImGuiWindowFlags, tooltip_flags: ImGuiTooltipFlags) void; pub extern fn igGetTopMostPopupModal() ?*ImGuiWindow; pub extern fn igFindBestWindowPosForPopup(pOut: [*c]ImVec2, window: ?*ImGuiWindow) void; pub extern fn igFindBestWindowPosForPopupEx(pOut: [*c]ImVec2, ref_pos: ImVec2, size: ImVec2, last_dir: [*c]ImGuiDir, r_outer: ImRect, r_avoid: ImRect, policy: ImGuiPopupPositionPolicy) void; pub extern fn igBeginViewportSideBar(name: [*c]const u8, viewport: [*c]ImGuiViewport, dir: ImGuiDir, size: f32, window_flags: ImGuiWindowFlags) bool; pub extern fn igNavInitWindow(window: ?*ImGuiWindow, force_reinit: bool) void; pub extern fn igNavMoveRequestButNoResultYet() bool; pub extern fn igNavMoveRequestCancel() void; pub extern fn igNavMoveRequestForward(move_dir: ImGuiDir, clip_dir: ImGuiDir, bb_rel: ImRect, move_flags: ImGuiNavMoveFlags) void; pub extern fn igNavMoveRequestTryWrapping(window: ?*ImGuiWindow, move_flags: ImGuiNavMoveFlags) void; pub extern fn igGetNavInputAmount(n: ImGuiNavInput, mode: ImGuiInputReadMode) f32; pub extern fn igGetNavInputAmount2d(pOut: [*c]ImVec2, dir_sources: ImGuiNavDirSourceFlags, mode: ImGuiInputReadMode, slow_factor: f32, fast_factor: f32) void; pub extern fn igCalcTypematicRepeatAmount(t0: f32, t1: f32, repeat_delay: f32, repeat_rate: f32) c_int; pub extern fn igActivateItem(id: ImGuiID) void; pub extern fn igSetNavID(id: ImGuiID, nav_layer: ImGuiNavLayer, focus_scope_id: ImGuiID, rect_rel: ImRect) void; pub extern fn igPushFocusScope(id: ImGuiID) void; pub extern fn igPopFocusScope() void; pub extern fn igGetFocusedFocusScope() ImGuiID; pub extern fn igGetFocusScope() ImGuiID; pub extern fn igSetItemUsingMouseWheel() void; pub extern fn igIsActiveIdUsingNavDir(dir: ImGuiDir) bool; pub extern fn igIsActiveIdUsingNavInput(input: ImGuiNavInput) bool; pub extern fn igIsActiveIdUsingKey(key: ImGuiKey) bool; pub extern fn igIsMouseDragPastThreshold(button: ImGuiMouseButton, lock_threshold: f32) bool; pub extern fn igIsKeyPressedMap(key: ImGuiKey, repeat: bool) bool; pub extern fn igIsNavInputDown(n: ImGuiNavInput) bool; pub extern fn igIsNavInputTest(n: ImGuiNavInput, rm: ImGuiInputReadMode) bool; pub extern fn igGetMergedKeyModFlags() ImGuiKeyModFlags; pub extern fn igDockContextInitialize(ctx: [*c]ImGuiContext) void; pub extern fn igDockContextShutdown(ctx: [*c]ImGuiContext) void; pub extern fn igDockContextClearNodes(ctx: [*c]ImGuiContext, root_id: ImGuiID, clear_settings_refs: bool) void; pub extern fn igDockContextRebuildNodes(ctx: [*c]ImGuiContext) void; pub extern fn igDockContextNewFrameUpdateUndocking(ctx: [*c]ImGuiContext) void; pub extern fn igDockContextNewFrameUpdateDocking(ctx: [*c]ImGuiContext) void; pub extern fn igDockContextGenNodeID(ctx: [*c]ImGuiContext) ImGuiID; pub extern fn igDockContextQueueDock(ctx: [*c]ImGuiContext, target: ?*ImGuiWindow, target_node: ?*ImGuiDockNode, payload: ?*ImGuiWindow, split_dir: ImGuiDir, split_ratio: f32, split_outer: bool) void; pub extern fn igDockContextQueueUndockWindow(ctx: [*c]ImGuiContext, window: ?*ImGuiWindow) void; pub extern fn igDockContextQueueUndockNode(ctx: [*c]ImGuiContext, node: ?*ImGuiDockNode) void; pub extern fn igDockContextCalcDropPosForDocking(target: ?*ImGuiWindow, target_node: ?*ImGuiDockNode, payload: ?*ImGuiWindow, split_dir: ImGuiDir, split_outer: bool, out_pos: [*c]ImVec2) bool; pub extern fn igDockNodeBeginAmendTabBar(node: ?*ImGuiDockNode) bool; pub extern fn igDockNodeEndAmendTabBar() void; pub extern fn igDockNodeGetRootNode(node: ?*ImGuiDockNode) ?*ImGuiDockNode; pub extern fn igDockNodeGetDepth(node: ?*const ImGuiDockNode) c_int; pub extern fn igDockNodeGetWindowMenuButtonId(node: ?*const ImGuiDockNode) ImGuiID; pub extern fn igGetWindowDockNode() ?*ImGuiDockNode; pub extern fn igGetWindowAlwaysWantOwnTabBar(window: ?*ImGuiWindow) bool; pub extern fn igBeginDocked(window: ?*ImGuiWindow, p_open: [*c]bool) void; pub extern fn igBeginDockableDragDropSource(window: ?*ImGuiWindow) void; pub extern fn igBeginDockableDragDropTarget(window: ?*ImGuiWindow) void; pub extern fn igSetWindowDock(window: ?*ImGuiWindow, dock_id: ImGuiID, cond: ImGuiCond) void; pub extern fn igDockBuilderDockWindow(window_name: [*c]const u8, node_id: ImGuiID) void; pub extern fn igDockBuilderGetNode(node_id: ImGuiID) ?*ImGuiDockNode; pub extern fn igDockBuilderGetCentralNode(node_id: ImGuiID) ?*ImGuiDockNode; pub extern fn igDockBuilderAddNode(node_id: ImGuiID, flags: ImGuiDockNodeFlags) ImGuiID; pub extern fn igDockBuilderRemoveNode(node_id: ImGuiID) void; pub extern fn igDockBuilderRemoveNodeDockedWindows(node_id: ImGuiID, clear_settings_refs: bool) void; pub extern fn igDockBuilderRemoveNodeChildNodes(node_id: ImGuiID) void; pub extern fn igDockBuilderSetNodePos(node_id: ImGuiID, pos: ImVec2) void; pub extern fn igDockBuilderSetNodeSize(node_id: ImGuiID, size: ImVec2) void; pub extern fn igDockBuilderSplitNode(node_id: ImGuiID, split_dir: ImGuiDir, size_ratio_for_node_at_dir: f32, out_id_at_dir: [*c]ImGuiID, out_id_at_opposite_dir: [*c]ImGuiID) ImGuiID; pub extern fn igDockBuilderCopyDockSpace(src_dockspace_id: ImGuiID, dst_dockspace_id: ImGuiID, in_window_remap_pairs: [*c]ImVector_const_charPtr) void; pub extern fn igDockBuilderCopyNode(src_node_id: ImGuiID, dst_node_id: ImGuiID, out_node_remap_pairs: [*c]ImVector_ImGuiID) void; pub extern fn igDockBuilderCopyWindowSettings(src_name: [*c]const u8, dst_name: [*c]const u8) void; pub extern fn igDockBuilderFinish(node_id: ImGuiID) void; pub extern fn igBeginDragDropTargetCustom(bb: ImRect, id: ImGuiID) bool; pub extern fn igClearDragDrop() void; pub extern fn igIsDragDropPayloadBeingAccepted() bool; pub extern fn igSetWindowClipRectBeforeSetChannel(window: ?*ImGuiWindow, clip_rect: ImRect) void; pub extern fn igBeginColumns(str_id: [*c]const u8, count: c_int, flags: ImGuiOldColumnFlags) void; pub extern fn igEndColumns() void; pub extern fn igPushColumnClipRect(column_index: c_int) void; pub extern fn igPushColumnsBackground() void; pub extern fn igPopColumnsBackground() void; pub extern fn igGetColumnsID(str_id: [*c]const u8, count: c_int) ImGuiID; pub extern fn igFindOrCreateColumns(window: ?*ImGuiWindow, id: ImGuiID) [*c]ImGuiOldColumns; pub extern fn igGetColumnOffsetFromNorm(columns: [*c]const ImGuiOldColumns, offset_norm: f32) f32; pub extern fn igGetColumnNormFromOffset(columns: [*c]const ImGuiOldColumns, offset: f32) f32; pub extern fn igTableOpenContextMenu(column_n: c_int) void; pub extern fn igTableSetColumnWidth(column_n: c_int, width: f32) void; pub extern fn igTableSetColumnSortDirection(column_n: c_int, sort_direction: ImGuiSortDirection, append_to_sort_specs: bool) void; pub extern fn igTableGetHoveredColumn() c_int; pub extern fn igTableGetHeaderRowHeight() f32; pub extern fn igTablePushBackgroundChannel() void; pub extern fn igTablePopBackgroundChannel() void; pub extern fn igGetCurrentTable() ?*ImGuiTable; pub extern fn igTableFindByID(id: ImGuiID) ?*ImGuiTable; pub extern fn igBeginTableEx(name: [*c]const u8, id: ImGuiID, columns_count: c_int, flags: ImGuiTableFlags, outer_size: ImVec2, inner_width: f32) bool; pub extern fn igTableBeginInitMemory(table: ?*ImGuiTable, columns_count: c_int) void; pub extern fn igTableBeginApplyRequests(table: ?*ImGuiTable) void; pub extern fn igTableSetupDrawChannels(table: ?*ImGuiTable) void; pub extern fn igTableUpdateLayout(table: ?*ImGuiTable) void; pub extern fn igTableUpdateBorders(table: ?*ImGuiTable) void; pub extern fn igTableUpdateColumnsWeightFromWidth(table: ?*ImGuiTable) void; pub extern fn igTableDrawBorders(table: ?*ImGuiTable) void; pub extern fn igTableDrawContextMenu(table: ?*ImGuiTable) void; pub extern fn igTableMergeDrawChannels(table: ?*ImGuiTable) void; pub extern fn igTableSortSpecsSanitize(table: ?*ImGuiTable) void; pub extern fn igTableSortSpecsBuild(table: ?*ImGuiTable) void; pub extern fn igTableGetColumnNextSortDirection(column: ?*ImGuiTableColumn) ImGuiSortDirection; pub extern fn igTableFixColumnSortDirection(table: ?*ImGuiTable, column: ?*ImGuiTableColumn) void; pub extern fn igTableGetColumnWidthAuto(table: ?*ImGuiTable, column: ?*ImGuiTableColumn) f32; pub extern fn igTableBeginRow(table: ?*ImGuiTable) void; pub extern fn igTableEndRow(table: ?*ImGuiTable) void; pub extern fn igTableBeginCell(table: ?*ImGuiTable, column_n: c_int) void; pub extern fn igTableEndCell(table: ?*ImGuiTable) void; pub extern fn igTableGetCellBgRect(pOut: [*c]ImRect, table: ?*const ImGuiTable, column_n: c_int) void; pub extern fn igTableGetColumnName_TablePtr(table: ?*const ImGuiTable, column_n: c_int) [*c]const u8; pub extern fn igTableGetColumnResizeID(table: ?*const ImGuiTable, column_n: c_int, instance_no: c_int) ImGuiID; pub extern fn igTableGetMaxColumnWidth(table: ?*const ImGuiTable, column_n: c_int) f32; pub extern fn igTableSetColumnWidthAutoSingle(table: ?*ImGuiTable, column_n: c_int) void; pub extern fn igTableSetColumnWidthAutoAll(table: ?*ImGuiTable) void; pub extern fn igTableRemove(table: ?*ImGuiTable) void; pub extern fn igTableGcCompactTransientBuffers_TablePtr(table: ?*ImGuiTable) void; pub extern fn igTableGcCompactTransientBuffers_TableTempDataPtr(table: [*c]ImGuiTableTempData) void; pub extern fn igTableGcCompactSettings() void; pub extern fn igTableLoadSettings(table: ?*ImGuiTable) void; pub extern fn igTableSaveSettings(table: ?*ImGuiTable) void; pub extern fn igTableResetSettings(table: ?*ImGuiTable) void; pub extern fn igTableGetBoundSettings(table: ?*ImGuiTable) [*c]ImGuiTableSettings; pub extern fn igTableSettingsInstallHandler(context: [*c]ImGuiContext) void; pub extern fn igTableSettingsCreate(id: ImGuiID, columns_count: c_int) [*c]ImGuiTableSettings; pub extern fn igTableSettingsFindByID(id: ImGuiID) [*c]ImGuiTableSettings; pub extern fn igBeginTabBarEx(tab_bar: [*c]ImGuiTabBar, bb: ImRect, flags: ImGuiTabBarFlags, dock_node: ?*ImGuiDockNode) bool; pub extern fn igTabBarFindTabByID(tab_bar: [*c]ImGuiTabBar, tab_id: ImGuiID) [*c]ImGuiTabItem; pub extern fn igTabBarFindMostRecentlySelectedTabForActiveWindow(tab_bar: [*c]ImGuiTabBar) [*c]ImGuiTabItem; pub extern fn igTabBarAddTab(tab_bar: [*c]ImGuiTabBar, tab_flags: ImGuiTabItemFlags, window: ?*ImGuiWindow) void; pub extern fn igTabBarRemoveTab(tab_bar: [*c]ImGuiTabBar, tab_id: ImGuiID) void; pub extern fn igTabBarCloseTab(tab_bar: [*c]ImGuiTabBar, tab: [*c]ImGuiTabItem) void; pub extern fn igTabBarQueueReorder(tab_bar: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem, offset: c_int) void; pub extern fn igTabBarQueueReorderFromMousePos(tab_bar: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem, mouse_pos: ImVec2) void; pub extern fn igTabBarProcessReorder(tab_bar: [*c]ImGuiTabBar) bool; pub extern fn igTabItemEx(tab_bar: [*c]ImGuiTabBar, label: [*c]const u8, p_open: [*c]bool, flags: ImGuiTabItemFlags, docked_window: ?*ImGuiWindow) bool; pub extern fn igTabItemCalcSize(pOut: [*c]ImVec2, label: [*c]const u8, has_close_button: bool) void; pub extern fn igTabItemBackground(draw_list: [*c]ImDrawList, bb: ImRect, flags: ImGuiTabItemFlags, col: ImU32) void; pub extern fn igTabItemLabelAndCloseButton(draw_list: [*c]ImDrawList, bb: ImRect, flags: ImGuiTabItemFlags, frame_padding: ImVec2, label: [*c]const u8, tab_id: ImGuiID, close_button_id: ImGuiID, is_contents_visible: bool, out_just_closed: [*c]bool, out_text_clipped: [*c]bool) void; pub extern fn igRenderText(pos: ImVec2, text: [*c]const u8, text_end: [*c]const u8, hide_text_after_hash: bool) void; pub extern fn igRenderTextWrapped(pos: ImVec2, text: [*c]const u8, text_end: [*c]const u8, wrap_width: f32) void; pub extern fn igRenderTextClipped(pos_min: ImVec2, pos_max: ImVec2, text: [*c]const u8, text_end: [*c]const u8, text_size_if_known: [*c]const ImVec2, @"align": ImVec2, clip_rect: [*c]const ImRect) void; pub extern fn igRenderTextClippedEx(draw_list: [*c]ImDrawList, pos_min: ImVec2, pos_max: ImVec2, text: [*c]const u8, text_end: [*c]const u8, text_size_if_known: [*c]const ImVec2, @"align": ImVec2, clip_rect: [*c]const ImRect) void; pub extern fn igRenderTextEllipsis(draw_list: [*c]ImDrawList, pos_min: ImVec2, pos_max: ImVec2, clip_max_x: f32, ellipsis_max_x: f32, text: [*c]const u8, text_end: [*c]const u8, text_size_if_known: [*c]const ImVec2) void; pub extern fn igRenderFrame(p_min: ImVec2, p_max: ImVec2, fill_col: ImU32, border: bool, rounding: f32) void; pub extern fn igRenderFrameBorder(p_min: ImVec2, p_max: ImVec2, rounding: f32) void; pub extern fn igRenderColorRectWithAlphaCheckerboard(draw_list: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, fill_col: ImU32, grid_step: f32, grid_off: ImVec2, rounding: f32, flags: ImDrawFlags) void; pub extern fn igRenderNavHighlight(bb: ImRect, id: ImGuiID, flags: ImGuiNavHighlightFlags) void; pub extern fn igFindRenderedTextEnd(text: [*c]const u8, text_end: [*c]const u8) [*c]const u8; pub extern fn igRenderArrow(draw_list: [*c]ImDrawList, pos: ImVec2, col: ImU32, dir: ImGuiDir, scale: f32) void; pub extern fn igRenderBullet(draw_list: [*c]ImDrawList, pos: ImVec2, col: ImU32) void; pub extern fn igRenderCheckMark(draw_list: [*c]ImDrawList, pos: ImVec2, col: ImU32, sz: f32) void; pub extern fn igRenderMouseCursor(draw_list: [*c]ImDrawList, pos: ImVec2, scale: f32, mouse_cursor: ImGuiMouseCursor, col_fill: ImU32, col_border: ImU32, col_shadow: ImU32) void; pub extern fn igRenderArrowPointingAt(draw_list: [*c]ImDrawList, pos: ImVec2, half_sz: ImVec2, direction: ImGuiDir, col: ImU32) void; pub extern fn igRenderArrowDockMenu(draw_list: [*c]ImDrawList, p_min: ImVec2, sz: f32, col: ImU32) void; pub extern fn igRenderRectFilledRangeH(draw_list: [*c]ImDrawList, rect: ImRect, col: ImU32, x_start_norm: f32, x_end_norm: f32, rounding: f32) void; pub extern fn igRenderRectFilledWithHole(draw_list: [*c]ImDrawList, outer: ImRect, inner: ImRect, col: ImU32, rounding: f32) void; pub extern fn igTextEx(text: [*c]const u8, text_end: [*c]const u8, flags: ImGuiTextFlags) void; pub extern fn igButtonEx(label: [*c]const u8, size_arg: ImVec2, flags: ImGuiButtonFlags) bool; pub extern fn igCloseButton(id: ImGuiID, pos: ImVec2) bool; pub extern fn igCollapseButton(id: ImGuiID, pos: ImVec2, dock_node: ?*ImGuiDockNode) bool; pub extern fn igArrowButtonEx(str_id: [*c]const u8, dir: ImGuiDir, size_arg: ImVec2, flags: ImGuiButtonFlags) bool; pub extern fn igScrollbar(axis: ImGuiAxis) void; pub extern fn igScrollbarEx(bb: ImRect, id: ImGuiID, axis: ImGuiAxis, p_scroll_v: [*c]f32, avail_v: f32, contents_v: f32, flags: ImDrawFlags) bool; pub extern fn igImageButtonEx(id: ImGuiID, texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, padding: ImVec2, bg_col: ImVec4, tint_col: ImVec4) bool; pub extern fn igGetWindowScrollbarRect(pOut: [*c]ImRect, window: ?*ImGuiWindow, axis: ImGuiAxis) void; pub extern fn igGetWindowScrollbarID(window: ?*ImGuiWindow, axis: ImGuiAxis) ImGuiID; pub extern fn igGetWindowResizeCornerID(window: ?*ImGuiWindow, n: c_int) ImGuiID; pub extern fn igGetWindowResizeBorderID(window: ?*ImGuiWindow, dir: ImGuiDir) ImGuiID; pub extern fn igSeparatorEx(flags: ImGuiSeparatorFlags) void; pub extern fn igCheckboxFlags_S64Ptr(label: [*c]const u8, flags: [*c]ImS64, flags_value: ImS64) bool; pub extern fn igCheckboxFlags_U64Ptr(label: [*c]const u8, flags: [*c]ImU64, flags_value: ImU64) bool; pub extern fn igButtonBehavior(bb: ImRect, id: ImGuiID, out_hovered: [*c]bool, out_held: [*c]bool, flags: ImGuiButtonFlags) bool; pub extern fn igDragBehavior(id: ImGuiID, data_type: ImGuiDataType, p_v: ?*c_void, v_speed: f32, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags) bool; pub extern fn igSliderBehavior(bb: ImRect, id: ImGuiID, data_type: ImGuiDataType, p_v: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void, format: [*c]const u8, flags: ImGuiSliderFlags, out_grab_bb: [*c]ImRect) bool; pub extern fn igSplitterBehavior(bb: ImRect, id: ImGuiID, axis: ImGuiAxis, size1: [*c]f32, size2: [*c]f32, min_size1: f32, min_size2: f32, hover_extend: f32, hover_visibility_delay: f32) bool; pub extern fn igTreeNodeBehavior(id: ImGuiID, flags: ImGuiTreeNodeFlags, label: [*c]const u8, label_end: [*c]const u8) bool; pub extern fn igTreeNodeBehaviorIsOpen(id: ImGuiID, flags: ImGuiTreeNodeFlags) bool; pub extern fn igTreePushOverrideID(id: ImGuiID) void; pub extern fn igDataTypeGetInfo(data_type: ImGuiDataType) [*c]const ImGuiDataTypeInfo; pub extern fn igDataTypeFormatString(buf: [*c]u8, buf_size: c_int, data_type: ImGuiDataType, p_data: ?*const c_void, format: [*c]const u8) c_int; pub extern fn igDataTypeApplyOp(data_type: ImGuiDataType, op: c_int, output: ?*c_void, arg_1: ?*const c_void, arg_2: ?*const c_void) void; pub extern fn igDataTypeApplyOpFromText(buf: [*c]const u8, initial_value_buf: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, format: [*c]const u8) bool; pub extern fn igDataTypeCompare(data_type: ImGuiDataType, arg_1: ?*const c_void, arg_2: ?*const c_void) c_int; pub extern fn igDataTypeClamp(data_type: ImGuiDataType, p_data: ?*c_void, p_min: ?*const c_void, p_max: ?*const c_void) bool; pub extern fn igInputTextEx(label: [*c]const u8, hint: [*c]const u8, buf: [*c]u8, buf_size: c_int, size_arg: ImVec2, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*c_void) bool; pub extern fn igTempInputText(bb: ImRect, id: ImGuiID, label: [*c]const u8, buf: [*c]u8, buf_size: c_int, flags: ImGuiInputTextFlags) bool; pub extern fn igTempInputScalar(bb: ImRect, id: ImGuiID, label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*c_void, format: [*c]const u8, p_clamp_min: ?*const c_void, p_clamp_max: ?*const c_void) bool; pub extern fn igTempInputIsActive(id: ImGuiID) bool; pub extern fn igGetInputTextState(id: ImGuiID) [*c]ImGuiInputTextState; pub extern fn igColorTooltip(text: [*c]const u8, col: [*c]const f32, flags: ImGuiColorEditFlags) void; pub extern fn igColorEditOptionsPopup(col: [*c]const f32, flags: ImGuiColorEditFlags) void; pub extern fn igColorPickerOptionsPopup(ref_col: [*c]const f32, flags: ImGuiColorEditFlags) void; pub extern fn igPlotEx(plot_type: ImGuiPlotType, label: [*c]const u8, values_getter: ?fn (?*c_void, c_int) callconv(.C) f32, data: ?*c_void, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, frame_size: ImVec2) c_int; pub extern fn igShadeVertsLinearColorGradientKeepAlpha(draw_list: [*c]ImDrawList, vert_start_idx: c_int, vert_end_idx: c_int, gradient_p0: ImVec2, gradient_p1: ImVec2, col0: ImU32, col1: ImU32) void; pub extern fn igShadeVertsLinearUV(draw_list: [*c]ImDrawList, vert_start_idx: c_int, vert_end_idx: c_int, a: ImVec2, b: ImVec2, uv_a: ImVec2, uv_b: ImVec2, clamp: bool) void; pub extern fn igGcCompactTransientMiscBuffers() void; pub extern fn igGcCompactTransientWindowBuffers(window: ?*ImGuiWindow) void; pub extern fn igGcAwakeTransientWindowBuffers(window: ?*ImGuiWindow) void; pub extern fn igErrorCheckEndFrameRecover(log_callback: ImGuiErrorLogCallback, user_data: ?*c_void) void; pub extern fn igDebugDrawItemRect(col: ImU32) void; pub extern fn igDebugStartItemPicker() void; pub extern fn igDebugNodeColumns(columns: [*c]ImGuiOldColumns) void; pub extern fn igDebugNodeDockNode(node: ?*ImGuiDockNode, label: [*c]const u8) void; pub extern fn igDebugNodeDrawList(window: ?*ImGuiWindow, viewport: [*c]ImGuiViewportP, draw_list: [*c]const ImDrawList, label: [*c]const u8) void; pub extern fn igDebugNodeDrawCmdShowMeshAndBoundingBox(out_draw_list: [*c]ImDrawList, draw_list: [*c]const ImDrawList, draw_cmd: [*c]const ImDrawCmd, show_mesh: bool, show_aabb: bool) void; pub extern fn igDebugNodeStorage(storage: [*c]ImGuiStorage, label: [*c]const u8) void; pub extern fn igDebugNodeTabBar(tab_bar: [*c]ImGuiTabBar, label: [*c]const u8) void; pub extern fn igDebugNodeTable(table: ?*ImGuiTable) void; pub extern fn igDebugNodeTableSettings(settings: [*c]ImGuiTableSettings) void; pub extern fn igDebugNodeWindow(window: ?*ImGuiWindow, label: [*c]const u8) void; pub extern fn igDebugNodeWindowSettings(settings: [*c]ImGuiWindowSettings) void; pub extern fn igDebugNodeWindowsList(windows: [*c]ImVector_ImGuiWindowPtr, label: [*c]const u8) void; pub extern fn igDebugNodeViewport(viewport: [*c]ImGuiViewportP) void; pub extern fn igDebugRenderViewportThumbnail(draw_list: [*c]ImDrawList, viewport: [*c]ImGuiViewportP, bb: ImRect) void; pub extern fn igImFontAtlasGetBuilderForStbTruetype() [*c]const ImFontBuilderIO; pub extern fn igImFontAtlasBuildInit(atlas: [*c]ImFontAtlas) void; pub extern fn igImFontAtlasBuildSetupFont(atlas: [*c]ImFontAtlas, font: [*c]ImFont, font_config: [*c]ImFontConfig, ascent: f32, descent: f32) void; pub extern fn igImFontAtlasBuildPackCustomRects(atlas: [*c]ImFontAtlas, stbrp_context_opaque: ?*c_void) void; pub extern fn igImFontAtlasBuildFinish(atlas: [*c]ImFontAtlas) void; pub extern fn igImFontAtlasBuildRender8bppRectFromString(atlas: [*c]ImFontAtlas, x: c_int, y: c_int, w: c_int, h: c_int, in_str: [*c]const u8, in_marker_char: u8, in_marker_pixel_value: u8) void; pub extern fn igImFontAtlasBuildRender32bppRectFromString(atlas: [*c]ImFontAtlas, x: c_int, y: c_int, w: c_int, h: c_int, in_str: [*c]const u8, in_marker_char: u8, in_marker_pixel_value: c_uint) void; pub extern fn igImFontAtlasBuildMultiplyCalcLookupTable(out_table: [*c]u8, in_multiply_factor: f32) void; pub extern fn igImFontAtlasBuildMultiplyRectAlpha8(table: [*c]const u8, pixels: [*c]u8, x: c_int, y: c_int, w: c_int, h: c_int, stride: c_int) void; pub extern fn igLogText(fmt: [*c]const u8, ...) void; pub extern fn ImGuiTextBuffer_appendf(buffer: [*c]struct_ImGuiTextBuffer, fmt: [*c]const u8, ...) void; pub extern fn igGET_FLT_MAX(...) f32; pub extern fn igGET_FLT_MIN(...) f32; pub extern fn ImVector_ImWchar_create(...) [*c]ImVector_ImWchar; pub extern fn ImVector_ImWchar_destroy(self: [*c]ImVector_ImWchar) void; pub extern fn ImVector_ImWchar_Init(p: [*c]ImVector_ImWchar) void; pub extern fn ImVector_ImWchar_UnInit(p: [*c]ImVector_ImWchar) void;
src/pkg/imgui.zig
const wlr = @import("../wlroots.zig"); const wayland = @import("wayland"); const wl = wayland.server.wl; pub const TextInputManagerV3 = extern struct { global: *wl.Global, text_inputs: wl.list.Head(TextInputV3, "link"), server_destroy: wl.Listener(*wl.Server), events: extern struct { text_input: wl.Signal(*wlr.TextInputV3), destroy: wl.Signal(*wlr.TextInputManagerV3), }, extern fn wlr_text_input_manager_v3_create(server: *wl.Server) ?*wlr.TextInputManagerV3; pub fn create(server: *wl.Server) !*wlr.TextInputManagerV3 { return wlr_text_input_manager_v3_create(server) orelse error.OutOfMemory; } }; pub const TextInputV3 = extern struct { pub const features = struct { pub const surrounding_text = 1 << 0; pub const content_type = 1 << 1; pub const cursor_rectangle = 1 << 2; }; pub const State = extern struct { surrounding: extern struct { text: ?[*:0]u8, cursor: u32, anchor: u32, }, text_change_cause: u32, content_type: extern struct { hint: u32, purpose: u32, }, cursor_rectangle: extern struct { x: i32, y: i32, width: i32, height: i32, }, features: u32, }; seat: *wlr.Seat, ressource: *wl.Resource, focused_surface: ?*wlr.Surface, pending: wlr.TextInputV3.State, current: wlr.TextInputV3.State, current_serial: u32, pending_enabled: bool, current_enabled: bool, active_features: u32, link: wl.list.Link, surface_destroy: wl.Listener(*wlr.Surface), seat_destroy: wl.Listener(*wlr.Seat), events: extern struct { enable: wl.Signal(*wlr.TextInputV3), commit: wl.Signal(*wlr.TextInputV3), disable: wl.Signal(*wlr.TextInputV3), destroy: wl.Signal(*wlr.TextInputV3), }, extern fn wlr_text_input_v3_send_enter(text_input: *wlr.TextInputV3, surface: *wlr.Surface) void; pub const sendEnter = wlr_text_input_v3_send_enter; extern fn wlr_text_input_v3_send_leave(text_input: *wlr.TextInputV3) void; pub const sendLeave = wlr_text_input_v3_send_leave; extern fn wlr_text_input_v3_send_preedit_string(text_input: *wlr.TextInputV3, text: [*:0]const u8, cursor_begin: u32, cursor_end: u32) void; pub const sendPreeditString = wlr_text_input_v3_send_preedit_string; extern fn wlr_text_input_v3_send_commit_string(text_input: *wlr.TextInputV3, text: [*:0]const u8) void; pub const sendCommitString = wlr_text_input_v3_send_commit_string; extern fn wlr_text_input_v3_send_delete_surrounding_text(text_input: *wlr.TextInputV3, before_length: u32, after_length: u32) void; pub const sendDeleteSurroundingText = wlr_text_input_v3_send_delete_surrounding_text; extern fn wlr_text_input_v3_send_done(text_input: *wlr.TextInputV3) void; pub const sendDone = wlr_text_input_v3_send_done; };
source/river-0.1.0/deps/zig-wlroots/src/types/text_input_v3.zig
pub const MMIO_BASE = 0x3F000000; const MMIO_BANK = RegBank.base(0x3F000000); const AUX_BANK = MMIO_BANK.sub(0x215000); pub const AUX_ENABLES = AUX_BANK.reg(0x04); pub const AUX_MU_IO = AUX_BANK.reg(0x40); pub const AUX_MU_IER = AUX_BANK.reg(0x44); pub const AUX_MU_IIR = AUX_BANK.reg(0x48); pub const AUX_MU_LCR = AUX_BANK.reg(0x4C); pub const AUX_MU_MCR = AUX_BANK.reg(0x50); pub const AUX_MU_LSR = AUX_BANK.reg(0x54); pub const AUX_MU_MSR = AUX_BANK.reg(0x58); pub const AUX_MU_SCRATCH = AUX_BANK.reg(0x5C); pub const AUX_MU_CNTL = AUX_BANK.reg(0x60); pub const AUX_MU_STAT = AUX_BANK.reg(0x64); pub const AUX_MU_BAUD = AUX_BANK.reg(0x68); const GPIO_BANK = MMIO_BANK.sub(0x200000); pub const GPFSEL0 = GPIO_BANK.reg(0x00); pub const GPFSEL1 = GPIO_BANK.reg(0x04); pub const GPPUD = GPIO_BANK.reg(0x94); pub const GPPUDCLK0 = GPIO_BANK.reg(0x98); const MBOX_BANK = MMIO_BANK.sub(0xB880); pub const MBOX_READ = MBOX_BANK.reg(0x00); pub const MBOX_CONFIG = MBOX_BANK.reg(0x1C); pub const MBOX_WRITE = MBOX_BANK.reg(0x20); pub const MBOX_STATUS = MBOX_BANK.reg(0x18); const RegBank = struct { bank_base: usize, /// Create the base register bank pub fn base(comptime bank_base: comptime_int) @This() { return .{ .bank_base = bank_base }; } /// Make a smaller register sub-bank out of a bigger one pub fn sub(self: @This(), comptime offset: comptime_int) @This() { return .{ .bank_base = self.bank_base + offset }; } /// Define a single register pub fn reg(self: @This(), comptime offset: comptime_int) *volatile u32 { return @intToPtr(*volatile u32, self.bank_base + offset); } }; pub fn mbox_call(channel: u4, ptr: usize) void { while ((MBOX_STATUS.* & 0x80000000) != 0) {} const addr = @truncate(u32, ptr) | @as(u32, channel); MBOX_WRITE.* = addr; } // This is the miniUART, it requires enable_uart=1 in config.txt pub fn miniuart_init() void { // set pins 14-15 to alt5 (miniuart). gpfsel1 handles pins 10 to 19 GPFSEL1.* = gpio_fsel(14 - 10, .Alt5, gpio_fsel(15 - 10, .Alt5, GPFSEL1.*)); GPPUD.* = 0; // disable pullup, pulldown for the clocked regs delay(150); GPPUDCLK0.* = (1 << 14) | (1 << 15); // clock pins 14-15 delay(150); GPPUDCLK0.* = 0; // clear clock for next usage delay(150); AUX_ENABLES.* |= 1; // enable the uart regs AUX_MU_CNTL.* = 0; // disable uart functionality to set the regs AUX_MU_IER.* = 0; // disable uart interrupts AUX_MU_LCR.* = 0b11; // 8-bit mode AUX_MU_MCR.* = 0; // RTS always high AUX_MU_IIR.* = 0xc6; AUX_MU_BAUD.* = minuart_calculate_baud(115200); AUX_MU_CNTL.* = 0b11; // enable tx and rx fifos } const VC4_CLOCK = 250 * 1000 * 1000; // 250 MHz fn minuart_calculate_baud(baudrate: u32) u32 { return VC4_CLOCK / (8 * baudrate) - 1; // the bcm2835 spec gives this formula: baudrate = vc4_clock / (8*(reg + 1)) } fn delay(cycles: usize) void { var i: u32 = 0; while (i < cycles) : (i += 1) { asm volatile ("nop"); } } const GpioMode = enum(u3) { // zig fmt: off Input = 0b000, Output = 0b001, Alt5 = 0b010, Alt4 = 0b011, Alt0 = 0b100, Alt1 = 0b101, Alt2 = 0b110, Alt3 = 0b111, // zig fmt: on }; fn gpio_fsel(pin: u5, mode: GpioMode, val: u32) u32 { const mode_int: u32 = @enumToInt(mode); const bit = pin * 3; var temp = val; temp &= ~(@as(u32, 0b111) << bit); temp |= mode_int << bit; return temp; }
src/platform/pi3_aarch64/regs.zig
const std = @import("std"); const sling = @import("sling.zig"); const zt = @import("zt"); const ig = @import("imgui"); /// Produces an enum of declarations found in a type. Useful for parameters /// aimed at a declaration in a type. pub fn DeclEnum(comptime T: type) type { const declInfos = std.meta.declarations(T); var declFields: [declInfos.len]std.builtin.TypeInfo.EnumField = undefined; var decls = [_]std.builtin.TypeInfo.Declaration{}; inline for (declInfos) |field, i| { declFields[i] = .{ .name = field.name, .value = i, }; } return @Type(.{ .Enum = .{ .layout = .Auto, .tag_type = std.math.IntFittingRange(0, declInfos.len - 1), .fields = &declFields, .decls = &decls, .is_exhaustive = true, }, }); } pub fn hexToColor(hex: u32) sling.math.Vec4 { const cast: [4]u8 = @bitCast([4]u8, hex); return sling.math.vec4(@intToFloat(f32, cast[0]) / 255.0, @intToFloat(f32, cast[1]) / 255.0, @intToFloat(f32, cast[2]) / 255.0, @intToFloat(f32, cast[3]) / 255.0); } pub fn hexToColorString(hexCode: []const u8) sling.math.Vec4 { var slice: []const u8 = std.mem.trim(u8, hexCode, "#"); var hex = std.fmt.parseUnsigned(u32, slice, 16) catch unreachable; return hexToColor(hex); } /// An allocated format print you dont need to free: pub fn tempFmt(comptime fmt: []const u8, params: anytype) []const u8 { return std.fmt.allocPrint(sling.zt.Allocators.ring(), fmt, params) catch unreachable; } /// Depends on each state having an `fn(*SelfState,*Context) ?TaggedUnion` named `update`. /// Pass in an `union(enum)` that contains each state, the update signature above /// returns the union if it will transition to a new state, or null if it will /// remain the same. pub fn StateMachine(comptime TaggedUnion: type, comptime Context: type) type { std.debug.assert(@typeInfo(TaggedUnion) == .Union); return struct { /// If true, the next state is updated on transitions. followThroughUpdate: bool = true, currentState: TaggedUnion, pub fn init(initialState: TaggedUnion) @This() { return .{ .currentState = initialState, }; } pub fn update(self: *@This(), context: Context) void { var activeTag = std.meta.activeTag(self.currentState); const info = @typeInfo(TaggedUnion).Union; inline for (info.fields) |field_info| { if (std.mem.eql(u8, field_info.name, @tagName(activeTag))) { const T = field_info.field_type; if (@hasDecl(T, "update")) { if (T.update(&@field(self.currentState, field_info.name), context)) |newState| { if (@hasDecl(T, "leave")) { T.leave(&@field(self.currentState, field_info.name), context); } self.goto(newState, context); } } else { @compileError("Each state of a statemachine should have an `fn update(self:*State, target:*Context) ?Union`"); } } } } fn goto(self: *@This(), newState: TaggedUnion, context: Context) void { self.currentState = newState; var nextTag = std.meta.activeTag(self.currentState); const info = @typeInfo(TaggedUnion).Union; inline for (info.fields) |field_info| { if (std.mem.eql(u8, field_info.name, @tagName(nextTag))) { const T = field_info.field_type; if (@hasDecl(T, "enter")) { T.enter(&@field(self.currentState, field_info.name), context); } } } if (self.followThroughUpdate) { self.update(context); } } }; } /// A data structure that lets you store a usize lookup id to retrieve a value /// without changing every other id reference when one is released by storing /// 'holes' to reuse in the structure. pub fn HoleQueue(comptime T: type) type { return struct { const Self = @This(); allocator: *std.mem.Allocator, internalList: std.ArrayList(T), holeQueue: std.fifo.LinearFifo(usize, .Dynamic), pub fn init(allocator: *std.mem.Allocator) Self { return .{ .allocator = allocator, .internalList = std.ArrayList(T).init(allocator), .holeQueue = std.fifo.LinearFifo(usize, .Dynamic).init(allocator), }; } pub fn deinit(self: *Self) void { self.internalList.deinit(); self.holeQueue.deinit(); } /// Copies a stack value into local memory and returns its index(which is guaranteed /// to never change.) pub fn take(self: *Self, stackVal: T) !usize { if (self.holeQueue.readItem()) |id| { self.internalList.items[id] = stackVal; return id; } else { var id = self.internalList.items.len; try self.internalList.append(stackVal); return id; } } pub fn release(self: *Self, id: usize) !void { try self.holeQueue.writeItem(id); self.internalList.items[id] = undefined; } pub fn get(self: *Self, id: usize) *T { return &self.internalList.items[id]; } pub fn getCopy(self: *Self, id: usize) T { return self.internalList.items[id]; } }; } /// Takes a value, and a min/max range, and returns a ratio depending on where value /// lies between the 2. if clamp, it is 0-1 pub fn remapValueToRange(value: f32, range_min: f32, range_max: f32, clamp: bool) f32 { if (clamp) { return std.math.clamp((value - range_min) / (range_max - range_min), 0.0, 1.0); } else { return (value - range_min) / (range_max - range_min); } } /// Creates an ig editor field for most possible types you feed it that isnt(and doesnt contain) /// an opaque type. pub fn igEdit(label: []const u8, ptr: anytype) bool { const ti: std.builtin.TypeInfo = @typeInfo(@TypeOf(ptr.*)); if (ti == .Pointer) { if (ti.Pointer.size == .Slice or ti.Pointer.size == .Many) { ig.igPushID_Str(label.ptr); var hit: bool = false; var height = std.math.clamp(@intToFloat(f32, ptr.*.len + 1) * 30.0, 0, 200); ig.igPushStyleVar_Vec2(ig.ImGuiStyleVar_WindowPadding, .{ .x = 2.0, .y = 2.0 }); if (ig.igBeginChild_Str(label.ptr, .{ .y = height }, true, ig.ImGuiWindowFlags_None)) { zt.custom_components.ztTextDisabled("{s}", .{label}); ig.igSameLine(0, 4); for (ptr.*) |*item, i| { var fmt = zt.custom_components.fmtTextForImgui("SubArray#{any}", .{i}); if (igEdit(fmt, item)) { hit = true; } } } ig.igEndChild(); ig.igPopStyleVar(1); ig.igPopID(); return hit; } } if (ti == .Enum) { var returnValue: bool = false; var integer = @enumToInt(ptr.*); if (ig.igBeginCombo(label.ptr, @tagName(ptr.*).ptr, ig.ImGuiComboFlags_None)) { inline for (ti.Enum.fields) |enumField, i| { //label: [*c]const u8, selected: bool, flags: ImGuiSelectableFlags, size: ImVec2 if (ig.igSelectable_Bool(enumField.name.ptr, i == integer, ig.ImGuiSelectableFlags_None, .{})) { ptr.* = @intToEnum(@TypeOf(ptr.*), i); returnValue = true; } } ig.igEndCombo(); } return returnValue; } if (ti == .Optional) { if (ptr.* == null) { zt.custom_components.ztTextDisabled("{s} (null)", .{label}); return false; } else { return igEdit(label, &ptr.*.?); } } // Handle string inputs. if (ti == .Array) { if (ti.Array.child == u8 and ti.Array.sentinel != null) { return ig.igInputText(label.ptr, ptr, @intCast(usize, ti.Array.len), ig.ImGuiInputTextFlags_None, null, null); } } // if(ti == .Union) { // var comboText = zt.custom_components.fmtTextForImgui("{s} Union", .{label}); // if(ig.igBeginCombo("", @tagName(ptr.*).ptr, ig.ImGuiComboFlags_None)) { // ig.igEndCombo(); // } // return false; // } switch (@TypeOf(ptr)) { *bool => { return ig.igCheckbox(label.ptr, ptr); }, *i32 => { return ig.igInputInt(label.ptr, ptr, 1, 3, ig.ImGuiInputTextFlags_None); }, *f32 => { return ig.igInputFloat(label.ptr, ptr, 1, 3, "%.2f", ig.ImGuiInputTextFlags_None); }, *usize => { var cast = @intCast(c_int, ptr.*); var result = ig.igInputInt(label.ptr, &cast, 1, 5, ig.ImGuiInputTextFlags_None); if (result) { ptr.* = @intCast(usize, std.math.max(0, cast)); } return result; }, *sling.math.Vec2 => { var cast: [2]f32 = .{ ptr.*.x, ptr.*.y }; var result = ig.igInputFloat2(label.ptr, &cast, "%.2f", ig.ImGuiInputTextFlags_None); if (result) { ptr.* = sling.math.vec2(cast[0], cast[1]); } return result; }, *sling.math.Vec3 => { var cast: [3]f32 = .{ ptr.*.x, ptr.*.y, ptr.*.z }; var result = ig.igInputFloat3(label.ptr, &cast, "%.2f", ig.ImGuiInputTextFlags_None); if (result) { ptr.* = sling.math.vec3(cast[0], cast[1], cast[2]); } return result; }, *sling.math.Vec4 => { var cast: [4]f32 = .{ ptr.*.x, ptr.*.y, ptr.*.z, ptr.*.w }; var result = ig.igColorEdit4(label.ptr, &cast, ig.ImGuiColorEditFlags_Float); if (result) { ptr.* = sling.math.vec4(cast[0], cast[1], cast[2], cast[3]); } return result; }, *sling.math.Rect => { var cast: [4]f32 = .{ ptr.*.position.x, ptr.*.position.y, ptr.*.size.x, ptr.*.size.y }; var result = ig.igInputFloat4(label.ptr, &cast, "%.2f", ig.ImGuiInputTextFlags_None); if (result) { ptr.* = sling.math.rect(cast[0], cast[1], cast[2], cast[3]); } return result; }, *sling.Depth => { var changed: bool = false; switch (ptr.*) { .Regular => { if (ig.igButton("To YSorted", .{})) { ptr.* = sling.Depth.initY(0.0, ptr.*.Regular); return true; } ig.igSameLine(0, 4.0); if (igEdit(label, &ptr.*.Regular)) { changed = true; } }, .YSorted => { var depthLabel = zt.custom_components.fmtTextForImgui("{s}: Depth", .{label}); var yLabel = zt.custom_components.fmtTextForImgui("{s}: Y", .{label}); if (igEdit(depthLabel, &ptr.*.YSorted.depth) or igEdit(yLabel, &ptr.*.YSorted.y)) { changed = true; } if (ig.igButton("To Regular", .{})) { ptr.* = sling.Depth.init(ptr.*.YSorted.depth); return true; } }, } return changed; }, else => { std.debug.warn("No editor found for label'{s}'\n", .{label}); return false; }, } }
src/util.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const webgpu = @import("../../../webgpu.zig"); const vulkan = @import("../vulkan.zig"); const vk = @import("../vk.zig"); const module = @import("../../../utilities/module.zig"); const QueueFamilies = @import("../QueueFamilies.zig"); const log = @import("../log.zig"); const Adapter = @import("./Adapter.zig"); const Instance = @This(); pub const BaseDispatch = vk.BaseWrapper(.{ .createInstance = true, .getInstanceProcAddr = true, .enumerateInstanceLayerProperties = true, .enumerateInstanceExtensionProperties = true, }); pub const InstanceDispatch = vk.InstanceWrapper(.{ .destroyInstance = true, .enumeratePhysicalDevices = true, .getPhysicalDeviceProperties = true, .getPhysicalDeviceProperties2 = true, .getPhysicalDeviceFeatures = true, .createDevice = true, .getDeviceProcAddr = true, .getPhysicalDeviceQueueFamilyProperties = true, .enumerateDeviceLayerProperties = true, .enumerateDeviceExtensionProperties = true, }); const vtable = webgpu.Instance.VTable{ .destroy_fn = destroy, .create_surface_fn = createSurface, .request_adapter_fn = requestAdapter, }; super: webgpu.Instance, allocator: Allocator, module: *anyopaque, get_instance_proc_addr: vk.PfnGetInstanceProcAddr, vkb: BaseDispatch, handle: vk.Instance, vki: InstanceDispatch, low_power_adapter: ?*Adapter, high_performance_adapter: ?*Adapter, pub fn create(descriptor: webgpu.InstanceDescriptor) !*Instance { var instance = try descriptor.allocator.create(Instance); errdefer descriptor.allocator.destroy(instance); instance.super = .{ .__vtable = &vtable, }; instance.allocator = descriptor.allocator; instance.module = module.load(instance.allocator, vulkan.LIBVULKAN_NAME) orelse return error.Failed; errdefer module.free(instance.module); instance.get_instance_proc_addr = @ptrCast(vk.PfnGetInstanceProcAddr, module.getProcAddress(instance.module, "vkGetInstanceProcAddr") orelse return error.Failed ); instance.vkb = BaseDispatch.load(instance.get_instance_proc_addr) catch return error.Failed; if (!(try instance.checkInstanceLayersSupport())) { return error.MissingInstanceLayers; } if (!(try instance.checkInstanceExtensionsSupport())) { return error.MissingInstanceExtensions; } const application_info = vk.ApplicationInfo{ .p_application_name = null, .application_version = 0, .p_engine_name = "webgpu", .engine_version = vk.makeApiVersion(0, 1, 0, 0), .api_version = vk.API_VERSION_1_2, }; var create_info = vk.InstanceCreateInfo{ .flags = vk.InstanceCreateFlags.fromInt(0), .p_application_info = &application_info, .enabled_layer_count = vulkan.INSTANCE_LAYERS.len, .pp_enabled_layer_names = @ptrCast([*]const [*:0]const u8, &vulkan.INSTANCE_LAYERS), .enabled_extension_count = vulkan.INSTANCE_EXTENSIONS.len, .pp_enabled_extension_names = @ptrCast([*]const [*:0]const u8, &vulkan.INSTANCE_EXTENSIONS), }; instance.handle = instance.vkb.createInstance(&create_info, null) catch return error.Failed; instance.vki = InstanceDispatch.load(instance.handle, instance.get_instance_proc_addr) catch return error.Failed; errdefer instance.vki.destroyInstance(instance.handle, null); instance.low_power_adapter = null; instance.high_performance_adapter = null; return instance; } fn destroy(super: *webgpu.Instance) void { var instance = @fieldParentPtr(Instance, "super", super); if (instance.low_power_adapter) |adapter| { adapter.destroy(); } if (instance.high_performance_adapter) |adapter| { adapter.destroy(); } module.free(instance.module); instance.allocator.destroy(instance); } fn createSurface(super: *webgpu.Instance, descriptor: webgpu.SurfaceDescriptor) webgpu.Instance.CreateSurfaceError!*webgpu.Surface { var instance = @fieldParentPtr(Instance, "super", super); _ = descriptor; _ = instance; return error.Failed; } fn requestAdapter(super: *webgpu.Instance, options: webgpu.RequestAdapterOptions) webgpu.Instance.RequestAdapterError!*webgpu.Adapter { var instance = @fieldParentPtr(Instance, "super", super); var adapter = switch (options.power_preference) { .low_power => &instance.low_power_adapter, .high_performance => &instance.high_performance_adapter, }; if (adapter.*) |cached| { return &cached.super; } adapter.* = try Adapter.create(instance, try pickPhysicalDevice(instance, options)); return &adapter.*.?.super; } fn pickPhysicalDevice(instance: *Instance, options: webgpu.RequestAdapterOptions) !vk.PhysicalDevice { var physical_devices_len: u32 = undefined; if ((instance.vki.enumeratePhysicalDevices(instance.handle, &physical_devices_len, null) catch return error.Failed) != .success) { return error.Unknown; } var physical_devices = try instance.allocator.alloc(vk.PhysicalDevice, physical_devices_len); defer instance.allocator.free(physical_devices); if ((instance.vki.enumeratePhysicalDevices(instance.handle, &physical_devices_len, physical_devices.ptr) catch return error.Failed) != .success) { return error.Unknown; } var best_physical_device: ?vk.PhysicalDevice = null; var best_score: usize = 0; for (physical_devices) |physical_device| { if (try scorePhysicalDevice(instance, physical_device, options)) |score| { if (score > best_score) { best_physical_device = physical_device; best_score = score; } } } return best_physical_device orelse error.Unavailable; } fn scorePhysicalDevice(instance: *Instance, physical_device: vk.PhysicalDevice, options: webgpu.RequestAdapterOptions) !?usize { const properties = instance.vki.getPhysicalDeviceProperties(physical_device); var score: usize = 0; var families = try QueueFamilies.findRaw(instance, physical_device); if (!families.isComplete()) { return null; } switch (options.power_preference) { .low_power => { switch (properties.device_type) { .integrated_gpu => { score += 1000; }, .discrete_gpu => { score += 100; }, else => {}, } }, .high_performance => { switch (properties.device_type) { .discrete_gpu => { score += 1000; }, .integrated_gpu => { score += 100; }, else => { if (!options.force_fallback_adapter) { return null; } }, } }, } return score; } fn checkInstanceLayersSupport(instance: *Instance) !bool { var layers_len: u32 = undefined; if ((try instance.vkb.enumerateInstanceLayerProperties(&layers_len, null)) != .success) { return error.Failed; } var layers = try instance.allocator.alloc(vk.LayerProperties, layers_len); defer instance.allocator.free(layers); if ((try instance.vkb.enumerateInstanceLayerProperties(&layers_len, layers.ptr)) != .success) { return error.Failed; } for (vulkan.INSTANCE_LAYERS) |validation_layer| { const validation_layer_name = std.mem.sliceTo(validation_layer, 0); var found = false; for (layers) |layer| { if (std.mem.eql(u8, validation_layer_name, std.mem.sliceTo(&layer.layer_name, 0))) { found = true; break; } } if (!found) { log.err("Missing required instance layer: {s}", .{ validation_layer_name }); return false; } else { log.debug("Found required instance layer: {s}", .{ validation_layer_name }); } } return true; } fn checkInstanceExtensionsSupport(instance: *Instance) !bool { var extensions_len: u32 = undefined; if ((try instance.vkb.enumerateInstanceExtensionProperties(null, &extensions_len, null)) != .success) { return error.Failed; } var extensions = try instance.allocator.alloc(vk.ExtensionProperties, extensions_len); defer instance.allocator.free(extensions); if ((try instance.vkb.enumerateInstanceExtensionProperties(null, &extensions_len, extensions.ptr)) != .success) { return error.Failed; } for (vulkan.INSTANCE_EXTENSIONS) |surface_extension| { const surface_extension_name = std.mem.sliceTo(surface_extension, 0); var found = false; for (extensions) |extension| { if (std.mem.eql(u8, surface_extension_name, std.mem.sliceTo(&extension.extension_name, 0))) { found = true; break; } } if (!found) { log.err("Missing required instance extension: {s}", .{ surface_extension_name }); return false; } else { log.debug("Found required instance extension: {s}", .{ surface_extension_name }); } } return true; }
src/backends/vulkan/instance/Instance.zig
const std = @import("std"); const c = @cImport({ @cInclude("Windows.h"); }); const Image = @import("Image.zig"); pub fn hasImage() bool { const png_format = c.RegisterClipboardFormatA("PNG"); if (png_format != 0 and c.IsClipboardFormatAvailable(png_format) != 0) return true; if (c.IsClipboardFormatAvailable(c.CF_DIBV5) != 0) return true; return false; } pub fn getImage(allocator: std.mem.Allocator) !Image { const png_format = c.RegisterClipboardFormatA("PNG"); if (png_format != 0 and c.IsClipboardFormatAvailable(png_format) != 0) { if (c.OpenClipboard(null) == 0) return error.OpenClipboardFailed; defer _ = c.CloseClipboard(); if (c.GetClipboardData(png_format)) |png_handle| { const size = c.GlobalSize(png_handle); if (c.GlobalLock(png_handle)) |local_mem| { defer _ = c.GlobalUnlock(png_handle); const data = @ptrCast([*]const u8, local_mem); return try Image.initFromMemory(allocator, data[0..size]); } } } if (c.IsClipboardFormatAvailable(c.CF_DIBV5) != 0) { if (c.OpenClipboard(null) == 0) return error.OpenClipboardFailed; defer _ = c.CloseClipboard(); if (c.GetClipboardData(c.CF_DIBV5)) |handle| { const size = c.GlobalSize(handle); if (c.GlobalLock(handle)) |local_mem| { defer _ = c.GlobalUnlock(handle); const data = @ptrCast([*]const u8, local_mem); return try loadBitmapV5Image(allocator, data[0..size]); } } } // if (c.IsClipboardFormatAvailable(c.CF_DIB) != 0) { // const handle = c.GetClipboardData(c.CF_DIB); // if (handle != null) { // const header = @ptrCast(*c.BITMAPINFO, @alignCast(@alignOf(*c.BITMAPINFO), handle)); // image.width = @intCast(u32, header.bmiHeader.biWidth); // image.height = @intCast(u32, header.bmiHeader.biWidth); // @panic("TODO"); // } // } return error.UnsupportedFormat; } pub fn setImage(allocator: std.mem.Allocator, image: Image) !void { const png_format = c.RegisterClipboardFormatA("PNG"); if (png_format == 0) return error.FormatPngUnsupported; if (c.OpenClipboard(null) == 0) return error.OpenClipboardFailed; defer _ = c.CloseClipboard(); if (c.EmptyClipboard() == 0) return error.EmptyClipboardFailed; var png_data = try image.writeToMemory(allocator); defer allocator.free(png_data); // copy to global memory const global_handle = c.GlobalAlloc(c.GMEM_MOVEABLE, png_data.len); if (global_handle == null) return error.GlobalAllocFail; defer _ = c.GlobalFree(global_handle); if (c.GlobalLock(global_handle)) |local_mem| { defer _ = c.GlobalUnlock(global_handle); const data = @ptrCast([*]u8, local_mem); std.mem.copy(u8, data[0..png_data.len], png_data); _ = c.SetClipboardData(png_format, global_handle); } } // https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapv5header fn loadBitmapV5Image(allocator: std.mem.Allocator, mem: []const u8) !Image { const ptr = @alignCast(@alignOf(*c.BITMAPV5HEADER), mem); const header = @ptrCast(*const c.BITMAPV5HEADER, ptr); const src = @ptrCast([*]const u8, ptr)[header.bV5Size .. header.bV5Size + header.bV5SizeImage]; var image: Image = undefined; image.width = @intCast(u32, header.bV5Width); // If the value of bV5Height is positive, the bitmap is a bottom-up DIB // and its origin is the lower-left corner. If bV5Height value is negative, // the bitmap is a top-down DIB and its origin is the upper-left corner. var origin_top: bool = false; if (header.bV5Height < 0) { image.height = @intCast(u32, -header.bV5Height); origin_top = true; } else { image.height = @intCast(u32, header.bV5Height); } std.debug.assert(header.bV5Planes == 1); // Must be 1 // TODO: Support other bit depths // 0: Defined by JPEG or PNG file format // 1: Monochrome // 4: 16 color palette // 8: 256 color palette // 16: 16-bit color depth // 24: 8-bit for red, green, blue // 32: 8-bit for red, green, blue and unused (alpha?) if (header.bV5BitCount != 24 and header.bV5BitCount != 32) return error.BitmapUnsupported; // TODO: support more formats // BI_RLE8, BI_RLE4, BI_BITFIELDS, BI_JPEG, BI_PNG const BI_RGB = 0; // Zig can't translate the c.BI_RGB macro currently if (header.bV5Compression != BI_RGB) return error.BitmapUnsupported; image.pixels = try allocator.alloc(u8, 4 * image.width * image.height); if (header.bV5BitCount == 24) { const bytes_per_row = 3 * image.width; const pitch = 4 * ((bytes_per_row + 3) / 4); var y: u32 = 0; while (y < image.height) : (y += 1) { const y_flip = if (origin_top) y else image.height - 1 - y; var x: u32 = 0; while (x < image.width) : (x += 1) { const b = src[(y * pitch + 3 * x) + 0]; const g = src[(y * pitch + 3 * x) + 1]; const r = src[(y * pitch + 3 * x) + 2]; image.pixels[4 * (y_flip * image.width + x) + 0] = r; image.pixels[4 * (y_flip * image.width + x) + 1] = g; image.pixels[4 * (y_flip * image.width + x) + 2] = b; image.pixels[4 * (y_flip * image.width + x) + 3] = 0xff; } } } else if (header.bV5BitCount == 32) { // red = 0xff // green = 0xff00 const pitch = 4 * image.width; var y: u32 = 0; while (y < image.height) : (y += 1) { const y_flip = if (origin_top) y else image.height - 1 - y; var x: u32 = 0; while (x < image.width) : (x += 1) { const b = src[(y * pitch + 4 * x) + 0]; const g = src[(y * pitch + 4 * x) + 1]; const r = src[(y * pitch + 4 * x) + 2]; const a = src[(y * pitch + 4 * x) + 3]; image.pixels[4 * (y_flip * image.width + x) + 0] = r; image.pixels[4 * (y_flip * image.width + x) + 1] = g; image.pixels[4 * (y_flip * image.width + x) + 2] = b; image.pixels[4 * (y_flip * image.width + x) + 3] = a; } } } return image; }
src/ClipboardWin32.zig
const std = @import("std"); const linux = std.os.linux; const c = @cImport({ @cInclude("xf86drm.h"); @cInclude("xf86drmMode.h"); }); const epoll = @import("../../epoll.zig"); const Dispatchable = @import("../../epoll.zig").Dispatchable; pub const DRM = struct { fd: i32, conn_id: u32, conn: c.drmModeConnectorPtr, mode_info: c.drmModeModeInfoPtr, crtc_id: u32, crtc: c.drmModeCrtcPtr, fb: ?u32, dispatchable: Dispatchable, pub fn init() !DRM { std.debug.warn("Loading DRM\n", .{}); var fd = @intCast(i32, linux.open("/dev/dri/card0", linux.O_RDWR, 0)); const r = c.drmModeGetResources(fd); defer c.drmModeFreeResources(r); const n = @intCast(usize, r.*.count_connectors); std.debug.warn("drm: resources: {any}, {any}\n", .{ r, n }); var i: usize = 0; while (i < n) { var id = r.*.connectors[i]; var conn = c.drmModeGetConnector(fd, id); std.debug.warn("connector id: {}\n", .{id}); if (conn.*.connection == c.drmModeConnection.DRM_MODE_CONNECTED and conn.*.encoder_id != 0) { var enc = c.drmModeGetEncoder(fd, conn.*.encoder_id); defer c.drmModeFreeEncoder(enc); return DRM{ .fd = fd, .conn_id = id, .conn = conn, .mode_info = conn.*.modes, .crtc_id = enc.*.crtc_id, .crtc = c.drmModeGetCrtc(fd, enc.*.crtc_id), .fb = null, .dispatchable = Dispatchable{ .impl = dispatch, } }; } i += 1; } return error.NoConnectorFound; } pub fn modeWidth(self: DRM) i32 { return self.mode_info.*.hdisplay; } pub fn modeHeight(self: DRM) i32 { return self.mode_info.*.vdisplay; } pub fn modeAddFb(self: DRM, depth: u8, bpp: u8, pitch: u32, handle: u32, fb: *u32) i32 { return c.drmModeAddFB( self.fd, self.mode_info.*.hdisplay, self.mode_info.*.vdisplay, depth, bpp, pitch, handle, fb, ); } pub fn modePageFlip(self: DRM, fb: u32) i32 { return c.drmModePageFlip( self.fd, self.crtc_id, fb, 1, null, ); } pub fn modeRmFb(self: DRM) !void { if (self.fb) |fb| { if (c.drmModeRmFB(self.fd, fb) != 0) { return error.DrmModeRmFBFailed; } return; } return error.NoFbToRemove; } pub fn addToEpoll(self: *DRM) !void { try epoll.addFd(self.fd, &self.dispatchable); } pub fn isPageFlipScheduled() bool { return PAGE_FLIP_SCHEDULED; } pub fn schedulePageFlip() void { PAGE_FLIP_SCHEDULED = true; } }; pub fn dispatch(dispatchable: *Dispatchable, event_type: usize) anyerror!void { var drm = @fieldParentPtr(DRM, "dispatchable", dispatchable); _ = c.drmHandleEvent(drm.fd, &event_handler); } var event_handler = c.drmEventContext{ .version = 3, .vblank_handler = null, .page_flip_handler = null, .page_flip_handler2 = handlePageFlip, .sequence_handler = null, }; var PAGE_FLIP_SCHEDULED: bool = false; fn handlePageFlip(fd: i32, sequence: u32, tv_sec: u32, tv_usec: u32, crtc_id: u32, user_data: ?*c_void) callconv(.C) void { PAGE_FLIP_SCHEDULED = false; }
src/backend/drm/drm.zig
const Builder = @import("std").build.Builder; const Build = @import("std").build; const lib = @import("libbuild.zig"); pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const engine_path = "./"; lib.strip = b.option(bool, "strip", "Strip the exe?") orelse false; const examples = b.option(bool, "examples", "Compile the examples?") orelse false; const main = b.option(bool, "main", "Compile the main source?") orelse false; if (examples) { { const exe = lib.setup(b, target, "basic_setup", "examples/basic_setup.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "input", "examples/input.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "shape_drawing", "examples/shape_drawing.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "texture_drawing", "examples/texture_drawing.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "text_rendering", "examples/text_rendering.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "ecs", "examples/ecs.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "ecs_benchmark", "examples/ecs_benchmark.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "camera2d", "examples/camera2d.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "camera2d_advanced", "examples/camera2d_advanced.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "gui", "examples/gui.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "custombatch", "examples/custombatch.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "customshaders", "examples/customshaders.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } { const exe = lib.setup(b, target, "shooter", "examples/shooter.zig", engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); exe.install(); } } if (main) { const exe = b.addExecutable("main", "src/main.zig"); exe.strip = lib.strip; exe.linkSystemLibrary("c"); exe.addIncludeDir(engine_path ++ "include/onefile/"); lib.include(exe, engine_path); lib.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; lib.compileGLFWWin32(exe, engine_path); }, .linux => { exe.setTarget(target); exe.linkSystemLibrary("X11"); lib.compileGLFWLinux(exe, engine_path); }, else => {}, } lib.compileGLFWShared(exe, engine_path); exe.setOutputDir("build"); exe.setBuildMode(mode); 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); } }
build.zig
const Allocator = std.mem.Allocator; const FormatInterface = @import("../format_interface.zig").FormatInterface; const ImageFormat = image.ImageFormat; const ImageReader = image.ImageReader; const ImageInfo = image.ImageInfo; const ImageSeekStream = image.ImageSeekStream; const PixelFormat = @import("../pixel_format.zig").PixelFormat; const color = @import("../color.zig"); const errors = @import("../errors.zig"); const image = @import("../image.zig"); const std = @import("std"); const utils = @import("../utils.zig"); // this file implements the Portable Anymap specification provided by // http://netpbm.sourceforge.net/doc/pbm.html // P1, P4 => Bitmap // http://netpbm.sourceforge.net/doc/pgm.html // P2, P5 => Graymap // http://netpbm.sourceforge.net/doc/ppm.html // P3, P6 => Pixmap /// one of the three types a netbpm graphic could be stored in. pub const Format = enum { /// the image contains black-and-white pixels. Bitmap, /// the image contains grayscale pixels. Grayscale, /// the image contains RGB pixels. Rgb, }; pub const Header = struct { format: Format, binary: bool, width: usize, height: usize, max_value: usize, }; fn parseHeader(stream: ImageReader) !Header { var hdr: Header = undefined; var magic: [2]u8 = undefined; _ = try stream.read(magic[0..]); if (std.mem.eql(u8, &magic, "P1")) { hdr.binary = false; hdr.format = .Bitmap; hdr.max_value = 1; } else if (std.mem.eql(u8, &magic, "P2")) { hdr.binary = false; hdr.format = .Grayscale; } else if (std.mem.eql(u8, &magic, "P3")) { hdr.binary = false; hdr.format = .Rgb; } else if (std.mem.eql(u8, &magic, "P4")) { hdr.binary = true; hdr.format = .Bitmap; hdr.max_value = 1; } else if (std.mem.eql(u8, &magic, "P5")) { hdr.binary = true; hdr.format = .Grayscale; } else if (std.mem.eql(u8, &magic, "P6")) { hdr.binary = true; hdr.format = .Rgb; } else { return errors.ImageError.InvalidMagicHeader; } var readBuffer: [16]u8 = undefined; hdr.width = try parseNumber(stream, readBuffer[0..]); hdr.height = try parseNumber(stream, readBuffer[0..]); if (hdr.format != .Bitmap) { hdr.max_value = try parseNumber(stream, readBuffer[0..]); } return hdr; } fn isWhitespace(b: u8) bool { return switch (b) { // Whitespace (blanks, TABs, CRs, LFs). '\n', '\r', ' ', '\t' => true, else => false, }; } fn readNextByte(stream: ImageReader) !u8 { while (true) { var b = try stream.readByte(); switch (b) { // Before the whitespace character that delimits the raster, any characters // from a "#" through the next carriage return or newline character, is a // comment and is ignored. Note that this is rather unconventional, because // a comment can actually be in the middle of what you might consider a token. // Note also that this means if you have a comment right before the raster, // the newline at the end of the comment is not sufficient to delimit the raster. '#' => { // eat up comment while (true) { var c = try stream.readByte(); switch (c) { '\r', '\n' => break, else => {}, } } }, else => return b, } } } /// skips whitespace and comments, then reads a number from the stream. /// this function reads one whitespace behind the number as a terminator. fn parseNumber(stream: ImageReader, buffer: []u8) !usize { var inputLength: usize = 0; while (true) { var b = try readNextByte(stream); if (isWhitespace(b)) { if (inputLength > 0) { return try std.fmt.parseInt(usize, buffer[0..inputLength], 10); } else { continue; } } else { if (inputLength >= buffer.len) return error.OutOfMemory; buffer[inputLength] = b; inputLength += 1; } } } fn loadBinaryBitmap(header: Header, data: []color.Grayscale1, stream: ImageReader) !void { var dataIndex: usize = 0; const dataEnd = header.width * header.height; var bit_reader = std.io.bitReader(.Big, stream); while (dataIndex < dataEnd) : (dataIndex += 1) { // set bit is black, cleared bit is white // bits are "left to right" (so msb to lsb) const read_bit = try bit_reader.readBitsNoEof(u1, 1); data[dataIndex] = color.Grayscale1{ .value = ~read_bit }; } } fn loadAsciiBitmap(header: Header, data: []color.Grayscale1, stream: ImageReader) !void { var dataIndex: usize = 0; const dataEnd = header.width * header.height; while (dataIndex < dataEnd) { var b = try stream.readByte(); if (isWhitespace(b)) { continue; } // 1 is black, 0 is white in PBM spec. // we use 1=white, 0=black in u1 format const pixel = if (b == '0') @as(u1, 1) else @as(u1, 0); data[dataIndex] = color.Grayscale1{ .value = pixel }; dataIndex += 1; } } fn readLinearizedValue(stream: ImageReader, maxValue: usize) !u8 { return if (maxValue > 255) @truncate(u8, 255 * @as(usize, try stream.readIntBig(u16)) / maxValue) else @truncate(u8, 255 * @as(usize, try stream.readByte()) / maxValue); } fn loadBinaryGraymap(header: Header, pixels: *color.ColorStorage, stream: ImageReader) !void { var dataIndex: usize = 0; const dataEnd = header.width * header.height; if (header.max_value <= 255) { while (dataIndex < dataEnd) : (dataIndex += 1) { pixels.Grayscale8[dataIndex] = color.Grayscale8{ .value = try readLinearizedValue(stream, header.max_value) }; } } else { while (dataIndex < dataEnd) : (dataIndex += 1) { pixels.Grayscale16[dataIndex] = color.Grayscale16{ .value = try stream.readIntBig(u16) }; } } } fn loadAsciiGraymap(header: Header, pixels: *color.ColorStorage, stream: ImageReader) !void { var readBuffer: [16]u8 = undefined; var dataIndex: usize = 0; const dataEnd = header.width * header.height; if (header.max_value <= 255) { while (dataIndex < dataEnd) : (dataIndex += 1) { pixels.Grayscale8[dataIndex] = color.Grayscale8{ .value = @truncate(u8, try parseNumber(stream, readBuffer[0..])) }; } } else { while (dataIndex < dataEnd) : (dataIndex += 1) { pixels.Grayscale16[dataIndex] = color.Grayscale16{ .value = @truncate(u16, try parseNumber(stream, readBuffer[0..])) }; } } } fn loadBinaryRgbmap(header: Header, data: []color.Rgb24, stream: ImageReader) !void { var dataIndex: usize = 0; const dataEnd = header.width * header.height; while (dataIndex < dataEnd) : (dataIndex += 1) { data[dataIndex] = color.Rgb24{ .R = try readLinearizedValue(stream, header.max_value), .G = try readLinearizedValue(stream, header.max_value), .B = try readLinearizedValue(stream, header.max_value), }; } } fn loadAsciiRgbmap(header: Header, data: []color.Rgb24, stream: ImageReader) !void { var readBuffer: [16]u8 = undefined; var dataIndex: usize = 0; const dataEnd = header.width * header.height; while (dataIndex < dataEnd) : (dataIndex += 1) { var r = try parseNumber(stream, readBuffer[0..]); var g = try parseNumber(stream, readBuffer[0..]); var b = try parseNumber(stream, readBuffer[0..]); data[dataIndex] = color.Rgb24{ .R = @truncate(u8, 255 * r / header.max_value), .G = @truncate(u8, 255 * g / header.max_value), .B = @truncate(u8, 255 * b / header.max_value), }; } } fn Netpbm(comptime imageFormat: ImageFormat, comptime headerNumbers: []const u8) type { return struct { header: Header = undefined, pixel_format: PixelFormat = undefined, const Self = @This(); pub const EncoderOptions = struct { binary: bool, }; pub fn formatInterface() FormatInterface { return FormatInterface{ .format = @ptrCast(FormatInterface.FormatFn, format), .formatDetect = @ptrCast(FormatInterface.FormatDetectFn, formatDetect), .readForImage = @ptrCast(FormatInterface.ReadForImageFn, readForImage), .writeForImage = @ptrCast(FormatInterface.WriteForImageFn, writeForImage), }; } pub fn format() ImageFormat { return imageFormat; } pub fn formatDetect(reader: ImageReader, seekStream: ImageSeekStream) !bool { var magicNumberBuffer: [2]u8 = undefined; _ = try reader.read(magicNumberBuffer[0..]); if (magicNumberBuffer[0] != 'P') { return false; } var found = false; for (headerNumbers) |number| { if (magicNumberBuffer[1] == number) { found = true; break; } } return found; } pub fn readForImage(allocator: *Allocator, reader: ImageReader, seekStream: ImageSeekStream, pixels: *?color.ColorStorage) !ImageInfo { var netpbmFile = Self{}; try netpbmFile.read(allocator, reader, seekStream, pixels); var imageInfo = ImageInfo{}; imageInfo.width = netpbmFile.header.width; imageInfo.height = netpbmFile.header.height; imageInfo.pixel_format = netpbmFile.pixel_format; return imageInfo; } pub fn writeForImage(allocator: *Allocator, write_stream: image.ImageWriterStream, seek_stream: ImageSeekStream, pixels: color.ColorStorage, save_info: image.ImageSaveInfo) !void { var netpbmFile = Self{}; netpbmFile.header.binary = switch (save_info.encoder_options) { .pbm => |options| options.binary, .pgm => |options| options.binary, .ppm => |options| options.binary, else => false, }; netpbmFile.header.width = save_info.width; netpbmFile.header.height = save_info.height; netpbmFile.header.format = switch (pixels) { .Grayscale1 => Format.Bitmap, .Grayscale8, .Grayscale16 => Format.Grayscale, .Rgb24 => Format.Rgb, else => return errors.ImageError.UnsupportedPixelFormat, }; netpbmFile.header.max_value = switch (pixels) { .Grayscale16 => std.math.maxInt(u16), .Grayscale1 => 1, else => std.math.maxInt(u8), }; try netpbmFile.write(write_stream, seek_stream, pixels); } pub fn read(self: *Self, allocator: *Allocator, reader: ImageReader, seekStream: ImageSeekStream, pixelsOpt: *?color.ColorStorage) !void { self.header = try parseHeader(reader); self.pixel_format = switch (self.header.format) { .Bitmap => PixelFormat.Grayscale1, .Grayscale => switch (self.header.max_value) { 0...255 => PixelFormat.Grayscale8, else => PixelFormat.Grayscale16, }, .Rgb => PixelFormat.Rgb24, }; pixelsOpt.* = try color.ColorStorage.init(allocator, self.pixel_format, self.header.width * self.header.height); if (pixelsOpt.*) |*pixels| { switch (self.header.format) { .Bitmap => { if (self.header.binary) { try loadBinaryBitmap(self.header, pixels.Grayscale1, reader); } else { try loadAsciiBitmap(self.header, pixels.Grayscale1, reader); } }, .Grayscale => { if (self.header.binary) { try loadBinaryGraymap(self.header, pixels, reader); } else { try loadAsciiGraymap(self.header, pixels, reader); } }, .Rgb => { if (self.header.binary) { try loadBinaryRgbmap(self.header, pixels.Rgb24, reader); } else { try loadAsciiRgbmap(self.header, pixels.Rgb24, reader); } }, } } } pub fn write(self: *Self, write_stream: image.ImageWriterStream, seek_stream: image.ImageSeekStream, pixels: color.ColorStorage) !void { const image_type = if (self.header.binary) headerNumbers[1] else headerNumbers[0]; try write_stream.print("P{c}\n", .{image_type}); _ = try write_stream.write("# Created by zigimg\n"); try write_stream.print("{} {}\n", .{ self.header.width, self.header.height }); if (self.header.format != .Bitmap) { try write_stream.print("{}\n", .{self.header.max_value}); } if (self.header.binary) { switch (self.header.format) { .Bitmap => { switch (pixels) { .Grayscale1 => { var bit_writer = std.io.bitWriter(.Big, write_stream); for (pixels.Grayscale1) |entry| { try bit_writer.writeBits(~entry.value, 1); } try bit_writer.flushBits(); }, else => { return errors.ImageError.UnsupportedPixelFormat; }, } }, .Grayscale => { switch (pixels) { .Grayscale16 => { for (pixels.Grayscale16) |entry| { // Big due to 16-bit PGM being semi standardized as big-endian try write_stream.writeIntBig(u16, entry.value); } }, .Grayscale8 => { for (pixels.Grayscale8) |entry| { try write_stream.writeIntLittle(u8, entry.value); } }, else => { return errors.ImageError.UnsupportedPixelFormat; }, } }, .Rgb => { switch (pixels) { .Rgb24 => { for (pixels.Rgb24) |entry| { try write_stream.writeByte(entry.R); try write_stream.writeByte(entry.G); try write_stream.writeByte(entry.B); } }, else => { return errors.ImageError.UnsupportedPixelFormat; }, } }, } } else { switch (self.header.format) { .Bitmap => { switch (pixels) { .Grayscale1 => { for (pixels.Grayscale1) |entry| { try write_stream.print("{}", .{~entry.value}); } _ = try write_stream.write("\n"); }, else => { return errors.ImageError.UnsupportedPixelFormat; }, } }, .Grayscale => { switch (pixels) { .Grayscale16 => { const pixels_len = pixels.len(); for (pixels.Grayscale16) |entry, index| { try write_stream.print("{}", .{entry.value}); if (index != (pixels_len - 1)) { _ = try write_stream.write(" "); } } _ = try write_stream.write("\n"); }, .Grayscale8 => { const pixels_len = pixels.len(); for (pixels.Grayscale8) |entry, index| { try write_stream.print("{}", .{entry.value}); if (index != (pixels_len - 1)) { _ = try write_stream.write(" "); } } _ = try write_stream.write("\n"); }, else => { return errors.ImageError.UnsupportedPixelFormat; }, } }, .Rgb => { switch (pixels) { .Rgb24 => { for (pixels.Rgb24) |entry| { try write_stream.print("{} {} {}\n", .{ entry.R, entry.G, entry.B }); } }, else => { return errors.ImageError.UnsupportedPixelFormat; }, } }, } } } }; } pub const PBM = Netpbm(ImageFormat.Pbm, &[_]u8{ '1', '4' }); pub const PGM = Netpbm(ImageFormat.Pgm, &[_]u8{ '2', '5' }); pub const PPM = Netpbm(ImageFormat.Ppm, &[_]u8{ '3', '6' });
src/formats/netpbm.zig
const getty = @import("../../lib.zig"); const std = @import("std"); /// Deserializer interface. /// /// Deserializers are responsible for the following conversion: /// /// Getty Data Model /// /// ▲ <------- /// | | /// | /// Data Format | /// | /// | /// | /// | /// /// `getty.Deserializer` /// /// Notice how Zig data is not a part of this conversion. Deserializers only /// convert into values that fall under Getty's data model. In other words, a /// Getty deserializer specifies how to convert a JSON map into Getty map, not /// how to convert a JSON map into a `struct { x: i32 }`. /// /// Parameters /// ========== /// /// Context /// ------- /// /// This is the type that implements `getty.Deserializer` (or a pointer to it). /// /// Error /// ----- /// /// The error set used by all of `getty.Deserializer`'s methods upon failure. /// /// user_dbt /// -------- /// /// A Deserialization Block or Tuple. /// /// This parameter is intended for users of a deserializer, enabling /// them to use their own custom deserialization logic. /// /// de_dbt /// ------- /// /// A Deserialization Block or Tuple. /// /// This parameter is intended for deserializers, enabling them to use /// their own custom deserialization logic. /// /// deserializeXXX /// -------------- /// /// Methods required by `getty.Deserializer` to carry out /// deserialization. /// /// Each method converts data from an input data format into Getty's /// data model. This is done by calling a method on the `visitor` /// parameter, which is a `getty.de.Visitor` interface value. For /// example, the `deserializeInt` method of a typical JSON deserializer /// would parse an integer from the input data and then map it to /// Getty's data model by passing the integer value to the visitor /// parameter's `visitInt` method. The visitor would then produce a Zig /// integer or whatever other value it wants from the Getty integer on /// its own. pub fn Deserializer( comptime Context: type, comptime Error: type, comptime user_dbt: anytype, comptime de_dbt: anytype, comptime deserializeBool: Fn(Context, Error), comptime deserializeEnum: Fn(Context, Error), comptime deserializeFloat: Fn(Context, Error), comptime deserializeInt: Fn(Context, Error), comptime deserializeMap: Fn(Context, Error), comptime deserializeOptional: Fn(Context, Error), comptime deserializeSeq: Fn(Context, Error), comptime deserializeString: Fn(Context, Error), comptime deserializeStruct: Fn(Context, Error), comptime deserializeVoid: Fn(Context, Error), ) type { comptime { getty.concepts.@"getty.de.dbt"(user_dbt); getty.concepts.@"getty.de.dbt"(de_dbt); //TODO: Add concept for Error (blocked by concepts library). } return struct { pub const @"getty.Deserializer" = struct { context: Context, const Self = @This(); pub const Error = Error; pub const dt = blk: { const user_dt = if (@TypeOf(user_dbt) == type) .{user_dbt} else user_dbt; const de_dt = if (@TypeOf(de_dbt) == type) .{de_dbt} else de_dbt; const default = getty.default_dt; const U = @TypeOf(user_dt); const D = @TypeOf(de_dt); const Default = @TypeOf(default); if (U == Default and D == Default) { break :blk default; } else if (U != Default and D == Default) { break :blk user_dt ++ default; } else if (U == Default and D != Default) { break :blk de_dt ++ default; } else { break :blk user_dt ++ de_dt ++ default; } }; pub fn deserializeBool(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeBool(self.context, allocator, visitor); } pub fn deserializeEnum(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeEnum(self.context, allocator, visitor); } pub fn deserializeFloat(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeFloat(self.context, allocator, visitor); } pub fn deserializeInt(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeInt(self.context, allocator, visitor); } pub fn deserializeMap(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeMap(self.context, allocator, visitor); } pub fn deserializeOptional(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeOptional(self.context, allocator, visitor); } pub fn deserializeSeq(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeSeq(self.context, allocator, visitor); } pub fn deserializeString(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeString(self.context, allocator, visitor); } pub fn deserializeStruct(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeStruct(self.context, allocator, visitor); } pub fn deserializeVoid(self: Self, allocator: ?std.mem.Allocator, visitor: anytype) Return(@TypeOf(visitor)) { return try deserializeVoid(self.context, allocator, visitor); } }; pub fn deserializer(self: Context) @"getty.Deserializer" { return .{ .context = self }; } fn Return(comptime Visitor: type) type { comptime getty.concepts.@"getty.de.Visitor"(Visitor); return Error!Visitor.Value; } }; } fn Fn(comptime Context: type, comptime Error: type) type { const S = struct { fn f(_: Context, _: ?std.mem.Allocator, visitor: anytype) Error!@TypeOf(visitor).Value { unreachable; } }; return @TypeOf(S.f); }
src/de/interface/deserializer.zig
pub const c = @import("../c.zig"); pub const accelerometer_as_joystick = c.SDL_HINT_ACCELEROMETER_AS_JOYSTICK; pub const android_apk_expansion_main_file_version = c.SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION; pub const android_apk_expansion_patch_file_version = c.SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION; pub const android_separate_mouse_and_touch = c.SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH; pub const apple_tv_controller_ui_events = c.SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS; pub const apple_tv_remote_allow_rotation = c.SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION; pub const bmp_save_legacy_format = c.SDL_HINT_BMP_SAVE_LEGACY_FORMAT; pub const emscripten_keyboard_element = c.SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT; pub const framebuffer_acceleration = c.SDL_HINT_FRAMEBUFFER_ACCELERATION; pub const gamecontrollerconfig = c.SDL_HINT_GAMECONTROLLERCONFIG; pub const grab_keyboard = c.SDL_HINT_GRAB_KEYBOARD; pub const idle_timer_disabled = c.SDL_HINT_IDLE_TIMER_DISABLED; pub const ime_internal_editing = c.SDL_HINT_IME_INTERNAL_EDITING; pub const joystick_allow_background_events = c.SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS; pub const mac_background_app = c.SDL_HINT_MAC_BACKGROUND_APP; pub const mac_ctrl_click_emulate_right_click = c.SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK; pub const mouse_focus_clickthrough = c.SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH; pub const mouse_relative_mode_warp = c.SDL_HINT_MOUSE_RELATIVE_MODE_WARP; pub const no_signal_handlers = c.SDL_HINT_NO_SIGNAL_HANDLERS; pub const orientations = c.SDL_HINT_ORIENTATIONS; pub const render_direct3d11_debug = c.SDL_HINT_RENDER_DIRECT3D11_DEBUG; pub const render_direct3d_threadsafe = c.SDL_HINT_RENDER_DIRECT3D_THREADSAFE; pub const render_driver = c.SDL_HINT_RENDER_DRIVER; pub const render_opengl_shaders = c.SDL_HINT_RENDER_OPENGL_SHADERS; pub const render_scale_quality = c.SDL_HINT_RENDER_SCALE_QUALITY; pub const render_vsync = c.SDL_HINT_RENDER_VSYNC; pub const rpi_video_layer = c.SDL_HINT_RPI_VIDEO_LAYER; pub const thread_stack_size = c.SDL_HINT_THREAD_STACK_SIZE; pub const timer_resolution = c.SDL_HINT_TIMER_RESOLUTION; pub const video_allow_screensaver = c.SDL_HINT_VIDEO_ALLOW_SCREENSAVER; pub const video_highdpi_disabled = c.SDL_HINT_VIDEO_HIGHDPI_DISABLED; pub const video_mac_fullscreen_spaces = c.SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES; pub const video_minimize_on_focus_loss = c.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS; pub const video_window_share_pixel_format = c.SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT; pub const video_win_d3dcompiler = c.SDL_HINT_VIDEO_WIN_D3DCOMPILER; pub const video_x11_net_wm_ping = c.SDL_HINT_VIDEO_X11_NET_WM_PING; pub const video_x11_xinerama = c.SDL_HINT_VIDEO_X11_XINERAMA; pub const video_x11_xrandr = c.SDL_HINT_VIDEO_X11_XRANDR; pub const video_x11_xvidmode = c.SDL_HINT_VIDEO_X11_XVIDMODE; pub const windows_disable_thread_naming = c.SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING; pub const windows_enable_messageloop = c.SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP; pub const windows_no_close_on_alt_f4 = c.SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4; pub const window_frame_usable_while_cursor_hidden = c.SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN; pub const winrt_handle_back_button = c.SDL_HINT_WINRT_HANDLE_BACK_BUTTON; pub const winrt_privacy_policy_label = c.SDL_HINT_WINRT_PRIVACY_POLICY_LABEL; pub const winrt_privacy_policy_url = c.SDL_HINT_WINRT_PRIVACY_POLICY_URL; pub const xinput_enabled = c.SDL_HINT_XINPUT_ENABLED; pub const xinput_use_old_joystick_mapping = c.SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING;
sdl/hint.zig
const std = @import("std"); const mem = std.mem; const LVT = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 44033, hi: u21 = 55203, pub fn init(allocator: *mem.Allocator) !LVT { var instance = LVT{ .allocator = allocator, .array = try allocator.alloc(bool, 11171), }; mem.set(bool, instance.array, false); var index: u21 = 0; index = 0; while (index <= 26) : (index += 1) { instance.array[index] = true; } index = 28; while (index <= 54) : (index += 1) { instance.array[index] = true; } index = 56; while (index <= 82) : (index += 1) { instance.array[index] = true; } index = 84; while (index <= 110) : (index += 1) { instance.array[index] = true; } index = 112; while (index <= 138) : (index += 1) { instance.array[index] = true; } index = 140; while (index <= 166) : (index += 1) { instance.array[index] = true; } index = 168; while (index <= 194) : (index += 1) { instance.array[index] = true; } index = 196; while (index <= 222) : (index += 1) { instance.array[index] = true; } index = 224; while (index <= 250) : (index += 1) { instance.array[index] = true; } index = 252; while (index <= 278) : (index += 1) { instance.array[index] = true; } index = 280; while (index <= 306) : (index += 1) { instance.array[index] = true; } index = 308; while (index <= 334) : (index += 1) { instance.array[index] = true; } index = 336; while (index <= 362) : (index += 1) { instance.array[index] = true; } index = 364; while (index <= 390) : (index += 1) { instance.array[index] = true; } index = 392; while (index <= 418) : (index += 1) { instance.array[index] = true; } index = 420; while (index <= 446) : (index += 1) { instance.array[index] = true; } index = 448; while (index <= 474) : (index += 1) { instance.array[index] = true; } index = 476; while (index <= 502) : (index += 1) { instance.array[index] = true; } index = 504; while (index <= 530) : (index += 1) { instance.array[index] = true; } index = 532; while (index <= 558) : (index += 1) { instance.array[index] = true; } index = 560; while (index <= 586) : (index += 1) { instance.array[index] = true; } index = 588; while (index <= 614) : (index += 1) { instance.array[index] = true; } index = 616; while (index <= 642) : (index += 1) { instance.array[index] = true; } index = 644; while (index <= 670) : (index += 1) { instance.array[index] = true; } index = 672; while (index <= 698) : (index += 1) { instance.array[index] = true; } index = 700; while (index <= 726) : (index += 1) { instance.array[index] = true; } index = 728; while (index <= 754) : (index += 1) { instance.array[index] = true; } index = 756; while (index <= 782) : (index += 1) { instance.array[index] = true; } index = 784; while (index <= 810) : (index += 1) { instance.array[index] = true; } index = 812; while (index <= 838) : (index += 1) { instance.array[index] = true; } index = 840; while (index <= 866) : (index += 1) { instance.array[index] = true; } index = 868; while (index <= 894) : (index += 1) { instance.array[index] = true; } index = 896; while (index <= 922) : (index += 1) { instance.array[index] = true; } index = 924; while (index <= 950) : (index += 1) { instance.array[index] = true; } index = 952; while (index <= 978) : (index += 1) { instance.array[index] = true; } index = 980; while (index <= 1006) : (index += 1) { instance.array[index] = true; } index = 1008; while (index <= 1034) : (index += 1) { instance.array[index] = true; } index = 1036; while (index <= 1062) : (index += 1) { instance.array[index] = true; } index = 1064; while (index <= 1090) : (index += 1) { instance.array[index] = true; } index = 1092; while (index <= 1118) : (index += 1) { instance.array[index] = true; } index = 1120; while (index <= 1146) : (index += 1) { instance.array[index] = true; } index = 1148; while (index <= 1174) : (index += 1) { instance.array[index] = true; } index = 1176; while (index <= 1202) : (index += 1) { instance.array[index] = true; } index = 1204; while (index <= 1230) : (index += 1) { instance.array[index] = true; } index = 1232; while (index <= 1258) : (index += 1) { instance.array[index] = true; } index = 1260; while (index <= 1286) : (index += 1) { instance.array[index] = true; } index = 1288; while (index <= 1314) : (index += 1) { instance.array[index] = true; } index = 1316; while (index <= 1342) : (index += 1) { instance.array[index] = true; } index = 1344; while (index <= 1370) : (index += 1) { instance.array[index] = true; } index = 1372; while (index <= 1398) : (index += 1) { instance.array[index] = true; } index = 1400; while (index <= 1426) : (index += 1) { instance.array[index] = true; } index = 1428; while (index <= 1454) : (index += 1) { instance.array[index] = true; } index = 1456; while (index <= 1482) : (index += 1) { instance.array[index] = true; } index = 1484; while (index <= 1510) : (index += 1) { instance.array[index] = true; } index = 1512; while (index <= 1538) : (index += 1) { instance.array[index] = true; } index = 1540; while (index <= 1566) : (index += 1) { instance.array[index] = true; } index = 1568; while (index <= 1594) : (index += 1) { instance.array[index] = true; } index = 1596; while (index <= 1622) : (index += 1) { instance.array[index] = true; } index = 1624; while (index <= 1650) : (index += 1) { instance.array[index] = true; } index = 1652; while (index <= 1678) : (index += 1) { instance.array[index] = true; } index = 1680; while (index <= 1706) : (index += 1) { instance.array[index] = true; } index = 1708; while (index <= 1734) : (index += 1) { instance.array[index] = true; } index = 1736; while (index <= 1762) : (index += 1) { instance.array[index] = true; } index = 1764; while (index <= 1790) : (index += 1) { instance.array[index] = true; } index = 1792; while (index <= 1818) : (index += 1) { instance.array[index] = true; } index = 1820; while (index <= 1846) : (index += 1) { instance.array[index] = true; } index = 1848; while (index <= 1874) : (index += 1) { instance.array[index] = true; } index = 1876; while (index <= 1902) : (index += 1) { instance.array[index] = true; } index = 1904; while (index <= 1930) : (index += 1) { instance.array[index] = true; } index = 1932; while (index <= 1958) : (index += 1) { instance.array[index] = true; } index = 1960; while (index <= 1986) : (index += 1) { instance.array[index] = true; } index = 1988; while (index <= 2014) : (index += 1) { instance.array[index] = true; } index = 2016; while (index <= 2042) : (index += 1) { instance.array[index] = true; } index = 2044; while (index <= 2070) : (index += 1) { instance.array[index] = true; } index = 2072; while (index <= 2098) : (index += 1) { instance.array[index] = true; } index = 2100; while (index <= 2126) : (index += 1) { instance.array[index] = true; } index = 2128; while (index <= 2154) : (index += 1) { instance.array[index] = true; } index = 2156; while (index <= 2182) : (index += 1) { instance.array[index] = true; } index = 2184; while (index <= 2210) : (index += 1) { instance.array[index] = true; } index = 2212; while (index <= 2238) : (index += 1) { instance.array[index] = true; } index = 2240; while (index <= 2266) : (index += 1) { instance.array[index] = true; } index = 2268; while (index <= 2294) : (index += 1) { instance.array[index] = true; } index = 2296; while (index <= 2322) : (index += 1) { instance.array[index] = true; } index = 2324; while (index <= 2350) : (index += 1) { instance.array[index] = true; } index = 2352; while (index <= 2378) : (index += 1) { instance.array[index] = true; } index = 2380; while (index <= 2406) : (index += 1) { instance.array[index] = true; } index = 2408; while (index <= 2434) : (index += 1) { instance.array[index] = true; } index = 2436; while (index <= 2462) : (index += 1) { instance.array[index] = true; } index = 2464; while (index <= 2490) : (index += 1) { instance.array[index] = true; } index = 2492; while (index <= 2518) : (index += 1) { instance.array[index] = true; } index = 2520; while (index <= 2546) : (index += 1) { instance.array[index] = true; } index = 2548; while (index <= 2574) : (index += 1) { instance.array[index] = true; } index = 2576; while (index <= 2602) : (index += 1) { instance.array[index] = true; } index = 2604; while (index <= 2630) : (index += 1) { instance.array[index] = true; } index = 2632; while (index <= 2658) : (index += 1) { instance.array[index] = true; } index = 2660; while (index <= 2686) : (index += 1) { instance.array[index] = true; } index = 2688; while (index <= 2714) : (index += 1) { instance.array[index] = true; } index = 2716; while (index <= 2742) : (index += 1) { instance.array[index] = true; } index = 2744; while (index <= 2770) : (index += 1) { instance.array[index] = true; } index = 2772; while (index <= 2798) : (index += 1) { instance.array[index] = true; } index = 2800; while (index <= 2826) : (index += 1) { instance.array[index] = true; } index = 2828; while (index <= 2854) : (index += 1) { instance.array[index] = true; } index = 2856; while (index <= 2882) : (index += 1) { instance.array[index] = true; } index = 2884; while (index <= 2910) : (index += 1) { instance.array[index] = true; } index = 2912; while (index <= 2938) : (index += 1) { instance.array[index] = true; } index = 2940; while (index <= 2966) : (index += 1) { instance.array[index] = true; } index = 2968; while (index <= 2994) : (index += 1) { instance.array[index] = true; } index = 2996; while (index <= 3022) : (index += 1) { instance.array[index] = true; } index = 3024; while (index <= 3050) : (index += 1) { instance.array[index] = true; } index = 3052; while (index <= 3078) : (index += 1) { instance.array[index] = true; } index = 3080; while (index <= 3106) : (index += 1) { instance.array[index] = true; } index = 3108; while (index <= 3134) : (index += 1) { instance.array[index] = true; } index = 3136; while (index <= 3162) : (index += 1) { instance.array[index] = true; } index = 3164; while (index <= 3190) : (index += 1) { instance.array[index] = true; } index = 3192; while (index <= 3218) : (index += 1) { instance.array[index] = true; } index = 3220; while (index <= 3246) : (index += 1) { instance.array[index] = true; } index = 3248; while (index <= 3274) : (index += 1) { instance.array[index] = true; } index = 3276; while (index <= 3302) : (index += 1) { instance.array[index] = true; } index = 3304; while (index <= 3330) : (index += 1) { instance.array[index] = true; } index = 3332; while (index <= 3358) : (index += 1) { instance.array[index] = true; } index = 3360; while (index <= 3386) : (index += 1) { instance.array[index] = true; } index = 3388; while (index <= 3414) : (index += 1) { instance.array[index] = true; } index = 3416; while (index <= 3442) : (index += 1) { instance.array[index] = true; } index = 3444; while (index <= 3470) : (index += 1) { instance.array[index] = true; } index = 3472; while (index <= 3498) : (index += 1) { instance.array[index] = true; } index = 3500; while (index <= 3526) : (index += 1) { instance.array[index] = true; } index = 3528; while (index <= 3554) : (index += 1) { instance.array[index] = true; } index = 3556; while (index <= 3582) : (index += 1) { instance.array[index] = true; } index = 3584; while (index <= 3610) : (index += 1) { instance.array[index] = true; } index = 3612; while (index <= 3638) : (index += 1) { instance.array[index] = true; } index = 3640; while (index <= 3666) : (index += 1) { instance.array[index] = true; } index = 3668; while (index <= 3694) : (index += 1) { instance.array[index] = true; } index = 3696; while (index <= 3722) : (index += 1) { instance.array[index] = true; } index = 3724; while (index <= 3750) : (index += 1) { instance.array[index] = true; } index = 3752; while (index <= 3778) : (index += 1) { instance.array[index] = true; } index = 3780; while (index <= 3806) : (index += 1) { instance.array[index] = true; } index = 3808; while (index <= 3834) : (index += 1) { instance.array[index] = true; } index = 3836; while (index <= 3862) : (index += 1) { instance.array[index] = true; } index = 3864; while (index <= 3890) : (index += 1) { instance.array[index] = true; } index = 3892; while (index <= 3918) : (index += 1) { instance.array[index] = true; } index = 3920; while (index <= 3946) : (index += 1) { instance.array[index] = true; } index = 3948; while (index <= 3974) : (index += 1) { instance.array[index] = true; } index = 3976; while (index <= 4002) : (index += 1) { instance.array[index] = true; } index = 4004; while (index <= 4030) : (index += 1) { instance.array[index] = true; } index = 4032; while (index <= 4058) : (index += 1) { instance.array[index] = true; } index = 4060; while (index <= 4086) : (index += 1) { instance.array[index] = true; } index = 4088; while (index <= 4114) : (index += 1) { instance.array[index] = true; } index = 4116; while (index <= 4142) : (index += 1) { instance.array[index] = true; } index = 4144; while (index <= 4170) : (index += 1) { instance.array[index] = true; } index = 4172; while (index <= 4198) : (index += 1) { instance.array[index] = true; } index = 4200; while (index <= 4226) : (index += 1) { instance.array[index] = true; } index = 4228; while (index <= 4254) : (index += 1) { instance.array[index] = true; } index = 4256; while (index <= 4282) : (index += 1) { instance.array[index] = true; } index = 4284; while (index <= 4310) : (index += 1) { instance.array[index] = true; } index = 4312; while (index <= 4338) : (index += 1) { instance.array[index] = true; } index = 4340; while (index <= 4366) : (index += 1) { instance.array[index] = true; } index = 4368; while (index <= 4394) : (index += 1) { instance.array[index] = true; } index = 4396; while (index <= 4422) : (index += 1) { instance.array[index] = true; } index = 4424; while (index <= 4450) : (index += 1) { instance.array[index] = true; } index = 4452; while (index <= 4478) : (index += 1) { instance.array[index] = true; } index = 4480; while (index <= 4506) : (index += 1) { instance.array[index] = true; } index = 4508; while (index <= 4534) : (index += 1) { instance.array[index] = true; } index = 4536; while (index <= 4562) : (index += 1) { instance.array[index] = true; } index = 4564; while (index <= 4590) : (index += 1) { instance.array[index] = true; } index = 4592; while (index <= 4618) : (index += 1) { instance.array[index] = true; } index = 4620; while (index <= 4646) : (index += 1) { instance.array[index] = true; } index = 4648; while (index <= 4674) : (index += 1) { instance.array[index] = true; } index = 4676; while (index <= 4702) : (index += 1) { instance.array[index] = true; } index = 4704; while (index <= 4730) : (index += 1) { instance.array[index] = true; } index = 4732; while (index <= 4758) : (index += 1) { instance.array[index] = true; } index = 4760; while (index <= 4786) : (index += 1) { instance.array[index] = true; } index = 4788; while (index <= 4814) : (index += 1) { instance.array[index] = true; } index = 4816; while (index <= 4842) : (index += 1) { instance.array[index] = true; } index = 4844; while (index <= 4870) : (index += 1) { instance.array[index] = true; } index = 4872; while (index <= 4898) : (index += 1) { instance.array[index] = true; } index = 4900; while (index <= 4926) : (index += 1) { instance.array[index] = true; } index = 4928; while (index <= 4954) : (index += 1) { instance.array[index] = true; } index = 4956; while (index <= 4982) : (index += 1) { instance.array[index] = true; } index = 4984; while (index <= 5010) : (index += 1) { instance.array[index] = true; } index = 5012; while (index <= 5038) : (index += 1) { instance.array[index] = true; } index = 5040; while (index <= 5066) : (index += 1) { instance.array[index] = true; } index = 5068; while (index <= 5094) : (index += 1) { instance.array[index] = true; } index = 5096; while (index <= 5122) : (index += 1) { instance.array[index] = true; } index = 5124; while (index <= 5150) : (index += 1) { instance.array[index] = true; } index = 5152; while (index <= 5178) : (index += 1) { instance.array[index] = true; } index = 5180; while (index <= 5206) : (index += 1) { instance.array[index] = true; } index = 5208; while (index <= 5234) : (index += 1) { instance.array[index] = true; } index = 5236; while (index <= 5262) : (index += 1) { instance.array[index] = true; } index = 5264; while (index <= 5290) : (index += 1) { instance.array[index] = true; } index = 5292; while (index <= 5318) : (index += 1) { instance.array[index] = true; } index = 5320; while (index <= 5346) : (index += 1) { instance.array[index] = true; } index = 5348; while (index <= 5374) : (index += 1) { instance.array[index] = true; } index = 5376; while (index <= 5402) : (index += 1) { instance.array[index] = true; } index = 5404; while (index <= 5430) : (index += 1) { instance.array[index] = true; } index = 5432; while (index <= 5458) : (index += 1) { instance.array[index] = true; } index = 5460; while (index <= 5486) : (index += 1) { instance.array[index] = true; } index = 5488; while (index <= 5514) : (index += 1) { instance.array[index] = true; } index = 5516; while (index <= 5542) : (index += 1) { instance.array[index] = true; } index = 5544; while (index <= 5570) : (index += 1) { instance.array[index] = true; } index = 5572; while (index <= 5598) : (index += 1) { instance.array[index] = true; } index = 5600; while (index <= 5626) : (index += 1) { instance.array[index] = true; } index = 5628; while (index <= 5654) : (index += 1) { instance.array[index] = true; } index = 5656; while (index <= 5682) : (index += 1) { instance.array[index] = true; } index = 5684; while (index <= 5710) : (index += 1) { instance.array[index] = true; } index = 5712; while (index <= 5738) : (index += 1) { instance.array[index] = true; } index = 5740; while (index <= 5766) : (index += 1) { instance.array[index] = true; } index = 5768; while (index <= 5794) : (index += 1) { instance.array[index] = true; } index = 5796; while (index <= 5822) : (index += 1) { instance.array[index] = true; } index = 5824; while (index <= 5850) : (index += 1) { instance.array[index] = true; } index = 5852; while (index <= 5878) : (index += 1) { instance.array[index] = true; } index = 5880; while (index <= 5906) : (index += 1) { instance.array[index] = true; } index = 5908; while (index <= 5934) : (index += 1) { instance.array[index] = true; } index = 5936; while (index <= 5962) : (index += 1) { instance.array[index] = true; } index = 5964; while (index <= 5990) : (index += 1) { instance.array[index] = true; } index = 5992; while (index <= 6018) : (index += 1) { instance.array[index] = true; } index = 6020; while (index <= 6046) : (index += 1) { instance.array[index] = true; } index = 6048; while (index <= 6074) : (index += 1) { instance.array[index] = true; } index = 6076; while (index <= 6102) : (index += 1) { instance.array[index] = true; } index = 6104; while (index <= 6130) : (index += 1) { instance.array[index] = true; } index = 6132; while (index <= 6158) : (index += 1) { instance.array[index] = true; } index = 6160; while (index <= 6186) : (index += 1) { instance.array[index] = true; } index = 6188; while (index <= 6214) : (index += 1) { instance.array[index] = true; } index = 6216; while (index <= 6242) : (index += 1) { instance.array[index] = true; } index = 6244; while (index <= 6270) : (index += 1) { instance.array[index] = true; } index = 6272; while (index <= 6298) : (index += 1) { instance.array[index] = true; } index = 6300; while (index <= 6326) : (index += 1) { instance.array[index] = true; } index = 6328; while (index <= 6354) : (index += 1) { instance.array[index] = true; } index = 6356; while (index <= 6382) : (index += 1) { instance.array[index] = true; } index = 6384; while (index <= 6410) : (index += 1) { instance.array[index] = true; } index = 6412; while (index <= 6438) : (index += 1) { instance.array[index] = true; } index = 6440; while (index <= 6466) : (index += 1) { instance.array[index] = true; } index = 6468; while (index <= 6494) : (index += 1) { instance.array[index] = true; } index = 6496; while (index <= 6522) : (index += 1) { instance.array[index] = true; } index = 6524; while (index <= 6550) : (index += 1) { instance.array[index] = true; } index = 6552; while (index <= 6578) : (index += 1) { instance.array[index] = true; } index = 6580; while (index <= 6606) : (index += 1) { instance.array[index] = true; } index = 6608; while (index <= 6634) : (index += 1) { instance.array[index] = true; } index = 6636; while (index <= 6662) : (index += 1) { instance.array[index] = true; } index = 6664; while (index <= 6690) : (index += 1) { instance.array[index] = true; } index = 6692; while (index <= 6718) : (index += 1) { instance.array[index] = true; } index = 6720; while (index <= 6746) : (index += 1) { instance.array[index] = true; } index = 6748; while (index <= 6774) : (index += 1) { instance.array[index] = true; } index = 6776; while (index <= 6802) : (index += 1) { instance.array[index] = true; } index = 6804; while (index <= 6830) : (index += 1) { instance.array[index] = true; } index = 6832; while (index <= 6858) : (index += 1) { instance.array[index] = true; } index = 6860; while (index <= 6886) : (index += 1) { instance.array[index] = true; } index = 6888; while (index <= 6914) : (index += 1) { instance.array[index] = true; } index = 6916; while (index <= 6942) : (index += 1) { instance.array[index] = true; } index = 6944; while (index <= 6970) : (index += 1) { instance.array[index] = true; } index = 6972; while (index <= 6998) : (index += 1) { instance.array[index] = true; } index = 7000; while (index <= 7026) : (index += 1) { instance.array[index] = true; } index = 7028; while (index <= 7054) : (index += 1) { instance.array[index] = true; } index = 7056; while (index <= 7082) : (index += 1) { instance.array[index] = true; } index = 7084; while (index <= 7110) : (index += 1) { instance.array[index] = true; } index = 7112; while (index <= 7138) : (index += 1) { instance.array[index] = true; } index = 7140; while (index <= 7166) : (index += 1) { instance.array[index] = true; } index = 7168; while (index <= 7194) : (index += 1) { instance.array[index] = true; } index = 7196; while (index <= 7222) : (index += 1) { instance.array[index] = true; } index = 7224; while (index <= 7250) : (index += 1) { instance.array[index] = true; } index = 7252; while (index <= 7278) : (index += 1) { instance.array[index] = true; } index = 7280; while (index <= 7306) : (index += 1) { instance.array[index] = true; } index = 7308; while (index <= 7334) : (index += 1) { instance.array[index] = true; } index = 7336; while (index <= 7362) : (index += 1) { instance.array[index] = true; } index = 7364; while (index <= 7390) : (index += 1) { instance.array[index] = true; } index = 7392; while (index <= 7418) : (index += 1) { instance.array[index] = true; } index = 7420; while (index <= 7446) : (index += 1) { instance.array[index] = true; } index = 7448; while (index <= 7474) : (index += 1) { instance.array[index] = true; } index = 7476; while (index <= 7502) : (index += 1) { instance.array[index] = true; } index = 7504; while (index <= 7530) : (index += 1) { instance.array[index] = true; } index = 7532; while (index <= 7558) : (index += 1) { instance.array[index] = true; } index = 7560; while (index <= 7586) : (index += 1) { instance.array[index] = true; } index = 7588; while (index <= 7614) : (index += 1) { instance.array[index] = true; } index = 7616; while (index <= 7642) : (index += 1) { instance.array[index] = true; } index = 7644; while (index <= 7670) : (index += 1) { instance.array[index] = true; } index = 7672; while (index <= 7698) : (index += 1) { instance.array[index] = true; } index = 7700; while (index <= 7726) : (index += 1) { instance.array[index] = true; } index = 7728; while (index <= 7754) : (index += 1) { instance.array[index] = true; } index = 7756; while (index <= 7782) : (index += 1) { instance.array[index] = true; } index = 7784; while (index <= 7810) : (index += 1) { instance.array[index] = true; } index = 7812; while (index <= 7838) : (index += 1) { instance.array[index] = true; } index = 7840; while (index <= 7866) : (index += 1) { instance.array[index] = true; } index = 7868; while (index <= 7894) : (index += 1) { instance.array[index] = true; } index = 7896; while (index <= 7922) : (index += 1) { instance.array[index] = true; } index = 7924; while (index <= 7950) : (index += 1) { instance.array[index] = true; } index = 7952; while (index <= 7978) : (index += 1) { instance.array[index] = true; } index = 7980; while (index <= 8006) : (index += 1) { instance.array[index] = true; } index = 8008; while (index <= 8034) : (index += 1) { instance.array[index] = true; } index = 8036; while (index <= 8062) : (index += 1) { instance.array[index] = true; } index = 8064; while (index <= 8090) : (index += 1) { instance.array[index] = true; } index = 8092; while (index <= 8118) : (index += 1) { instance.array[index] = true; } index = 8120; while (index <= 8146) : (index += 1) { instance.array[index] = true; } index = 8148; while (index <= 8174) : (index += 1) { instance.array[index] = true; } index = 8176; while (index <= 8202) : (index += 1) { instance.array[index] = true; } index = 8204; while (index <= 8230) : (index += 1) { instance.array[index] = true; } index = 8232; while (index <= 8258) : (index += 1) { instance.array[index] = true; } index = 8260; while (index <= 8286) : (index += 1) { instance.array[index] = true; } index = 8288; while (index <= 8314) : (index += 1) { instance.array[index] = true; } index = 8316; while (index <= 8342) : (index += 1) { instance.array[index] = true; } index = 8344; while (index <= 8370) : (index += 1) { instance.array[index] = true; } index = 8372; while (index <= 8398) : (index += 1) { instance.array[index] = true; } index = 8400; while (index <= 8426) : (index += 1) { instance.array[index] = true; } index = 8428; while (index <= 8454) : (index += 1) { instance.array[index] = true; } index = 8456; while (index <= 8482) : (index += 1) { instance.array[index] = true; } index = 8484; while (index <= 8510) : (index += 1) { instance.array[index] = true; } index = 8512; while (index <= 8538) : (index += 1) { instance.array[index] = true; } index = 8540; while (index <= 8566) : (index += 1) { instance.array[index] = true; } index = 8568; while (index <= 8594) : (index += 1) { instance.array[index] = true; } index = 8596; while (index <= 8622) : (index += 1) { instance.array[index] = true; } index = 8624; while (index <= 8650) : (index += 1) { instance.array[index] = true; } index = 8652; while (index <= 8678) : (index += 1) { instance.array[index] = true; } index = 8680; while (index <= 8706) : (index += 1) { instance.array[index] = true; } index = 8708; while (index <= 8734) : (index += 1) { instance.array[index] = true; } index = 8736; while (index <= 8762) : (index += 1) { instance.array[index] = true; } index = 8764; while (index <= 8790) : (index += 1) { instance.array[index] = true; } index = 8792; while (index <= 8818) : (index += 1) { instance.array[index] = true; } index = 8820; while (index <= 8846) : (index += 1) { instance.array[index] = true; } index = 8848; while (index <= 8874) : (index += 1) { instance.array[index] = true; } index = 8876; while (index <= 8902) : (index += 1) { instance.array[index] = true; } index = 8904; while (index <= 8930) : (index += 1) { instance.array[index] = true; } index = 8932; while (index <= 8958) : (index += 1) { instance.array[index] = true; } index = 8960; while (index <= 8986) : (index += 1) { instance.array[index] = true; } index = 8988; while (index <= 9014) : (index += 1) { instance.array[index] = true; } index = 9016; while (index <= 9042) : (index += 1) { instance.array[index] = true; } index = 9044; while (index <= 9070) : (index += 1) { instance.array[index] = true; } index = 9072; while (index <= 9098) : (index += 1) { instance.array[index] = true; } index = 9100; while (index <= 9126) : (index += 1) { instance.array[index] = true; } index = 9128; while (index <= 9154) : (index += 1) { instance.array[index] = true; } index = 9156; while (index <= 9182) : (index += 1) { instance.array[index] = true; } index = 9184; while (index <= 9210) : (index += 1) { instance.array[index] = true; } index = 9212; while (index <= 9238) : (index += 1) { instance.array[index] = true; } index = 9240; while (index <= 9266) : (index += 1) { instance.array[index] = true; } index = 9268; while (index <= 9294) : (index += 1) { instance.array[index] = true; } index = 9296; while (index <= 9322) : (index += 1) { instance.array[index] = true; } index = 9324; while (index <= 9350) : (index += 1) { instance.array[index] = true; } index = 9352; while (index <= 9378) : (index += 1) { instance.array[index] = true; } index = 9380; while (index <= 9406) : (index += 1) { instance.array[index] = true; } index = 9408; while (index <= 9434) : (index += 1) { instance.array[index] = true; } index = 9436; while (index <= 9462) : (index += 1) { instance.array[index] = true; } index = 9464; while (index <= 9490) : (index += 1) { instance.array[index] = true; } index = 9492; while (index <= 9518) : (index += 1) { instance.array[index] = true; } index = 9520; while (index <= 9546) : (index += 1) { instance.array[index] = true; } index = 9548; while (index <= 9574) : (index += 1) { instance.array[index] = true; } index = 9576; while (index <= 9602) : (index += 1) { instance.array[index] = true; } index = 9604; while (index <= 9630) : (index += 1) { instance.array[index] = true; } index = 9632; while (index <= 9658) : (index += 1) { instance.array[index] = true; } index = 9660; while (index <= 9686) : (index += 1) { instance.array[index] = true; } index = 9688; while (index <= 9714) : (index += 1) { instance.array[index] = true; } index = 9716; while (index <= 9742) : (index += 1) { instance.array[index] = true; } index = 9744; while (index <= 9770) : (index += 1) { instance.array[index] = true; } index = 9772; while (index <= 9798) : (index += 1) { instance.array[index] = true; } index = 9800; while (index <= 9826) : (index += 1) { instance.array[index] = true; } index = 9828; while (index <= 9854) : (index += 1) { instance.array[index] = true; } index = 9856; while (index <= 9882) : (index += 1) { instance.array[index] = true; } index = 9884; while (index <= 9910) : (index += 1) { instance.array[index] = true; } index = 9912; while (index <= 9938) : (index += 1) { instance.array[index] = true; } index = 9940; while (index <= 9966) : (index += 1) { instance.array[index] = true; } index = 9968; while (index <= 9994) : (index += 1) { instance.array[index] = true; } index = 9996; while (index <= 10022) : (index += 1) { instance.array[index] = true; } index = 10024; while (index <= 10050) : (index += 1) { instance.array[index] = true; } index = 10052; while (index <= 10078) : (index += 1) { instance.array[index] = true; } index = 10080; while (index <= 10106) : (index += 1) { instance.array[index] = true; } index = 10108; while (index <= 10134) : (index += 1) { instance.array[index] = true; } index = 10136; while (index <= 10162) : (index += 1) { instance.array[index] = true; } index = 10164; while (index <= 10190) : (index += 1) { instance.array[index] = true; } index = 10192; while (index <= 10218) : (index += 1) { instance.array[index] = true; } index = 10220; while (index <= 10246) : (index += 1) { instance.array[index] = true; } index = 10248; while (index <= 10274) : (index += 1) { instance.array[index] = true; } index = 10276; while (index <= 10302) : (index += 1) { instance.array[index] = true; } index = 10304; while (index <= 10330) : (index += 1) { instance.array[index] = true; } index = 10332; while (index <= 10358) : (index += 1) { instance.array[index] = true; } index = 10360; while (index <= 10386) : (index += 1) { instance.array[index] = true; } index = 10388; while (index <= 10414) : (index += 1) { instance.array[index] = true; } index = 10416; while (index <= 10442) : (index += 1) { instance.array[index] = true; } index = 10444; while (index <= 10470) : (index += 1) { instance.array[index] = true; } index = 10472; while (index <= 10498) : (index += 1) { instance.array[index] = true; } index = 10500; while (index <= 10526) : (index += 1) { instance.array[index] = true; } index = 10528; while (index <= 10554) : (index += 1) { instance.array[index] = true; } index = 10556; while (index <= 10582) : (index += 1) { instance.array[index] = true; } index = 10584; while (index <= 10610) : (index += 1) { instance.array[index] = true; } index = 10612; while (index <= 10638) : (index += 1) { instance.array[index] = true; } index = 10640; while (index <= 10666) : (index += 1) { instance.array[index] = true; } index = 10668; while (index <= 10694) : (index += 1) { instance.array[index] = true; } index = 10696; while (index <= 10722) : (index += 1) { instance.array[index] = true; } index = 10724; while (index <= 10750) : (index += 1) { instance.array[index] = true; } index = 10752; while (index <= 10778) : (index += 1) { instance.array[index] = true; } index = 10780; while (index <= 10806) : (index += 1) { instance.array[index] = true; } index = 10808; while (index <= 10834) : (index += 1) { instance.array[index] = true; } index = 10836; while (index <= 10862) : (index += 1) { instance.array[index] = true; } index = 10864; while (index <= 10890) : (index += 1) { instance.array[index] = true; } index = 10892; while (index <= 10918) : (index += 1) { instance.array[index] = true; } index = 10920; while (index <= 10946) : (index += 1) { instance.array[index] = true; } index = 10948; while (index <= 10974) : (index += 1) { instance.array[index] = true; } index = 10976; while (index <= 11002) : (index += 1) { instance.array[index] = true; } index = 11004; while (index <= 11030) : (index += 1) { instance.array[index] = true; } index = 11032; while (index <= 11058) : (index += 1) { instance.array[index] = true; } index = 11060; while (index <= 11086) : (index += 1) { instance.array[index] = true; } index = 11088; while (index <= 11114) : (index += 1) { instance.array[index] = true; } index = 11116; while (index <= 11142) : (index += 1) { instance.array[index] = true; } index = 11144; while (index <= 11170) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *LVT) void { self.allocator.free(self.array); } // isLVT checks if cp is of the kind LVT. pub fn isLVT(self: LVT, cp: u21) bool { if (cp < self.lo or cp > self.hi) return false; const index = cp - self.lo; return if (index >= self.array.len) false else self.array[index]; }
src/components/autogen/GraphemeBreakProperty/LVT.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Count = struct { ones: i64 = 0, zeros: i64 = 0, pub fn max(self: *const Count) u64 { if (self.ones >= self.zeros) { return 1; } else { return 0; } } pub fn min(self: *const Count) u64 { if (self.zeros <= self.ones) { return 0; } else { return 1; } } pub fn add(self: *Count, c: u8) void { switch (c) { '0' => self.zeros += 1, '1' => self.ones += 1, else => unreachable, } } }; const RowSet = struct { const Self = @This(); counts: []Count, rows: [][]const u8, allocator: Allocator, pub fn load(allocator: Allocator, rowSlice: [][]const u8) !Self { var list = std.ArrayList(Count).init(allocator); defer list.deinit(); var rows = std.ArrayList([]const u8).init(allocator); defer rows.deinit(); for (rowSlice) |line| { if (line.len != 0) { if (list.items.len == 0) { try list.appendNTimes(Count{}, line.len); } for (line) |c, idx| { list.items[idx].add(c); } try rows.append(line); } } return Self{ .allocator = allocator, .counts = list.toOwnedSlice(), .rows = rows.toOwnedSlice() }; } pub fn deinit(self: Self) void { self.allocator.free(self.counts); self.allocator.free(self.rows); } pub fn gamma(self: *const Self) u64 { var g: u64 = 0; for (self.counts) |c| { var m = c.max(); g = (g << 1) | m; } return g; } pub fn epsilon(self: *const Self) u64 { var g: u64 = 0; for (self.counts) |c| { var m = c.min(); g = (g << 1) | m; } return g; } const GeneratorError = error{GenError}; fn bitToChar(m: u64) u8 { if (m == 1) { return '1'; } else { return '0'; } } pub fn generator(self: *const Self, bit_idx: usize) !u64 { var valid = std.ArrayList([]const u8).init(self.allocator); defer valid.deinit(); const c = self.counts[bit_idx]; const m = c.max(); const mStr = bitToChar(m); for (self.rows) |r| { if (r[bit_idx] == mStr) { try valid.append(r); } } if (valid.items.len == 1) { var val = try std.fmt.parseInt(u64, valid.items[0], 2); return val; } var rs = try RowSet.load(self.allocator, valid.items); defer rs.deinit(); return rs.generator(bit_idx + 1); } pub fn scrubber(self: *const Self, bit_idx: usize) !u64 { var valid = std.ArrayList([]const u8).init(self.allocator); defer valid.deinit(); const c = self.counts[bit_idx]; const m = c.min(); const mStr = bitToChar(m); for (self.rows) |r| { if (r[bit_idx] == mStr) { try valid.append(r); } } if (valid.items.len == 1) { var val = try std.fmt.parseInt(u64, valid.items[0], 2); return val; } var rs = try RowSet.load(self.allocator, valid.items); defer rs.deinit(); return rs.scrubber(bit_idx + 1); } }; const DiagnosticReport = struct { const Self = @This(); rows: RowSet, allocator: Allocator, pub fn load(allocator: Allocator, str: []const u8) !Self { var rows = std.ArrayList([]const u8).init(allocator); defer rows.deinit(); var iter = std.mem.split(u8, str, "\n"); while (iter.next()) |line| { if (line.len != 0) { try rows.append(line); } } var rowSet = try RowSet.load(allocator, rows.items); return Self{ .allocator = allocator, .rows = rowSet }; } pub fn deinit(self: Self) void { self.rows.deinit(); } pub fn powerConsumption(self: *const Self) u64 { return self.rows.gamma() * self.rows.epsilon(); } pub fn lifeSupport(self: *const Self) !u64 { var gen = try self.rows.generator(0); var scrub = try self.rows.scrubber(0); return gen * scrub; } }; pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); const str = @embedFile("../input.txt"); var d = try DiagnosticReport.load(allocator, str); defer d.deinit(); const stdout = std.io.getStdOut().writer(); const part1 = d.powerConsumption(); try stdout.print("Part 1: {d}\n", .{part1}); const part2 = try d.lifeSupport(); try stdout.print("Part 2: {d}\n", .{part2}); } test "part1 test" { const str = @embedFile("../test.txt"); var d = try DiagnosticReport.load(test_allocator, str); defer d.deinit(); try expect(198 == d.powerConsumption()); } test "part2 test" { const str = @embedFile("../test.txt"); var d = try DiagnosticReport.load(test_allocator, str); defer d.deinit(); var l = try d.lifeSupport(); try expect(230 == l); }
day03/src/main.zig
pub const HVSOCKET_CONNECT_TIMEOUT = @as(u32, 1); pub const HVSOCKET_CONNECT_TIMEOUT_MAX = @as(u32, 300000); pub const HVSOCKET_CONTAINER_PASSTHRU = @as(u32, 2); pub const HVSOCKET_CONNECTED_SUSPEND = @as(u32, 4); pub const HV_PROTOCOL_RAW = @as(u32, 1); pub const HVSOCKET_ADDRESS_FLAG_PASSTHRU = @as(u32, 1); pub const WHV_PROCESSOR_FEATURES_BANKS_COUNT = @as(u32, 2); pub const WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS_COUNT = @as(u32, 1); pub const WHV_READ_WRITE_GPA_RANGE_MAX_SIZE = @as(u32, 16); pub const WHV_HYPERCALL_CONTEXT_MAX_XMM_REGISTERS = @as(u32, 6); pub const WHV_MAX_DEVICE_ID_SIZE_IN_CHARS = @as(u32, 200); pub const WHV_VPCI_TYPE0_BAR_COUNT = @as(u32, 6); pub const WHV_ANY_VP = @as(u32, 4294967295); pub const WHV_SYNIC_MESSAGE_SIZE = @as(u32, 256); pub const IOCTL_VMGENCOUNTER_READ = @as(u32, 3325956); pub const HDV_PCI_BAR_COUNT = @as(u32, 6); pub const HV_GUID_ZERO = Guid.initString("00000000-0000-0000-0000-000000000000"); pub const HV_GUID_BROADCAST = Guid.initString("ffffffff-ffff-ffff-ffff-ffffffffffff"); pub const HV_GUID_CHILDREN = Guid.initString("90db8b89-0d35-4f79-8ce9-49ea0ac8b7cd"); pub const HV_GUID_LOOPBACK = Guid.initString("e0e16197-dd56-4a10-9195-5ee7a155a838"); pub const HV_GUID_PARENT = Guid.initString("a42e7cda-d03f-480c-9cc2-a4de20abb878"); pub const HV_GUID_SILOHOST = Guid.initString("36bd0c5c-7276-4223-88ba-7d03b654c568"); pub const HV_GUID_VSOCK_TEMPLATE = Guid.initString("00000000-facb-11e6-bd58-64006a7986d3"); pub const GUID_DEVINTERFACE_VM_GENCOUNTER = Guid.initString("3ff2c92b-6598-4e60-8e1c-0ccf4927e319"); //-------------------------------------------------------------------------------- // Section: Types (162) //-------------------------------------------------------------------------------- // TODO: this type has a FreeFunc 'WHvDeletePartition', what can Zig do with this information? pub const WHV_PARTITION_HANDLE = isize; pub const WHV_CAPABILITY_CODE = enum(i32) { HypervisorPresent = 0, Features = 1, ExtendedVmExits = 2, ExceptionExitBitmap = 3, X64MsrExitBitmap = 4, GpaRangePopulateFlags = 5, SchedulerFeatures = 6, ProcessorVendor = 4096, ProcessorFeatures = 4097, ProcessorClFlushSize = 4098, ProcessorXsaveFeatures = 4099, ProcessorClockFrequency = 4100, InterruptClockFrequency = 4101, ProcessorFeaturesBanks = 4102, ProcessorFrequencyCap = 4103, SyntheticProcessorFeaturesBanks = 4104, ProcessorPerfmonFeatures = 4105, }; pub const WHvCapabilityCodeHypervisorPresent = WHV_CAPABILITY_CODE.HypervisorPresent; pub const WHvCapabilityCodeFeatures = WHV_CAPABILITY_CODE.Features; pub const WHvCapabilityCodeExtendedVmExits = WHV_CAPABILITY_CODE.ExtendedVmExits; pub const WHvCapabilityCodeExceptionExitBitmap = WHV_CAPABILITY_CODE.ExceptionExitBitmap; pub const WHvCapabilityCodeX64MsrExitBitmap = WHV_CAPABILITY_CODE.X64MsrExitBitmap; pub const WHvCapabilityCodeGpaRangePopulateFlags = WHV_CAPABILITY_CODE.GpaRangePopulateFlags; pub const WHvCapabilityCodeSchedulerFeatures = WHV_CAPABILITY_CODE.SchedulerFeatures; pub const WHvCapabilityCodeProcessorVendor = WHV_CAPABILITY_CODE.ProcessorVendor; pub const WHvCapabilityCodeProcessorFeatures = WHV_CAPABILITY_CODE.ProcessorFeatures; pub const WHvCapabilityCodeProcessorClFlushSize = WHV_CAPABILITY_CODE.ProcessorClFlushSize; pub const WHvCapabilityCodeProcessorXsaveFeatures = WHV_CAPABILITY_CODE.ProcessorXsaveFeatures; pub const WHvCapabilityCodeProcessorClockFrequency = WHV_CAPABILITY_CODE.ProcessorClockFrequency; pub const WHvCapabilityCodeInterruptClockFrequency = WHV_CAPABILITY_CODE.InterruptClockFrequency; pub const WHvCapabilityCodeProcessorFeaturesBanks = WHV_CAPABILITY_CODE.ProcessorFeaturesBanks; pub const WHvCapabilityCodeProcessorFrequencyCap = WHV_CAPABILITY_CODE.ProcessorFrequencyCap; pub const WHvCapabilityCodeSyntheticProcessorFeaturesBanks = WHV_CAPABILITY_CODE.SyntheticProcessorFeaturesBanks; pub const WHvCapabilityCodeProcessorPerfmonFeatures = WHV_CAPABILITY_CODE.ProcessorPerfmonFeatures; pub const WHV_CAPABILITY_FEATURES = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_EXTENDED_VM_EXITS = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_PROCESSOR_VENDOR = enum(i32) { Amd = 0, Intel = 1, Hygon = 2, }; pub const WHvProcessorVendorAmd = WHV_PROCESSOR_VENDOR.Amd; pub const WHvProcessorVendorIntel = WHV_PROCESSOR_VENDOR.Intel; pub const WHvProcessorVendorHygon = WHV_PROCESSOR_VENDOR.Hygon; pub const WHV_PROCESSOR_FEATURES = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_PROCESSOR_FEATURES1 = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_PROCESSOR_FEATURES_BANKS = extern struct { BanksCount: u32, Reserved0: u32, Anonymous: extern union { Anonymous: extern struct { Bank0: WHV_PROCESSOR_FEATURES, Bank1: WHV_PROCESSOR_FEATURES1, }, AsUINT64: [2]u64, }, }; pub const WHV_SYNTHETIC_PROCESSOR_FEATURES = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS = extern struct { BanksCount: u32, Reserved0: u32, Anonymous: extern union { Anonymous: extern struct { Bank0: WHV_SYNTHETIC_PROCESSOR_FEATURES, }, AsUINT64: [1]u64, }, }; pub const WHV_PARTITION_PROPERTY_CODE = enum(i32) { ExtendedVmExits = 1, ExceptionExitBitmap = 2, SeparateSecurityDomain = 3, NestedVirtualization = 4, X64MsrExitBitmap = 5, PrimaryNumaNode = 6, CpuReserve = 7, CpuCap = 8, CpuWeight = 9, CpuGroupId = 10, ProcessorFrequencyCap = 11, AllowDeviceAssignment = 12, DisableSmt = 13, ProcessorFeatures = 4097, ProcessorClFlushSize = 4098, CpuidExitList = 4099, CpuidResultList = 4100, LocalApicEmulationMode = 4101, ProcessorXsaveFeatures = 4102, ProcessorClockFrequency = 4103, InterruptClockFrequency = 4104, ApicRemoteReadSupport = 4105, ProcessorFeaturesBanks = 4106, ReferenceTime = 4107, SyntheticProcessorFeaturesBanks = 4108, CpuidResultList2 = 4109, ProcessorPerfmonFeatures = 4110, MsrActionList = 4111, UnimplementedMsrAction = 4112, ProcessorCount = 8191, }; pub const WHvPartitionPropertyCodeExtendedVmExits = WHV_PARTITION_PROPERTY_CODE.ExtendedVmExits; pub const WHvPartitionPropertyCodeExceptionExitBitmap = WHV_PARTITION_PROPERTY_CODE.ExceptionExitBitmap; pub const WHvPartitionPropertyCodeSeparateSecurityDomain = WHV_PARTITION_PROPERTY_CODE.SeparateSecurityDomain; pub const WHvPartitionPropertyCodeNestedVirtualization = WHV_PARTITION_PROPERTY_CODE.NestedVirtualization; pub const WHvPartitionPropertyCodeX64MsrExitBitmap = WHV_PARTITION_PROPERTY_CODE.X64MsrExitBitmap; pub const WHvPartitionPropertyCodePrimaryNumaNode = WHV_PARTITION_PROPERTY_CODE.PrimaryNumaNode; pub const WHvPartitionPropertyCodeCpuReserve = WHV_PARTITION_PROPERTY_CODE.CpuReserve; pub const WHvPartitionPropertyCodeCpuCap = WHV_PARTITION_PROPERTY_CODE.CpuCap; pub const WHvPartitionPropertyCodeCpuWeight = WHV_PARTITION_PROPERTY_CODE.CpuWeight; pub const WHvPartitionPropertyCodeCpuGroupId = WHV_PARTITION_PROPERTY_CODE.CpuGroupId; pub const WHvPartitionPropertyCodeProcessorFrequencyCap = WHV_PARTITION_PROPERTY_CODE.ProcessorFrequencyCap; pub const WHvPartitionPropertyCodeAllowDeviceAssignment = WHV_PARTITION_PROPERTY_CODE.AllowDeviceAssignment; pub const WHvPartitionPropertyCodeDisableSmt = WHV_PARTITION_PROPERTY_CODE.DisableSmt; pub const WHvPartitionPropertyCodeProcessorFeatures = WHV_PARTITION_PROPERTY_CODE.ProcessorFeatures; pub const WHvPartitionPropertyCodeProcessorClFlushSize = WHV_PARTITION_PROPERTY_CODE.ProcessorClFlushSize; pub const WHvPartitionPropertyCodeCpuidExitList = WHV_PARTITION_PROPERTY_CODE.CpuidExitList; pub const WHvPartitionPropertyCodeCpuidResultList = WHV_PARTITION_PROPERTY_CODE.CpuidResultList; pub const WHvPartitionPropertyCodeLocalApicEmulationMode = WHV_PARTITION_PROPERTY_CODE.LocalApicEmulationMode; pub const WHvPartitionPropertyCodeProcessorXsaveFeatures = WHV_PARTITION_PROPERTY_CODE.ProcessorXsaveFeatures; pub const WHvPartitionPropertyCodeProcessorClockFrequency = WHV_PARTITION_PROPERTY_CODE.ProcessorClockFrequency; pub const WHvPartitionPropertyCodeInterruptClockFrequency = WHV_PARTITION_PROPERTY_CODE.InterruptClockFrequency; pub const WHvPartitionPropertyCodeApicRemoteReadSupport = WHV_PARTITION_PROPERTY_CODE.ApicRemoteReadSupport; pub const WHvPartitionPropertyCodeProcessorFeaturesBanks = WHV_PARTITION_PROPERTY_CODE.ProcessorFeaturesBanks; pub const WHvPartitionPropertyCodeReferenceTime = WHV_PARTITION_PROPERTY_CODE.ReferenceTime; pub const WHvPartitionPropertyCodeSyntheticProcessorFeaturesBanks = WHV_PARTITION_PROPERTY_CODE.SyntheticProcessorFeaturesBanks; pub const WHvPartitionPropertyCodeCpuidResultList2 = WHV_PARTITION_PROPERTY_CODE.CpuidResultList2; pub const WHvPartitionPropertyCodeProcessorPerfmonFeatures = WHV_PARTITION_PROPERTY_CODE.ProcessorPerfmonFeatures; pub const WHvPartitionPropertyCodeMsrActionList = WHV_PARTITION_PROPERTY_CODE.MsrActionList; pub const WHvPartitionPropertyCodeUnimplementedMsrAction = WHV_PARTITION_PROPERTY_CODE.UnimplementedMsrAction; pub const WHvPartitionPropertyCodeProcessorCount = WHV_PARTITION_PROPERTY_CODE.ProcessorCount; pub const WHV_PROCESSOR_XSAVE_FEATURES = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_PROCESSOR_PERFMON_FEATURES = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_X64_MSR_EXIT_BITMAP = extern union { AsUINT64: u64, Anonymous: extern struct { _bitfield: u64, }, }; pub const WHV_MEMORY_RANGE_ENTRY = extern struct { GuestAddress: u64, SizeInBytes: u64, }; pub const WHV_ADVISE_GPA_RANGE_POPULATE_FLAGS = extern union { AsUINT32: u32, Anonymous: extern struct { _bitfield: u32, }, }; pub const WHV_MEMORY_ACCESS_TYPE = enum(i32) { Read = 0, Write = 1, Execute = 2, }; pub const WHvMemoryAccessRead = WHV_MEMORY_ACCESS_TYPE.Read; pub const WHvMemoryAccessWrite = WHV_MEMORY_ACCESS_TYPE.Write; pub const WHvMemoryAccessExecute = WHV_MEMORY_ACCESS_TYPE.Execute; pub const WHV_ADVISE_GPA_RANGE_POPULATE = extern struct { Flags: WHV_ADVISE_GPA_RANGE_POPULATE_FLAGS, AccessType: WHV_MEMORY_ACCESS_TYPE, }; pub const WHV_CAPABILITY_PROCESSOR_FREQUENCY_CAP = extern struct { _bitfield: u32, HighestFrequencyMhz: u32, NominalFrequencyMhz: u32, LowestFrequencyMhz: u32, FrequencyStepMhz: u32, }; pub const WHV_SCHEDULER_FEATURES = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_CAPABILITY = extern union { HypervisorPresent: BOOL, Features: WHV_CAPABILITY_FEATURES, ExtendedVmExits: WHV_EXTENDED_VM_EXITS, ProcessorVendor: WHV_PROCESSOR_VENDOR, ProcessorFeatures: WHV_PROCESSOR_FEATURES, SyntheticProcessorFeaturesBanks: WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS, ProcessorXsaveFeatures: WHV_PROCESSOR_XSAVE_FEATURES, ProcessorClFlushSize: u8, ExceptionExitBitmap: u64, X64MsrExitBitmap: WHV_X64_MSR_EXIT_BITMAP, ProcessorClockFrequency: u64, InterruptClockFrequency: u64, ProcessorFeaturesBanks: WHV_PROCESSOR_FEATURES_BANKS, GpaRangePopulateFlags: WHV_ADVISE_GPA_RANGE_POPULATE_FLAGS, ProcessorFrequencyCap: WHV_CAPABILITY_PROCESSOR_FREQUENCY_CAP, ProcessorPerfmonFeatures: WHV_PROCESSOR_PERFMON_FEATURES, SchedulerFeatures: WHV_SCHEDULER_FEATURES, }; pub const WHV_X64_CPUID_RESULT = extern struct { Function: u32, Reserved: [3]u32, Eax: u32, Ebx: u32, Ecx: u32, Edx: u32, }; pub const WHV_X64_CPUID_RESULT2_FLAGS = enum(u32) { SubleafSpecific = 1, VpSpecific = 2, _, pub fn initFlags(o: struct { SubleafSpecific: u1 = 0, VpSpecific: u1 = 0, }) WHV_X64_CPUID_RESULT2_FLAGS { return @intToEnum(WHV_X64_CPUID_RESULT2_FLAGS, (if (o.SubleafSpecific == 1) @enumToInt(WHV_X64_CPUID_RESULT2_FLAGS.SubleafSpecific) else 0) | (if (o.VpSpecific == 1) @enumToInt(WHV_X64_CPUID_RESULT2_FLAGS.VpSpecific) else 0) ); } }; pub const WHvX64CpuidResult2FlagSubleafSpecific = WHV_X64_CPUID_RESULT2_FLAGS.SubleafSpecific; pub const WHvX64CpuidResult2FlagVpSpecific = WHV_X64_CPUID_RESULT2_FLAGS.VpSpecific; pub const WHV_CPUID_OUTPUT = extern struct { Eax: u32, Ebx: u32, Ecx: u32, Edx: u32, }; pub const WHV_X64_CPUID_RESULT2 = extern struct { Function: u32, Index: u32, VpIndex: u32, Flags: WHV_X64_CPUID_RESULT2_FLAGS, Output: WHV_CPUID_OUTPUT, Mask: WHV_CPUID_OUTPUT, }; pub const WHV_MSR_ACTION_ENTRY = extern struct { Index: u32, ReadAction: u8, WriteAction: u8, Reserved: u16, }; pub const WHV_MSR_ACTION = enum(i32) { ArchitectureDefault = 0, IgnoreWriteReadZero = 1, Exit = 2, }; pub const WHvMsrActionArchitectureDefault = WHV_MSR_ACTION.ArchitectureDefault; pub const WHvMsrActionIgnoreWriteReadZero = WHV_MSR_ACTION.IgnoreWriteReadZero; pub const WHvMsrActionExit = WHV_MSR_ACTION.Exit; pub const WHV_EXCEPTION_TYPE = enum(i32) { DivideErrorFault = 0, DebugTrapOrFault = 1, BreakpointTrap = 3, OverflowTrap = 4, BoundRangeFault = 5, InvalidOpcodeFault = 6, DeviceNotAvailableFault = 7, DoubleFaultAbort = 8, InvalidTaskStateSegmentFault = 10, SegmentNotPresentFault = 11, StackFault = 12, GeneralProtectionFault = 13, PageFault = 14, FloatingPointErrorFault = 16, AlignmentCheckFault = 17, MachineCheckAbort = 18, SimdFloatingPointFault = 19, }; pub const WHvX64ExceptionTypeDivideErrorFault = WHV_EXCEPTION_TYPE.DivideErrorFault; pub const WHvX64ExceptionTypeDebugTrapOrFault = WHV_EXCEPTION_TYPE.DebugTrapOrFault; pub const WHvX64ExceptionTypeBreakpointTrap = WHV_EXCEPTION_TYPE.BreakpointTrap; pub const WHvX64ExceptionTypeOverflowTrap = WHV_EXCEPTION_TYPE.OverflowTrap; pub const WHvX64ExceptionTypeBoundRangeFault = WHV_EXCEPTION_TYPE.BoundRangeFault; pub const WHvX64ExceptionTypeInvalidOpcodeFault = WHV_EXCEPTION_TYPE.InvalidOpcodeFault; pub const WHvX64ExceptionTypeDeviceNotAvailableFault = WHV_EXCEPTION_TYPE.DeviceNotAvailableFault; pub const WHvX64ExceptionTypeDoubleFaultAbort = WHV_EXCEPTION_TYPE.DoubleFaultAbort; pub const WHvX64ExceptionTypeInvalidTaskStateSegmentFault = WHV_EXCEPTION_TYPE.InvalidTaskStateSegmentFault; pub const WHvX64ExceptionTypeSegmentNotPresentFault = WHV_EXCEPTION_TYPE.SegmentNotPresentFault; pub const WHvX64ExceptionTypeStackFault = WHV_EXCEPTION_TYPE.StackFault; pub const WHvX64ExceptionTypeGeneralProtectionFault = WHV_EXCEPTION_TYPE.GeneralProtectionFault; pub const WHvX64ExceptionTypePageFault = WHV_EXCEPTION_TYPE.PageFault; pub const WHvX64ExceptionTypeFloatingPointErrorFault = WHV_EXCEPTION_TYPE.FloatingPointErrorFault; pub const WHvX64ExceptionTypeAlignmentCheckFault = WHV_EXCEPTION_TYPE.AlignmentCheckFault; pub const WHvX64ExceptionTypeMachineCheckAbort = WHV_EXCEPTION_TYPE.MachineCheckAbort; pub const WHvX64ExceptionTypeSimdFloatingPointFault = WHV_EXCEPTION_TYPE.SimdFloatingPointFault; pub const WHV_X64_LOCAL_APIC_EMULATION_MODE = enum(i32) { None = 0, XApic = 1, X2Apic = 2, }; pub const WHvX64LocalApicEmulationModeNone = WHV_X64_LOCAL_APIC_EMULATION_MODE.None; pub const WHvX64LocalApicEmulationModeXApic = WHV_X64_LOCAL_APIC_EMULATION_MODE.XApic; pub const WHvX64LocalApicEmulationModeX2Apic = WHV_X64_LOCAL_APIC_EMULATION_MODE.X2Apic; pub const WHV_PARTITION_PROPERTY = extern union { ExtendedVmExits: WHV_EXTENDED_VM_EXITS, ProcessorFeatures: WHV_PROCESSOR_FEATURES, SyntheticProcessorFeaturesBanks: WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS, ProcessorXsaveFeatures: WHV_PROCESSOR_XSAVE_FEATURES, ProcessorClFlushSize: u8, ProcessorCount: u32, CpuidExitList: [1]u32, CpuidResultList: [1]WHV_X64_CPUID_RESULT, CpuidResultList2: [1]WHV_X64_CPUID_RESULT2, MsrActionList: [1]WHV_MSR_ACTION_ENTRY, UnimplementedMsrAction: WHV_MSR_ACTION, ExceptionExitBitmap: u64, LocalApicEmulationMode: WHV_X64_LOCAL_APIC_EMULATION_MODE, SeparateSecurityDomain: BOOL, NestedVirtualization: BOOL, X64MsrExitBitmap: WHV_X64_MSR_EXIT_BITMAP, ProcessorClockFrequency: u64, InterruptClockFrequency: u64, ApicRemoteRead: BOOL, ProcessorFeaturesBanks: WHV_PROCESSOR_FEATURES_BANKS, ReferenceTime: u64, PrimaryNumaNode: u16, CpuReserve: u32, CpuCap: u32, CpuWeight: u32, CpuGroupId: u64, ProcessorFrequencyCap: u32, AllowDeviceAssignment: BOOL, ProcessorPerfmonFeatures: WHV_PROCESSOR_PERFMON_FEATURES, DisableSmt: BOOL, }; pub const WHV_MAP_GPA_RANGE_FLAGS = enum(u32) { None = 0, Read = 1, Write = 2, Execute = 4, TrackDirtyPages = 8, _, pub fn initFlags(o: struct { None: u1 = 0, Read: u1 = 0, Write: u1 = 0, Execute: u1 = 0, TrackDirtyPages: u1 = 0, }) WHV_MAP_GPA_RANGE_FLAGS { return @intToEnum(WHV_MAP_GPA_RANGE_FLAGS, (if (o.None == 1) @enumToInt(WHV_MAP_GPA_RANGE_FLAGS.None) else 0) | (if (o.Read == 1) @enumToInt(WHV_MAP_GPA_RANGE_FLAGS.Read) else 0) | (if (o.Write == 1) @enumToInt(WHV_MAP_GPA_RANGE_FLAGS.Write) else 0) | (if (o.Execute == 1) @enumToInt(WHV_MAP_GPA_RANGE_FLAGS.Execute) else 0) | (if (o.TrackDirtyPages == 1) @enumToInt(WHV_MAP_GPA_RANGE_FLAGS.TrackDirtyPages) else 0) ); } }; pub const WHvMapGpaRangeFlagNone = WHV_MAP_GPA_RANGE_FLAGS.None; pub const WHvMapGpaRangeFlagRead = WHV_MAP_GPA_RANGE_FLAGS.Read; pub const WHvMapGpaRangeFlagWrite = WHV_MAP_GPA_RANGE_FLAGS.Write; pub const WHvMapGpaRangeFlagExecute = WHV_MAP_GPA_RANGE_FLAGS.Execute; pub const WHvMapGpaRangeFlagTrackDirtyPages = WHV_MAP_GPA_RANGE_FLAGS.TrackDirtyPages; pub const WHV_TRANSLATE_GVA_FLAGS = enum(u32) { None = 0, ValidateRead = 1, ValidateWrite = 2, ValidateExecute = 4, PrivilegeExempt = 8, SetPageTableBits = 16, EnforceSmap = 256, OverrideSmap = 512, _, pub fn initFlags(o: struct { None: u1 = 0, ValidateRead: u1 = 0, ValidateWrite: u1 = 0, ValidateExecute: u1 = 0, PrivilegeExempt: u1 = 0, SetPageTableBits: u1 = 0, EnforceSmap: u1 = 0, OverrideSmap: u1 = 0, }) WHV_TRANSLATE_GVA_FLAGS { return @intToEnum(WHV_TRANSLATE_GVA_FLAGS, (if (o.None == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.None) else 0) | (if (o.ValidateRead == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.ValidateRead) else 0) | (if (o.ValidateWrite == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.ValidateWrite) else 0) | (if (o.ValidateExecute == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.ValidateExecute) else 0) | (if (o.PrivilegeExempt == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.PrivilegeExempt) else 0) | (if (o.SetPageTableBits == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.SetPageTableBits) else 0) | (if (o.EnforceSmap == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.EnforceSmap) else 0) | (if (o.OverrideSmap == 1) @enumToInt(WHV_TRANSLATE_GVA_FLAGS.OverrideSmap) else 0) ); } }; pub const WHvTranslateGvaFlagNone = WHV_TRANSLATE_GVA_FLAGS.None; pub const WHvTranslateGvaFlagValidateRead = WHV_TRANSLATE_GVA_FLAGS.ValidateRead; pub const WHvTranslateGvaFlagValidateWrite = WHV_TRANSLATE_GVA_FLAGS.ValidateWrite; pub const WHvTranslateGvaFlagValidateExecute = WHV_TRANSLATE_GVA_FLAGS.ValidateExecute; pub const WHvTranslateGvaFlagPrivilegeExempt = WHV_TRANSLATE_GVA_FLAGS.PrivilegeExempt; pub const WHvTranslateGvaFlagSetPageTableBits = WHV_TRANSLATE_GVA_FLAGS.SetPageTableBits; pub const WHvTranslateGvaFlagEnforceSmap = WHV_TRANSLATE_GVA_FLAGS.EnforceSmap; pub const WHvTranslateGvaFlagOverrideSmap = WHV_TRANSLATE_GVA_FLAGS.OverrideSmap; pub const WHV_TRANSLATE_GVA_RESULT_CODE = enum(i32) { Success = 0, PageNotPresent = 1, PrivilegeViolation = 2, InvalidPageTableFlags = 3, GpaUnmapped = 4, GpaNoReadAccess = 5, GpaNoWriteAccess = 6, GpaIllegalOverlayAccess = 7, Intercept = 8, }; pub const WHvTranslateGvaResultSuccess = WHV_TRANSLATE_GVA_RESULT_CODE.Success; pub const WHvTranslateGvaResultPageNotPresent = WHV_TRANSLATE_GVA_RESULT_CODE.PageNotPresent; pub const WHvTranslateGvaResultPrivilegeViolation = WHV_TRANSLATE_GVA_RESULT_CODE.PrivilegeViolation; pub const WHvTranslateGvaResultInvalidPageTableFlags = WHV_TRANSLATE_GVA_RESULT_CODE.InvalidPageTableFlags; pub const WHvTranslateGvaResultGpaUnmapped = WHV_TRANSLATE_GVA_RESULT_CODE.GpaUnmapped; pub const WHvTranslateGvaResultGpaNoReadAccess = WHV_TRANSLATE_GVA_RESULT_CODE.GpaNoReadAccess; pub const WHvTranslateGvaResultGpaNoWriteAccess = WHV_TRANSLATE_GVA_RESULT_CODE.GpaNoWriteAccess; pub const WHvTranslateGvaResultGpaIllegalOverlayAccess = WHV_TRANSLATE_GVA_RESULT_CODE.GpaIllegalOverlayAccess; pub const WHvTranslateGvaResultIntercept = WHV_TRANSLATE_GVA_RESULT_CODE.Intercept; pub const WHV_TRANSLATE_GVA_RESULT = extern struct { ResultCode: WHV_TRANSLATE_GVA_RESULT_CODE, Reserved: u32, }; pub const WHV_ADVISE_GPA_RANGE = extern union { Populate: WHV_ADVISE_GPA_RANGE_POPULATE, }; pub const WHV_CACHE_TYPE = enum(i32) { Uncached = 0, WriteCombining = 1, WriteThrough = 4, WriteProtected = 5, WriteBack = 6, }; pub const WHvCacheTypeUncached = WHV_CACHE_TYPE.Uncached; pub const WHvCacheTypeWriteCombining = WHV_CACHE_TYPE.WriteCombining; pub const WHvCacheTypeWriteThrough = WHV_CACHE_TYPE.WriteThrough; pub const WHvCacheTypeWriteProtected = WHV_CACHE_TYPE.WriteProtected; pub const WHvCacheTypeWriteBack = WHV_CACHE_TYPE.WriteBack; pub const WHV_ACCESS_GPA_CONTROLS = extern union { AsUINT64: u64, Anonymous: extern struct { CacheType: WHV_CACHE_TYPE, Reserved: u32, }, }; pub const WHV_REGISTER_NAME = enum(i32) { X64RegisterRax = 0, X64RegisterRcx = 1, X64RegisterRdx = 2, X64RegisterRbx = 3, X64RegisterRsp = 4, X64RegisterRbp = 5, X64RegisterRsi = 6, X64RegisterRdi = 7, X64RegisterR8 = 8, X64RegisterR9 = 9, X64RegisterR10 = 10, X64RegisterR11 = 11, X64RegisterR12 = 12, X64RegisterR13 = 13, X64RegisterR14 = 14, X64RegisterR15 = 15, X64RegisterRip = 16, X64RegisterRflags = 17, X64RegisterEs = 18, X64RegisterCs = 19, X64RegisterSs = 20, X64RegisterDs = 21, X64RegisterFs = 22, X64RegisterGs = 23, X64RegisterLdtr = 24, X64RegisterTr = 25, X64RegisterIdtr = 26, X64RegisterGdtr = 27, X64RegisterCr0 = 28, X64RegisterCr2 = 29, X64RegisterCr3 = 30, X64RegisterCr4 = 31, X64RegisterCr8 = 32, X64RegisterDr0 = 33, X64RegisterDr1 = 34, X64RegisterDr2 = 35, X64RegisterDr3 = 36, X64RegisterDr6 = 37, X64RegisterDr7 = 38, X64RegisterXCr0 = 39, X64RegisterVirtualCr0 = 40, X64RegisterVirtualCr3 = 41, X64RegisterVirtualCr4 = 42, X64RegisterVirtualCr8 = 43, X64RegisterXmm0 = 4096, X64RegisterXmm1 = 4097, X64RegisterXmm2 = 4098, X64RegisterXmm3 = 4099, X64RegisterXmm4 = 4100, X64RegisterXmm5 = 4101, X64RegisterXmm6 = 4102, X64RegisterXmm7 = 4103, X64RegisterXmm8 = 4104, X64RegisterXmm9 = 4105, X64RegisterXmm10 = 4106, X64RegisterXmm11 = 4107, X64RegisterXmm12 = 4108, X64RegisterXmm13 = 4109, X64RegisterXmm14 = 4110, X64RegisterXmm15 = 4111, X64RegisterFpMmx0 = 4112, X64RegisterFpMmx1 = 4113, X64RegisterFpMmx2 = 4114, X64RegisterFpMmx3 = 4115, X64RegisterFpMmx4 = 4116, X64RegisterFpMmx5 = 4117, X64RegisterFpMmx6 = 4118, X64RegisterFpMmx7 = 4119, X64RegisterFpControlStatus = 4120, X64RegisterXmmControlStatus = 4121, X64RegisterTsc = 8192, X64RegisterEfer = 8193, X64RegisterKernelGsBase = 8194, X64RegisterApicBase = 8195, X64RegisterPat = 8196, X64RegisterSysenterCs = 8197, X64RegisterSysenterEip = 8198, X64RegisterSysenterEsp = 8199, X64RegisterStar = 8200, X64RegisterLstar = 8201, X64RegisterCstar = 8202, X64RegisterSfmask = 8203, X64RegisterInitialApicId = 8204, X64RegisterMsrMtrrCap = 8205, X64RegisterMsrMtrrDefType = 8206, X64RegisterMsrMtrrPhysBase0 = 8208, X64RegisterMsrMtrrPhysBase1 = 8209, X64RegisterMsrMtrrPhysBase2 = 8210, X64RegisterMsrMtrrPhysBase3 = 8211, X64RegisterMsrMtrrPhysBase4 = 8212, X64RegisterMsrMtrrPhysBase5 = 8213, X64RegisterMsrMtrrPhysBase6 = 8214, X64RegisterMsrMtrrPhysBase7 = 8215, X64RegisterMsrMtrrPhysBase8 = 8216, X64RegisterMsrMtrrPhysBase9 = 8217, X64RegisterMsrMtrrPhysBaseA = 8218, X64RegisterMsrMtrrPhysBaseB = 8219, X64RegisterMsrMtrrPhysBaseC = 8220, X64RegisterMsrMtrrPhysBaseD = 8221, X64RegisterMsrMtrrPhysBaseE = 8222, X64RegisterMsrMtrrPhysBaseF = 8223, X64RegisterMsrMtrrPhysMask0 = 8256, X64RegisterMsrMtrrPhysMask1 = 8257, X64RegisterMsrMtrrPhysMask2 = 8258, X64RegisterMsrMtrrPhysMask3 = 8259, X64RegisterMsrMtrrPhysMask4 = 8260, X64RegisterMsrMtrrPhysMask5 = 8261, X64RegisterMsrMtrrPhysMask6 = 8262, X64RegisterMsrMtrrPhysMask7 = 8263, X64RegisterMsrMtrrPhysMask8 = 8264, X64RegisterMsrMtrrPhysMask9 = 8265, X64RegisterMsrMtrrPhysMaskA = 8266, X64RegisterMsrMtrrPhysMaskB = 8267, X64RegisterMsrMtrrPhysMaskC = 8268, X64RegisterMsrMtrrPhysMaskD = 8269, X64RegisterMsrMtrrPhysMaskE = 8270, X64RegisterMsrMtrrPhysMaskF = 8271, X64RegisterMsrMtrrFix64k00000 = 8304, X64RegisterMsrMtrrFix16k80000 = 8305, X64RegisterMsrMtrrFix16kA0000 = 8306, X64RegisterMsrMtrrFix4kC0000 = 8307, X64RegisterMsrMtrrFix4kC8000 = 8308, X64RegisterMsrMtrrFix4kD0000 = 8309, X64RegisterMsrMtrrFix4kD8000 = 8310, X64RegisterMsrMtrrFix4kE0000 = 8311, X64RegisterMsrMtrrFix4kE8000 = 8312, X64RegisterMsrMtrrFix4kF0000 = 8313, X64RegisterMsrMtrrFix4kF8000 = 8314, X64RegisterTscAux = 8315, X64RegisterBndcfgs = 8316, X64RegisterMCount = 8318, X64RegisterACount = 8319, X64RegisterSpecCtrl = 8324, X64RegisterPredCmd = 8325, X64RegisterTscVirtualOffset = 8327, X64RegisterTsxCtrl = 8328, X64RegisterXss = 8331, X64RegisterUCet = 8332, X64RegisterSCet = 8333, X64RegisterSsp = 8334, X64RegisterPl0Ssp = 8335, X64RegisterPl1Ssp = 8336, X64RegisterPl2Ssp = 8337, X64RegisterPl3Ssp = 8338, X64RegisterInterruptSspTableAddr = 8339, X64RegisterTscDeadline = 8341, X64RegisterTscAdjust = 8342, X64RegisterUmwaitControl = 8344, X64RegisterXfd = 8345, X64RegisterXfdErr = 8346, X64RegisterApicId = 12290, X64RegisterApicVersion = 12291, X64RegisterApicTpr = 12296, X64RegisterApicPpr = 12298, X64RegisterApicEoi = 12299, X64RegisterApicLdr = 12301, X64RegisterApicSpurious = 12303, X64RegisterApicIsr0 = 12304, X64RegisterApicIsr1 = 12305, X64RegisterApicIsr2 = 12306, X64RegisterApicIsr3 = 12307, X64RegisterApicIsr4 = 12308, X64RegisterApicIsr5 = 12309, X64RegisterApicIsr6 = 12310, X64RegisterApicIsr7 = 12311, X64RegisterApicTmr0 = 12312, X64RegisterApicTmr1 = 12313, X64RegisterApicTmr2 = 12314, X64RegisterApicTmr3 = 12315, X64RegisterApicTmr4 = 12316, X64RegisterApicTmr5 = 12317, X64RegisterApicTmr6 = 12318, X64RegisterApicTmr7 = 12319, X64RegisterApicIrr0 = 12320, X64RegisterApicIrr1 = 12321, X64RegisterApicIrr2 = 12322, X64RegisterApicIrr3 = 12323, X64RegisterApicIrr4 = 12324, X64RegisterApicIrr5 = 12325, X64RegisterApicIrr6 = 12326, X64RegisterApicIrr7 = 12327, X64RegisterApicEse = 12328, X64RegisterApicIcr = 12336, X64RegisterApicLvtTimer = 12338, X64RegisterApicLvtThermal = 12339, X64RegisterApicLvtPerfmon = 12340, X64RegisterApicLvtLint0 = 12341, X64RegisterApicLvtLint1 = 12342, X64RegisterApicLvtError = 12343, X64RegisterApicInitCount = 12344, X64RegisterApicCurrentCount = 12345, X64RegisterApicDivide = 12350, X64RegisterApicSelfIpi = 12351, RegisterSint0 = 16384, RegisterSint1 = 16385, RegisterSint2 = 16386, RegisterSint3 = 16387, RegisterSint4 = 16388, RegisterSint5 = 16389, RegisterSint6 = 16390, RegisterSint7 = 16391, RegisterSint8 = 16392, RegisterSint9 = 16393, RegisterSint10 = 16394, RegisterSint11 = 16395, RegisterSint12 = 16396, RegisterSint13 = 16397, RegisterSint14 = 16398, RegisterSint15 = 16399, RegisterScontrol = 16400, RegisterSversion = 16401, RegisterSiefp = 16402, RegisterSimp = 16403, RegisterEom = 16404, RegisterVpRuntime = 20480, X64RegisterHypercall = 20481, RegisterGuestOsId = 20482, RegisterVpAssistPage = 20499, RegisterReferenceTsc = 20503, RegisterReferenceTscSequence = 20506, RegisterPendingInterruption = -2147483648, RegisterInterruptState = -2147483647, RegisterPendingEvent = -2147483646, X64RegisterDeliverabilityNotifications = -2147483644, RegisterInternalActivityState = -2147483643, X64RegisterPendingDebugException = -2147483642, }; pub const WHvX64RegisterRax = WHV_REGISTER_NAME.X64RegisterRax; pub const WHvX64RegisterRcx = WHV_REGISTER_NAME.X64RegisterRcx; pub const WHvX64RegisterRdx = WHV_REGISTER_NAME.X64RegisterRdx; pub const WHvX64RegisterRbx = WHV_REGISTER_NAME.X64RegisterRbx; pub const WHvX64RegisterRsp = WHV_REGISTER_NAME.X64RegisterRsp; pub const WHvX64RegisterRbp = WHV_REGISTER_NAME.X64RegisterRbp; pub const WHvX64RegisterRsi = WHV_REGISTER_NAME.X64RegisterRsi; pub const WHvX64RegisterRdi = WHV_REGISTER_NAME.X64RegisterRdi; pub const WHvX64RegisterR8 = WHV_REGISTER_NAME.X64RegisterR8; pub const WHvX64RegisterR9 = WHV_REGISTER_NAME.X64RegisterR9; pub const WHvX64RegisterR10 = WHV_REGISTER_NAME.X64RegisterR10; pub const WHvX64RegisterR11 = WHV_REGISTER_NAME.X64RegisterR11; pub const WHvX64RegisterR12 = WHV_REGISTER_NAME.X64RegisterR12; pub const WHvX64RegisterR13 = WHV_REGISTER_NAME.X64RegisterR13; pub const WHvX64RegisterR14 = WHV_REGISTER_NAME.X64RegisterR14; pub const WHvX64RegisterR15 = WHV_REGISTER_NAME.X64RegisterR15; pub const WHvX64RegisterRip = WHV_REGISTER_NAME.X64RegisterRip; pub const WHvX64RegisterRflags = WHV_REGISTER_NAME.X64RegisterRflags; pub const WHvX64RegisterEs = WHV_REGISTER_NAME.X64RegisterEs; pub const WHvX64RegisterCs = WHV_REGISTER_NAME.X64RegisterCs; pub const WHvX64RegisterSs = WHV_REGISTER_NAME.X64RegisterSs; pub const WHvX64RegisterDs = WHV_REGISTER_NAME.X64RegisterDs; pub const WHvX64RegisterFs = WHV_REGISTER_NAME.X64RegisterFs; pub const WHvX64RegisterGs = WHV_REGISTER_NAME.X64RegisterGs; pub const WHvX64RegisterLdtr = WHV_REGISTER_NAME.X64RegisterLdtr; pub const WHvX64RegisterTr = WHV_REGISTER_NAME.X64RegisterTr; pub const WHvX64RegisterIdtr = WHV_REGISTER_NAME.X64RegisterIdtr; pub const WHvX64RegisterGdtr = WHV_REGISTER_NAME.X64RegisterGdtr; pub const WHvX64RegisterCr0 = WHV_REGISTER_NAME.X64RegisterCr0; pub const WHvX64RegisterCr2 = WHV_REGISTER_NAME.X64RegisterCr2; pub const WHvX64RegisterCr3 = WHV_REGISTER_NAME.X64RegisterCr3; pub const WHvX64RegisterCr4 = WHV_REGISTER_NAME.X64RegisterCr4; pub const WHvX64RegisterCr8 = WHV_REGISTER_NAME.X64RegisterCr8; pub const WHvX64RegisterDr0 = WHV_REGISTER_NAME.X64RegisterDr0; pub const WHvX64RegisterDr1 = WHV_REGISTER_NAME.X64RegisterDr1; pub const WHvX64RegisterDr2 = WHV_REGISTER_NAME.X64RegisterDr2; pub const WHvX64RegisterDr3 = WHV_REGISTER_NAME.X64RegisterDr3; pub const WHvX64RegisterDr6 = WHV_REGISTER_NAME.X64RegisterDr6; pub const WHvX64RegisterDr7 = WHV_REGISTER_NAME.X64RegisterDr7; pub const WHvX64RegisterXCr0 = WHV_REGISTER_NAME.X64RegisterXCr0; pub const WHvX64RegisterVirtualCr0 = WHV_REGISTER_NAME.X64RegisterVirtualCr0; pub const WHvX64RegisterVirtualCr3 = WHV_REGISTER_NAME.X64RegisterVirtualCr3; pub const WHvX64RegisterVirtualCr4 = WHV_REGISTER_NAME.X64RegisterVirtualCr4; pub const WHvX64RegisterVirtualCr8 = WHV_REGISTER_NAME.X64RegisterVirtualCr8; pub const WHvX64RegisterXmm0 = WHV_REGISTER_NAME.X64RegisterXmm0; pub const WHvX64RegisterXmm1 = WHV_REGISTER_NAME.X64RegisterXmm1; pub const WHvX64RegisterXmm2 = WHV_REGISTER_NAME.X64RegisterXmm2; pub const WHvX64RegisterXmm3 = WHV_REGISTER_NAME.X64RegisterXmm3; pub const WHvX64RegisterXmm4 = WHV_REGISTER_NAME.X64RegisterXmm4; pub const WHvX64RegisterXmm5 = WHV_REGISTER_NAME.X64RegisterXmm5; pub const WHvX64RegisterXmm6 = WHV_REGISTER_NAME.X64RegisterXmm6; pub const WHvX64RegisterXmm7 = WHV_REGISTER_NAME.X64RegisterXmm7; pub const WHvX64RegisterXmm8 = WHV_REGISTER_NAME.X64RegisterXmm8; pub const WHvX64RegisterXmm9 = WHV_REGISTER_NAME.X64RegisterXmm9; pub const WHvX64RegisterXmm10 = WHV_REGISTER_NAME.X64RegisterXmm10; pub const WHvX64RegisterXmm11 = WHV_REGISTER_NAME.X64RegisterXmm11; pub const WHvX64RegisterXmm12 = WHV_REGISTER_NAME.X64RegisterXmm12; pub const WHvX64RegisterXmm13 = WHV_REGISTER_NAME.X64RegisterXmm13; pub const WHvX64RegisterXmm14 = WHV_REGISTER_NAME.X64RegisterXmm14; pub const WHvX64RegisterXmm15 = WHV_REGISTER_NAME.X64RegisterXmm15; pub const WHvX64RegisterFpMmx0 = WHV_REGISTER_NAME.X64RegisterFpMmx0; pub const WHvX64RegisterFpMmx1 = WHV_REGISTER_NAME.X64RegisterFpMmx1; pub const WHvX64RegisterFpMmx2 = WHV_REGISTER_NAME.X64RegisterFpMmx2; pub const WHvX64RegisterFpMmx3 = WHV_REGISTER_NAME.X64RegisterFpMmx3; pub const WHvX64RegisterFpMmx4 = WHV_REGISTER_NAME.X64RegisterFpMmx4; pub const WHvX64RegisterFpMmx5 = WHV_REGISTER_NAME.X64RegisterFpMmx5; pub const WHvX64RegisterFpMmx6 = WHV_REGISTER_NAME.X64RegisterFpMmx6; pub const WHvX64RegisterFpMmx7 = WHV_REGISTER_NAME.X64RegisterFpMmx7; pub const WHvX64RegisterFpControlStatus = WHV_REGISTER_NAME.X64RegisterFpControlStatus; pub const WHvX64RegisterXmmControlStatus = WHV_REGISTER_NAME.X64RegisterXmmControlStatus; pub const WHvX64RegisterTsc = WHV_REGISTER_NAME.X64RegisterTsc; pub const WHvX64RegisterEfer = WHV_REGISTER_NAME.X64RegisterEfer; pub const WHvX64RegisterKernelGsBase = WHV_REGISTER_NAME.X64RegisterKernelGsBase; pub const WHvX64RegisterApicBase = WHV_REGISTER_NAME.X64RegisterApicBase; pub const WHvX64RegisterPat = WHV_REGISTER_NAME.X64RegisterPat; pub const WHvX64RegisterSysenterCs = WHV_REGISTER_NAME.X64RegisterSysenterCs; pub const WHvX64RegisterSysenterEip = WHV_REGISTER_NAME.X64RegisterSysenterEip; pub const WHvX64RegisterSysenterEsp = WHV_REGISTER_NAME.X64RegisterSysenterEsp; pub const WHvX64RegisterStar = WHV_REGISTER_NAME.X64RegisterStar; pub const WHvX64RegisterLstar = WHV_REGISTER_NAME.X64RegisterLstar; pub const WHvX64RegisterCstar = WHV_REGISTER_NAME.X64RegisterCstar; pub const WHvX64RegisterSfmask = WHV_REGISTER_NAME.X64RegisterSfmask; pub const WHvX64RegisterInitialApicId = WHV_REGISTER_NAME.X64RegisterInitialApicId; pub const WHvX64RegisterMsrMtrrCap = WHV_REGISTER_NAME.X64RegisterMsrMtrrCap; pub const WHvX64RegisterMsrMtrrDefType = WHV_REGISTER_NAME.X64RegisterMsrMtrrDefType; pub const WHvX64RegisterMsrMtrrPhysBase0 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase0; pub const WHvX64RegisterMsrMtrrPhysBase1 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase1; pub const WHvX64RegisterMsrMtrrPhysBase2 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase2; pub const WHvX64RegisterMsrMtrrPhysBase3 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase3; pub const WHvX64RegisterMsrMtrrPhysBase4 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase4; pub const WHvX64RegisterMsrMtrrPhysBase5 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase5; pub const WHvX64RegisterMsrMtrrPhysBase6 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase6; pub const WHvX64RegisterMsrMtrrPhysBase7 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase7; pub const WHvX64RegisterMsrMtrrPhysBase8 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase8; pub const WHvX64RegisterMsrMtrrPhysBase9 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBase9; pub const WHvX64RegisterMsrMtrrPhysBaseA = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBaseA; pub const WHvX64RegisterMsrMtrrPhysBaseB = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBaseB; pub const WHvX64RegisterMsrMtrrPhysBaseC = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBaseC; pub const WHvX64RegisterMsrMtrrPhysBaseD = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBaseD; pub const WHvX64RegisterMsrMtrrPhysBaseE = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBaseE; pub const WHvX64RegisterMsrMtrrPhysBaseF = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysBaseF; pub const WHvX64RegisterMsrMtrrPhysMask0 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask0; pub const WHvX64RegisterMsrMtrrPhysMask1 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask1; pub const WHvX64RegisterMsrMtrrPhysMask2 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask2; pub const WHvX64RegisterMsrMtrrPhysMask3 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask3; pub const WHvX64RegisterMsrMtrrPhysMask4 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask4; pub const WHvX64RegisterMsrMtrrPhysMask5 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask5; pub const WHvX64RegisterMsrMtrrPhysMask6 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask6; pub const WHvX64RegisterMsrMtrrPhysMask7 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask7; pub const WHvX64RegisterMsrMtrrPhysMask8 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask8; pub const WHvX64RegisterMsrMtrrPhysMask9 = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMask9; pub const WHvX64RegisterMsrMtrrPhysMaskA = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMaskA; pub const WHvX64RegisterMsrMtrrPhysMaskB = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMaskB; pub const WHvX64RegisterMsrMtrrPhysMaskC = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMaskC; pub const WHvX64RegisterMsrMtrrPhysMaskD = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMaskD; pub const WHvX64RegisterMsrMtrrPhysMaskE = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMaskE; pub const WHvX64RegisterMsrMtrrPhysMaskF = WHV_REGISTER_NAME.X64RegisterMsrMtrrPhysMaskF; pub const WHvX64RegisterMsrMtrrFix64k00000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix64k00000; pub const WHvX64RegisterMsrMtrrFix16k80000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix16k80000; pub const WHvX64RegisterMsrMtrrFix16kA0000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix16kA0000; pub const WHvX64RegisterMsrMtrrFix4kC0000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kC0000; pub const WHvX64RegisterMsrMtrrFix4kC8000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kC8000; pub const WHvX64RegisterMsrMtrrFix4kD0000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kD0000; pub const WHvX64RegisterMsrMtrrFix4kD8000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kD8000; pub const WHvX64RegisterMsrMtrrFix4kE0000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kE0000; pub const WHvX64RegisterMsrMtrrFix4kE8000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kE8000; pub const WHvX64RegisterMsrMtrrFix4kF0000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kF0000; pub const WHvX64RegisterMsrMtrrFix4kF8000 = WHV_REGISTER_NAME.X64RegisterMsrMtrrFix4kF8000; pub const WHvX64RegisterTscAux = WHV_REGISTER_NAME.X64RegisterTscAux; pub const WHvX64RegisterBndcfgs = WHV_REGISTER_NAME.X64RegisterBndcfgs; pub const WHvX64RegisterMCount = WHV_REGISTER_NAME.X64RegisterMCount; pub const WHvX64RegisterACount = WHV_REGISTER_NAME.X64RegisterACount; pub const WHvX64RegisterSpecCtrl = WHV_REGISTER_NAME.X64RegisterSpecCtrl; pub const WHvX64RegisterPredCmd = WHV_REGISTER_NAME.X64RegisterPredCmd; pub const WHvX64RegisterTscVirtualOffset = WHV_REGISTER_NAME.X64RegisterTscVirtualOffset; pub const WHvX64RegisterTsxCtrl = WHV_REGISTER_NAME.X64RegisterTsxCtrl; pub const WHvX64RegisterXss = WHV_REGISTER_NAME.X64RegisterXss; pub const WHvX64RegisterUCet = WHV_REGISTER_NAME.X64RegisterUCet; pub const WHvX64RegisterSCet = WHV_REGISTER_NAME.X64RegisterSCet; pub const WHvX64RegisterSsp = WHV_REGISTER_NAME.X64RegisterSsp; pub const WHvX64RegisterPl0Ssp = WHV_REGISTER_NAME.X64RegisterPl0Ssp; pub const WHvX64RegisterPl1Ssp = WHV_REGISTER_NAME.X64RegisterPl1Ssp; pub const WHvX64RegisterPl2Ssp = WHV_REGISTER_NAME.X64RegisterPl2Ssp; pub const WHvX64RegisterPl3Ssp = WHV_REGISTER_NAME.X64RegisterPl3Ssp; pub const WHvX64RegisterInterruptSspTableAddr = WHV_REGISTER_NAME.X64RegisterInterruptSspTableAddr; pub const WHvX64RegisterTscDeadline = WHV_REGISTER_NAME.X64RegisterTscDeadline; pub const WHvX64RegisterTscAdjust = WHV_REGISTER_NAME.X64RegisterTscAdjust; pub const WHvX64RegisterUmwaitControl = WHV_REGISTER_NAME.X64RegisterUmwaitControl; pub const WHvX64RegisterXfd = WHV_REGISTER_NAME.X64RegisterXfd; pub const WHvX64RegisterXfdErr = WHV_REGISTER_NAME.X64RegisterXfdErr; pub const WHvX64RegisterApicId = WHV_REGISTER_NAME.X64RegisterApicId; pub const WHvX64RegisterApicVersion = WHV_REGISTER_NAME.X64RegisterApicVersion; pub const WHvX64RegisterApicTpr = WHV_REGISTER_NAME.X64RegisterApicTpr; pub const WHvX64RegisterApicPpr = WHV_REGISTER_NAME.X64RegisterApicPpr; pub const WHvX64RegisterApicEoi = WHV_REGISTER_NAME.X64RegisterApicEoi; pub const WHvX64RegisterApicLdr = WHV_REGISTER_NAME.X64RegisterApicLdr; pub const WHvX64RegisterApicSpurious = WHV_REGISTER_NAME.X64RegisterApicSpurious; pub const WHvX64RegisterApicIsr0 = WHV_REGISTER_NAME.X64RegisterApicIsr0; pub const WHvX64RegisterApicIsr1 = WHV_REGISTER_NAME.X64RegisterApicIsr1; pub const WHvX64RegisterApicIsr2 = WHV_REGISTER_NAME.X64RegisterApicIsr2; pub const WHvX64RegisterApicIsr3 = WHV_REGISTER_NAME.X64RegisterApicIsr3; pub const WHvX64RegisterApicIsr4 = WHV_REGISTER_NAME.X64RegisterApicIsr4; pub const WHvX64RegisterApicIsr5 = WHV_REGISTER_NAME.X64RegisterApicIsr5; pub const WHvX64RegisterApicIsr6 = WHV_REGISTER_NAME.X64RegisterApicIsr6; pub const WHvX64RegisterApicIsr7 = WHV_REGISTER_NAME.X64RegisterApicIsr7; pub const WHvX64RegisterApicTmr0 = WHV_REGISTER_NAME.X64RegisterApicTmr0; pub const WHvX64RegisterApicTmr1 = WHV_REGISTER_NAME.X64RegisterApicTmr1; pub const WHvX64RegisterApicTmr2 = WHV_REGISTER_NAME.X64RegisterApicTmr2; pub const WHvX64RegisterApicTmr3 = WHV_REGISTER_NAME.X64RegisterApicTmr3; pub const WHvX64RegisterApicTmr4 = WHV_REGISTER_NAME.X64RegisterApicTmr4; pub const WHvX64RegisterApicTmr5 = WHV_REGISTER_NAME.X64RegisterApicTmr5; pub const WHvX64RegisterApicTmr6 = WHV_REGISTER_NAME.X64RegisterApicTmr6; pub const WHvX64RegisterApicTmr7 = WHV_REGISTER_NAME.X64RegisterApicTmr7; pub const WHvX64RegisterApicIrr0 = WHV_REGISTER_NAME.X64RegisterApicIrr0; pub const WHvX64RegisterApicIrr1 = WHV_REGISTER_NAME.X64RegisterApicIrr1; pub const WHvX64RegisterApicIrr2 = WHV_REGISTER_NAME.X64RegisterApicIrr2; pub const WHvX64RegisterApicIrr3 = WHV_REGISTER_NAME.X64RegisterApicIrr3; pub const WHvX64RegisterApicIrr4 = WHV_REGISTER_NAME.X64RegisterApicIrr4; pub const WHvX64RegisterApicIrr5 = WHV_REGISTER_NAME.X64RegisterApicIrr5; pub const WHvX64RegisterApicIrr6 = WHV_REGISTER_NAME.X64RegisterApicIrr6; pub const WHvX64RegisterApicIrr7 = WHV_REGISTER_NAME.X64RegisterApicIrr7; pub const WHvX64RegisterApicEse = WHV_REGISTER_NAME.X64RegisterApicEse; pub const WHvX64RegisterApicIcr = WHV_REGISTER_NAME.X64RegisterApicIcr; pub const WHvX64RegisterApicLvtTimer = WHV_REGISTER_NAME.X64RegisterApicLvtTimer; pub const WHvX64RegisterApicLvtThermal = WHV_REGISTER_NAME.X64RegisterApicLvtThermal; pub const WHvX64RegisterApicLvtPerfmon = WHV_REGISTER_NAME.X64RegisterApicLvtPerfmon; pub const WHvX64RegisterApicLvtLint0 = WHV_REGISTER_NAME.X64RegisterApicLvtLint0; pub const WHvX64RegisterApicLvtLint1 = WHV_REGISTER_NAME.X64RegisterApicLvtLint1; pub const WHvX64RegisterApicLvtError = WHV_REGISTER_NAME.X64RegisterApicLvtError; pub const WHvX64RegisterApicInitCount = WHV_REGISTER_NAME.X64RegisterApicInitCount; pub const WHvX64RegisterApicCurrentCount = WHV_REGISTER_NAME.X64RegisterApicCurrentCount; pub const WHvX64RegisterApicDivide = WHV_REGISTER_NAME.X64RegisterApicDivide; pub const WHvX64RegisterApicSelfIpi = WHV_REGISTER_NAME.X64RegisterApicSelfIpi; pub const WHvRegisterSint0 = WHV_REGISTER_NAME.RegisterSint0; pub const WHvRegisterSint1 = WHV_REGISTER_NAME.RegisterSint1; pub const WHvRegisterSint2 = WHV_REGISTER_NAME.RegisterSint2; pub const WHvRegisterSint3 = WHV_REGISTER_NAME.RegisterSint3; pub const WHvRegisterSint4 = WHV_REGISTER_NAME.RegisterSint4; pub const WHvRegisterSint5 = WHV_REGISTER_NAME.RegisterSint5; pub const WHvRegisterSint6 = WHV_REGISTER_NAME.RegisterSint6; pub const WHvRegisterSint7 = WHV_REGISTER_NAME.RegisterSint7; pub const WHvRegisterSint8 = WHV_REGISTER_NAME.RegisterSint8; pub const WHvRegisterSint9 = WHV_REGISTER_NAME.RegisterSint9; pub const WHvRegisterSint10 = WHV_REGISTER_NAME.RegisterSint10; pub const WHvRegisterSint11 = WHV_REGISTER_NAME.RegisterSint11; pub const WHvRegisterSint12 = WHV_REGISTER_NAME.RegisterSint12; pub const WHvRegisterSint13 = WHV_REGISTER_NAME.RegisterSint13; pub const WHvRegisterSint14 = WHV_REGISTER_NAME.RegisterSint14; pub const WHvRegisterSint15 = WHV_REGISTER_NAME.RegisterSint15; pub const WHvRegisterScontrol = WHV_REGISTER_NAME.RegisterScontrol; pub const WHvRegisterSversion = WHV_REGISTER_NAME.RegisterSversion; pub const WHvRegisterSiefp = WHV_REGISTER_NAME.RegisterSiefp; pub const WHvRegisterSimp = WHV_REGISTER_NAME.RegisterSimp; pub const WHvRegisterEom = WHV_REGISTER_NAME.RegisterEom; pub const WHvRegisterVpRuntime = WHV_REGISTER_NAME.RegisterVpRuntime; pub const WHvX64RegisterHypercall = WHV_REGISTER_NAME.X64RegisterHypercall; pub const WHvRegisterGuestOsId = WHV_REGISTER_NAME.RegisterGuestOsId; pub const WHvRegisterVpAssistPage = WHV_REGISTER_NAME.RegisterVpAssistPage; pub const WHvRegisterReferenceTsc = WHV_REGISTER_NAME.RegisterReferenceTsc; pub const WHvRegisterReferenceTscSequence = WHV_REGISTER_NAME.RegisterReferenceTscSequence; pub const WHvRegisterPendingInterruption = WHV_REGISTER_NAME.RegisterPendingInterruption; pub const WHvRegisterInterruptState = WHV_REGISTER_NAME.RegisterInterruptState; pub const WHvRegisterPendingEvent = WHV_REGISTER_NAME.RegisterPendingEvent; pub const WHvX64RegisterDeliverabilityNotifications = WHV_REGISTER_NAME.X64RegisterDeliverabilityNotifications; pub const WHvRegisterInternalActivityState = WHV_REGISTER_NAME.RegisterInternalActivityState; pub const WHvX64RegisterPendingDebugException = WHV_REGISTER_NAME.X64RegisterPendingDebugException; pub const WHV_UINT128 = extern union { Anonymous: extern struct { Low64: u64, High64: u64, }, Dword: [4]u32, }; pub const WHV_X64_FP_REGISTER = extern union { Anonymous: extern struct { Mantissa: u64, _bitfield: u64, }, AsUINT128: WHV_UINT128, }; pub const WHV_X64_FP_CONTROL_STATUS_REGISTER = extern union { Anonymous: extern struct { FpControl: u16, FpStatus: u16, FpTag: u8, Reserved: u8, LastFpOp: u16, Anonymous: extern union { LastFpRip: u64, Anonymous: extern struct { LastFpEip: u32, LastFpCs: u16, Reserved2: u16, }, }, }, AsUINT128: WHV_UINT128, }; pub const WHV_X64_XMM_CONTROL_STATUS_REGISTER = extern union { Anonymous: extern struct { Anonymous: extern union { LastFpRdp: u64, Anonymous: extern struct { LastFpDp: u32, LastFpDs: u16, Reserved: u16, }, }, XmmStatusControl: u32, XmmStatusControlMask: u32, }, AsUINT128: WHV_UINT128, }; pub const WHV_X64_SEGMENT_REGISTER = extern struct { Base: u64, Limit: u32, Selector: u16, Anonymous: extern union { Anonymous: extern struct { _bitfield: u16, }, Attributes: u16, }, }; pub const WHV_X64_TABLE_REGISTER = extern struct { Pad: [3]u16, Limit: u16, Base: u64, }; pub const WHV_X64_INTERRUPT_STATE_REGISTER = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_X64_PENDING_INTERRUPTION_REGISTER = extern union { Anonymous: extern struct { _bitfield: u32, ErrorCode: u32, }, AsUINT64: u64, }; pub const WHV_X64_DELIVERABILITY_NOTIFICATIONS_REGISTER = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_X64_PENDING_EVENT_TYPE = enum(i32) { ception = 0, tInt = 5, }; pub const WHvX64PendingEventException = WHV_X64_PENDING_EVENT_TYPE.ception; pub const WHvX64PendingEventExtInt = WHV_X64_PENDING_EVENT_TYPE.tInt; pub const WHV_X64_PENDING_EXCEPTION_EVENT = extern union { Anonymous: extern struct { _bitfield: u32, ErrorCode: u32, ExceptionParameter: u64, }, AsUINT128: WHV_UINT128, }; pub const WHV_X64_PENDING_EXT_INT_EVENT = extern union { Anonymous: extern struct { _bitfield: u64, Reserved2: u64, }, AsUINT128: WHV_UINT128, }; pub const WHV_INTERNAL_ACTIVITY_REGISTER = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_X64_PENDING_DEBUG_EXCEPTION = extern union { AsUINT64: u64, Anonymous: extern struct { _bitfield: u64, }, }; pub const WHV_SYNIC_SINT_DELIVERABLE_CONTEXT = extern struct { DeliverableSints: u16, Reserved1: u16, Reserved2: u32, }; pub const WHV_REGISTER_VALUE = extern union { Reg128: WHV_UINT128, Reg64: u64, Reg32: u32, Reg16: u16, Reg8: u8, Fp: WHV_X64_FP_REGISTER, FpControlStatus: WHV_X64_FP_CONTROL_STATUS_REGISTER, XmmControlStatus: WHV_X64_XMM_CONTROL_STATUS_REGISTER, Segment: WHV_X64_SEGMENT_REGISTER, Table: WHV_X64_TABLE_REGISTER, InterruptState: WHV_X64_INTERRUPT_STATE_REGISTER, PendingInterruption: WHV_X64_PENDING_INTERRUPTION_REGISTER, DeliverabilityNotifications: WHV_X64_DELIVERABILITY_NOTIFICATIONS_REGISTER, ExceptionEvent: WHV_X64_PENDING_EXCEPTION_EVENT, ExtIntEvent: WHV_X64_PENDING_EXT_INT_EVENT, InternalActivity: WHV_INTERNAL_ACTIVITY_REGISTER, PendingDebugException: WHV_X64_PENDING_DEBUG_EXCEPTION, }; pub const WHV_RUN_VP_EXIT_REASON = enum(i32) { None = 0, MemoryAccess = 1, X64IoPortAccess = 2, UnrecoverableException = 4, InvalidVpRegisterValue = 5, UnsupportedFeature = 6, X64InterruptWindow = 7, X64Halt = 8, X64ApicEoi = 9, SynicSintDeliverable = 10, X64MsrAccess = 4096, X64Cpuid = 4097, Exception = 4098, X64Rdtsc = 4099, X64ApicSmiTrap = 4100, Hypercall = 4101, X64ApicInitSipiTrap = 4102, X64ApicWriteTrap = 4103, Canceled = 8193, }; pub const WHvRunVpExitReasonNone = WHV_RUN_VP_EXIT_REASON.None; pub const WHvRunVpExitReasonMemoryAccess = WHV_RUN_VP_EXIT_REASON.MemoryAccess; pub const WHvRunVpExitReasonX64IoPortAccess = WHV_RUN_VP_EXIT_REASON.X64IoPortAccess; pub const WHvRunVpExitReasonUnrecoverableException = WHV_RUN_VP_EXIT_REASON.UnrecoverableException; pub const WHvRunVpExitReasonInvalidVpRegisterValue = WHV_RUN_VP_EXIT_REASON.InvalidVpRegisterValue; pub const WHvRunVpExitReasonUnsupportedFeature = WHV_RUN_VP_EXIT_REASON.UnsupportedFeature; pub const WHvRunVpExitReasonX64InterruptWindow = WHV_RUN_VP_EXIT_REASON.X64InterruptWindow; pub const WHvRunVpExitReasonX64Halt = WHV_RUN_VP_EXIT_REASON.X64Halt; pub const WHvRunVpExitReasonX64ApicEoi = WHV_RUN_VP_EXIT_REASON.X64ApicEoi; pub const WHvRunVpExitReasonSynicSintDeliverable = WHV_RUN_VP_EXIT_REASON.SynicSintDeliverable; pub const WHvRunVpExitReasonX64MsrAccess = WHV_RUN_VP_EXIT_REASON.X64MsrAccess; pub const WHvRunVpExitReasonX64Cpuid = WHV_RUN_VP_EXIT_REASON.X64Cpuid; pub const WHvRunVpExitReasonException = WHV_RUN_VP_EXIT_REASON.Exception; pub const WHvRunVpExitReasonX64Rdtsc = WHV_RUN_VP_EXIT_REASON.X64Rdtsc; pub const WHvRunVpExitReasonX64ApicSmiTrap = WHV_RUN_VP_EXIT_REASON.X64ApicSmiTrap; pub const WHvRunVpExitReasonHypercall = WHV_RUN_VP_EXIT_REASON.Hypercall; pub const WHvRunVpExitReasonX64ApicInitSipiTrap = WHV_RUN_VP_EXIT_REASON.X64ApicInitSipiTrap; pub const WHvRunVpExitReasonX64ApicWriteTrap = WHV_RUN_VP_EXIT_REASON.X64ApicWriteTrap; pub const WHvRunVpExitReasonCanceled = WHV_RUN_VP_EXIT_REASON.Canceled; pub const WHV_X64_VP_EXECUTION_STATE = extern union { Anonymous: extern struct { _bitfield: u16, }, AsUINT16: u16, }; pub const WHV_VP_EXIT_CONTEXT = extern struct { ExecutionState: WHV_X64_VP_EXECUTION_STATE, _bitfield: u8, Reserved: u8, Reserved2: u32, Cs: WHV_X64_SEGMENT_REGISTER, Rip: u64, Rflags: u64, }; pub const WHV_MEMORY_ACCESS_INFO = extern union { Anonymous: extern struct { _bitfield: u32, }, AsUINT32: u32, }; pub const WHV_MEMORY_ACCESS_CONTEXT = extern struct { InstructionByteCount: u8, Reserved: [3]u8, InstructionBytes: [16]u8, AccessInfo: WHV_MEMORY_ACCESS_INFO, Gpa: u64, Gva: u64, }; pub const WHV_X64_IO_PORT_ACCESS_INFO = extern union { Anonymous: extern struct { _bitfield: u32, }, AsUINT32: u32, }; pub const WHV_X64_IO_PORT_ACCESS_CONTEXT = extern struct { InstructionByteCount: u8, Reserved: [3]u8, InstructionBytes: [16]u8, AccessInfo: WHV_X64_IO_PORT_ACCESS_INFO, PortNumber: u16, Reserved2: [3]u16, Rax: u64, Rcx: u64, Rsi: u64, Rdi: u64, Ds: WHV_X64_SEGMENT_REGISTER, Es: WHV_X64_SEGMENT_REGISTER, }; pub const WHV_X64_MSR_ACCESS_INFO = extern union { Anonymous: extern struct { _bitfield: u32, }, AsUINT32: u32, }; pub const WHV_X64_MSR_ACCESS_CONTEXT = extern struct { AccessInfo: WHV_X64_MSR_ACCESS_INFO, MsrNumber: u32, Rax: u64, Rdx: u64, }; pub const WHV_X64_CPUID_ACCESS_CONTEXT = extern struct { Rax: u64, Rcx: u64, Rdx: u64, Rbx: u64, DefaultResultRax: u64, DefaultResultRcx: u64, DefaultResultRdx: u64, DefaultResultRbx: u64, }; pub const WHV_VP_EXCEPTION_INFO = extern union { Anonymous: extern struct { _bitfield: u32, }, AsUINT32: u32, }; pub const WHV_VP_EXCEPTION_CONTEXT = extern struct { InstructionByteCount: u8, Reserved: [3]u8, InstructionBytes: [16]u8, ExceptionInfo: WHV_VP_EXCEPTION_INFO, ExceptionType: u8, Reserved2: [3]u8, ErrorCode: u32, ExceptionParameter: u64, }; pub const WHV_X64_UNSUPPORTED_FEATURE_CODE = enum(i32) { Intercept = 1, TaskSwitchTss = 2, }; pub const WHvUnsupportedFeatureIntercept = WHV_X64_UNSUPPORTED_FEATURE_CODE.Intercept; pub const WHvUnsupportedFeatureTaskSwitchTss = WHV_X64_UNSUPPORTED_FEATURE_CODE.TaskSwitchTss; pub const WHV_X64_UNSUPPORTED_FEATURE_CONTEXT = extern struct { FeatureCode: WHV_X64_UNSUPPORTED_FEATURE_CODE, Reserved: u32, FeatureParameter: u64, }; pub const WHV_RUN_VP_CANCEL_REASON = enum(i32) { r = 0, }; pub const WHvRunVpCancelReasonUser = WHV_RUN_VP_CANCEL_REASON.r; pub const WHV_RUN_VP_CANCELED_CONTEXT = extern struct { CancelReason: WHV_RUN_VP_CANCEL_REASON, }; pub const WHV_X64_PENDING_INTERRUPTION_TYPE = enum(i32) { Interrupt = 0, Nmi = 2, Exception = 3, }; pub const WHvX64PendingInterrupt = WHV_X64_PENDING_INTERRUPTION_TYPE.Interrupt; pub const WHvX64PendingNmi = WHV_X64_PENDING_INTERRUPTION_TYPE.Nmi; pub const WHvX64PendingException = WHV_X64_PENDING_INTERRUPTION_TYPE.Exception; pub const WHV_X64_INTERRUPTION_DELIVERABLE_CONTEXT = extern struct { DeliverableType: WHV_X64_PENDING_INTERRUPTION_TYPE, }; pub const WHV_X64_APIC_EOI_CONTEXT = extern struct { InterruptVector: u32, }; pub const WHV_X64_RDTSC_INFO = extern union { Anonymous: extern struct { _bitfield: u64, }, AsUINT64: u64, }; pub const WHV_X64_RDTSC_CONTEXT = extern struct { TscAux: u64, VirtualOffset: u64, Tsc: u64, ReferenceTime: u64, RdtscInfo: WHV_X64_RDTSC_INFO, }; pub const WHV_X64_APIC_SMI_CONTEXT = extern struct { ApicIcr: u64, }; pub const WHV_HYPERCALL_CONTEXT = extern struct { Rax: u64, Rbx: u64, Rcx: u64, Rdx: u64, R8: u64, Rsi: u64, Rdi: u64, Reserved0: u64, XmmRegisters: [6]WHV_UINT128, Reserved1: [2]u64, }; pub const WHV_X64_APIC_INIT_SIPI_CONTEXT = extern struct { ApicIcr: u64, }; pub const WHV_X64_APIC_WRITE_TYPE = enum(i32) { Ldr = 208, Dfr = 224, Svr = 240, Lint0 = 848, Lint1 = 864, }; pub const WHvX64ApicWriteTypeLdr = WHV_X64_APIC_WRITE_TYPE.Ldr; pub const WHvX64ApicWriteTypeDfr = WHV_X64_APIC_WRITE_TYPE.Dfr; pub const WHvX64ApicWriteTypeSvr = WHV_X64_APIC_WRITE_TYPE.Svr; pub const WHvX64ApicWriteTypeLint0 = WHV_X64_APIC_WRITE_TYPE.Lint0; pub const WHvX64ApicWriteTypeLint1 = WHV_X64_APIC_WRITE_TYPE.Lint1; pub const WHV_X64_APIC_WRITE_CONTEXT = extern struct { Type: WHV_X64_APIC_WRITE_TYPE, Reserved: u32, WriteValue: u64, }; pub const WHV_RUN_VP_EXIT_CONTEXT = extern struct { ExitReason: WHV_RUN_VP_EXIT_REASON, Reserved: u32, VpContext: WHV_VP_EXIT_CONTEXT, Anonymous: extern union { MemoryAccess: WHV_MEMORY_ACCESS_CONTEXT, IoPortAccess: WHV_X64_IO_PORT_ACCESS_CONTEXT, MsrAccess: WHV_X64_MSR_ACCESS_CONTEXT, CpuidAccess: WHV_X64_CPUID_ACCESS_CONTEXT, VpException: WHV_VP_EXCEPTION_CONTEXT, InterruptWindow: WHV_X64_INTERRUPTION_DELIVERABLE_CONTEXT, UnsupportedFeature: WHV_X64_UNSUPPORTED_FEATURE_CONTEXT, CancelReason: WHV_RUN_VP_CANCELED_CONTEXT, ApicEoi: WHV_X64_APIC_EOI_CONTEXT, ReadTsc: WHV_X64_RDTSC_CONTEXT, ApicSmi: WHV_X64_APIC_SMI_CONTEXT, Hypercall: WHV_HYPERCALL_CONTEXT, ApicInitSipi: WHV_X64_APIC_INIT_SIPI_CONTEXT, ApicWrite: WHV_X64_APIC_WRITE_CONTEXT, SynicSintDeliverable: WHV_SYNIC_SINT_DELIVERABLE_CONTEXT, }, }; pub const WHV_INTERRUPT_TYPE = enum(i32) { Fixed = 0, LowestPriority = 1, Nmi = 4, Init = 5, Sipi = 6, LocalInt1 = 9, }; pub const WHvX64InterruptTypeFixed = WHV_INTERRUPT_TYPE.Fixed; pub const WHvX64InterruptTypeLowestPriority = WHV_INTERRUPT_TYPE.LowestPriority; pub const WHvX64InterruptTypeNmi = WHV_INTERRUPT_TYPE.Nmi; pub const WHvX64InterruptTypeInit = WHV_INTERRUPT_TYPE.Init; pub const WHvX64InterruptTypeSipi = WHV_INTERRUPT_TYPE.Sipi; pub const WHvX64InterruptTypeLocalInt1 = WHV_INTERRUPT_TYPE.LocalInt1; pub const WHV_INTERRUPT_DESTINATION_MODE = enum(i32) { Physical = 0, Logical = 1, }; pub const WHvX64InterruptDestinationModePhysical = WHV_INTERRUPT_DESTINATION_MODE.Physical; pub const WHvX64InterruptDestinationModeLogical = WHV_INTERRUPT_DESTINATION_MODE.Logical; pub const WHV_INTERRUPT_TRIGGER_MODE = enum(i32) { Edge = 0, Level = 1, }; pub const WHvX64InterruptTriggerModeEdge = WHV_INTERRUPT_TRIGGER_MODE.Edge; pub const WHvX64InterruptTriggerModeLevel = WHV_INTERRUPT_TRIGGER_MODE.Level; pub const WHV_INTERRUPT_CONTROL = extern struct { _bitfield: u64, Destination: u32, Vector: u32, }; pub const WHV_DOORBELL_MATCH_DATA = extern struct { GuestAddress: u64, Value: u64, Length: u32, _bitfield: u32, }; pub const WHV_PARTITION_COUNTER_SET = enum(i32) { y = 0, }; pub const WHvPartitionCounterSetMemory = WHV_PARTITION_COUNTER_SET.y; pub const WHV_PARTITION_MEMORY_COUNTERS = extern struct { Mapped4KPageCount: u64, Mapped2MPageCount: u64, Mapped1GPageCount: u64, }; pub const WHV_PROCESSOR_COUNTER_SET = enum(i32) { Runtime = 0, Intercepts = 1, Events = 2, Apic = 3, SyntheticFeatures = 4, }; pub const WHvProcessorCounterSetRuntime = WHV_PROCESSOR_COUNTER_SET.Runtime; pub const WHvProcessorCounterSetIntercepts = WHV_PROCESSOR_COUNTER_SET.Intercepts; pub const WHvProcessorCounterSetEvents = WHV_PROCESSOR_COUNTER_SET.Events; pub const WHvProcessorCounterSetApic = WHV_PROCESSOR_COUNTER_SET.Apic; pub const WHvProcessorCounterSetSyntheticFeatures = WHV_PROCESSOR_COUNTER_SET.SyntheticFeatures; pub const WHV_PROCESSOR_RUNTIME_COUNTERS = extern struct { TotalRuntime100ns: u64, HypervisorRuntime100ns: u64, }; pub const WHV_PROCESSOR_INTERCEPT_COUNTER = extern struct { Count: u64, Time100ns: u64, }; pub const WHV_PROCESSOR_INTERCEPT_COUNTERS = extern struct { PageInvalidations: WHV_PROCESSOR_INTERCEPT_COUNTER, ControlRegisterAccesses: WHV_PROCESSOR_INTERCEPT_COUNTER, IoInstructions: WHV_PROCESSOR_INTERCEPT_COUNTER, HaltInstructions: WHV_PROCESSOR_INTERCEPT_COUNTER, CpuidInstructions: WHV_PROCESSOR_INTERCEPT_COUNTER, MsrAccesses: WHV_PROCESSOR_INTERCEPT_COUNTER, OtherIntercepts: WHV_PROCESSOR_INTERCEPT_COUNTER, PendingInterrupts: WHV_PROCESSOR_INTERCEPT_COUNTER, EmulatedInstructions: WHV_PROCESSOR_INTERCEPT_COUNTER, DebugRegisterAccesses: WHV_PROCESSOR_INTERCEPT_COUNTER, PageFaultIntercepts: WHV_PROCESSOR_INTERCEPT_COUNTER, NestedPageFaultIntercepts: WHV_PROCESSOR_INTERCEPT_COUNTER, Hypercalls: WHV_PROCESSOR_INTERCEPT_COUNTER, RdpmcInstructions: WHV_PROCESSOR_INTERCEPT_COUNTER, }; pub const WHV_PROCESSOR_EVENT_COUNTERS = extern struct { PageFaultCount: u64, ExceptionCount: u64, InterruptCount: u64, }; pub const WHV_PROCESSOR_APIC_COUNTERS = extern struct { MmioAccessCount: u64, EoiAccessCount: u64, TprAccessCount: u64, SentIpiCount: u64, SelfIpiCount: u64, }; pub const WHV_PROCESSOR_SYNTHETIC_FEATURES_COUNTERS = extern struct { SyntheticInterruptsCount: u64, LongSpinWaitHypercallsCount: u64, OtherHypercallsCount: u64, SyntheticInterruptHypercallsCount: u64, VirtualInterruptHypercallsCount: u64, VirtualMmuHypercallsCount: u64, }; pub const WHV_ADVISE_GPA_RANGE_CODE = enum(i32) { Populate = 0, Pin = 1, Unpin = 2, }; pub const WHvAdviseGpaRangeCodePopulate = WHV_ADVISE_GPA_RANGE_CODE.Populate; pub const WHvAdviseGpaRangeCodePin = WHV_ADVISE_GPA_RANGE_CODE.Pin; pub const WHvAdviseGpaRangeCodeUnpin = WHV_ADVISE_GPA_RANGE_CODE.Unpin; pub const WHV_VIRTUAL_PROCESSOR_STATE_TYPE = enum(i32) { SynicMessagePage = 0, SynicEventFlagPage = 1, SynicTimerState = 2, InterruptControllerState2 = 4096, XsaveState = 4097, }; pub const WHvVirtualProcessorStateTypeSynicMessagePage = WHV_VIRTUAL_PROCESSOR_STATE_TYPE.SynicMessagePage; pub const WHvVirtualProcessorStateTypeSynicEventFlagPage = WHV_VIRTUAL_PROCESSOR_STATE_TYPE.SynicEventFlagPage; pub const WHvVirtualProcessorStateTypeSynicTimerState = WHV_VIRTUAL_PROCESSOR_STATE_TYPE.SynicTimerState; pub const WHvVirtualProcessorStateTypeInterruptControllerState2 = WHV_VIRTUAL_PROCESSOR_STATE_TYPE.InterruptControllerState2; pub const WHvVirtualProcessorStateTypeXsaveState = WHV_VIRTUAL_PROCESSOR_STATE_TYPE.XsaveState; pub const WHV_SYNIC_EVENT_PARAMETERS = extern struct { VpIndex: u32, TargetSint: u8, Reserved: u8, FlagNumber: u16, }; pub const WHV_ALLOCATE_VPCI_RESOURCE_FLAGS = enum(u32) { None = 0, AllowDirectP2P = 1, _, pub fn initFlags(o: struct { None: u1 = 0, AllowDirectP2P: u1 = 0, }) WHV_ALLOCATE_VPCI_RESOURCE_FLAGS { return @intToEnum(WHV_ALLOCATE_VPCI_RESOURCE_FLAGS, (if (o.None == 1) @enumToInt(WHV_ALLOCATE_VPCI_RESOURCE_FLAGS.None) else 0) | (if (o.AllowDirectP2P == 1) @enumToInt(WHV_ALLOCATE_VPCI_RESOURCE_FLAGS.AllowDirectP2P) else 0) ); } }; pub const WHvAllocateVpciResourceFlagNone = WHV_ALLOCATE_VPCI_RESOURCE_FLAGS.None; pub const WHvAllocateVpciResourceFlagAllowDirectP2P = WHV_ALLOCATE_VPCI_RESOURCE_FLAGS.AllowDirectP2P; pub const WHV_SRIOV_RESOURCE_DESCRIPTOR = extern struct { PnpInstanceId: [200]u16, VirtualFunctionId: LUID, VirtualFunctionIndex: u16, Reserved: u16, }; pub const WHV_VPCI_DEVICE_NOTIFICATION_TYPE = enum(i32) { Undefined = 0, MmioRemapping = 1, SurpriseRemoval = 2, }; pub const WHvVpciDeviceNotificationUndefined = WHV_VPCI_DEVICE_NOTIFICATION_TYPE.Undefined; pub const WHvVpciDeviceNotificationMmioRemapping = WHV_VPCI_DEVICE_NOTIFICATION_TYPE.MmioRemapping; pub const WHvVpciDeviceNotificationSurpriseRemoval = WHV_VPCI_DEVICE_NOTIFICATION_TYPE.SurpriseRemoval; pub const WHV_VPCI_DEVICE_NOTIFICATION = extern struct { NotificationType: WHV_VPCI_DEVICE_NOTIFICATION_TYPE, Reserved1: u32, Anonymous: extern union { Reserved2: u64, }, }; pub const WHV_CREATE_VPCI_DEVICE_FLAGS = enum(u32) { None = 0, PhysicallyBacked = 1, UseLogicalInterrupts = 2, _, pub fn initFlags(o: struct { None: u1 = 0, PhysicallyBacked: u1 = 0, UseLogicalInterrupts: u1 = 0, }) WHV_CREATE_VPCI_DEVICE_FLAGS { return @intToEnum(WHV_CREATE_VPCI_DEVICE_FLAGS, (if (o.None == 1) @enumToInt(WHV_CREATE_VPCI_DEVICE_FLAGS.None) else 0) | (if (o.PhysicallyBacked == 1) @enumToInt(WHV_CREATE_VPCI_DEVICE_FLAGS.PhysicallyBacked) else 0) | (if (o.UseLogicalInterrupts == 1) @enumToInt(WHV_CREATE_VPCI_DEVICE_FLAGS.UseLogicalInterrupts) else 0) ); } }; pub const WHvCreateVpciDeviceFlagNone = WHV_CREATE_VPCI_DEVICE_FLAGS.None; pub const WHvCreateVpciDeviceFlagPhysicallyBacked = WHV_CREATE_VPCI_DEVICE_FLAGS.PhysicallyBacked; pub const WHvCreateVpciDeviceFlagUseLogicalInterrupts = WHV_CREATE_VPCI_DEVICE_FLAGS.UseLogicalInterrupts; pub const WHV_VPCI_DEVICE_PROPERTY_CODE = enum(i32) { Undefined = 0, HardwareIDs = 1, ProbedBARs = 2, }; pub const WHvVpciDevicePropertyCodeUndefined = WHV_VPCI_DEVICE_PROPERTY_CODE.Undefined; pub const WHvVpciDevicePropertyCodeHardwareIDs = WHV_VPCI_DEVICE_PROPERTY_CODE.HardwareIDs; pub const WHvVpciDevicePropertyCodeProbedBARs = WHV_VPCI_DEVICE_PROPERTY_CODE.ProbedBARs; pub const WHV_VPCI_HARDWARE_IDS = extern struct { VendorID: u16, DeviceID: u16, RevisionID: u8, ProgIf: u8, SubClass: u8, BaseClass: u8, SubVendorID: u16, SubSystemID: u16, }; pub const WHV_VPCI_PROBED_BARS = extern struct { Value: [6]u32, }; pub const WHV_VPCI_MMIO_RANGE_FLAGS = enum(u32) { ReadAccess = 1, WriteAccess = 2, _, pub fn initFlags(o: struct { ReadAccess: u1 = 0, WriteAccess: u1 = 0, }) WHV_VPCI_MMIO_RANGE_FLAGS { return @intToEnum(WHV_VPCI_MMIO_RANGE_FLAGS, (if (o.ReadAccess == 1) @enumToInt(WHV_VPCI_MMIO_RANGE_FLAGS.ReadAccess) else 0) | (if (o.WriteAccess == 1) @enumToInt(WHV_VPCI_MMIO_RANGE_FLAGS.WriteAccess) else 0) ); } }; pub const WHvVpciMmioRangeFlagReadAccess = WHV_VPCI_MMIO_RANGE_FLAGS.ReadAccess; pub const WHvVpciMmioRangeFlagWriteAccess = WHV_VPCI_MMIO_RANGE_FLAGS.WriteAccess; pub const WHV_VPCI_DEVICE_REGISTER_SPACE = enum(i32) { ConfigSpace = -1, Bar0 = 0, Bar1 = 1, Bar2 = 2, Bar3 = 3, Bar4 = 4, Bar5 = 5, }; pub const WHvVpciConfigSpace = WHV_VPCI_DEVICE_REGISTER_SPACE.ConfigSpace; pub const WHvVpciBar0 = WHV_VPCI_DEVICE_REGISTER_SPACE.Bar0; pub const WHvVpciBar1 = WHV_VPCI_DEVICE_REGISTER_SPACE.Bar1; pub const WHvVpciBar2 = WHV_VPCI_DEVICE_REGISTER_SPACE.Bar2; pub const WHvVpciBar3 = WHV_VPCI_DEVICE_REGISTER_SPACE.Bar3; pub const WHvVpciBar4 = WHV_VPCI_DEVICE_REGISTER_SPACE.Bar4; pub const WHvVpciBar5 = WHV_VPCI_DEVICE_REGISTER_SPACE.Bar5; pub const WHV_VPCI_MMIO_MAPPING = extern struct { Location: WHV_VPCI_DEVICE_REGISTER_SPACE, Flags: WHV_VPCI_MMIO_RANGE_FLAGS, SizeInBytes: u64, OffsetInBytes: u64, VirtualAddress: ?*anyopaque, }; pub const WHV_VPCI_DEVICE_REGISTER = extern struct { Location: WHV_VPCI_DEVICE_REGISTER_SPACE, SizeInBytes: u32, OffsetInBytes: u64, }; pub const WHV_VPCI_INTERRUPT_TARGET_FLAGS = enum(u32) { None = 0, Multicast = 1, _, pub fn initFlags(o: struct { None: u1 = 0, Multicast: u1 = 0, }) WHV_VPCI_INTERRUPT_TARGET_FLAGS { return @intToEnum(WHV_VPCI_INTERRUPT_TARGET_FLAGS, (if (o.None == 1) @enumToInt(WHV_VPCI_INTERRUPT_TARGET_FLAGS.None) else 0) | (if (o.Multicast == 1) @enumToInt(WHV_VPCI_INTERRUPT_TARGET_FLAGS.Multicast) else 0) ); } }; pub const WHvVpciInterruptTargetFlagNone = WHV_VPCI_INTERRUPT_TARGET_FLAGS.None; pub const WHvVpciInterruptTargetFlagMulticast = WHV_VPCI_INTERRUPT_TARGET_FLAGS.Multicast; pub const WHV_VPCI_INTERRUPT_TARGET = extern struct { Vector: u32, Flags: WHV_VPCI_INTERRUPT_TARGET_FLAGS, ProcessorCount: u32, Processors: [1]u32, }; pub const WHV_TRIGGER_TYPE = enum(i32) { Interrupt = 0, SynicEvent = 1, DeviceInterrupt = 2, }; pub const WHvTriggerTypeInterrupt = WHV_TRIGGER_TYPE.Interrupt; pub const WHvTriggerTypeSynicEvent = WHV_TRIGGER_TYPE.SynicEvent; pub const WHvTriggerTypeDeviceInterrupt = WHV_TRIGGER_TYPE.DeviceInterrupt; pub const WHV_TRIGGER_PARAMETERS = extern struct { TriggerType: WHV_TRIGGER_TYPE, Reserved: u32, Anonymous: extern union { Interrupt: WHV_INTERRUPT_CONTROL, SynicEvent: WHV_SYNIC_EVENT_PARAMETERS, DeviceInterrupt: extern struct { LogicalDeviceId: u64, MsiAddress: u64, MsiData: u32, Reserved: u32, }, }, }; pub const WHV_VIRTUAL_PROCESSOR_PROPERTY_CODE = enum(i32) { e = 0, }; pub const WHvVirtualProcessorPropertyCodeNumaNode = WHV_VIRTUAL_PROCESSOR_PROPERTY_CODE.e; pub const WHV_VIRTUAL_PROCESSOR_PROPERTY = extern struct { PropertyCode: WHV_VIRTUAL_PROCESSOR_PROPERTY_CODE, Reserved: u32, Anonymous: extern union { NumaNode: u16, Padding: u64, }, }; pub const WHV_NOTIFICATION_PORT_TYPE = enum(i32) { Event = 2, Doorbell = 4, }; pub const WHvNotificationPortTypeEvent = WHV_NOTIFICATION_PORT_TYPE.Event; pub const WHvNotificationPortTypeDoorbell = WHV_NOTIFICATION_PORT_TYPE.Doorbell; pub const WHV_NOTIFICATION_PORT_PARAMETERS = extern struct { NotificationPortType: WHV_NOTIFICATION_PORT_TYPE, Reserved: u32, Anonymous: extern union { Doorbell: WHV_DOORBELL_MATCH_DATA, Event: extern struct { ConnectionId: u32, }, }, }; pub const WHV_NOTIFICATION_PORT_PROPERTY_CODE = enum(i32) { Vp = 1, Duration = 5, }; pub const WHvNotificationPortPropertyPreferredTargetVp = WHV_NOTIFICATION_PORT_PROPERTY_CODE.Vp; pub const WHvNotificationPortPropertyPreferredTargetDuration = WHV_NOTIFICATION_PORT_PROPERTY_CODE.Duration; pub const WHV_EMULATOR_STATUS = extern union { Anonymous: extern struct { _bitfield: u32, }, AsUINT32: u32, }; pub const WHV_EMULATOR_MEMORY_ACCESS_INFO = extern struct { GpaAddress: u64, Direction: u8, AccessSize: u8, Data: [8]u8, }; pub const WHV_EMULATOR_IO_ACCESS_INFO = extern struct { Direction: u8, Port: u16, AccessSize: u16, Data: u32, }; pub const WHV_EMULATOR_IO_PORT_CALLBACK = fn( Context: ?*anyopaque, IoAccess: ?*WHV_EMULATOR_IO_ACCESS_INFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const WHV_EMULATOR_MEMORY_CALLBACK = fn( Context: ?*anyopaque, MemoryAccess: ?*WHV_EMULATOR_MEMORY_ACCESS_INFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const WHV_EMULATOR_GET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK = fn( Context: ?*anyopaque, RegisterNames: [*]const WHV_REGISTER_NAME, RegisterCount: u32, RegisterValues: [*]WHV_REGISTER_VALUE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const WHV_EMULATOR_SET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK = fn( Context: ?*anyopaque, RegisterNames: [*]const WHV_REGISTER_NAME, RegisterCount: u32, RegisterValues: [*]const WHV_REGISTER_VALUE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const WHV_EMULATOR_TRANSLATE_GVA_PAGE_CALLBACK = fn( Context: ?*anyopaque, Gva: u64, TranslateFlags: WHV_TRANSLATE_GVA_FLAGS, TranslationResult: ?*WHV_TRANSLATE_GVA_RESULT_CODE, Gpa: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const WHV_EMULATOR_CALLBACKS = extern struct { Size: u32, Reserved: u32, WHvEmulatorIoPortCallback: ?WHV_EMULATOR_IO_PORT_CALLBACK, WHvEmulatorMemoryCallback: ?WHV_EMULATOR_MEMORY_CALLBACK, WHvEmulatorGetVirtualProcessorRegisters: ?WHV_EMULATOR_GET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK, WHvEmulatorSetVirtualProcessorRegisters: ?WHV_EMULATOR_SET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK, WHvEmulatorTranslateGvaPage: ?WHV_EMULATOR_TRANSLATE_GVA_PAGE_CALLBACK, }; pub const SOCKADDR_HV = extern struct { Family: u16, Reserved: u16, VmId: Guid, ServiceId: Guid, }; pub const HVSOCKET_ADDRESS_INFO = extern struct { SystemId: Guid, VirtualMachineId: Guid, SiloId: Guid, Flags: u32, }; pub const VM_GENCOUNTER = extern struct { GenerationCount: u64, GenerationCountHigh: u64, }; pub const HDV_DEVICE_TYPE = enum(i32) { Undefined = 0, PCI = 1, }; pub const HdvDeviceTypeUndefined = HDV_DEVICE_TYPE.Undefined; pub const HdvDeviceTypePCI = HDV_DEVICE_TYPE.PCI; pub const HDV_PCI_PNP_ID = extern struct { VendorID: u16, DeviceID: u16, RevisionID: u8, ProgIf: u8, SubClass: u8, BaseClass: u8, SubVendorID: u16, SubSystemID: u16, }; pub const HDV_PCI_BAR_SELECTOR = enum(i32) { @"0" = 0, @"1" = 1, @"2" = 2, @"3" = 3, @"4" = 4, @"5" = 5, }; pub const HDV_PCI_BAR0 = HDV_PCI_BAR_SELECTOR.@"0"; pub const HDV_PCI_BAR1 = HDV_PCI_BAR_SELECTOR.@"1"; pub const HDV_PCI_BAR2 = HDV_PCI_BAR_SELECTOR.@"2"; pub const HDV_PCI_BAR3 = HDV_PCI_BAR_SELECTOR.@"3"; pub const HDV_PCI_BAR4 = HDV_PCI_BAR_SELECTOR.@"4"; pub const HDV_PCI_BAR5 = HDV_PCI_BAR_SELECTOR.@"5"; pub const HDV_DOORBELL_FLAGS = enum(i32) { SIZE_ANY = 0, SIZE_BYTE = 1, SIZE_WORD = 2, SIZE_DWORD = 3, SIZE_QWORD = 4, ANY_VALUE = -2147483648, }; pub const HDV_DOORBELL_FLAG_TRIGGER_SIZE_ANY = HDV_DOORBELL_FLAGS.SIZE_ANY; pub const HDV_DOORBELL_FLAG_TRIGGER_SIZE_BYTE = HDV_DOORBELL_FLAGS.SIZE_BYTE; pub const HDV_DOORBELL_FLAG_TRIGGER_SIZE_WORD = HDV_DOORBELL_FLAGS.SIZE_WORD; pub const HDV_DOORBELL_FLAG_TRIGGER_SIZE_DWORD = HDV_DOORBELL_FLAGS.SIZE_DWORD; pub const HDV_DOORBELL_FLAG_TRIGGER_SIZE_QWORD = HDV_DOORBELL_FLAGS.SIZE_QWORD; pub const HDV_DOORBELL_FLAG_TRIGGER_ANY_VALUE = HDV_DOORBELL_FLAGS.ANY_VALUE; pub const HDV_MMIO_MAPPING_FLAGS = enum(u32) { None = 0, Writeable = 1, Executable = 2, _, pub fn initFlags(o: struct { None: u1 = 0, Writeable: u1 = 0, Executable: u1 = 0, }) HDV_MMIO_MAPPING_FLAGS { return @intToEnum(HDV_MMIO_MAPPING_FLAGS, (if (o.None == 1) @enumToInt(HDV_MMIO_MAPPING_FLAGS.None) else 0) | (if (o.Writeable == 1) @enumToInt(HDV_MMIO_MAPPING_FLAGS.Writeable) else 0) | (if (o.Executable == 1) @enumToInt(HDV_MMIO_MAPPING_FLAGS.Executable) else 0) ); } }; pub const HdvMmioMappingFlagNone = HDV_MMIO_MAPPING_FLAGS.None; pub const HdvMmioMappingFlagWriteable = HDV_MMIO_MAPPING_FLAGS.Writeable; pub const HdvMmioMappingFlagExecutable = HDV_MMIO_MAPPING_FLAGS.Executable; pub const HDV_PCI_DEVICE_INITIALIZE = fn( deviceContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_DEVICE_TEARDOWN = fn( deviceContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const HDV_PCI_DEVICE_SET_CONFIGURATION = fn( deviceContext: ?*anyopaque, configurationValueCount: u32, configurationValues: [*]const ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_DEVICE_GET_DETAILS = fn( deviceContext: ?*anyopaque, pnpId: ?*HDV_PCI_PNP_ID, probedBarsCount: u32, probedBars: [*]u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_DEVICE_START = fn( deviceContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_DEVICE_STOP = fn( deviceContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const HDV_PCI_READ_CONFIG_SPACE = fn( deviceContext: ?*anyopaque, offset: u32, value: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_WRITE_CONFIG_SPACE = fn( deviceContext: ?*anyopaque, offset: u32, value: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_READ_INTERCEPTED_MEMORY = fn( deviceContext: ?*anyopaque, barIndex: HDV_PCI_BAR_SELECTOR, offset: u64, length: u64, value: [*:0]u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_WRITE_INTERCEPTED_MEMORY = fn( deviceContext: ?*anyopaque, barIndex: HDV_PCI_BAR_SELECTOR, offset: u64, length: u64, value: [*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const HDV_PCI_INTERFACE_VERSION = enum(i32) { Invalid = 0, @"1" = 1, }; pub const HdvPciDeviceInterfaceVersionInvalid = HDV_PCI_INTERFACE_VERSION.Invalid; pub const HdvPciDeviceInterfaceVersion1 = HDV_PCI_INTERFACE_VERSION.@"1"; pub const HDV_PCI_DEVICE_INTERFACE = extern struct { Version: HDV_PCI_INTERFACE_VERSION, Initialize: ?HDV_PCI_DEVICE_INITIALIZE, Teardown: ?HDV_PCI_DEVICE_TEARDOWN, SetConfiguration: ?HDV_PCI_DEVICE_SET_CONFIGURATION, GetDetails: ?HDV_PCI_DEVICE_GET_DETAILS, Start: ?HDV_PCI_DEVICE_START, Stop: ?HDV_PCI_DEVICE_STOP, ReadConfigSpace: ?HDV_PCI_READ_CONFIG_SPACE, WriteConfigSpace: ?HDV_PCI_WRITE_CONFIG_SPACE, ReadInterceptedMemory: ?HDV_PCI_READ_INTERCEPTED_MEMORY, WriteInterceptedMemory: ?HDV_PCI_WRITE_INTERCEPTED_MEMORY, }; pub const PAGING_MODE = enum(i32) { Invalid = 0, NonPaged = 1, @"32Bit" = 2, Pae = 3, Long = 4, Armv8 = 5, }; pub const Paging_Invalid = PAGING_MODE.Invalid; pub const Paging_NonPaged = PAGING_MODE.NonPaged; pub const Paging_32Bit = PAGING_MODE.@"32Bit"; pub const Paging_Pae = PAGING_MODE.Pae; pub const Paging_Long = PAGING_MODE.Long; pub const Paging_Armv8 = PAGING_MODE.Armv8; pub const GPA_MEMORY_CHUNK = extern struct { GuestPhysicalStartPageIndex: u64, PageCount: u64, }; pub const VIRTUAL_PROCESSOR_ARCH = enum(i32) { Unknown = 0, x86 = 1, x64 = 2, Armv8 = 3, }; pub const Arch_Unknown = VIRTUAL_PROCESSOR_ARCH.Unknown; pub const Arch_x86 = VIRTUAL_PROCESSOR_ARCH.x86; pub const Arch_x64 = VIRTUAL_PROCESSOR_ARCH.x64; pub const Arch_Armv8 = VIRTUAL_PROCESSOR_ARCH.Armv8; pub const VIRTUAL_PROCESSOR_VENDOR = enum(i32) { Unknown = 0, Amd = 1, Intel = 2, Hygon = 3, Arm = 4, }; pub const ProcessorVendor_Unknown = VIRTUAL_PROCESSOR_VENDOR.Unknown; pub const ProcessorVendor_Amd = VIRTUAL_PROCESSOR_VENDOR.Amd; pub const ProcessorVendor_Intel = VIRTUAL_PROCESSOR_VENDOR.Intel; pub const ProcessorVendor_Hygon = VIRTUAL_PROCESSOR_VENDOR.Hygon; pub const ProcessorVendor_Arm = VIRTUAL_PROCESSOR_VENDOR.Arm; pub const GUEST_OS_VENDOR = enum(i32) { Undefined = 0, Microsoft = 1, HPE = 2, LANCOM = 512, }; pub const GuestOsVendorUndefined = GUEST_OS_VENDOR.Undefined; pub const GuestOsVendorMicrosoft = GUEST_OS_VENDOR.Microsoft; pub const GuestOsVendorHPE = GUEST_OS_VENDOR.HPE; pub const GuestOsVendorLANCOM = GUEST_OS_VENDOR.LANCOM; pub const GUEST_OS_MICROSOFT_IDS = enum(i32) { Undefined = 0, MSDOS = 1, Windows3x = 2, Windows9x = 3, WindowsNT = 4, WindowsCE = 5, }; pub const GuestOsMicrosoftUndefined = GUEST_OS_MICROSOFT_IDS.Undefined; pub const GuestOsMicrosoftMSDOS = GUEST_OS_MICROSOFT_IDS.MSDOS; pub const GuestOsMicrosoftWindows3x = GUEST_OS_MICROSOFT_IDS.Windows3x; pub const GuestOsMicrosoftWindows9x = GUEST_OS_MICROSOFT_IDS.Windows9x; pub const GuestOsMicrosoftWindowsNT = GUEST_OS_MICROSOFT_IDS.WindowsNT; pub const GuestOsMicrosoftWindowsCE = GUEST_OS_MICROSOFT_IDS.WindowsCE; pub const GUEST_OS_OPENSOURCE_IDS = enum(i32) { Undefined = 0, Linux = 1, FreeBSD = 2, Xen = 3, Illumos = 4, }; pub const GuestOsOpenSourceUndefined = GUEST_OS_OPENSOURCE_IDS.Undefined; pub const GuestOsOpenSourceLinux = GUEST_OS_OPENSOURCE_IDS.Linux; pub const GuestOsOpenSourceFreeBSD = GUEST_OS_OPENSOURCE_IDS.FreeBSD; pub const GuestOsOpenSourceXen = GUEST_OS_OPENSOURCE_IDS.Xen; pub const GuestOsOpenSourceIllumos = GUEST_OS_OPENSOURCE_IDS.Illumos; pub const GUEST_OS_INFO = extern union { AsUINT64: u64, ClosedSource: extern struct { _bitfield: u64, }, OpenSource: extern struct { _bitfield: u64, }, }; pub const REGISTER_ID = enum(i32) { X64_RegisterRax = 0, X64_RegisterRcx = 1, X64_RegisterRdx = 2, X64_RegisterRbx = 3, X64_RegisterRsp = 4, X64_RegisterRbp = 5, X64_RegisterRsi = 6, X64_RegisterRdi = 7, X64_RegisterR8 = 8, X64_RegisterR9 = 9, X64_RegisterR10 = 10, X64_RegisterR11 = 11, X64_RegisterR12 = 12, X64_RegisterR13 = 13, X64_RegisterR14 = 14, X64_RegisterR15 = 15, X64_RegisterRip = 16, X64_RegisterRFlags = 17, X64_RegisterXmm0 = 18, X64_RegisterXmm1 = 19, X64_RegisterXmm2 = 20, X64_RegisterXmm3 = 21, X64_RegisterXmm4 = 22, X64_RegisterXmm5 = 23, X64_RegisterXmm6 = 24, X64_RegisterXmm7 = 25, X64_RegisterXmm8 = 26, X64_RegisterXmm9 = 27, X64_RegisterXmm10 = 28, X64_RegisterXmm11 = 29, X64_RegisterXmm12 = 30, X64_RegisterXmm13 = 31, X64_RegisterXmm14 = 32, X64_RegisterXmm15 = 33, X64_RegisterFpMmx0 = 34, X64_RegisterFpMmx1 = 35, X64_RegisterFpMmx2 = 36, X64_RegisterFpMmx3 = 37, X64_RegisterFpMmx4 = 38, X64_RegisterFpMmx5 = 39, X64_RegisterFpMmx6 = 40, X64_RegisterFpMmx7 = 41, X64_RegisterFpControlStatus = 42, X64_RegisterXmmControlStatus = 43, X64_RegisterCr0 = 44, X64_RegisterCr2 = 45, X64_RegisterCr3 = 46, X64_RegisterCr4 = 47, X64_RegisterCr8 = 48, X64_RegisterEfer = 49, X64_RegisterDr0 = 50, X64_RegisterDr1 = 51, X64_RegisterDr2 = 52, X64_RegisterDr3 = 53, X64_RegisterDr6 = 54, X64_RegisterDr7 = 55, X64_RegisterEs = 56, X64_RegisterCs = 57, X64_RegisterSs = 58, X64_RegisterDs = 59, X64_RegisterFs = 60, X64_RegisterGs = 61, X64_RegisterLdtr = 62, X64_RegisterTr = 63, X64_RegisterIdtr = 64, X64_RegisterGdtr = 65, X64_RegisterMax = 66, ARM64_RegisterX0 = 67, ARM64_RegisterX1 = 68, ARM64_RegisterX2 = 69, ARM64_RegisterX3 = 70, ARM64_RegisterX4 = 71, ARM64_RegisterX5 = 72, ARM64_RegisterX6 = 73, ARM64_RegisterX7 = 74, ARM64_RegisterX8 = 75, ARM64_RegisterX9 = 76, ARM64_RegisterX10 = 77, ARM64_RegisterX11 = 78, ARM64_RegisterX12 = 79, ARM64_RegisterX13 = 80, ARM64_RegisterX14 = 81, ARM64_RegisterX15 = 82, ARM64_RegisterX16 = 83, ARM64_RegisterX17 = 84, ARM64_RegisterX18 = 85, ARM64_RegisterX19 = 86, ARM64_RegisterX20 = 87, ARM64_RegisterX21 = 88, ARM64_RegisterX22 = 89, ARM64_RegisterX23 = 90, ARM64_RegisterX24 = 91, ARM64_RegisterX25 = 92, ARM64_RegisterX26 = 93, ARM64_RegisterX27 = 94, ARM64_RegisterX28 = 95, ARM64_RegisterXFp = 96, ARM64_RegisterXLr = 97, ARM64_RegisterPc = 98, ARM64_RegisterSpEl0 = 99, ARM64_RegisterSpEl1 = 100, ARM64_RegisterCpsr = 101, ARM64_RegisterQ0 = 102, ARM64_RegisterQ1 = 103, ARM64_RegisterQ2 = 104, ARM64_RegisterQ3 = 105, ARM64_RegisterQ4 = 106, ARM64_RegisterQ5 = 107, ARM64_RegisterQ6 = 108, ARM64_RegisterQ7 = 109, ARM64_RegisterQ8 = 110, ARM64_RegisterQ9 = 111, ARM64_RegisterQ10 = 112, ARM64_RegisterQ11 = 113, ARM64_RegisterQ12 = 114, ARM64_RegisterQ13 = 115, ARM64_RegisterQ14 = 116, ARM64_RegisterQ15 = 117, ARM64_RegisterQ16 = 118, ARM64_RegisterQ17 = 119, ARM64_RegisterQ18 = 120, ARM64_RegisterQ19 = 121, ARM64_RegisterQ20 = 122, ARM64_RegisterQ21 = 123, ARM64_RegisterQ22 = 124, ARM64_RegisterQ23 = 125, ARM64_RegisterQ24 = 126, ARM64_RegisterQ25 = 127, ARM64_RegisterQ26 = 128, ARM64_RegisterQ27 = 129, ARM64_RegisterQ28 = 130, ARM64_RegisterQ29 = 131, ARM64_RegisterQ30 = 132, ARM64_RegisterQ31 = 133, ARM64_RegisterFpStatus = 134, ARM64_RegisterFpControl = 135, ARM64_RegisterEsrEl1 = 136, ARM64_RegisterSpsrEl1 = 137, ARM64_RegisterFarEl1 = 138, ARM64_RegisterParEl1 = 139, ARM64_RegisterElrEl1 = 140, ARM64_RegisterTtbr0El1 = 141, ARM64_RegisterTtbr1El1 = 142, ARM64_RegisterVbarEl1 = 143, ARM64_RegisterSctlrEl1 = 144, ARM64_RegisterActlrEl1 = 145, ARM64_RegisterTcrEl1 = 146, ARM64_RegisterMairEl1 = 147, ARM64_RegisterAmairEl1 = 148, ARM64_RegisterTpidrEl0 = 149, ARM64_RegisterTpidrroEl0 = 150, ARM64_RegisterTpidrEl1 = 151, ARM64_RegisterContextIdrEl1 = 152, ARM64_RegisterCpacrEl1 = 153, ARM64_RegisterCsselrEl1 = 154, ARM64_RegisterCntkctlEl1 = 155, ARM64_RegisterCntvCvalEl0 = 156, ARM64_RegisterCntvCtlEl0 = 157, ARM64_RegisterMax = 158, }; pub const X64_RegisterRax = REGISTER_ID.X64_RegisterRax; pub const X64_RegisterRcx = REGISTER_ID.X64_RegisterRcx; pub const X64_RegisterRdx = REGISTER_ID.X64_RegisterRdx; pub const X64_RegisterRbx = REGISTER_ID.X64_RegisterRbx; pub const X64_RegisterRsp = REGISTER_ID.X64_RegisterRsp; pub const X64_RegisterRbp = REGISTER_ID.X64_RegisterRbp; pub const X64_RegisterRsi = REGISTER_ID.X64_RegisterRsi; pub const X64_RegisterRdi = REGISTER_ID.X64_RegisterRdi; pub const X64_RegisterR8 = REGISTER_ID.X64_RegisterR8; pub const X64_RegisterR9 = REGISTER_ID.X64_RegisterR9; pub const X64_RegisterR10 = REGISTER_ID.X64_RegisterR10; pub const X64_RegisterR11 = REGISTER_ID.X64_RegisterR11; pub const X64_RegisterR12 = REGISTER_ID.X64_RegisterR12; pub const X64_RegisterR13 = REGISTER_ID.X64_RegisterR13; pub const X64_RegisterR14 = REGISTER_ID.X64_RegisterR14; pub const X64_RegisterR15 = REGISTER_ID.X64_RegisterR15; pub const X64_RegisterRip = REGISTER_ID.X64_RegisterRip; pub const X64_RegisterRFlags = REGISTER_ID.X64_RegisterRFlags; pub const X64_RegisterXmm0 = REGISTER_ID.X64_RegisterXmm0; pub const X64_RegisterXmm1 = REGISTER_ID.X64_RegisterXmm1; pub const X64_RegisterXmm2 = REGISTER_ID.X64_RegisterXmm2; pub const X64_RegisterXmm3 = REGISTER_ID.X64_RegisterXmm3; pub const X64_RegisterXmm4 = REGISTER_ID.X64_RegisterXmm4; pub const X64_RegisterXmm5 = REGISTER_ID.X64_RegisterXmm5; pub const X64_RegisterXmm6 = REGISTER_ID.X64_RegisterXmm6; pub const X64_RegisterXmm7 = REGISTER_ID.X64_RegisterXmm7; pub const X64_RegisterXmm8 = REGISTER_ID.X64_RegisterXmm8; pub const X64_RegisterXmm9 = REGISTER_ID.X64_RegisterXmm9; pub const X64_RegisterXmm10 = REGISTER_ID.X64_RegisterXmm10; pub const X64_RegisterXmm11 = REGISTER_ID.X64_RegisterXmm11; pub const X64_RegisterXmm12 = REGISTER_ID.X64_RegisterXmm12; pub const X64_RegisterXmm13 = REGISTER_ID.X64_RegisterXmm13; pub const X64_RegisterXmm14 = REGISTER_ID.X64_RegisterXmm14; pub const X64_RegisterXmm15 = REGISTER_ID.X64_RegisterXmm15; pub const X64_RegisterFpMmx0 = REGISTER_ID.X64_RegisterFpMmx0; pub const X64_RegisterFpMmx1 = REGISTER_ID.X64_RegisterFpMmx1; pub const X64_RegisterFpMmx2 = REGISTER_ID.X64_RegisterFpMmx2; pub const X64_RegisterFpMmx3 = REGISTER_ID.X64_RegisterFpMmx3; pub const X64_RegisterFpMmx4 = REGISTER_ID.X64_RegisterFpMmx4; pub const X64_RegisterFpMmx5 = REGISTER_ID.X64_RegisterFpMmx5; pub const X64_RegisterFpMmx6 = REGISTER_ID.X64_RegisterFpMmx6; pub const X64_RegisterFpMmx7 = REGISTER_ID.X64_RegisterFpMmx7; pub const X64_RegisterFpControlStatus = REGISTER_ID.X64_RegisterFpControlStatus; pub const X64_RegisterXmmControlStatus = REGISTER_ID.X64_RegisterXmmControlStatus; pub const X64_RegisterCr0 = REGISTER_ID.X64_RegisterCr0; pub const X64_RegisterCr2 = REGISTER_ID.X64_RegisterCr2; pub const X64_RegisterCr3 = REGISTER_ID.X64_RegisterCr3; pub const X64_RegisterCr4 = REGISTER_ID.X64_RegisterCr4; pub const X64_RegisterCr8 = REGISTER_ID.X64_RegisterCr8; pub const X64_RegisterEfer = REGISTER_ID.X64_RegisterEfer; pub const X64_RegisterDr0 = REGISTER_ID.X64_RegisterDr0; pub const X64_RegisterDr1 = REGISTER_ID.X64_RegisterDr1; pub const X64_RegisterDr2 = REGISTER_ID.X64_RegisterDr2; pub const X64_RegisterDr3 = REGISTER_ID.X64_RegisterDr3; pub const X64_RegisterDr6 = REGISTER_ID.X64_RegisterDr6; pub const X64_RegisterDr7 = REGISTER_ID.X64_RegisterDr7; pub const X64_RegisterEs = REGISTER_ID.X64_RegisterEs; pub const X64_RegisterCs = REGISTER_ID.X64_RegisterCs; pub const X64_RegisterSs = REGISTER_ID.X64_RegisterSs; pub const X64_RegisterDs = REGISTER_ID.X64_RegisterDs; pub const X64_RegisterFs = REGISTER_ID.X64_RegisterFs; pub const X64_RegisterGs = REGISTER_ID.X64_RegisterGs; pub const X64_RegisterLdtr = REGISTER_ID.X64_RegisterLdtr; pub const X64_RegisterTr = REGISTER_ID.X64_RegisterTr; pub const X64_RegisterIdtr = REGISTER_ID.X64_RegisterIdtr; pub const X64_RegisterGdtr = REGISTER_ID.X64_RegisterGdtr; pub const X64_RegisterMax = REGISTER_ID.X64_RegisterMax; pub const ARM64_RegisterX0 = REGISTER_ID.ARM64_RegisterX0; pub const ARM64_RegisterX1 = REGISTER_ID.ARM64_RegisterX1; pub const ARM64_RegisterX2 = REGISTER_ID.ARM64_RegisterX2; pub const ARM64_RegisterX3 = REGISTER_ID.ARM64_RegisterX3; pub const ARM64_RegisterX4 = REGISTER_ID.ARM64_RegisterX4; pub const ARM64_RegisterX5 = REGISTER_ID.ARM64_RegisterX5; pub const ARM64_RegisterX6 = REGISTER_ID.ARM64_RegisterX6; pub const ARM64_RegisterX7 = REGISTER_ID.ARM64_RegisterX7; pub const ARM64_RegisterX8 = REGISTER_ID.ARM64_RegisterX8; pub const ARM64_RegisterX9 = REGISTER_ID.ARM64_RegisterX9; pub const ARM64_RegisterX10 = REGISTER_ID.ARM64_RegisterX10; pub const ARM64_RegisterX11 = REGISTER_ID.ARM64_RegisterX11; pub const ARM64_RegisterX12 = REGISTER_ID.ARM64_RegisterX12; pub const ARM64_RegisterX13 = REGISTER_ID.ARM64_RegisterX13; pub const ARM64_RegisterX14 = REGISTER_ID.ARM64_RegisterX14; pub const ARM64_RegisterX15 = REGISTER_ID.ARM64_RegisterX15; pub const ARM64_RegisterX16 = REGISTER_ID.ARM64_RegisterX16; pub const ARM64_RegisterX17 = REGISTER_ID.ARM64_RegisterX17; pub const ARM64_RegisterX18 = REGISTER_ID.ARM64_RegisterX18; pub const ARM64_RegisterX19 = REGISTER_ID.ARM64_RegisterX19; pub const ARM64_RegisterX20 = REGISTER_ID.ARM64_RegisterX20; pub const ARM64_RegisterX21 = REGISTER_ID.ARM64_RegisterX21; pub const ARM64_RegisterX22 = REGISTER_ID.ARM64_RegisterX22; pub const ARM64_RegisterX23 = REGISTER_ID.ARM64_RegisterX23; pub const ARM64_RegisterX24 = REGISTER_ID.ARM64_RegisterX24; pub const ARM64_RegisterX25 = REGISTER_ID.ARM64_RegisterX25; pub const ARM64_RegisterX26 = REGISTER_ID.ARM64_RegisterX26; pub const ARM64_RegisterX27 = REGISTER_ID.ARM64_RegisterX27; pub const ARM64_RegisterX28 = REGISTER_ID.ARM64_RegisterX28; pub const ARM64_RegisterXFp = REGISTER_ID.ARM64_RegisterXFp; pub const ARM64_RegisterXLr = REGISTER_ID.ARM64_RegisterXLr; pub const ARM64_RegisterPc = REGISTER_ID.ARM64_RegisterPc; pub const ARM64_RegisterSpEl0 = REGISTER_ID.ARM64_RegisterSpEl0; pub const ARM64_RegisterSpEl1 = REGISTER_ID.ARM64_RegisterSpEl1; pub const ARM64_RegisterCpsr = REGISTER_ID.ARM64_RegisterCpsr; pub const ARM64_RegisterQ0 = REGISTER_ID.ARM64_RegisterQ0; pub const ARM64_RegisterQ1 = REGISTER_ID.ARM64_RegisterQ1; pub const ARM64_RegisterQ2 = REGISTER_ID.ARM64_RegisterQ2; pub const ARM64_RegisterQ3 = REGISTER_ID.ARM64_RegisterQ3; pub const ARM64_RegisterQ4 = REGISTER_ID.ARM64_RegisterQ4; pub const ARM64_RegisterQ5 = REGISTER_ID.ARM64_RegisterQ5; pub const ARM64_RegisterQ6 = REGISTER_ID.ARM64_RegisterQ6; pub const ARM64_RegisterQ7 = REGISTER_ID.ARM64_RegisterQ7; pub const ARM64_RegisterQ8 = REGISTER_ID.ARM64_RegisterQ8; pub const ARM64_RegisterQ9 = REGISTER_ID.ARM64_RegisterQ9; pub const ARM64_RegisterQ10 = REGISTER_ID.ARM64_RegisterQ10; pub const ARM64_RegisterQ11 = REGISTER_ID.ARM64_RegisterQ11; pub const ARM64_RegisterQ12 = REGISTER_ID.ARM64_RegisterQ12; pub const ARM64_RegisterQ13 = REGISTER_ID.ARM64_RegisterQ13; pub const ARM64_RegisterQ14 = REGISTER_ID.ARM64_RegisterQ14; pub const ARM64_RegisterQ15 = REGISTER_ID.ARM64_RegisterQ15; pub const ARM64_RegisterQ16 = REGISTER_ID.ARM64_RegisterQ16; pub const ARM64_RegisterQ17 = REGISTER_ID.ARM64_RegisterQ17; pub const ARM64_RegisterQ18 = REGISTER_ID.ARM64_RegisterQ18; pub const ARM64_RegisterQ19 = REGISTER_ID.ARM64_RegisterQ19; pub const ARM64_RegisterQ20 = REGISTER_ID.ARM64_RegisterQ20; pub const ARM64_RegisterQ21 = REGISTER_ID.ARM64_RegisterQ21; pub const ARM64_RegisterQ22 = REGISTER_ID.ARM64_RegisterQ22; pub const ARM64_RegisterQ23 = REGISTER_ID.ARM64_RegisterQ23; pub const ARM64_RegisterQ24 = REGISTER_ID.ARM64_RegisterQ24; pub const ARM64_RegisterQ25 = REGISTER_ID.ARM64_RegisterQ25; pub const ARM64_RegisterQ26 = REGISTER_ID.ARM64_RegisterQ26; pub const ARM64_RegisterQ27 = REGISTER_ID.ARM64_RegisterQ27; pub const ARM64_RegisterQ28 = REGISTER_ID.ARM64_RegisterQ28; pub const ARM64_RegisterQ29 = REGISTER_ID.ARM64_RegisterQ29; pub const ARM64_RegisterQ30 = REGISTER_ID.ARM64_RegisterQ30; pub const ARM64_RegisterQ31 = REGISTER_ID.ARM64_RegisterQ31; pub const ARM64_RegisterFpStatus = REGISTER_ID.ARM64_RegisterFpStatus; pub const ARM64_RegisterFpControl = REGISTER_ID.ARM64_RegisterFpControl; pub const ARM64_RegisterEsrEl1 = REGISTER_ID.ARM64_RegisterEsrEl1; pub const ARM64_RegisterSpsrEl1 = REGISTER_ID.ARM64_RegisterSpsrEl1; pub const ARM64_RegisterFarEl1 = REGISTER_ID.ARM64_RegisterFarEl1; pub const ARM64_RegisterParEl1 = REGISTER_ID.ARM64_RegisterParEl1; pub const ARM64_RegisterElrEl1 = REGISTER_ID.ARM64_RegisterElrEl1; pub const ARM64_RegisterTtbr0El1 = REGISTER_ID.ARM64_RegisterTtbr0El1; pub const ARM64_RegisterTtbr1El1 = REGISTER_ID.ARM64_RegisterTtbr1El1; pub const ARM64_RegisterVbarEl1 = REGISTER_ID.ARM64_RegisterVbarEl1; pub const ARM64_RegisterSctlrEl1 = REGISTER_ID.ARM64_RegisterSctlrEl1; pub const ARM64_RegisterActlrEl1 = REGISTER_ID.ARM64_RegisterActlrEl1; pub const ARM64_RegisterTcrEl1 = REGISTER_ID.ARM64_RegisterTcrEl1; pub const ARM64_RegisterMairEl1 = REGISTER_ID.ARM64_RegisterMairEl1; pub const ARM64_RegisterAmairEl1 = REGISTER_ID.ARM64_RegisterAmairEl1; pub const ARM64_RegisterTpidrEl0 = REGISTER_ID.ARM64_RegisterTpidrEl0; pub const ARM64_RegisterTpidrroEl0 = REGISTER_ID.ARM64_RegisterTpidrroEl0; pub const ARM64_RegisterTpidrEl1 = REGISTER_ID.ARM64_RegisterTpidrEl1; pub const ARM64_RegisterContextIdrEl1 = REGISTER_ID.ARM64_RegisterContextIdrEl1; pub const ARM64_RegisterCpacrEl1 = REGISTER_ID.ARM64_RegisterCpacrEl1; pub const ARM64_RegisterCsselrEl1 = REGISTER_ID.ARM64_RegisterCsselrEl1; pub const ARM64_RegisterCntkctlEl1 = REGISTER_ID.ARM64_RegisterCntkctlEl1; pub const ARM64_RegisterCntvCvalEl0 = REGISTER_ID.ARM64_RegisterCntvCvalEl0; pub const ARM64_RegisterCntvCtlEl0 = REGISTER_ID.ARM64_RegisterCntvCtlEl0; pub const ARM64_RegisterMax = REGISTER_ID.ARM64_RegisterMax; pub const VIRTUAL_PROCESSOR_REGISTER = extern union { Reg64: u64, Reg32: u32, Reg16: u16, Reg8: u8, Reg128: extern struct { Low64: u64, High64: u64, }, X64: extern union { Segment: extern struct { Base: u64, Limit: u32, Selector: u16, Anonymous: extern union { Attributes: u16, Anonymous: extern struct { _bitfield: u16, }, }, }, Table: extern struct { Limit: u16, Base: u64, }, FpControlStatus: extern struct { FpControl: u16, FpStatus: u16, FpTag: u8, Reserved: u8, LastFpOp: u16, Anonymous: extern union { LastFpRip: u64, Anonymous: extern struct { LastFpEip: u32, LastFpCs: u16, }, }, }, XmmControlStatus: extern struct { Anonymous: extern union { LastFpRdp: u64, Anonymous: extern struct { LastFpDp: u32, LastFpDs: u16, }, }, XmmStatusControl: u32, XmmStatusControlMask: u32, }, }, }; pub const DOS_IMAGE_INFO = extern struct { PdbName: ?[*:0]const u8, ImageBaseAddress: u64, ImageSize: u32, Timestamp: u32, }; pub const GUEST_SYMBOLS_PROVIDER_DEBUG_INFO_CALLBACK = fn( InfoMessage: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) void; pub const FOUND_IMAGE_CALLBACK = fn( Context: ?*anyopaque, ImageInfo: ?*DOS_IMAGE_INFO, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const MODULE_INFO = extern struct { ProcessImageName: ?[*:0]const u8, Image: DOS_IMAGE_INFO, }; //-------------------------------------------------------------------------------- // Section: Functions (125) //-------------------------------------------------------------------------------- pub extern "WinHvPlatform" fn WHvGetCapability( CapabilityCode: WHV_CAPABILITY_CODE, // TODO: what to do with BytesParamIndex 2? CapabilityBuffer: ?*anyopaque, CapabilityBufferSizeInBytes: u32, WrittenSizeInBytes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCreatePartition( Partition: ?*WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetupPartition( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvResetPartition( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvDeletePartition( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetPartitionProperty( Partition: WHV_PARTITION_HANDLE, PropertyCode: WHV_PARTITION_PROPERTY_CODE, // TODO: what to do with BytesParamIndex 3? PropertyBuffer: ?*anyopaque, PropertyBufferSizeInBytes: u32, WrittenSizeInBytes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetPartitionProperty( Partition: WHV_PARTITION_HANDLE, PropertyCode: WHV_PARTITION_PROPERTY_CODE, // TODO: what to do with BytesParamIndex 3? PropertyBuffer: ?*const anyopaque, PropertyBufferSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSuspendPartitionTime( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvResumePartitionTime( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvMapGpaRange( Partition: WHV_PARTITION_HANDLE, SourceAddress: ?*anyopaque, GuestAddress: u64, SizeInBytes: u64, Flags: WHV_MAP_GPA_RANGE_FLAGS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvMapGpaRange2( Partition: WHV_PARTITION_HANDLE, Process: ?HANDLE, SourceAddress: ?*anyopaque, GuestAddress: u64, SizeInBytes: u64, Flags: WHV_MAP_GPA_RANGE_FLAGS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvUnmapGpaRange( Partition: WHV_PARTITION_HANDLE, GuestAddress: u64, SizeInBytes: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvTranslateGva( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, Gva: u64, TranslateFlags: WHV_TRANSLATE_GVA_FLAGS, TranslationResult: ?*WHV_TRANSLATE_GVA_RESULT, Gpa: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCreateVirtualProcessor( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCreateVirtualProcessor2( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, Properties: [*]const WHV_VIRTUAL_PROCESSOR_PROPERTY, PropertyCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvDeleteVirtualProcessor( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvRunVirtualProcessor( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? ExitContext: ?*anyopaque, ExitContextSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCancelRunVirtualProcessor( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorRegisters( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, RegisterNames: [*]const WHV_REGISTER_NAME, RegisterCount: u32, RegisterValues: [*]WHV_REGISTER_VALUE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetVirtualProcessorRegisters( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, RegisterNames: [*]const WHV_REGISTER_NAME, RegisterCount: u32, RegisterValues: [*]const WHV_REGISTER_VALUE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorInterruptControllerState( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? State: ?*anyopaque, StateSize: u32, WrittenSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetVirtualProcessorInterruptControllerState( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? State: ?*const anyopaque, StateSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvRequestInterrupt( Partition: WHV_PARTITION_HANDLE, Interrupt: ?*const WHV_INTERRUPT_CONTROL, InterruptControlSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorXsaveState( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? Buffer: ?*anyopaque, BufferSizeInBytes: u32, BytesWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetVirtualProcessorXsaveState( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? Buffer: ?*const anyopaque, BufferSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvQueryGpaRangeDirtyBitmap( Partition: WHV_PARTITION_HANDLE, GuestAddress: u64, RangeSizeInBytes: u64, // TODO: what to do with BytesParamIndex 4? Bitmap: ?*u64, BitmapSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetPartitionCounters( Partition: WHV_PARTITION_HANDLE, CounterSet: WHV_PARTITION_COUNTER_SET, // TODO: what to do with BytesParamIndex 3? Buffer: ?*anyopaque, BufferSizeInBytes: u32, BytesWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorCounters( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, CounterSet: WHV_PROCESSOR_COUNTER_SET, // TODO: what to do with BytesParamIndex 4? Buffer: ?*anyopaque, BufferSizeInBytes: u32, BytesWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorInterruptControllerState2( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? State: ?*anyopaque, StateSize: u32, WrittenSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetVirtualProcessorInterruptControllerState2( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, // TODO: what to do with BytesParamIndex 3? State: ?*const anyopaque, StateSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvRegisterPartitionDoorbellEvent( Partition: WHV_PARTITION_HANDLE, MatchData: ?*const WHV_DOORBELL_MATCH_DATA, EventHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvUnregisterPartitionDoorbellEvent( Partition: WHV_PARTITION_HANDLE, MatchData: ?*const WHV_DOORBELL_MATCH_DATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvAdviseGpaRange( Partition: WHV_PARTITION_HANDLE, GpaRanges: [*]const WHV_MEMORY_RANGE_ENTRY, GpaRangesCount: u32, Advice: WHV_ADVISE_GPA_RANGE_CODE, // TODO: what to do with BytesParamIndex 5? AdviceBuffer: ?*const anyopaque, AdviceBufferSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvReadGpaRange( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, GuestAddress: u64, Controls: WHV_ACCESS_GPA_CONTROLS, // TODO: what to do with BytesParamIndex 5? Data: ?*anyopaque, DataSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvWriteGpaRange( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, GuestAddress: u64, Controls: WHV_ACCESS_GPA_CONTROLS, // TODO: what to do with BytesParamIndex 5? Data: ?*const anyopaque, DataSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSignalVirtualProcessorSynicEvent( Partition: WHV_PARTITION_HANDLE, SynicEvent: WHV_SYNIC_EVENT_PARAMETERS, NewlySignaled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorState( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, StateType: WHV_VIRTUAL_PROCESSOR_STATE_TYPE, // TODO: what to do with BytesParamIndex 4? Buffer: ?*anyopaque, BufferSizeInBytes: u32, BytesWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetVirtualProcessorState( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, StateType: WHV_VIRTUAL_PROCESSOR_STATE_TYPE, // TODO: what to do with BytesParamIndex 4? Buffer: ?*const anyopaque, BufferSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvAllocateVpciResource( ProviderId: ?*const Guid, Flags: WHV_ALLOCATE_VPCI_RESOURCE_FLAGS, ResourceDescriptor: ?[*]const u8, ResourceDescriptorSizeInBytes: u32, VpciResource: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCreateVpciDevice( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, VpciResource: ?HANDLE, Flags: WHV_CREATE_VPCI_DEVICE_FLAGS, NotificationEventHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvDeleteVpciDevice( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVpciDeviceProperty( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, PropertyCode: WHV_VPCI_DEVICE_PROPERTY_CODE, // TODO: what to do with BytesParamIndex 4? PropertyBuffer: ?*anyopaque, PropertyBufferSizeInBytes: u32, WrittenSizeInBytes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVpciDeviceNotification( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, // TODO: what to do with BytesParamIndex 3? Notification: ?*WHV_VPCI_DEVICE_NOTIFICATION, NotificationSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvMapVpciDeviceMmioRanges( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, MappingCount: ?*u32, Mappings: ?*?*WHV_VPCI_MMIO_MAPPING, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvUnmapVpciDeviceMmioRanges( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetVpciDevicePowerState( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, PowerState: DEVICE_POWER_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvReadVpciDeviceRegister( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, Register: ?*const WHV_VPCI_DEVICE_REGISTER, Data: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvWriteVpciDeviceRegister( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, Register: ?*const WHV_VPCI_DEVICE_REGISTER, Data: ?*const anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvMapVpciDeviceInterrupt( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, Index: u32, MessageCount: u32, Target: ?*const WHV_VPCI_INTERRUPT_TARGET, MsiAddress: ?*u64, MsiData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvUnmapVpciDeviceInterrupt( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, Index: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvRetargetVpciDeviceInterrupt( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, MsiAddress: u64, MsiData: u32, Target: ?*const WHV_VPCI_INTERRUPT_TARGET, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvRequestVpciDeviceInterrupt( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, MsiAddress: u64, MsiData: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVpciDeviceInterruptTarget( Partition: WHV_PARTITION_HANDLE, LogicalDeviceId: u64, Index: u32, MultiMessageNumber: u32, // TODO: what to do with BytesParamIndex 5? Target: ?*WHV_VPCI_INTERRUPT_TARGET, TargetSizeInBytes: u32, BytesWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCreateTrigger( Partition: WHV_PARTITION_HANDLE, Parameters: ?*const WHV_TRIGGER_PARAMETERS, TriggerHandle: ?*?*anyopaque, EventHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvUpdateTriggerParameters( Partition: WHV_PARTITION_HANDLE, Parameters: ?*const WHV_TRIGGER_PARAMETERS, TriggerHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvDeleteTrigger( Partition: WHV_PARTITION_HANDLE, TriggerHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCreateNotificationPort( Partition: WHV_PARTITION_HANDLE, Parameters: ?*const WHV_NOTIFICATION_PORT_PARAMETERS, EventHandle: ?HANDLE, PortHandle: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvSetNotificationPortProperty( Partition: WHV_PARTITION_HANDLE, PortHandle: ?*anyopaque, PropertyCode: WHV_NOTIFICATION_PORT_PROPERTY_CODE, PropertyValue: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvDeleteNotificationPort( Partition: WHV_PARTITION_HANDLE, PortHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvPostVirtualProcessorSynicMessage( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, SintIndex: u32, // TODO: what to do with BytesParamIndex 4? Message: ?*const anyopaque, MessageSizeInBytes: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetVirtualProcessorCpuidOutput( Partition: WHV_PARTITION_HANDLE, VpIndex: u32, Eax: u32, Ecx: u32, CpuidOutput: ?*WHV_CPUID_OUTPUT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvGetInterruptTargetVpSet( Partition: WHV_PARTITION_HANDLE, Destination: u64, DestinationMode: WHV_INTERRUPT_DESTINATION_MODE, TargetVps: [*]u32, VpCount: u32, TargetVpCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvStartPartitionMigration( Partition: WHV_PARTITION_HANDLE, MigrationHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCancelPartitionMigration( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvCompletePartitionMigration( Partition: WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvPlatform" fn WHvAcceptPartitionMigration( MigrationHandle: ?HANDLE, Partition: ?*WHV_PARTITION_HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvEmulation" fn WHvEmulatorCreateEmulator( Callbacks: ?*const WHV_EMULATOR_CALLBACKS, Emulator: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvEmulation" fn WHvEmulatorDestroyEmulator( Emulator: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvEmulation" fn WHvEmulatorTryIoEmulation( Emulator: ?*anyopaque, Context: ?*anyopaque, VpContext: ?*const WHV_VP_EXIT_CONTEXT, IoInstructionContext: ?*const WHV_X64_IO_PORT_ACCESS_CONTEXT, EmulatorReturnStatus: ?*WHV_EMULATOR_STATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "WinHvEmulation" fn WHvEmulatorTryMmioEmulation( Emulator: ?*anyopaque, Context: ?*anyopaque, VpContext: ?*const WHV_VP_EXIT_CONTEXT, MmioInstructionContext: ?*const WHV_MEMORY_ACCESS_CONTEXT, EmulatorReturnStatus: ?*WHV_EMULATOR_STATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvInitializeDeviceHost( computeSystem: HCS_SYSTEM, deviceHostHandle: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvTeardownDeviceHost( deviceHostHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvCreateDeviceInstance( deviceHostHandle: ?*anyopaque, deviceType: HDV_DEVICE_TYPE, deviceClassId: ?*const Guid, deviceInstanceId: ?*const Guid, deviceInterface: ?*const anyopaque, deviceContext: ?*anyopaque, deviceHandle: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvReadGuestMemory( requestor: ?*anyopaque, guestPhysicalAddress: u64, byteCount: u32, buffer: [*:0]u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvWriteGuestMemory( requestor: ?*anyopaque, guestPhysicalAddress: u64, byteCount: u32, buffer: [*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvCreateGuestMemoryAperture( requestor: ?*anyopaque, guestPhysicalAddress: u64, byteCount: u32, writeProtected: BOOL, mappedAddress: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvDestroyGuestMemoryAperture( requestor: ?*anyopaque, mappedAddress: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvDeliverGuestInterrupt( requestor: ?*anyopaque, msiAddress: u64, msiData: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvRegisterDoorbell( requestor: ?*anyopaque, BarIndex: HDV_PCI_BAR_SELECTOR, BarOffset: u64, TriggerValue: u64, Flags: u64, DoorbellEvent: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvUnregisterDoorbell( requestor: ?*anyopaque, BarIndex: HDV_PCI_BAR_SELECTOR, BarOffset: u64, TriggerValue: u64, Flags: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvCreateSectionBackedMmioRange( requestor: ?*anyopaque, barIndex: HDV_PCI_BAR_SELECTOR, offsetInPages: u64, lengthInPages: u64, MappingFlags: HDV_MMIO_MAPPING_FLAGS, sectionHandle: ?HANDLE, sectionOffsetInPages: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "vmdevicehost" fn HdvDestroySectionBackedMmioRange( requestor: ?*anyopaque, barIndex: HDV_PCI_BAR_SELECTOR, offsetInPages: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn LocateSavedStateFiles( vmName: ?[*:0]const u16, snapshotName: ?[*:0]const u16, binPath: ?*?PWSTR, vsvPath: ?*?PWSTR, vmrsPath: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn LoadSavedStateFile( vmrsFile: ?[*:0]const u16, vmSavedStateDumpHandle: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ApplyPendingSavedStateFileReplayLog( vmrsFile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn LoadSavedStateFiles( binFile: ?[*:0]const u16, vsvFile: ?[*:0]const u16, vmSavedStateDumpHandle: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ReleaseSavedStateFiles( vmSavedStateDumpHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetGuestEnabledVirtualTrustLevels( vmSavedStateDumpHandle: ?*anyopaque, virtualTrustLevels: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetGuestOsInfo( vmSavedStateDumpHandle: ?*anyopaque, virtualTrustLevel: u8, guestOsInfo: ?*GUEST_OS_INFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetVpCount( vmSavedStateDumpHandle: ?*anyopaque, vpCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetArchitecture( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, architecture: ?*VIRTUAL_PROCESSOR_ARCH, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ForceArchitecture( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, architecture: VIRTUAL_PROCESSOR_ARCH, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetActiveVirtualTrustLevel( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, virtualTrustLevel: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetEnabledVirtualTrustLevels( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, virtualTrustLevels: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ForceActiveVirtualTrustLevel( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, virtualTrustLevel: u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn IsActiveVirtualTrustLevelEnabled( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, activeVirtualTrustLevelEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn IsNestedVirtualizationEnabled( vmSavedStateDumpHandle: ?*anyopaque, enabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetNestedVirtualizationMode( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, enabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ForceNestedHostMode( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, hostMode: BOOL, oldMode: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn InKernelSpace( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, inKernelSpace: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetRegisterValue( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, registerId: u32, registerValue: ?*VIRTUAL_PROCESSOR_REGISTER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetPagingMode( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, pagingMode: ?*PAGING_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ForcePagingMode( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, pagingMode: PAGING_MODE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ReadGuestPhysicalAddress( vmSavedStateDumpHandle: ?*anyopaque, physicalAddress: u64, // TODO: what to do with BytesParamIndex 3? buffer: ?*anyopaque, bufferSize: u32, bytesRead: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GuestVirtualAddressToPhysicalAddress( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, virtualAddress: u64, physicalAddress: ?*u64, unmappedRegionSize: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetGuestPhysicalMemoryChunks( vmSavedStateDumpHandle: ?*anyopaque, memoryChunkPageSize: ?*u64, memoryChunks: ?*GPA_MEMORY_CHUNK, memoryChunkCount: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GuestPhysicalAddressToRawSavedMemoryOffset( vmSavedStateDumpHandle: ?*anyopaque, physicalAddress: u64, rawSavedMemoryOffset: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ReadGuestRawSavedMemory( vmSavedStateDumpHandle: ?*anyopaque, rawSavedMemoryOffset: u64, // TODO: what to do with BytesParamIndex 3? buffer: ?*anyopaque, bufferSize: u32, bytesRead: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetGuestRawSavedMemorySize( vmSavedStateDumpHandle: ?*anyopaque, guestRawSavedMemorySize: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn SetMemoryBlockCacheLimit( vmSavedStateDumpHandle: ?*anyopaque, memoryBlockCacheLimit: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetMemoryBlockCacheLimit( vmSavedStateDumpHandle: ?*anyopaque, memoryBlockCacheLimit: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ApplyGuestMemoryFix( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, virtualAddress: u64, fixBuffer: ?*anyopaque, fixBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn LoadSavedStateSymbolProvider( vmSavedStateDumpHandle: ?*anyopaque, userSymbols: ?[*:0]const u16, force: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ReleaseSavedStateSymbolProvider( vmSavedStateDumpHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetSavedStateSymbolProviderHandle( vmSavedStateDumpHandle: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; pub extern "VmSavedStateDumpProvider" fn SetSavedStateSymbolProviderDebugInfoCallback( vmSavedStateDumpHandle: ?*anyopaque, Callback: ?GUEST_SYMBOLS_PROVIDER_DEBUG_INFO_CALLBACK, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn LoadSavedStateModuleSymbols( vmSavedStateDumpHandle: ?*anyopaque, imageName: ?[*:0]const u8, moduleName: ?[*:0]const u8, baseAddress: u64, sizeOfBase: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn LoadSavedStateModuleSymbolsEx( vmSavedStateDumpHandle: ?*anyopaque, imageName: ?[*:0]const u8, imageTimestamp: u32, moduleName: ?[*:0]const u8, baseAddress: u64, sizeOfBase: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ResolveSavedStateGlobalVariableAddress( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, globalName: ?[*:0]const u8, virtualAddress: ?*u64, size: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ReadSavedStateGlobalVariable( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, globalName: ?[*:0]const u8, buffer: ?*anyopaque, bufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetSavedStateSymbolTypeSize( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, typeName: ?[*:0]const u8, size: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn FindSavedStateSymbolFieldInType( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, typeName: ?[*:0]const u8, fieldName: ?[*:0]const u16, offset: ?*u32, found: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn GetSavedStateSymbolFieldInfo( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, typeName: ?[*:0]const u8, typeFieldInfoMap: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn ScanMemoryForDosImages( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, startAddress: u64, endAddress: u64, callbackContext: ?*anyopaque, foundImageCallback: ?FOUND_IMAGE_CALLBACK, standaloneAddress: ?*u64, standaloneAddressCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "VmSavedStateDumpProvider" fn CallStackUnwind( vmSavedStateDumpHandle: ?*anyopaque, vpId: u32, imageInfo: ?*MODULE_INFO, imageInfoCount: u32, frameCount: u32, callStack: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (9) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const DEVICE_POWER_STATE = @import("../system/power.zig").DEVICE_POWER_STATE; const HANDLE = @import("../foundation.zig").HANDLE; const HCS_SYSTEM = @import("../system/host_compute_system.zig").HCS_SYSTEM; const HRESULT = @import("../foundation.zig").HRESULT; const LUID = @import("../foundation.zig").LUID; 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(), "WHV_EMULATOR_IO_PORT_CALLBACK")) { _ = WHV_EMULATOR_IO_PORT_CALLBACK; } if (@hasDecl(@This(), "WHV_EMULATOR_MEMORY_CALLBACK")) { _ = WHV_EMULATOR_MEMORY_CALLBACK; } if (@hasDecl(@This(), "WHV_EMULATOR_GET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK")) { _ = WHV_EMULATOR_GET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK; } if (@hasDecl(@This(), "WHV_EMULATOR_SET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK")) { _ = WHV_EMULATOR_SET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK; } if (@hasDecl(@This(), "WHV_EMULATOR_TRANSLATE_GVA_PAGE_CALLBACK")) { _ = WHV_EMULATOR_TRANSLATE_GVA_PAGE_CALLBACK; } if (@hasDecl(@This(), "HDV_PCI_DEVICE_INITIALIZE")) { _ = HDV_PCI_DEVICE_INITIALIZE; } if (@hasDecl(@This(), "HDV_PCI_DEVICE_TEARDOWN")) { _ = HDV_PCI_DEVICE_TEARDOWN; } if (@hasDecl(@This(), "HDV_PCI_DEVICE_SET_CONFIGURATION")) { _ = HDV_PCI_DEVICE_SET_CONFIGURATION; } if (@hasDecl(@This(), "HDV_PCI_DEVICE_GET_DETAILS")) { _ = HDV_PCI_DEVICE_GET_DETAILS; } if (@hasDecl(@This(), "HDV_PCI_DEVICE_START")) { _ = HDV_PCI_DEVICE_START; } if (@hasDecl(@This(), "HDV_PCI_DEVICE_STOP")) { _ = HDV_PCI_DEVICE_STOP; } if (@hasDecl(@This(), "HDV_PCI_READ_CONFIG_SPACE")) { _ = HDV_PCI_READ_CONFIG_SPACE; } if (@hasDecl(@This(), "HDV_PCI_WRITE_CONFIG_SPACE")) { _ = HDV_PCI_WRITE_CONFIG_SPACE; } if (@hasDecl(@This(), "HDV_PCI_READ_INTERCEPTED_MEMORY")) { _ = HDV_PCI_READ_INTERCEPTED_MEMORY; } if (@hasDecl(@This(), "HDV_PCI_WRITE_INTERCEPTED_MEMORY")) { _ = HDV_PCI_WRITE_INTERCEPTED_MEMORY; } if (@hasDecl(@This(), "GUEST_SYMBOLS_PROVIDER_DEBUG_INFO_CALLBACK")) { _ = GUEST_SYMBOLS_PROVIDER_DEBUG_INFO_CALLBACK; } if (@hasDecl(@This(), "FOUND_IMAGE_CALLBACK")) { _ = FOUND_IMAGE_CALLBACK; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/hypervisor.zig
const std = @import("std"); const mem = std.mem; const c = @import("./c.zig"); const glfw = @import("./main.zig"); pub const Window = struct { const Self = @This(); handle: *c.GLFWwindow, pub const ClientApi = enum(i32) { OpenGLApi = c.GLFW_OPENGL_API, OpenGLESApi = c.GLFW_OPENGL_ES_API, NoApi = c.GLFW_NO_API, }; pub const ContextCreationApi = enum(i32) { NativeContextApi = c.GLFW_NATIVE_CONTEXT_API, EGLContextApi = c.GLFW_EGL_CONTEXT_API, OSMesaContextApi = c.GLFW_OSMESA_CONTEXT_API, }; pub const ContextRobustness = enum(i32) { NoRobustness = c.GLFW_NO_ROBUSTNESS, NoResetNotification = c.GLFW_NO_RESET_NOTIFICATION, LoseContextOnReset = c.GLFW_LOSE_CONTEXT_ON_RESET, }; pub const ContextReleaseBehavior = enum(i32) { AnyReleaseBehavior = c.GLFW_ANY_RELEASE_BEHAVIOR, ReleaseBehaviorFlush = c.GLFW_RELEASE_BEHAVIOR_FLUSH, ReleaseBehaviorNone = c.GLFW_RELEASE_BEHAVIOR_NONE, }; pub const OpenGLProfile = enum(i32) { OpenGLAnyProfile = c.GLFW_OPENGL_ANY_PROFILE, OpenGLCompatProfile = c.GLFW_OPENGL_COMPAT_PROFILE, OpenGLCoreProfile = c.GLFW_OPENGL_CORE_PROFILE, }; pub const HintName = enum(i32) { Resizable = c.GLFW_RESIZABLE, Visible = c.GLFW_VISIBLE, Decorated = c.GLFW_DECORATED, Focused = c.GLFW_FOCUSED, AutoIconify = c.GLFW_AUTO_ICONIFY, Floating = c.GLFW_FLOATING, Maximized = c.GLFW_MAXIMIZED, CenterCursor = c.GLFW_CENTER_CURSOR, // TransparentFramebuffer = c.GLFW_TRANPARENT_FRAMEBUFFER, FocusOnShow = c.GLFW_FOCUS_ON_SHOW, ScaleToMonitor = c.GLFW_SCALE_TO_MONITOR, RedBits = c.GLFW_RED_BITS, GreenBits = c.GLFW_GREEN_BITS, BlueBits = c.GLFW_BLUE_BITS, AlphaBits = c.GLFW_ALPHA_BITS, AccumRedBits = c.GLFW_ACCUM_RED_BITS, AccumGreenBits = c.GLFW_ACCUM_GREEN_BITS, AccumBlueBits = c.GLFW_ACCUM_BLUE_BITS, AccumAlphaBits = c.GLFW_ACCUM_ALPHA_BITS, AuxBuffers = c.GLFW_AUX_BUFFERS, Stereo = c.GLFW_STEREO, Samples = c.GLFW_SAMPLES, SRGBCapable = c.GLFW_SRGB_CAPABLE, DoubleBuffer = c.GLFW_DOUBLEBUFFER, RefreshRate = c.GLFW_REFRESH_RATE, ClientApi = c.GLFW_CLIENT_API, ContextCreationApi = c.GLFW_CONTEXT_CREATION_API, ContextVersionMajor = c.GLFW_CONTEXT_VERSION_MAJOR, ContextVersionMinor = c.GLFW_CONTEXT_VERSION_MINOR, OpenGLForwardCompat = c.GLFW_OPENGL_FORWARD_COMPAT, OpenGLDebugContext = c.GLFW_OPENGL_DEBUG_CONTEXT, OpenGLProfile = c.GLFW_OPENGL_PROFILE, ContextRobustness = c.GLFW_CONTEXT_ROBUSTNESS, ContextReleaseBehavior = c.GLFW_CONTEXT_RELEASE_BEHAVIOR, // ContextNoError = c.GLFW_CONTEXT_NO_ERROR, CocoaRetinaFramebuffer = c.GLFW_COCOA_RETINA_FRAMEBUFFER, CocoaFrameName = c.GLFW_COCOA_FRAME_NAME, CocoaGraphicsSwitching = c.GLFW_COCOA_GRAPHICS_SWITCHING, X11ClassName = c.GLFW_X11_CLASS_NAME, X11InstanceName = c.GLFW_X11_INSTANCE_NAME, }; pub const Hint = union(HintName) { Resizable: bool, Visible: bool, Decorated: bool, Focused: bool, AutoIconify: bool, Floating: bool, Maximized: bool, CenterCursor: bool, // TransparentFramebuffer: bool, FocusOnShow: bool, ScaleToMonitor: bool, RedBits: ?i32, GreenBits: ?i32, BlueBits: ?i32, AlphaBits: ?i32, // DepthBits: ?i32, // StencilBits: ?i32, AccumRedBits: ?i32, AccumGreenBits: ?i32, AccumBlueBits: ?i32, AccumAlphaBits: ?i32, AuxBuffers: ?i32, Samples: ?i32, RefreshRate: ?i32, Stereo: bool, SRGBCapable: bool, DoubleBuffer: bool, ClientApi: ClientApi, ContextCreationApi: ContextCreationApi, ContextVersionMajor: i32, ContextVersionMinor: i32, ContextRobustness: ContextRobustness, ContextReleaseBehavior: ContextReleaseBehavior, OpenGLForwardCompat: bool, OpenGLDebugContext: bool, OpenGLProfile: OpenGLProfile, CocoaRetinaFramebuffer: bool, CocoaFrameName: [:0]const u8, CocoaGraphicsSwitching: bool, X11ClassName: [:0]const u8, X11InstanceName: [:0]const u8, }; pub fn defaultHints() void { c.glfwDefaultWindowHints(); glfw.getError() catch |err| switch (err) { .NotInitialized => return err, else => unreachable, }; } pub fn hint(h: Hint) !void { switch (h) { .Resizable => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .Visible => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .Decorated => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .Focused => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .AutoIconify => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .Floating => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .Maximized => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .CenterCursor => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), // .TransparentFramebuffer => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .FocusOnShow => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .ScaleToMonitor => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .RedBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .GreenBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .BlueBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .AlphaBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), // .DepthBits => |value| c.glfwWindowHint(@enumToInt(hint), toGLFWInt(value)), // .StencilBits => |value| c.glfwWindowHint(@enumToInt(hint), toGLFWInt(value)), .AccumRedBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .AccumGreenBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .AccumBlueBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .AccumAlphaBits => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .AuxBuffers => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .Samples => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .RefreshRate => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .Stereo => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .SRGBCapable => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .DoubleBuffer => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .ClientApi => |value| c.glfwWindowHint(@enumToInt(h), @enumToInt(value)), .ContextCreationApi => |value| c.glfwWindowHint(@enumToInt(h), @enumToInt(value)), .ContextVersionMajor => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .ContextVersionMinor => |value| c.glfwWindowHint(@enumToInt(h), toGLFWInt(value)), .ContextRobustness => |value| c.glfwWindowHint(@enumToInt(h), @enumToInt(value)), .ContextReleaseBehavior => |value| c.glfwWindowHint(@enumToInt(h), @enumToInt(value)), .OpenGLForwardCompat => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .OpenGLDebugContext => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .OpenGLProfile => |value| c.glfwWindowHint(@enumToInt(h), @enumToInt(value)), .CocoaRetinaFramebuffer => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .CocoaFrameName => |value| c.glfwWindowHintString(@enumToInt(h), value.ptr), .CocoaGraphicsSwitching => |value| c.glfwWindowHint(@enumToInt(h), toGLFWBool(value)), .X11ClassName => |value| c.glfwWindowHintString(@enumToInt(h), value.ptr), .X11InstanceName => |value| c.glfwWindowHintString(@enumToInt(h), value.ptr), } glfw.getError() catch |err| switch (err) { error.NotInitialized => return err, else => unreachable, }; } pub const AttributeName = enum(i32) { Focused = c.GLFW_FOCUSED, Iconified = c.GLFW_ICONIFIED, Maximized = c.GLFW_MAXIMIZED, Hovered = c.GLFW_HOVERED, Visible = c.GLFW_VISIBLE, Resizable = c.GLFW_RESIZABLE, Decorated = c.GLFW_DECORATED, AutoIconify = c.GLFW_AUTO_ICONIFY, Floating = c.GFLW_FLOATING, TransparentFramebuffer = c.GLFW_TRANPARENT_FRAMEBUFFER, FocusOnShow = c.GLFW_FOCUS_ON_SHOW, ClientApi = c.GLFW_CLIENT_API, ContextCreationApi = c.GLFW_CONTEXT_CREATION_API, ContextVersionMajor = c.GLFW_CONTEXT_VERSION_MAJOR, ContextVersionMinor = c.GLFW_CONTEXT_VERSION_MINOR, ContextRevision = c.GLFW_CONTEXT_REVISION, OpenGLForwardCompat = c.GLFW_OPENGL_FORWARD_COMPAT, OpenGLDebugContext = c.GLFW_OPENGGL_DEBUG_CONTEXT, OpenGLProfile = c.GLFW_OPENGL_PROFILE, ContextReleaseBehavior = c.GLFW_CONTEXT_RELEASE_BEHAVIOR, ContextNoError = c.GLFW_CONTEXT_NO_ERROR, ContextRobustness = c.GLFW_CONTEXT_ROBUSTNESS, }; pub const Attribute = union(AttributeName) { Focused: bool, Iconified: bool, Maximized: bool, Hovered: bool, Visible: bool, Resizable: bool, Decorated: bool, AutoIconify: bool, Floating: bool, TransparentFramebuffer: bool, FocusOnShow: bool, ClientApi: ClientApi, ContextCreationApi: ContextCreationApi, ContextVersionMajor: i32, ContextVersionMinor: i32, ContextRevision: i32, OpenGLForwardCompat: bool, OpenGLDebugContext: bool, OpenGLProfile: OpenGLProfile, ContextReleaseBehavior: ContextReleaseBehavior, ContextNoError: bool, ContextRobustness: ContextRobustness, }; pub fn getAttrib(self: Self, attrib: AttributeName) !Attribute { var attribute = blk: { switch (attrib) { .Focused => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Focused = value == c.GLFW_TRUE }; }, .Iconified => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Iconified = value == c.GLFW_TRUE }; }, .Maximized => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Maximized = value == c.GLFW_TRUE }; }, .Hovered => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Hovered = value == c.GLFW_TRUE }; }, .Visible => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Visible = value == c.GLFW_TRUE }; }, .Resizable => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Resizable = value == c.GLFW_TRUE }; }, .Decorated => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Decorated = value == c.GLFW_TRUE }; }, .AutoIconify => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .AutoIconify = value == c.GLFW_TRUE }; }, .Floating => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .Floating = value == c.GLFW_TRUE }; }, .TransparentFramebuffer => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .TransparentFramebuffer = value == c.GLFW_TRUE }; }, .FocusOnShow => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .FocusOnShow = value == c.GLFW_TRUE }; }, .ClientApi => { var value = @intToEnum(ClientApi, c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib))); break :blk Attribute{ .ClientApi = value, }; }, .ContextCreationApi => { var value = @intToEnum(ContextCreationApi, c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib))); break :blk Attribute{ .ContextCreationApi = value, }; }, .ContextVersionMajor => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .ContextVersionMajor = value, }; }, .ContextVersionMinor => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .ContextVersionMinor = value, }; }, .ContextRevision => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .ContextRevision = value, }; }, .OpenGLForwardCompat => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .OpenGLForwardCompat = value == c.GLFW_TRUE }; }, .OpenGLDebugContext => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .OpenGLDebugContext = value == c.GLFW_TRUE }; }, .OpenGLProfile => { var value = @intToEnum(OpenGLProfile, c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib))); break :blk Attribute{ .OpenGLProfile = value, }; }, .ContextReleaseBehavior => { var value = @intToEnum(ContextReleaseBehavior, c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib))); break :blk Attribute{ .ContextReleaseBehavior = value, }; }, .ContextNoError => { var value = c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib)); break :blk Attribute{ .ContextNoError = value == c.GLFW_TRUE }; }, .ContextRobustness => { var value = @intToEnum(ContextRobustness, c.glfwGetWindowAttrib(self.handle, @enumToInt(attrib))); break :blk Attribute{ .ContextRobustness = value, }; }, } }; glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return attribute; } pub fn setAttrib(self: *Self, attribute: Attribute) !void { switch (attribute) { Resizable => |value| c.glfwSetWindowAttrib(self.handle, @enumToInt(attribute), toGLFWBool(value)), Decorated => |value| c.glfwSetWindowAttrib(self.handle, @enumToInt(attribute), toGLFWBool(value)), AutoIconify => |value| c.glfwSetWindowAttrib(self.handle, @enumToInt(attribute), toGLFWBool(value)), Floating => |value| c.glfwSetWindowAttrib(self.handle, @enumToInt(attribute), toGLFWBool(value)), FocusOnShow => |value| c.glfwSetWindowAttrib(self.handle, @enumToInt(attribute), toGLFWBool(value)), else => std.debug.panic("unsupported attribute in setter"), } glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } inline fn toGLFWBool(value: bool) i32 { return if (value) c.GLFW_TRUE else c.GLFW_FALSE; } inline fn toGLFWInt(value: ?i32) i32 { return if (value) |v| v else c.GLFW_DONT_CARE; } pub fn init(width: i32, height: i32, title: [:0]const u8, monitor: ?glfw.Monitor, share: ?glfw.Window) !Self { var handle = c.glfwCreateWindow(width, height, title.ptr, if (monitor) |m| m.handle else null, if (share) |s| s.handle else null); if (handle == null) { glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.InvalidValue, glfw.Error.ApiUnavailable, glfw.Error.VersionUnavailable, glfw.Error.FormatUnavailable, glfw.Error.PlatformError => return err, else => unreachable, }; } return Self{ .handle = handle.? }; } pub fn deinit(self: *Self) void { c.glfwDestroyWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => std.debug.panic("cannot handle: {}\n", .{ err }), else => unreachable, }; } pub fn shouldClose(self: Self) !bool { var result = c.glfwWindowShouldClose(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized => return err, else => unreachable, }; return result == c.GLFW_TRUE; } pub fn setShouldClose(self: *Self, value: bool) !void { c.glfwSetWindowShouldClose(self.handle, toGLFWBool(value)); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized => return err, else => unreachable, }; } pub fn setTitle(self: *Self, title: [:0]const u8) !void { c.glfwSetWindowTitle(self.handle, title.ptr); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn setIcon(self: *Self, icon: glfw.Image) !void { return self.setIcons(&[1]glfw.Image{ icon }); } pub fn setIcons(self: *Self, icons: []glfw.Image) !void { c.glfwSetWindowIcon(self.handle, @intCast(i32, icons.len), icons.ptr); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub const Position = struct { x: i32, y: i32, }; pub fn getPos(self: Self) !Position { var position: Position = undefined; c.glfwGetWindowPos(self.handle, &position.x, &position.y); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return position; } pub fn setPos(self: *Self, position: Position) !void { c.glfwSetWindowPos(self.handle, position.x, position.y); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn getSize(self: Self) !glfw.Size { var size: glfw.Size = undefined; c.glfwGetWindowSize(self.handle, &size.width, &size.height); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return size; } pub fn setSize(self: Self, size: glfw.Size) !void { c.glfwSetWindowSize(self.handle, size.width, size.height); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn setSizeLimits(self: *Self, min: ?glfw.Size, max: ?glfw.Size) !void { var minwidth: i32 = if (min) |m| m.width else c.GLFW_DONT_CARE; var minheight: i32 = if (min) |m| m.height else c.GLFW_DONT_CARE; var maxwidth: i32 = if (max) |m| m.width else c.GLFW_DONT_CARE; var maxheight: i32 = if (max) |m| m.height else c.GLFW_DONT_CARE; c.glfwSetWindowSizeLimits(self.handle, minwidth, minheight, maxwidth, maxheight); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn setAspectRatio(self: *Self, aspect: ?glfw.Size) !void { if (aspect) |a| { c.glfwSetWindowAspectRatio(self.handle, a.width, a.height); } else { c.glfwSetWindowAspectRatio(self.handle, c.GLFW_DONT_CARE, c.GLFW_DONT_CARE); } glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn getFramebufferSize(self: Self) !glfw.Size { var framebufferSize: glfw.Size = undefined; c.glfwGetFramebufferSize(self.handle, &framebufferSize.width, &framebufferSize.height); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return framebufferSize; } pub fn getFrameSize(self: Self) !glfw.Bounds { var frameSize: glfw.Bounds = undefined; c.glfwGetWindowFrameSize(self.handle, &frameSize.left, &frameSize.top, &frameSize.right, &frameSize.bottom); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return frameSize; } pub fn getContentScale(self: Self) !glfw.Scale { var scale: glfw.Scale = undefined; c.glfwGetWindowContentScale(self.handle, &scale.x, &scale.y); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return scale; } pub fn getOpacity(self: Self) !f32 { var opacity = c.glfwGetWindowOpacity(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; return opacity; } pub fn setOpacity(self: *Self, opacity: f32) !void { c.glfwSetWindowOpacity(self.handle, opacity); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn iconify(self: *Self) !void { c.glfwIconifyWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn restore(self: *Self) !void { c.glfwRestoreWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn maximize(self: *Self) !void { c.glfwMaximizeWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn show(self: *Self) !void { c.glfwShowWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn hide(self: *Self) !void { c.glfwHideWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn focus(self: *Self) !void { c.glfwFocusWindow(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn requestAttention(self: *Self) !void { c.glfwRequestWindowAttention(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn getMonitor(self: Self) !?glfw.Monitor { var handle = c.glfwGetWindowMonitor(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; if (handle) |h| { return glfw.Monitor{ .handle = handle }; } else { return null; } } pub fn setMonitor(self: *Self, monitor: ?glfw.Monitor, position: glfw.Position, size: glfw.Size, refreshRate: ?i32) !void { c.glfwSetWindowMonitor(self.handle, if (monitor) |m| m.handle else null, position.x, position.y, size.width, size.height, if (refreshRate) |rr| rr else c.GLFW_DONT_CARE); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError => return err, else => unreachable, }; } pub fn setUserPointer(self: *Self, comptime T: type, pointer: ?*T) !void { c.glfwSetWindowUserPointer(self.handle, if (pointer) |ptr| @ptrToInt(ptr) else null); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized => return err, else => unreachable, }; } pub fn getUserPointer(self: Self, comptime T: type) !?*T { var ptr = c.glfwGetWindowUserPointer(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized => return err, else => unreachable, }; if (ptr) |pointer| { return @intToPtr(*T, pointer); } else { return null; } } pub fn swapBuffers(self: *Self) !void { c.glfwSwapBuffers(self.handle); glfw.getError() catch |err| switch (err) { glfw.Error.NotInitialized, glfw.Error.PlatformError, glfw.Error.NoWindowContext => return err, else => unreachable, }; } pub fn makeContextCurrent(self: *Self) void { c.glfwMakeContextCurrent(self.handle); } pub fn getKey(self: *Self, key: i32) bool { return c.glfwGetKey(self.handle, key) == 1; } };
src/window.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const global_allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day14.txt", .{ .read = true, }, ); var reader = std.io.bufferedReader(file.reader()).reader(); var line = std.ArrayList(u8).init(global_allocator); defer line.deinit(); const ReindeerState = union(enum) { at_rest_since: usize, in_movement_since: usize, }; const Reindeer = struct { speed: usize, movement_duration: usize, rest_duration: usize, score: usize, distance: usize, state: ReindeerState, }; var reindeers = std.ArrayList(Reindeer).init(global_allocator); defer reindeers.deinit(); const duration_goal: usize = 2503; var max_distance: usize = 0; while (reader.readUntilDelimiterArrayList(&line, '\n', 1024)) { var tokens = std.mem.tokenize(u8, line.items, " "); _ = tokens.next(); // <name> _ = tokens.next(); // can _ = tokens.next(); // fly const speed_str = tokens.next().?; const speed = try std.fmt.parseInt(usize, speed_str, 10); _ = tokens.next(); // km/s _ = tokens.next(); // for const movement_duration_str = tokens.next().?; const movement_duration = try std.fmt.parseInt(usize, movement_duration_str, 10); _ = tokens.next(); // seconds, _ = tokens.next(); // but _ = tokens.next(); // then _ = tokens.next(); // must _ = tokens.next(); // rest _ = tokens.next(); // for const rest_duration_str = tokens.next().?; const rest_duration = try std.fmt.parseInt(usize, rest_duration_str, 10); try reindeers.append(Reindeer{ .speed = speed, .movement_duration = movement_duration, .rest_duration = rest_duration, .score = 0, .distance = 0, .state = ReindeerState{ .in_movement_since = 0, }, }); var distance: usize = 0; var duration: usize = 0; while (duration < duration_goal) { { // movement var d = std.math.min(movement_duration, duration_goal - duration); distance += speed * d; duration += d; } { // rest var d = std.math.min(rest_duration, duration_goal - duration); duration += d; } } max_distance = std.math.max(max_distance, distance); } else |err| { if (err != error.EndOfStream) { return err; } } print("Part 1: {d}\n", .{max_distance}); var seconds: usize = 1; while (seconds <= duration_goal) : (seconds += 1) { var best_distance_so_far: usize = 0; for (reindeers.items) |*r| { switch (r.state) { .at_rest_since => |t| { if (t + r.rest_duration == seconds) { r.state = ReindeerState{ .in_movement_since = seconds }; } }, .in_movement_since => |t| { if (t + r.movement_duration == seconds) { r.state = ReindeerState{ .at_rest_since = seconds }; } r.distance += r.speed; }, } best_distance_so_far = std.math.max(best_distance_so_far, r.distance); } for (reindeers.items) |*r| { if (r.distance == best_distance_so_far) { r.score += 1; } } } var best_score: usize = 0; for (reindeers.items) |r| { best_score = std.math.max(best_score, r.score); } print("Part 2: {d}\n", .{best_score}); }
src/day14.zig
const builtin = @import("builtin"); const Builder = @import("std").build.Builder; const fs = @import("std").fs; pub fn build(b: *Builder) void { const mode = b.standardReleaseOptions(); const windows = b.option(bool, "windows", "compile windows build") orelse false; const use_bundled_deps = b.option(bool, "bundled-deps", "use bundled deps (default for windows build)") orelse windows; const tracy = b.option([]const u8, "tracy", "Enable Tracy integration. Supply path to Tracy source"); var target = b.standardTargetOptions(.{}); if (windows) target = .{ .cpu_arch = .x86_64, .os_tag = .windows, .abi = .gnu, }; const exe = b.addExecutable("mandelbrot-explorer", "src/main.zig"); const exe_options = b.addOptions(); exe.addOptions("build_options", exe_options); exe_options.addOption(bool, "enable_tracy", tracy != null); if (use_bundled_deps) { exe.addSystemIncludeDir("deps/VulkanSDK/include"); exe.addSystemIncludeDir("deps/SDL2-x86_64-w64-mingw32/include"); exe.addLibPath("deps/SDL2-x86_64-w64-mingw32/lib"); exe.addLibPath("deps/VulkanSDK/lib"); } exe.addIncludeDir("src/"); exe.addIncludeDir("deps/imgui/"); exe.addCSourceFile("deps/imgui/cimgui.cpp", &[_][]const u8{"-Wno-return-type-c-linkage"}); // "-D_DEBUG" exe.addCSourceFile("src/imgui_impl_main.cpp", &[_][]const u8{}); exe.addCSourceFile("src/imgui_impl_sdl.cpp", &[_][]const u8{}); exe.addCSourceFile("deps/imgui/imgui.cpp", &[_][]const u8{}); exe.addCSourceFile("deps/imgui/imgui_draw.cpp", &[_][]const u8{}); exe.addCSourceFile("deps/imgui/imgui_widgets.cpp", &[_][]const u8{}); if (tracy) |tracy_path| { const client_cpp = fs.path.join( b.allocator, &[_][]const u8{ tracy_path, "TracyClient.cpp" }, ) catch unreachable; exe.addIncludeDir(tracy_path); exe.addCSourceFile(client_cpp, &[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" }); } exe.linkSystemLibrary(if (windows) "SDL2.dll" else "SDL2"); exe.linkSystemLibrary(if (windows) "vulkan-1" else "vulkan"); exe.linkLibCpp(); exe.setTarget(target); exe.setBuildMode(mode); exe.install(); 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.zig"); const mem = std.mem; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const assert = std.debug.assert; const process = std.process; const is_windows = std.Target.current.isWindows(); pub const NativePaths = struct { include_dirs: ArrayList([:0]u8), lib_dirs: ArrayList([:0]u8), rpaths: ArrayList([:0]u8), warnings: ArrayList([:0]u8), pub fn detect(allocator: *Allocator) !NativePaths { var self: NativePaths = .{ .include_dirs = ArrayList([:0]u8).init(allocator), .lib_dirs = ArrayList([:0]u8).init(allocator), .rpaths = ArrayList([:0]u8).init(allocator), .warnings = ArrayList([:0]u8).init(allocator), }; errdefer self.deinit(); var is_nix = false; if (process.getEnvVarOwned(allocator, "NIX_CFLAGS_COMPILE")) |nix_cflags_compile| { defer allocator.free(nix_cflags_compile); is_nix = true; var it = mem.tokenize(nix_cflags_compile, " "); while (true) { const word = it.next() orelse break; if (mem.eql(u8, word, "-isystem")) { const include_path = it.next() orelse { try self.addWarning("Expected argument after -isystem in NIX_CFLAGS_COMPILE"); break; }; try self.addIncludeDir(include_path); } else { try self.addWarningFmt("Unrecognized C flag from NIX_CFLAGS_COMPILE: {}", .{word}); break; } } } else |err| switch (err) { error.InvalidUtf8 => {}, error.EnvironmentVariableNotFound => {}, error.OutOfMemory => |e| return e, } if (process.getEnvVarOwned(allocator, "NIX_LDFLAGS")) |nix_ldflags| { defer allocator.free(nix_ldflags); is_nix = true; var it = mem.tokenize(nix_ldflags, " "); while (true) { const word = it.next() orelse break; if (mem.eql(u8, word, "-rpath")) { const rpath = it.next() orelse { try self.addWarning("Expected argument after -rpath in NIX_LDFLAGS"); break; }; try self.addRPath(rpath); } else if (word.len > 2 and word[0] == '-' and word[1] == 'L') { const lib_path = word[2..]; try self.addLibDir(lib_path); } else { try self.addWarningFmt("Unrecognized C flag from NIX_LDFLAGS: {}", .{word}); break; } } } else |err| switch (err) { error.InvalidUtf8 => {}, error.EnvironmentVariableNotFound => {}, error.OutOfMemory => |e| return e, } if (is_nix) { return self; } if (!is_windows) { const triple = try std.Target.current.linuxTriple(allocator); // TODO: $ ld --verbose | grep SEARCH_DIR // the output contains some paths that end with lib64, maybe include them too? // TODO: what is the best possible order of things? // TODO: some of these are suspect and should only be added on some systems. audit needed. try self.addIncludeDir("/usr/local/include"); try self.addLibDir("/usr/local/lib"); try self.addLibDir("/usr/local/lib64"); try self.addIncludeDirFmt("/usr/include/{}", .{triple}); try self.addLibDirFmt("/usr/lib/{}", .{triple}); try self.addIncludeDir("/usr/include"); try self.addLibDir("/lib"); try self.addLibDir("/lib64"); try self.addLibDir("/usr/lib"); try self.addLibDir("/usr/lib64"); // example: on a 64-bit debian-based linux distro, with zlib installed from apt: // zlib.h is in /usr/include (added above) // libz.so.1 is in /lib/x86_64-linux-gnu (added here) try self.addLibDirFmt("/lib/{}", .{triple}); } return self; } pub fn deinit(self: *NativePaths) void { deinitArray(&self.include_dirs); deinitArray(&self.lib_dirs); deinitArray(&self.rpaths); deinitArray(&self.warnings); self.* = undefined; } fn deinitArray(array: *ArrayList([:0]u8)) void { for (array.toSlice()) |item| { array.allocator.free(item); } array.deinit(); } pub fn addIncludeDir(self: *NativePaths, s: []const u8) !void { return self.appendArray(&self.include_dirs, s); } pub fn addIncludeDirFmt(self: *NativePaths, comptime fmt: []const u8, args: var) !void { const item = try std.fmt.allocPrint0(self.include_dirs.allocator, fmt, args); errdefer self.include_dirs.allocator.free(item); try self.include_dirs.append(item); } pub fn addLibDir(self: *NativePaths, s: []const u8) !void { return self.appendArray(&self.lib_dirs, s); } pub fn addLibDirFmt(self: *NativePaths, comptime fmt: []const u8, args: var) !void { const item = try std.fmt.allocPrint0(self.lib_dirs.allocator, fmt, args); errdefer self.lib_dirs.allocator.free(item); try self.lib_dirs.append(item); } pub fn addWarning(self: *NativePaths, s: []const u8) !void { return self.appendArray(&self.warnings, s); } pub fn addWarningFmt(self: *NativePaths, comptime fmt: []const u8, args: var) !void { const item = try std.fmt.allocPrint0(self.warnings.allocator, fmt, args); errdefer self.warnings.allocator.free(item); try self.warnings.append(item); } pub fn addRPath(self: *NativePaths, s: []const u8) !void { return self.appendArray(&self.rpaths, s); } fn appendArray(self: *NativePaths, array: *ArrayList([:0]u8), s: []const u8) !void { const item = try std.mem.dupeZ(array.allocator, u8, s); errdefer array.allocator.free(item); try array.append(item); } };
lib/std/zig/system.zig
const std = @import("std"); const Allocator = mem.Allocator; const mem = std.mem; const warn = std.debug.warn; pub const OpList = std.ArrayList(*Op); pub const Lines = std.ArrayList([]const u8); pub const Diff = struct { list: OpList, arena: std.heap.ArenaAllocator, fn init(a: *Allocator) Diff { return Diff{ .list = OpList.init(a), .arena = std.heap.ArenaAllocator.init(a), }; } fn newOp(self: *Diff) !*Op { var a = &self.arena.allocator; return a.create(Op); } }; pub const Op = struct { kind: Kind, content: ?[]const []const u8, i_1: isize, i_2: isize, j_1: isize, pub const Kind = enum { Delete, Insert, Equal, }; }; pub fn applyEdits(alloc: *Allocator, a: [][]const u8, operations: []const Op) !Lines { var lines = Lines.init(alloc); var prev12: isize = 0; for (operations) |*op| { if (op.i_1 - prev12 > 0) { for (a[@intCast(usize, prev12)..@intCast(usize, op.i_1)]) |c| { try lines.append(c); } switch (op.kind) { .Insert, .Equal => { if (op.content) |content| { for (content) |c| { try lines.append(c); } } }, else => {}, } } prev12 = op.i_2; } if (@intCast(isize, a.len) > prev12) { for (a[@intCast(usize, prev12)..a.len]) |c| { try lines.append(c); } } return lines; } pub fn Operations(allocator: *Allocator, a: [][]const u8, b: [][]const u8) !Diff { var ops = Diff.init(allocator); var seq = &Sequence.init(allocator); defer seq.deinit(); try seq.process(a, b); try ops.list.resize(a.len + b.len); var i: usize = 0; var solution = ops.list.toSlice(); var x: usize = 0; var y: usize = 0; for (seq.snakes.toSlice()) |snake| { if (snake.len < 2) { continue; } var op: ?*Op = null; while (snake[0] - snake[1] > x - y) { if (op == null) { op = try ops.newOp(); op.?.* = Op{ .kind = .Delete, .i_1 = @intCast(isize, x), .j_1 = @intCast(isize, y), .i_2 = 0, .content = null, }; } x += 1; if (x == a.len) { break; } } add(solution, b, &i, op, x, y); op = null; while (snake[0] - snake[1] > x - y) { if (op == null) { op = try ops.newOp(); op.?.* = Op{ .kind = .Insert, .i_1 = @intCast(isize, x), .j_1 = @intCast(isize, y), .i_2 = 0, .content = null, }; } y += 1; } add(solution, b, &i, op, x, y); op = null; while (x < snake[0]) { x += 1; y += 1; } if (x >= a.len and y >= b.len) { break; } } ops.list.shrink(i); return ops; } fn add( solution: []*Op, b: [][]const u8, i: *usize, ops: ?*Op, i_2: usize, j2: usize, ) void { if (ops == null) { return; } var op = ops.?; op.i_2 = @intCast(isize, i_2); if (op.kind == .Insert) { op.content = b[@intCast(usize, op.j_1)..j2]; } solution[i.*] = op; i.* = i.* + 1; } const Sequence = struct { edits: Edits, offset: usize, arena: std.heap.ArenaAllocator, allocator: *Allocator, snakes: Edits, const Edits = std.ArrayList([]usize); fn init(a: *Allocator) Sequence { var s: Sequence = undefined; s.arena = std.heap.ArenaAllocator.init(a); s.offset = 0; s.edits = Edits.init(&s.arena.allocator); return s; } fn shortestEdit(self: *Sequence, a: [][]const u8, b: [][]const u8) !void { const m = @intCast(isize, a.len); const n = @intCast(isize, b.len); var alloc = &self.arena.allocator; var v = try alloc.alloc(isize, 2 * (a.len + b.len) + 1); var offset = @intCast(isize, n + m); try self.edits.resize(b.len + a.len + 1); var trace = self.edits.toSlice(); comptime var d = 0; while (d <= (n + m)) : (d += 1) { var k: isize = -d; while (k < d) : (k += 2) { var x: isize = 0; if (k == -d or (k != d and v[@intCast(usize, k - 1 + offset)] < v[@intCast(usize, k + 1 + offset)])) { x = v[@intCast(usize, k + 1 + offset)]; } else { x = v[@intCast(usize, k - 1 + offset)]; } var y = x - k; while (x < m and y < n and mem.eql(u8, a[@intCast(usize, x)], b[@intCast(usize, y)])) { x += 1; y += 1; } v[@intCast(usize, k + offset)] = x; if (x == m and y == n) { trace[d] = try copy(alloc, v); self.offset = @intCast(usize, offset); return; } } trace[d] = try copy(alloc, v); } } fn copy(allocator: *mem.Allocator, v: []isize) ![]usize { var o = try allocator.alloc(usize, v.len); var i: usize = 0; while (i < v.len) : (i += 1) { o[i] = @intCast(usize, v[i]); } return o; } fn deinit(self: *Sequence) void { self.arena.deinit(); } fn process(self: *Sequence, a: [][]const u8, b: [][]const u8) !void { try self.shortestEdit(a, b); try self.backtrack(a.len, b.len, self.offset); } fn backtrack(self: *Sequence, xx: usize, yy: usize, offset: usize) !void { try self.snakes.resize(self.edits.len); var snakes = self.snakes.toSlice(); const trace = self.edits.toSlice(); var alloc = &self.arena.allocator; var d = self.edits.len - 1; var x = xx; var y = yy; while (x > 0 and y > 0 and d > 0) : (d -= 1) { const v = trace[d]; if (v.len == 0) { continue; } var value = try alloc.alloc(usize, 2); value[0] = x; value[1] = y; snakes[d] = value; const k = x - y; var k_prev: usize = 0; if (k == -d or (k != d and v[k - 1 + offset] < v[k + 1 + offset])) { k_prev = k + 1; } else { k_prev = k - 1; } x = v[k_prev + offset]; y = x - k_prev; } if (x < 0 or y < 0) { return; } var value = try alloc.alloc(usize, 2); value[0] = x; value[1] = y; snakes[d] = value; } }; pub fn splitLines(a: *Allocator, text: []const u8) !Lines { var lines = Lines.init(a); var arr = &lines; var start: usize = 0; for (text) |ch, i| { if (ch == '\n') { try arr.append(text[start .. i + 1]); start = i + 1; } } // ignoring the last line if it only ends with with if (start < text.len and start != (text.len - 1)) { try arr.append(text[start..]); } return lines; } pub const Unified = struct { from: []const u8, to: []const u8, hunks: ?std.ArrayList(*Hunk), const edge = 3; const gap = edge * 2; pub fn init( a: *mem.Allocator, form: []const u8, to: []const u8, lines: [][]const u8, ops: []const Op, ) !Unified { var u = Unified{ .from = form, .to = to, .hunks = null, }; if (ops.len == 0) { return u; } u.hunks = std.ArrayList(*Hunk).init(a); var last: isize = -(gap + 2); var h: ?Hunk = null; for (ops) |op| { if (op.i_1 < last) { return error.UnsortedOp; } else if (op.i_1 == last) {} else if (op.i_1 <= last + gap) { _ = try Hunk.addEqualLines(&h.?, lines, last, op.i_1); } else { if (h != null) { _ = try Hunk.addEqualLines(&h.?, lines, last, last + edge); var ha = try a.create(Hunk); ha.* = h.?; try u.hunks.?.append(ha); } h = Hunk{ .form_line = op.i_1 + 1, .to_line = op.j_1 + 1, .lines = std.ArrayList(Line).init(a), }; const delta = try Hunk.addEqualLines(&h.?, lines, op.i_1 - edge, op.i_1); h.?.form_line -= delta; h.?.to_line -= delta; } last = op.i_1; switch (op.kind) { .Delete => { var i = op.i_1; while (i < op.i_2) : (i += 1) { try (&h.?).lines.append(Line{ .kind = .Delete, .content = lines[@intCast(usize, i)], }); last += 1; } }, .Insert => { if (op.content) |content| { for (content) |c| { try (&h.?).lines.append(Line{ .kind = .Insert, .content = c, }); } } }, else => {}, } } if (h != null) { _ = try Hunk.addEqualLines(&h.?, lines, last, last + edge); var ha = try a.create(Hunk); ha.* = h.?; try u.hunks.?.append(ha); } return u; } pub fn format( self: Unified, comptime fmt: []const u8, comptime options: std.fmt.FormatOptions, context: var, comptime Errors: type, output: fn (@typeOf(context), []const u8) Errors!void, ) Errors!void { try std.fmt.format( context, Errors, output, "--- {}\n", self.from, ); try std.fmt.format( context, Errors, output, "+++ {}\n", self.to, ); if (self.hunks) |hunks| { for (hunks.toSlice()) |hunk| { var from_count: usize = 0; var to_count: usize = 0; for (hunk.lines.toSlice()) |ln| { switch (ln.kind) { .Delete => { from_count += 1; }, .Insert => { to_count += 1; }, else => { from_count += 1; to_count += 1; }, } } try output(context, "@@"); if (from_count > 1) { try std.fmt.format( context, Errors, output, " -{},{}", hunk.form_line, from_count, ); } else { try std.fmt.format( context, Errors, output, " -{}", hunk.form_line, ); } if (to_count > 1) { try std.fmt.format( context, Errors, output, " +{},{}", hunk.to_line, to_count, ); } else { try std.fmt.format( context, Errors, output, " +{}", hunk.to_line, ); } try output(context, " @@\n"); for (hunk.lines.toSlice()) |ln| { switch (ln.kind) { .Delete => { try output(context, "-"); try output(context, ln.content); }, .Insert => { try output(context, "+"); try output(context, ln.content); }, else => { try output(context, ln.content); }, } if (!mem.endsWith(u8, ln.content, "\n")) { try std.fmt.format( context, Errors, output, "\n\\ No newline at end of file\n", ); } } } } } }; pub const Hunk = struct { form_line: isize, to_line: isize, lines: std.ArrayList(Line), fn addEqualLines( self: *Hunk, lines: [][]const u8, start: isize, end: isize, ) !isize { var delta: isize = 0; var i = start; while (i < end) : (i += 1) { if (i < 0) { continue; } if (i >= @intCast(isize, lines.len)) { return delta; } try self.lines.append(Line{ .kind = .Equal, .content = lines[@intCast(usize, i)], }); delta += 1; } return delta; } }; pub const Line = struct { kind: Op.Kind, content: []const u8, };
src/lsp/diff/diff.zig
const std = @import("std"); const imgui = @import("imgui.zig"); pub const icons = @import("font_awesome.zig"); extern fn _ogImage(user_texture_id: imgui.ImTextureID, size: *const imgui.ImVec2, uv0: *const imgui.ImVec2, uv1: *const imgui.ImVec2) void; extern fn _ogImageButton(user_texture_id: imgui.ImTextureID, size: *const imgui.ImVec2, uv0: *const imgui.ImVec2, uv1: *const imgui.ImVec2, frame_padding: c_int) bool; extern fn _ogColoredText(r: f32, g: f32, b: f32, text: [*c]const u8) void; // arm64 cant send ImVec2s to anything... extern fn _ogButton(label: [*c]const u8, x: f32, y: f32) bool; extern fn _ogImDrawData_ScaleClipRects(self: [*c]imgui.ImDrawData, fb_scale: f32) void; extern fn _ogDockBuilderSetNodeSize(node_id: imgui.ImGuiID, size: *const imgui.ImVec2) void; extern fn _ogSetNextWindowPos(pos: *const imgui.ImVec2, cond: imgui.ImGuiCond, pivot: *const imgui.ImVec2) void; extern fn _ogSetNextWindowSize(size: *const imgui.ImVec2, cond: imgui.ImGuiCond) void; extern fn _ogPushStyleVarVec2(idx: imgui.ImGuiStyleVar, w: f32, y: f32) void; extern fn _ogInvisibleButton(str_id: [*c]const u8, w: f32, h: f32, flags: imgui.ImGuiButtonFlags) bool; extern fn _ogSelectableBool(label: [*c]const u8, selected: bool, flags: imgui.ImGuiSelectableFlags, w: f32, h: f32) bool; extern fn _ogDummy(w: f32, h: f32) void; extern fn _ogBeginChildFrame(id: imgui.ImGuiID, w: f32, h: f32, flags: imgui.ImGuiWindowFlags) bool; extern fn _ogBeginChildEx(name: [*c]const u8, id: imgui.ImGuiID, size_arg: *const imgui.ImVec2, border: bool, flags: imgui.ImGuiWindowFlags) bool; extern fn _ogDockSpace(id: imgui.ImGuiID, w: f32, h: f32, flags: imgui.ImGuiDockNodeFlags, window_class: [*c]const imgui.ImGuiWindowClass) void; extern fn _ogImDrawList_AddQuad(self: [*c]imgui.ImDrawList, p1: *const imgui.ImVec2, p2: *const imgui.ImVec2, p3: *const imgui.ImVec2, p4: *const imgui.ImVec2, col: imgui.ImU32, thickness: f32) void; extern fn _ogImDrawList_AddQuadFilled(self: [*c]imgui.ImDrawList, p1: *const imgui.ImVec2, p2: *const imgui.ImVec2, p3: *const imgui.ImVec2, p4: *const imgui.ImVec2, col: imgui.ImU32) void; extern fn _ogImDrawList_AddImage(self: [*c]imgui.ImDrawList, id: imgui.ImTextureID, p_min: *const imgui.ImVec2, p_max: *const imgui.ImVec2, uv_min: *const imgui.ImVec2, uv_max: *const imgui.ImVec2, col: imgui.ImU32) void; extern fn _ogImDrawList_AddLine(self: [*c]imgui.ImDrawList, p1: *const imgui.ImVec2, p2: *const imgui.ImVec2, col: imgui.ImU32, thickness: f32) void; extern fn _ogSetCursorScreenPos(pos: *const imgui.ImVec2) void; extern fn _ogListBoxHeaderVec2(label: [*c]const u8, size: *const imgui.ImVec2) bool; extern fn _ogColorConvertFloat4ToU32(color: *const imgui.ImVec4 ) imgui.ImU32; // implementations for ABI incompatibility bugs pub fn ogImage(texture: imgui.ImTextureID, width: i32, height: i32) void { var size = imgui.ImVec2{ .x = @intToFloat(f32, width), .y = @intToFloat(f32, height) }; _ogImage(texture, &size, &imgui.ImVec2{}, &imgui.ImVec2{ .x = 1, .y = 1 }); } pub fn ogImageButton(texture: imgui.ImTextureID, size: imgui.ImVec2, uv0: imgui.ImVec2, uv1: imgui.ImVec2, frame_padding: c_int) bool { return ogImageButtonEx(texture, size, uv0, uv1, frame_padding, .{}, .{ .x = 1, .y = 1, .z = 1, .w = 1 }); } pub fn ogImageButtonEx(texture: imgui.ImTextureID, size: imgui.ImVec2, uv0: imgui.ImVec2, uv1: imgui.ImVec2, frame_padding: c_int, bg_col: imgui.ImVec4, tint_col: imgui.ImVec4) bool { _ = tint_col; _ = bg_col; return _ogImageButton(texture, &size, &uv0, &uv1, frame_padding); } pub fn ogColoredText(r: f32, g: f32, b: f32, text: [:0]const u8) void { _ogColoredText(r, g, b, text); } pub fn ogButton(label: [*c]const u8) bool { return _ogButton(label, 0, 0); } pub fn ogButtonEx(label: [*c]const u8, size: imgui.ImVec2) bool { return _ogButton(label, size.x, size.y); } pub fn ogImDrawData_ScaleClipRects(self: [*c]imgui.ImDrawData, fb_scale: imgui.ImVec2) void { _ogImDrawData_ScaleClipRects(self, fb_scale.x); } pub fn ogDockBuilderSetNodeSize(node_id: imgui.ImGuiID, size: imgui.ImVec2) void { _ogDockBuilderSetNodeSize(node_id, &size); } pub fn ogSetNextWindowPos(pos: imgui.ImVec2, cond: imgui.ImGuiCond, pivot: imgui.ImVec2) void { _ogSetNextWindowPos(&pos, cond, &pivot); } pub fn ogSetNextWindowSize(size: imgui.ImVec2, cond: imgui.ImGuiCond) void { _ogSetNextWindowSize(&size, cond); } pub fn ogPushStyleVarVec2(idx: imgui.ImGuiStyleVar, val: imgui.ImVec2) void { _ogPushStyleVarVec2(idx, val.x, val.y); } pub fn ogInvisibleButton(str_id: [*c]const u8, size: imgui.ImVec2, flags: imgui.ImGuiButtonFlags) bool { return _ogInvisibleButton(str_id, size.x, size.y, flags); } pub fn ogSelectableBool(label: [*c]const u8, selected: bool, flags: imgui.ImGuiSelectableFlags, size: imgui.ImVec2) bool { return _ogSelectableBool(label, selected, flags, size.x, size.y); } pub fn ogDummy(size: imgui.ImVec2) void { _ogDummy(size.x, size.y); } pub fn ogSetCursorPos(cursor: imgui.ImVec2) void { imgui.igSetCursorPosX(cursor.x); imgui.igSetCursorPosY(cursor.y); } pub fn ogBeginChildFrame(id: imgui.ImGuiID, size: imgui.ImVec2, flags: imgui.ImGuiWindowFlags) bool { return _ogBeginChildFrame(id, size.x, size.y, flags); } pub fn ogBeginChildEx(name: [*c]const u8, id: imgui.ImGuiID, size_arg: imgui.ImVec2, border: bool, flags: imgui.ImGuiWindowFlags) bool { return _ogBeginChildEx(name, id, &size_arg, border, flags); } pub fn ogDockSpace(id: imgui.ImGuiID, size: imgui.ImVec2, flags: imgui.ImGuiDockNodeFlags, window_class: [*c]const imgui.ImGuiWindowClass) void { _ogDockSpace(id, size.x, size.y, flags, window_class); } pub fn ogImDrawList_AddQuad(draw_list: [*c]imgui.ImDrawList, p1: *imgui.ImVec2, p2: *imgui.ImVec2, p3: *imgui.ImVec2, p4: *imgui.ImVec2, col: imgui.ImU32, thickness: f32) void { _ogImDrawList_AddQuad(draw_list, p1, p2, p3, p4, col, thickness); } pub fn ogImDrawList_AddQuadFilled(draw_list: [*c]imgui.ImDrawList, p1: *imgui.ImVec2, p2: *imgui.ImVec2, p3: *imgui.ImVec2, p4: *imgui.ImVec2, col: imgui.ImU32) void { _ogImDrawList_AddQuadFilled(draw_list, p1, p2, p3, p4, col); } pub fn ogImDrawList_AddImage( draw_list: [*c]imgui.ImDrawList, id: imgui.ImTextureID, p_min: imgui.ImVec2, p_max: imgui.ImVec2, uv_min: imgui.ImVec2, uv_max: imgui.ImVec2, col: imgui.ImU32) void { _ogImDrawList_AddImage(draw_list, id, &p_min, &p_max, &uv_min, &uv_max, col); } /// adds a rect outline with possibly non-matched width/height to the draw list pub fn ogAddRect(draw_list: [*c]imgui.ImDrawList, tl: imgui.ImVec2, size: imgui.ImVec2, col: imgui.ImU32, thickness: f32) void { _ogImDrawList_AddQuad(draw_list, &imgui.ImVec2{ .x = tl.x, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size.x, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size.x, .y = tl.y + size.y }, &imgui.ImVec2{ .x = tl.x, .y = tl.y + size.y }, col, thickness); } pub fn ogImDrawList_AddLine(draw_list: [*c]imgui.ImDrawList, p1: imgui.ImVec2, p2: imgui.ImVec2, col: imgui.ImU32, thickness: f32) void { _ogImDrawList_AddLine(draw_list, &p1, &p2, col, thickness); } pub fn ogSetCursorScreenPos(pos: imgui.ImVec2) void { _ogSetCursorScreenPos(&pos); } pub fn ogListBoxHeaderVec2(label: [*c]const u8, size: imgui.ImVec2) bool { return _ogListBoxHeaderVec2(label, &size); } // just plain helper methods pub fn ogOpenPopup(str_id: [*c]const u8) void { imgui.igOpenPopup(str_id); } pub fn ogColoredButton(color: imgui.ImU32, label: [*c]const u8) bool { return ogColoredButtonEx(color, label, .{}); } pub fn ogColoredButtonEx(color: imgui.ImU32, label: [*c]const u8, size: imgui.ImVec2) bool { imgui.igPushStyleColorU32(imgui.ImGuiCol_Button, color); defer imgui.igPopStyleColor(1); return ogButtonEx(label, size); } pub fn ogPushIDUsize(id: usize) void { imgui.igPushIDInt(@intCast(c_int, id)); } /// helper to shorten disabling controls via ogPushDisabled; defer ogPopDisabled; due to defer not working inside the if block. pub fn ogPushDisabled(should_push: bool) void { if (should_push) { imgui.igPushItemFlag(imgui.ImGuiItemFlags_Disabled, true); imgui.igPushStyleVarFloat(imgui.ImGuiStyleVar_Alpha, 0.7); } } pub fn ogPopDisabled(should_pop: bool) void { if (should_pop) { imgui.igPopItemFlag(); imgui.igPopStyleVar(1); } } /// only true if down this frame and not down the previous frame pub fn ogKeyPressed(key: usize) bool { return imgui.igGetIO().KeysDown[key] and imgui.igGetIO().KeysDownDuration[key] == 0; } /// true the entire time the key is down pub fn ogKeyDown(key: usize) bool { return imgui.igGetIO().KeysDown[key]; } /// true only the frame the key is released pub fn ogKeyUp(key: usize) bool { return !imgui.igGetIO().KeysDown[key] and imgui.igGetIO().KeysDownDuration[key] == -1 and imgui.igGetIO().KeysDownDurationPrev[key] >= 0; } pub fn ogGetCursorScreenPos() imgui.ImVec2 { var pos = imgui.ImVec2{}; imgui.igGetCursorScreenPos(&pos); return pos; } pub fn ogGetCursorPos() imgui.ImVec2 { var pos = imgui.ImVec2{}; imgui.igGetCursorPos(&pos); return pos; } pub fn ogGetWindowSize() imgui.ImVec2 { var pos = imgui.ImVec2{}; imgui.igGetWindowSize(&pos); return pos; } pub fn ogGetWindowPos() imgui.ImVec2 { var pos = imgui.ImVec2{}; imgui.igGetWindowPos(&pos); return pos; } pub fn ogGetItemRectSize() imgui.ImVec2 { var size = imgui.ImVec2{}; imgui.igGetItemRectSize(&size); return size; } pub fn ogGetItemRectMax() imgui.ImVec2 { var size = imgui.ImVec2{}; imgui.igGetItemRectMax(&size); return size; } pub fn ogGetMouseDragDelta(button: imgui.ImGuiMouseButton, lock_threshold: f32) imgui.ImVec2 { var pos = imgui.ImVec2{}; imgui.igGetMouseDragDelta(&pos, button, lock_threshold); return pos; } /// returns the drag delta of the mouse buttons that is dragging pub fn ogGetAnyMouseDragDelta() imgui.ImVec2 { var drag_delta = imgui.ImVec2{}; if (imgui.igIsMouseDragging(imgui.ImGuiMouseButton_Left, 0)) { imgui.igGetMouseDragDelta(&drag_delta, imgui.ImGuiMouseButton_Left, 0); } else { imgui.igGetMouseDragDelta(&drag_delta, imgui.ImGuiMouseButton_Right, 0); } return drag_delta; } /// returns true if any mouse is dragging pub fn ogIsAnyMouseDragging() bool { return imgui.igIsMouseDragging(imgui.ImGuiMouseButton_Left, 0) or imgui.igIsMouseDragging(imgui.ImGuiMouseButton_Right, 0); } pub fn ogIsAnyMouseDown() bool { return imgui.igIsMouseDown(imgui.ImGuiMouseButton_Left) or imgui.igIsMouseDown(imgui.ImGuiMouseButton_Right); } pub fn ogIsAnyMouseReleased() bool { return imgui.igIsMouseReleased(imgui.ImGuiMouseButton_Left) or imgui.igIsMouseReleased(imgui.ImGuiMouseButton_Right); } pub fn ogGetContentRegionAvail() imgui.ImVec2 { var pos = imgui.ImVec2{}; imgui.igGetContentRegionAvail(&pos); return pos; } pub fn ogGetWindowContentRegionMax() imgui.ImVec2 { var max = imgui.ImVec2{}; imgui.igGetWindowContentRegionMax(&max); return max; } pub fn ogGetWindowCenter() imgui.ImVec2 { var max = imgui.ogGetWindowContentRegionMax(); max.x /= 2; max.y /= 2; return max; } pub fn ogAddQuad(draw_list: [*c]imgui.ImDrawList, tl: imgui.ImVec2, size: f32, col: imgui.ImU32, thickness: f32) void { ogImDrawList_AddQuad(draw_list, &imgui.ImVec2{ .x = tl.x, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size, .y = tl.y + size }, &imgui.ImVec2{ .x = tl.x, .y = tl.y + size }, col, thickness); } pub fn ogAddQuadFilled(draw_list: [*c]imgui.ImDrawList, tl: imgui.ImVec2, size: f32, col: imgui.ImU32) void { ogImDrawList_AddQuadFilled(draw_list, &imgui.mVec2{ .x = tl.x, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size, .y = tl.y + size }, &imgui.ImVec2{ .x = tl.x, .y = tl.y + size }, col); } /// adds a rect with possibly non-matched width/height to the draw list pub fn ogAddRectFilled(draw_list: [*c]imgui.ImDrawList, tl: imgui.ImVec2, size: imgui.ImVec2, col: imgui.ImU32) void { ogImDrawList_AddQuadFilled(draw_list, &imgui.ImVec2{ .x = tl.x, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size.x, .y = tl.y }, &imgui.ImVec2{ .x = tl.x + size.x, .y = tl.y + size.y }, &imgui.ImVec2{ .x = tl.x, .y = tl.y + size.y }, col); } pub fn ogInputText(label: [*c]const u8, buf: [*c]u8, buf_size: usize) bool { return imgui.igInputText(label, buf, buf_size, imgui.ImGuiInputTextFlags_None, null, null); } pub fn ogInputTextEnter(label: [*c]const u8, buf: [*c]u8, buf_size: usize) bool { return imgui.igInputText(label, buf, buf_size, imgui.ImGuiInputTextFlags_EnterReturnsTrue | imgui.ImGuiInputTextFlags_AutoSelectAll, null, null); } /// adds an unformatted (igTextUnformatted) tooltip with a specific wrap width pub fn ogUnformattedTooltip(text_wrap_pos: f32, text: [*c]const u8) void { if (imgui.igIsItemHovered(imgui.ImGuiHoveredFlags_None)) { imgui.igBeginTooltip(); defer imgui.igEndTooltip(); imgui.igPushTextWrapPos(imgui.igGetFontSize() * text_wrap_pos); imgui.igTextUnformatted(text, null); imgui.igPopTextWrapPos(); } } pub fn ogDrag(comptime T: type, label: [*c]const u8, p_data: *T, v_speed: f32, p_min: T, p_max: T) bool { if (std.meta.trait.isUnsignedInt(T)) { return ogDragUnsignedFormat(T, label, p_data, v_speed, p_min, p_max, "%u"); } else if (T == f32) { return ogDragSigned(T, label, p_data, v_speed, p_min, p_max); } return ogDragSigned(T, label, p_data, v_speed, p_min, p_max); } pub fn ogDragUnsignedFormat(comptime T: type, label: [*c]const u8, p_data: *T, v_speed: f32, p_min: T, p_max: T, format: [*c]const u8) bool { std.debug.assert(std.meta.trait.isUnsignedInt(T)); var min = p_min; var max = p_max; const data_type = switch (T) { u8 => imgui.ImGuiDataType_U8, u16 => imgui.ImGuiDataType_U16, u32 => imgui.ImGuiDataType_U32, usize => imgui.ImGuiDataType_U64, else => unreachable, }; return imgui.igDragScalar(label, data_type, p_data, v_speed, &min, &max, format, 1); } pub fn ogDragSigned(comptime T: type, label: [*c]const u8, p_data: *T, v_speed: f32, p_min: T, p_max: T) bool { var min = p_min; var max = p_max; const data_type = switch (T) { i16 => imgui.ImGuiDataType_S16, i32 => imgui.ImGuiDataType_S32, f32 => imgui.ImGuiDataType_Float, else => unreachable, }; return imgui.igDragScalar(label, data_type, p_data, v_speed, &min, &max, "%.2f", 1); } pub fn ogDragSignedFormat(comptime T: type, label: [*c]const u8, p_data: *T, v_speed: f32, p_min: T, p_max: T, format: [*c]const u8) bool { var min = p_min; var max = p_max; const data_type = switch (T) { i16 => imgui.ImGuiDataType_S16, i32 => imgui.ImGuiDataType_S32, f32 => imgui.ImGuiDataType_Float, else => unreachable, }; return imgui.igDragScalar(label, data_type, p_data, v_speed, &min, &max, format, 1); } pub fn ogColorConvertU32ToFloat4(in: imgui.ImU32) imgui.ImVec4 { var col = imgui.ImVec4{}; imgui.igColorConvertU32ToFloat4(&col, in); return col; } pub fn ogColorConvertFloat4ToU32 (in: imgui.ImVec4) imgui.ImU32 { return _ogColorConvertFloat4ToU32(&in); }
src/deps/imgui/wrapper.zig
const out = @import("platform.zig").out; const in = @import("platform.zig").in; const isr = @import("isr.zig"); const x86 = @import("platform.zig"); const sti = x86.sti; const hlt = x86.hlt; const serial = @import("../../debug/serial.zig"); const PIC1_CMD = 0x20; const PIC1_DATA = 0x21; const PIC2_CMD = 0xA0; const PIC2_DATA = 0xA1; const ISR_READ = @as(u8, 0x0B); const EOI = @as(u8, 0x20); const ICW1_INIT = @as(u8, 0x10); const ICW1_ICW4 = @as(u8, 0x01); const ICW4_8086 = @as(u8, 0x01); const EXCEPTION_0 = @as(u8, 0); const EXCEPTION_31 = EXCEPTION_0 + 31; const IRQ_0 = EXCEPTION_31 + 1; const IRQ_15 = IRQ_0 + 15; var handlers = [_]fn (*x86.Context) usize{unhandled} ** 48; fn unhandled(context: *x86.Context) usize { const n = context.interrupt_n; if (n >= IRQ_0) { serial.ppanic("unhandled IRQ number: {d}", .{n - IRQ_0}); } else { serial.ppanic("unhandled exception number: {d}", .{n}); } return @ptrToInt(context); } export fn interruptDispatch(context: *x86.Context) usize { const n = @truncate(u8, context.interrupt_n); switch (n) { EXCEPTION_0...EXCEPTION_31 => { return handlers[n](context); }, IRQ_0...IRQ_15 => { const irq = n - IRQ_0; if (spuriousIRQ(n)) return @ptrToInt(context); const retaddr = handlers[n](context); signalEndOfInterrupt(n); return retaddr; }, else => unreachable, } return @ptrToInt(context); // Return the proper rsp back. } fn spuriousIRQ(irq: u8) bool { if (irq != 7) return false; out(PIC1_CMD, ISR_READ); const in_service = in(u8, PIC1_CMD); return (in_service & (1 << 7)) == 0; } fn signalEndOfInterrupt(irq: u8) void { if (irq >= 8) { out(PIC2_CMD, EOI); } out(PIC1_CMD, EOI); } pub fn register(n: u8, handler: fn (*x86.Context) usize) void { handlers[n] = handler; } pub fn registerIRQ(irq: u8, handler: fn (*x86.Context) usize) void { register(IRQ_0 + irq, handler); maskIRQ(irq, false); } pub fn maskIRQ(irq: u8, mask: bool) void { const port = if (irq < 8) @as(u16, PIC1_DATA) else @as(u16, PIC2_DATA); const old = in(u8, port); const shift = @truncate(u3, irq % 8); if (mask) { out(port, old | (@as(u8, 1) << shift)); } else { out(port, old & ~(@as(u8, 1) << shift)); } } fn remapPIC() void { out(PIC1_CMD, ICW1_INIT | ICW1_ICW4); out(PIC2_CMD, ICW1_INIT | ICW1_ICW4); out(PIC1_DATA, IRQ_0); out(PIC2_DATA, IRQ_0 + 8); out(PIC1_DATA, @as(u8, 1 << 2)); out(PIC2_DATA, @as(u8, 2)); out(PIC1_DATA, ICW4_8086); out(PIC2_DATA, ICW4_8086); out(PIC1_DATA, @as(u8, 0xFF)); out(PIC2_DATA, @as(u8, 0xFF)); } pub fn initialize() void { serial.writeText("Remapping PICs...\n"); remapPIC(); serial.writeText("PICs remapped.\n"); isr.install_exceptions(); serial.writeText("Exceptions installed.\n"); isr.install_irqs(); serial.writeText("IRQs installed.\n"); }
src/kernel/arch/x86/interrupts.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "Process", .filter = .info, }).write; pub const address_space = @import("process/address_space.zig"); pub const memory_object = @import("process/memory_object.zig"); const platform = os.platform; const copernicus = os.kernel.copernicus; // Representation of a process in a kernel context // We can have binary compatibility for an operating system (syscall numbers, process state) // built into the kernel. If we do, this is where that is stored too. pub fn currentProcess() ?*Process { return os.platform.get_current_task().process; } fn resolveSyscall(frame: *platform.InterruptFrame) fn (*Process, *platform.InterruptFrame) void { switch (comptime platform.arch) { .x86_64 => { switch (syscallNumber(frame)) { 1 => return Process.linuxWrite, 60 => return Process.linuxExit, else => {}, } }, .aarch64 => { switch (syscallNumber(frame)) { 64 => return Process.linuxWrite, 93 => return Process.linuxExit, else => {}, } }, else => unreachable, } return Process.syscallUnknown; } fn syscallNumber(frame: *platform.InterruptFrame) usize { switch (comptime platform.arch) { .x86_64 => return frame.rax, .aarch64 => return frame.x8, else => @compileError("syscallNumber not implemented for arch"), } } fn syscallArg(frame: *platform.InterruptFrame, num: usize) usize { switch (comptime platform.arch) { .x86_64 => { return switch (num) { 0 => frame.rdi, 1 => frame.rsi, 2 => frame.rdx, 3 => frame.r10, 4 => frame.r8, 5 => frame.r9, else => unreachable, }; }, .aarch64 => { return switch (num) { 0 => frame.x0, 1 => frame.x1, 2 => frame.x2, 3 => frame.x3, 4 => frame.x4, 5 => frame.x5, else => unreachable, }; }, else => @compileError("syscallArg not implemented for arch"), } } var lazy_zeroes = memory_object.lazyZeroes(os.memory.paging.rw()); pub const Process = struct { page_table: platform.paging.PagingContext, addr_space: address_space.AddrSpace, pub fn init(self: *@This(), name: []const u8) !void { try os.thread.scheduler.spawnTask("Userspace task", initProcessTask, .{ self, name }); } fn initProcessTask(self: *@This(), name: []const u8) !void { const task = os.platform.get_current_task(); task.secondary_name = name; const userspace_base = 0x000400000; try self.addr_space.init(userspace_base, 0xFFFFFFF000); self.page_table = try os.platform.paging.PagingContext.make_userspace(); task.paging_context = &self.page_table; errdefer task.paging_context.deinit(); const entry = try copernicus.map(&self.addr_space); const stack_size = 0x2000; const stack_base = try self.addr_space.allocateAnywhere(stack_size); try self.addr_space.lazyMap(stack_base, stack_size, try lazy_zeroes.makeRegion()); const stack_top = stack_base + stack_size; task.process = self; self.page_table.apply(); os.platform.thread.enter_userspace(entry, 0, stack_top); } fn exitProc(frame: *platform.InterruptFrame) void { // TODO: Stop all tasks and do whatever else is needed log(.info, "Exiting current userspace task.", .{}); os.thread.scheduler.exitTask(); } pub fn deinit() void { log(.warn, "TODO: Process deinit", .{}); } pub fn handleSyscall(self: *@This(), frame: *platform.InterruptFrame) void { resolveSyscall(frame)(self, frame); } pub fn onPageFault(self: *@This(), addr: usize, present: bool, fault_type: platform.PageFaultAccess, frame: *platform.InterruptFrame) void { self.addr_space.pageFault(addr, present, fault_type) catch |err| { const present_str: []const u8 = if (present) "present" else "non-present"; log(null, "Page fault in userspace process: {s} {e} at 0x{X}", .{ present_str, fault_type, addr }); log(null, "Didn't handle the page fault: {e}", .{err}); if (@errorReturnTrace()) |trace| { os.kernel.debug.dumpStackTrace(trace); } log(null, "Frame dump:\n{}", .{frame}); frame.trace_stack(); exitProc(frame); }; } fn linuxWrite(self: *@This(), frame: *platform.InterruptFrame) void { const fd = syscallArg(frame, 0); switch (fd) { 1, 2 => { const str_ptr = @intToPtr([*]const u8, syscallArg(frame, 1)); const str_len = syscallArg(frame, 2); if (str_len > 0) { const ends_with_endl = str_ptr[str_len - 1] == '\n'; const str: []const u8 = if (ends_with_endl) str_ptr[0 .. str_len - 1] else str_ptr[0..str_len]; log(null, "USERSPACE LOG: {s}", .{str}); } }, else => { log(.warn, "linuxWrite to bad fd {d}", .{fd}); }, } } fn linuxExit(self: *@This(), frame: *platform.InterruptFrame) void { log(.info, "Userspace process requested exit.", .{}); exitProc(frame); } fn syscallUnknown(self: *@This(), frame: *platform.InterruptFrame) void { log(.warn, "Process executed unknown syscall {d}", .{syscallNumber(frame)}); exitProc(frame); } };
subprojects/flork/src/kernel/process.zig
/// Another way to get the output in intel mnemonics and with source code is: /// $ zig build-obj --release-fast emit-asm-example/optional.i32.zig && objdump --source -d -M intel optional.i32.o > emit-asm-example/optional.i32.src.s /// $ cat -n emit-asm-example/optional.i32.src.s /// 1 /// 2 optional.i32.o: file format elf64-x86-64 /// 3 /// 4 /// 5 Disassembly of section .text: /// 6 /// 7 0000000000000000 <entry>: /// 8 /// A function or any other code you'd like to see the its asm. /// 9 fn aFunc() i32 { /// 10 var pResult: *volatile ?i32 = &gResult; /// 11 var value: i32 = undefined; /// 12 /// 13 pResult.* = 4; /// 14 0: 48 8b 05 00 00 00 00 mov rax,QWORD PTR [rip+0x0] # 7 <entry+0x7> /// 15 7: 48 89 05 00 00 00 00 mov QWORD PTR [rip+0x0],rax # e <entry+0xe> /// 16 value = if (pResult.* == null) math.minInt(i32) else pResult.*.?; /// 17 e: 80 3d 00 00 00 00 01 cmp BYTE PTR [rip+0x0],0x1 # 15 <entry+0x15> /// 18 15: 75 06 jne 1d <entry+0x1d> /// 19 17: 8b 05 00 00 00 00 mov eax,DWORD PTR [rip+0x0] # 1d <entry+0x1d> /// 20 assert(value == 4); /// 21 pResult.* = null; /// 22 1d: 48 8b 05 00 00 00 00 mov rax,QWORD PTR [rip+0x0] # 24 <entry+0x24> /// 23 24: 48 89 05 00 00 00 00 mov QWORD PTR [rip+0x0],rax # 2b <entry+0x2b> /// 24 2b: b8 00 00 00 80 mov eax,0x80000000 /// 25 value = if (pResult.* == null) math.minInt(i32) else pResult.*.?; /// 26 30: 80 3d 00 00 00 00 01 cmp BYTE PTR [rip+0x0],0x1 # 37 <entry+0x37> /// 27 37: 75 06 jne 3f <entry+0x3f> /// 28 39: 8b 05 00 00 00 00 mov eax,DWORD PTR [rip+0x0] # 3f <entry+0x3f> /// 29 return value; /// 30 } /// 31 /// 32 /// An exported function otherwise no code is generated when build-obj /// 33 export fn entry() i32 { /// 34 return aFunc(); /// 35 3f: c3 ret const std = @import("std"); const math = std.math; const assert = std.debug.assert; var gResult: ?i32 = undefined; /// A function or any other code you'd like to see the its asm. fn aFunc() i32 { var pResult: *volatile ?i32 = &gResult; var value: i32 = undefined; pResult.* = 4; value = if (pResult.* == null) math.minInt(i32) else pResult.*.?; assert(value == 4); pResult.* = null; value = if (pResult.* == null) math.minInt(i32) else pResult.*.?; assert(value == math.minInt(i32)); return value; } /// An exported function otherwise no code is generated when build-obj export fn entry() i32 { return aFunc(); } /// Programs that need a fn panic get large because of the code /// necessary to dump a stack trace. If you enable `pub fn main()` /// but not `pub fn panic` the output about 16,000 lines of assembly. /// /// $ zig build-obj --output-h /dev/null --release-safe --strip --emit asm optional.i32.zig /// $ wc -l optional.i32.s /// 15896 optional.i32.s /// /// But if you enable `pub fn panic` below its 61 lines /// $ zig build-obj --output-h /dev/null --release-safe --strip --emit asm optional.i32.zig /// $ wc -l optional.i32.s /// 61 optional.i32.s /// /// Alos, if you do --release-fast build then it's small as there is no invocation of panic /// $ zig build-obj --output-h /dev/null --release-fast --strip --emit asm optional.i32.zig /// $ wc -l optional.i32.s /// 45 optional.i32.s var global: i32 = undefined; pub fn panic(msg: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { // Must not return so add endless loop var pGlobal: *volatile i32 = &global; pGlobal.* = 123; while (true) {} } test "test.optional.i32" { assert(aFunc() == math.minInt(i32)); }
emit-asm-example/optional.i32.zig
pub const Token = @import("json_grammar.tokens.zig").Token; pub const Id = @import("json_grammar.tokens.zig").Id; pub const Lexer = struct { first: usize, index: usize, source: []const u8, char: i32, peek: i32, const Self = @This(); pub fn init(source: []const u8) Lexer { var peek: i32 = -1; if (source.len > 0) { peek = source[0]; } return Lexer{ .first = 0, .index = 0, .source = source, .char = 0, .peek = peek, }; } // Deal with lookahead and EOF fn getc(self: *Self) i32 { self.char = self.peek; self.index += 1; if (self.index < self.source.len) { self.peek = self.source[self.index]; } else { self.peek = -1; } return self.char; } fn getString(self: *Self) Token { _ = self.getc(); while (true) { switch (self.peek) { '\n', -1 => { return Token{ .id = .Invalid, .start = self.first+1, .end = self.index-1 }; }, '\\' => { _ = self.getc(); }, '"' => { _ = self.getc(); return Token{ .id = .StringLiteral, .start = self.first+1, .end = self.index-1 }; }, else => {}, } _ = self.getc(); } } fn getInteger(self: *Self) Token { _ = self.getc(); while (true) { switch (self.peek) { '0'...'9' => { _ = self.getc(); }, else => { return Token{ .id = .IntegerLiteral, .start = self.first, .end = self.index }; }, } } } // Get the next token in parse; always ends with Token.Id.Eof pub fn next(self: *Self) Token { self.first = self.index; // Keep parsing until EOF while (self.peek != -1) { switch(self.peek) { '"' => return self.getString(), '0'...'9' => return self.getInteger(), '-' => { _ = self.getc(); if(self.peek >= '1' and self.peek <= '9') return self.getInteger(); return Token{ .id = .Invalid, .start = self.first, .end = self.index }; }, ' ','\t','\r','\n' => _ = self.getc(), '{' => { _ = self.getc(); return Token{ .id = .LBrace, .start = self.first, .end = self.index }; }, '}' => { _ = self.getc(); return Token{ .id = .RBrace, .start = self.first, .end = self.index }; }, '[' => { _ = self.getc(); return Token{ .id = .LBracket, .start = self.first, .end = self.index }; }, ']' => { _ = self.getc(); return Token{ .id = .RBracket, .start = self.first, .end = self.index }; }, ':' => { _ = self.getc(); return Token{ .id = .Colon, .start = self.first, .end = self.index }; }, ',' => { _ = self.getc(); return Token{ .id = .Comma, .start = self.first, .end = self.index }; }, 'n' => { _ = self.getc(); if('u' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('l' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('l' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; return Token{ .id = .Keyword_null, .start = self.first, .end = self.index }; }, 't' => { _ = self.getc(); if('r' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('u' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('e' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; return Token{ .id = .Keyword_true, .start = self.first, .end = self.index }; }, 'f' => { _ = self.getc(); if('a' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('l' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('s' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; if('e' != self.getc()) return Token{ .id = .Invalid, .start = self.first, .end = self.index }; return Token{ .id = .Keyword_false, .start = self.first, .end = self.index }; }, else => { _ = self.getc(); return Token{ .id = .Invalid, .start = self.first, .end = self.index }; } } } // No more input; return Eof return Token{ .id = .Eof, .start = self.first, .end = self.index }; } };
json/json_lexer.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Writer = std.io.Writer; // All magics are little-endian values. const UF2_MAGIC_FIRST: u32 = 0x0A324655; const UF2_MAGIC_SECOND: u32 = 0x9E5D5157; const UF2_MAGIC_FINAL: u32 = 0x0AB16F30; pub const UF2Config = struct { family_id: ?u32, }; const UF2Block = packed struct { magic_start_0: u32 = UF2_MAGIC_FIRST, magic_start_1: u32 = UF2_MAGIC_SECOND, flags: u32, target_addr: u32, payload_size: u32, block_no: u32, num_blocks: u32, file_size_or_family_id: u32, data: [476]u8, magic_end: u32 = UF2_MAGIC_FINAL, }; const UF2Error = error { InvalidOffset, }; pub const UF2 = struct { binary: ArrayList(u8), binary_offset: u32, config: UF2Config, allocator: *Allocator, const Self = @This(); pub fn init(allocator: *Allocator, offset: u32, config: UF2Config) Self { return Self { .binary = ArrayList(u8).init(allocator.*), .binary_offset = offset, .config = config, .allocator = allocator, }; } pub fn deinit(self: *Self) void { self.allocator.destroy(&self.binary); } pub fn addData(self: *Self, data: []const u8, offset: u32) !void { if(offset < self.binary_offset) return UF2Error.InvalidOffset; const local_offset = offset - self.binary_offset; if(self.binary.items.len < local_offset + data.len) { try self.enlargeAndZeroBinaryBuffer(local_offset, data.len); } try self.binary.replaceRange(local_offset, data.len, data); } pub fn write(self: *Self, writer: anytype) !void { // For now, we assume payload size of 256. const total_blocks = self.binary.items.len / 256 + 1; var target_address = self.binary_offset; var i: u32 = 0; while (i < total_blocks) : (i += 1) { var binary_index = i * 256; try self.writeSingleBlock(writer, self.binary.items[binary_index..], target_address, i, 256, @intCast(u32, total_blocks)); target_address += 256; } } fn writeSingleBlock(self: *Self, writer: anytype, data: []const u8, target_address: u32, block_number: u32, payload_size: u32, num_blocks: u32) !void { var buf = [_]u8{0} ** 476; for (buf) |*b, i| { if (i >= 256) break; if (i >= data.len) { b.* = 0; } else { b.* = data[i]; } } var block = UF2Block { .flags = if (self.config.family_id == null) 0x00000000 else 0x00002000, .target_addr = target_address, .payload_size = payload_size, .block_no = block_number, .num_blocks = num_blocks, .file_size_or_family_id = self.config.family_id orelse 0x00000000, .data = buf, }; const block_binary = @bitCast([512]u8, block); _ = try writer.writeAll(block_binary[0..]); } fn enlargeAndZeroBinaryBuffer(self: *Self, needed_local_offset: u32, needed_length: usize) !void { const previous_last_index = if (self.binary.items.len == 0) 0 else self.binary.items.len - 1; try self.binary.resize(needed_local_offset + needed_length); var i = previous_last_index + 1; while (i < self.binary.items.len) : (i += 1) { self.binary.items[i] = 0; } } };
build/uf2.zig
const std = @import("std"); const alphabet = @import("bio/alphabet.zig"); const Sequence = @import("sequence.zig").Sequence; const Cigar = @import("cigar.zig").Cigar; const CigarOp = @import("cigar.zig").CigarOp; pub const BandedAlignOptions = struct { bandwidth: usize = 16, gap_interior_open_score: i32 = -20, gap_interior_extend_score: i32 = -2, gap_terminal_open_score: i32 = -2, gap_terminal_extend_score: i32 = -1, }; pub const BandedAlignDirection = enum { forward, backward, }; pub fn BandedAlign(comptime A: type) type { return struct { const Self = @This(); const MinScore = -1_000_000; const Gap = struct { score: i32 = MinScore, is_terminal: bool = false, pub fn openOrExtend(self: *Gap, options: BandedAlignOptions, score: i32, is_terminal: bool, length: usize) void { var new_gap_score: i32 = score; if (length > 0) { if (is_terminal) { new_gap_score += options.gap_terminal_open_score + @intCast(i32, length) * options.gap_terminal_extend_score; } else { new_gap_score += options.gap_interior_open_score + @intCast(i32, length) * options.gap_interior_extend_score; } } if (self.is_terminal) { self.score += @intCast(i32, length) * options.gap_terminal_extend_score; } else { self.score += @intCast(i32, length) * options.gap_interior_extend_score; } if (new_gap_score > self.score) { self.score = new_gap_score; self.is_terminal = is_terminal; } } pub fn reset(self: *Gap) void { self.score = MinScore; self.is_terminal = false; } }; options: BandedAlignOptions, allocator: std.mem.Allocator, scores: std.ArrayList(i32), vertical_gaps: std.ArrayList(Gap), ops: std.ArrayList(CigarOp), pub fn init(allocator: std.mem.Allocator, options: BandedAlignOptions) Self { return Self{ .allocator = allocator, .options = options, .scores = std.ArrayList(i32).init(allocator), .vertical_gaps = std.ArrayList(Gap).init(allocator), .ops = std.ArrayList(CigarOp).init(allocator), }; } pub fn deinit(self: *Self) void { self.scores.deinit(); self.vertical_gaps.deinit(); self.ops.deinit(); } pub fn process( self: *Self, seq_one: Sequence(A), seq_two: Sequence(A), dir: BandedAlignDirection, start_one_: usize, start_two_: usize, end_one_: ?usize, end_two_: ?usize, cigar: ?*Cigar, ) !i32 { // const width = if (dir == AlignDirection.forward) (seq_one.data.len - start_one + 1) else (start_one + 1); // const height = if (dir == AlignDirection.forward) (seq_two.data.len - start_two + 1) else (start_two + 1); // try self.row.resize(@floatToInt(usize, @intToFloat(f32, width) * 1.5)); // const row = self.row.items; // Calculate matrix width, depending on alignment // direction and length of sequences // A will be on the X axis (width of matrix) // B will be on the Y axis (height of matrix) const len_one = seq_one.length(); const len_two = seq_two.length(); const default_end_one = if (dir == .forward) len_one else 0; var end_one = end_one_ orelse default_end_one; const default_end_two = if (dir == .forward) len_two else 0; var end_two = end_two_ orelse default_end_two; var start_one = start_one_; var start_two = start_two_; // sanitize if (start_one > len_one) start_one = len_one; if (start_two > len_two) start_two = len_two; if (end_one > len_one) end_one = len_one; if (end_two > len_two) end_two = len_two; const width = if (end_one > start_one) end_one - start_one + 1 else start_one - end_one + 1; const height = if (end_two > start_two) end_two - start_two + 1 else start_two - end_two + 1; if (dir == .forward) { std.debug.assert(end_one >= start_one); std.debug.assert(end_two >= start_two); } else { std.debug.assert(end_one <= start_one); std.debug.assert(end_two <= start_two); } // Make sure we have enough cells try self.scores.resize(@floatToInt(usize, @intToFloat(f32, width) * 1.5)); std.mem.set(i32, self.scores.items, MinScore); const scores = self.scores.items; try self.vertical_gaps.resize(@floatToInt(usize, @intToFloat(f32, width) * 1.5)); std.mem.set(Gap, self.vertical_gaps.items, Gap{}); const vertical_gaps = self.vertical_gaps.items; try self.ops.resize(@floatToInt(usize, @intToFloat(f32, width * height) * 1.5)); const ops = self.ops.items; // Initialize first row const bw = self.options.bandwidth; const is_beginning_one: bool = (start_one == 0 or start_one == len_one); const is_beginning_two: bool = (start_two == 0 or start_two == len_two); const is_ending_one: bool = (end_one == 0 or end_one == len_one); const is_ending_two: bool = (end_two == 0 or end_two == len_two); scores[0] = 0; vertical_gaps[0].reset(); vertical_gaps[0].openOrExtend(self.options, scores[0], is_beginning_two, 1); var horizontal_gap = Gap{}; var x: usize = 1; while (x < width) : (x += 1) { if (x > bw and height > 1) // only break on BW bound if B is not empty break; horizontal_gap.openOrExtend(self.options, scores[x - 1], is_beginning_one, 1); scores[x] = horizontal_gap.score; ops[x] = CigarOp.insertion; vertical_gaps[x].reset(); } if (x < width) { scores[x] = MinScore; vertical_gaps[x].reset(); } // Row by row var center: usize = 1; var y: usize = 1; while (y < height) : (y += 1) { var score: i32 = MinScore; // Calculate band bounds const left_bound = std.math.min(width - 1, if (center > bw) center - bw else 0); const right_bound = std.math.min(width - 1, center + bw); // Set diagonal score for first calculated cell in row var diag_score: i32 = MinScore; if (left_bound > 0) { diag_score = scores[left_bound - 1]; scores[left_bound - 1] = MinScore; vertical_gaps[left_bound - 1].reset(); } // Calculate row within the band bounds horizontal_gap.reset(); x = left_bound; while (x <= right_bound) : (x += 1) { var pos_one: usize = 0; var pos_two: usize = 0; var match: bool = false; if (x > 0) { // diagScore: score at col-1, row-1 pos_one = if (dir == .forward) start_one + x - 1 else start_one - x; pos_two = if (dir == .forward) start_two + y - 1 else start_two - y; const letter_one = seq_one.data[pos_one]; const letter_two = seq_two.data[pos_two]; match = A.match(letter_one, letter_two); score = diag_score + A.score(letter_one, letter_two); } // Select highest score // - coming from diag (current), // - coming from left (row) // - coming from top (col) const vertical_gap = &vertical_gaps[x]; score = std.math.max(score, horizontal_gap.score); score = std.math.max(score, vertical_gap.score); // Save the prev score at (x - 1) which // we will use to compute the diagonal score at (x) diag_score = scores[x]; // Save new score scores[x] = score; // Record op var op: CigarOp = undefined; if (score == horizontal_gap.score) { op = CigarOp.insertion; } else if (score == vertical_gap.score) { op = CigarOp.deletion; } else if (match) { op = CigarOp.match; } else { op = CigarOp.mismatch; } ops[y * width + x] = op; // Calculate potential gaps const is_gap_terminal_one = (x == 0 or x == width - 1) and is_ending_one; const is_gap_terminal_two = (y == 0 or y == height - 1) and is_ending_two; horizontal_gap.openOrExtend(self.options, score, is_gap_terminal_two, 1); vertical_gap.openOrExtend(self.options, score, is_gap_terminal_one, 1); } if (right_bound + 1 < width) { scores[right_bound + 1] = MinScore; vertical_gaps[right_bound + 1].reset(); } if (right_bound == left_bound) break; // Move one cell over for the next row center += 1; } // backtrack if (cigar != null) { var bx = x - 1; var by = y - 1; cigar.?.clear(); while (bx > 0 or by > 0) { const op = ops[by * width + bx]; try cigar.?.add(op); // where did we come from? switch (op) { CigarOp.insertion => { bx -= 1; }, CigarOp.deletion => { by -= 1; }, CigarOp.match, CigarOp.mismatch => { bx -= 1; by -= 1; }, } } // make cigar forward facing // we need to potentially append tails below // cigar orientation is determined after these tail additions cigar.?.reverse(); } var score = scores[x - 1]; if (x == width) { // We reached the end of A, emulate going down on B (vertical gaps) const num_remaining = height - y; const vertical_gap = &vertical_gaps[x - 1]; vertical_gap.openOrExtend(self.options, score, vertical_gap.is_terminal, num_remaining); score = vertical_gap.score; var pad = num_remaining; while (pad > 0) : (pad -= 1) { try cigar.?.add(CigarOp.deletion); } } else if (y == height) { // We reached the end of B, emulate going down on A (horizontal gaps) const num_remaining = width - x; horizontal_gap.openOrExtend(self.options, score, horizontal_gap.is_terminal, num_remaining); score = horizontal_gap.score; var pad = num_remaining; while (pad > 0) : (pad -= 1) { try cigar.?.add(CigarOp.insertion); } } // finally orient cigar if (cigar != null and dir == .backward) { cigar.?.reverse(); } return score; } }; } fn testAlign(one: []const u8, two: []const u8, dir: BandedAlignDirection, options: BandedAlignOptions, start_one: usize, start_two: usize, end_one: ?usize, end_two: ?usize, expected_cigar_str: []const u8) !i32 { const allocator = std.testing.allocator; var seq_one = try Sequence(alphabet.DNA).init(allocator, "", one); defer seq_one.deinit(); var seq_two = try Sequence(alphabet.DNA).init(allocator, "", two); defer seq_two.deinit(); var banded_align = BandedAlign(alphabet.DNA).init(allocator, options); defer banded_align.deinit(); var cigar = Cigar.init(allocator); defer cigar.deinit(); var score = try banded_align.process(seq_one, seq_two, dir, start_one, start_two, end_one, end_two, &cigar); try std.testing.expectEqualStrings(expected_cigar_str, cigar.str()); return score; } fn testAlignFwd(one: []const u8, two: []const u8, options: BandedAlignOptions, expected_cigar_str: []const u8) !i32 { return try testAlign(one, two, .forward, options, 0, 0, null, null, expected_cigar_str); } test "basic" { const MatchScore = 2; const MismatchScore = -4; const options = BandedAlignOptions{}; // // TATAATGTTTACATTGG // // ||||||| |||.||| // // TATAATG---ACACTGG var score = try testAlignFwd("TATAATGTTTACATTGG", "TATAATGACACTGG", options, "7=3I3=1X3="); try std.testing.expectEqual(13 * MatchScore + 1 * options.gap_interior_open_score + 3 * options.gap_interior_extend_score + 1 * MismatchScore, score); } test "gap penalties" { _ = try testAlignFwd("GGATCCTA", "ATCGTA", .{}, "2I3=1X2="); _ = try testAlignFwd("GGATCCTA", "ATCGTA", .{ .gap_terminal_open_score = -40 }, "1X2I2=1X2="); } test "long tails" { _ = try testAlignFwd("ATCGGGGGGGGGGGGGGGGGGGGGGG", "CGG", .{}, "2I3=21I"); _ = try testAlignFwd("GGGGTATAAAATTT", "TTTTTTTTGGGGTATAAAA", .{}, "8D11=3I"); } test "edge cases" { _ = try testAlignFwd("", "", .{}, ""); _ = try testAlignFwd("A", "", .{}, "1I"); _ = try testAlignFwd("", "T", .{}, "1D"); } test "offsets" { _ = try testAlign("TTTTATCGGTAT", "GGCGGTAT", .forward, .{}, 0, 0, null, null, "4I2X6="); _ = try testAlign("TTTTATCGGTAT", "GGCGGTAT", .forward, .{}, 4, 2, null, null, "2I6="); _ = try testAlign("GGATGA", "ATGAA", .backward, .{}, 6, 5, null, null, "2I4=1D"); _ = try testAlign("GGATGA", "ATGAA", .backward, .{}, 6, 3, null, null, "2I3=1I"); } test "Breaking case when first row is not initialized properly (beyond bandwidth)" { _ = try testAlignFwd("AAAAAAAAAAAAAAA", "CCCCCCAAAAAAAAA", .{}, "6D9=6I"); _ = try testAlignFwd("CCCCCCCCCCCCCCC", "CCCCCCAAAAAAAAA", .{}, "9I6=9D"); } test "Breaking case when startA >> lenA" { _ = try testAlign("ATGCC", "TTTATGCC", .forward, .{}, 6, 3, null, null, "5D"); } test "Breaking case: Improper reset of vertical gap at 0,0" { const allocator = std.testing.allocator; var banded_align = BandedAlign(alphabet.DNA).init(allocator, .{}); defer banded_align.deinit(); var seq_one = try Sequence(alphabet.DNA).init(allocator, "one", "ATGCC"); defer seq_one.deinit(); var cigar = Cigar.init(allocator); defer cigar.deinit(); var score1: i32 = undefined; var score2: i32 = undefined; // Align first with fresh alignment cache { var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "TTTTAGCC"); defer seq_two.deinit(); score1 = try banded_align.process(seq_one, seq_two, .forward, 1, 1, null, null, &cigar); try std.testing.expectEqualStrings("1=3X3D", cigar.str()); } // This alignment will set mVerticalGaps[0] to a low value, which will be // extended upon subsequently if we don't reset { var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "A"); defer seq_two.deinit(); _ = try banded_align.process(seq_one, seq_two, .forward, 0, 0, null, null, &cigar); } // Test with the "leaky" vgap { var seq_two = try Sequence(alphabet.DNA).init(allocator, "two", "TTTTAGCC"); defer seq_two.deinit(); score2 = try banded_align.process(seq_one, seq_two, .forward, 1, 1, null, null, &cigar); try std.testing.expectEqualStrings("1=3X3D", cigar.str()); } try std.testing.expectEqual(score1, score2); }
src/banded_align.zig
const windows = @import("windows.zig"); const IUnknown = windows.IUnknown; const HRESULT = windows.HRESULT; const WINAPI = windows.WINAPI; const GUID = windows.GUID; const UINT = windows.UINT; const UINT64 = windows.UINT64; const SIZE_T = windows.SIZE_T; const BOOL = windows.BOOL; pub const MESSAGE_CATEGORY = enum(UINT) { APPLICATION_DEFINED = 0, MISCELLANEOUS = 1, INITIALIZATION = 2, CLEANUP = 3, COMPILATION = 4, STATE_CREATION = 5, STATE_SETTING = 6, STATE_GETTING = 7, RESOURCE_MANIPULATION = 8, EXECUTION = 9, SHADER = 10, }; pub const MESSAGE_SEVERITY = enum(UINT) { CORRUPTION = 0, ERROR = 1, WARNING = 2, INFO = 3, MESSAGE = 4, }; pub const MESSAGE_ID = enum(UINT) { UNKNOWN = 0, DEVICE_IASETVERTEXBUFFERS_HAZARD = 1, DEVICE_IASETINDEXBUFFER_HAZARD = 2, DEVICE_VSSETSHADERRESOURCES_HAZARD = 3, DEVICE_VSSETCONSTANTBUFFERS_HAZARD = 4, DEVICE_GSSETSHADERRESOURCES_HAZARD = 5, DEVICE_GSSETCONSTANTBUFFERS_HAZARD = 6, DEVICE_PSSETSHADERRESOURCES_HAZARD = 7, DEVICE_PSSETCONSTANTBUFFERS_HAZARD = 8, DEVICE_OMSETRENDERTARGETS_HAZARD = 9, DEVICE_SOSETTARGETS_HAZARD = 10, STRING_FROM_APPLICATION = 11, CORRUPTED_THIS = 12, CORRUPTED_PARAMETER1 = 13, CORRUPTED_PARAMETER2 = 14, CORRUPTED_PARAMETER3 = 15, CORRUPTED_PARAMETER4 = 16, CORRUPTED_PARAMETER5 = 17, CORRUPTED_PARAMETER6 = 18, CORRUPTED_PARAMETER7 = 19, CORRUPTED_PARAMETER8 = 20, CORRUPTED_PARAMETER9 = 21, CORRUPTED_PARAMETER10 = 22, CORRUPTED_PARAMETER11 = 23, CORRUPTED_PARAMETER12 = 24, CORRUPTED_PARAMETER13 = 25, CORRUPTED_PARAMETER14 = 26, CORRUPTED_PARAMETER15 = 27, CORRUPTED_MULTITHREADING = 28, MESSAGE_REPORTING_OUTOFMEMORY = 29, IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = 30, IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = 31, IASETINDEXBUFFER_UNBINDDELETINGOBJECT = 32, VSSETSHADER_UNBINDDELETINGOBJECT = 33, VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 34, VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 35, VSSETSAMPLERS_UNBINDDELETINGOBJECT = 36, GSSETSHADER_UNBINDDELETINGOBJECT = 37, GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 38, GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 39, GSSETSAMPLERS_UNBINDDELETINGOBJECT = 40, SOSETTARGETS_UNBINDDELETINGOBJECT = 41, PSSETSHADER_UNBINDDELETINGOBJECT = 42, PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 43, PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 44, PSSETSAMPLERS_UNBINDDELETINGOBJECT = 45, RSSETSTATE_UNBINDDELETINGOBJECT = 46, OMSETBLENDSTATE_UNBINDDELETINGOBJECT = 47, OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = 48, OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = 49, SETPREDICATION_UNBINDDELETINGOBJECT = 50, GETPRIVATEDATA_MOREDATA = 51, SETPRIVATEDATA_INVALIDFREEDATA = 52, SETPRIVATEDATA_INVALIDIUNKNOWN = 53, SETPRIVATEDATA_INVALIDFLAGS = 54, SETPRIVATEDATA_CHANGINGPARAMS = 55, SETPRIVATEDATA_OUTOFMEMORY = 56, CREATEBUFFER_UNRECOGNIZEDFORMAT = 57, CREATEBUFFER_INVALIDSAMPLES = 58, CREATEBUFFER_UNRECOGNIZEDUSAGE = 59, CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = 60, CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = 61, CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = 62, CREATEBUFFER_INVALIDCPUACCESSFLAGS = 63, CREATEBUFFER_INVALIDBINDFLAGS = 64, CREATEBUFFER_INVALIDINITIALDATA = 65, CREATEBUFFER_INVALIDDIMENSIONS = 66, CREATEBUFFER_INVALIDMIPLEVELS = 67, CREATEBUFFER_INVALIDMISCFLAGS = 68, CREATEBUFFER_INVALIDARG_RETURN = 69, CREATEBUFFER_OUTOFMEMORY_RETURN = 70, CREATEBUFFER_NULLDESC = 71, CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = 72, CREATEBUFFER_LARGEALLOCATION = 73, CREATETEXTURE1D_UNRECOGNIZEDFORMAT = 74, CREATETEXTURE1D_UNSUPPORTEDFORMAT = 75, CREATETEXTURE1D_INVALIDSAMPLES = 76, CREATETEXTURE1D_UNRECOGNIZEDUSAGE = 77, CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = 78, CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = 79, CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = 80, CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = 81, CREATETEXTURE1D_INVALIDBINDFLAGS = 82, CREATETEXTURE1D_INVALIDINITIALDATA = 83, CREATETEXTURE1D_INVALIDDIMENSIONS = 84, CREATETEXTURE1D_INVALIDMIPLEVELS = 85, CREATETEXTURE1D_INVALIDMISCFLAGS = 86, CREATETEXTURE1D_INVALIDARG_RETURN = 87, CREATETEXTURE1D_OUTOFMEMORY_RETURN = 88, CREATETEXTURE1D_NULLDESC = 89, CREATETEXTURE1D_LARGEALLOCATION = 90, CREATETEXTURE2D_UNRECOGNIZEDFORMAT = 91, CREATETEXTURE2D_UNSUPPORTEDFORMAT = 92, CREATETEXTURE2D_INVALIDSAMPLES = 93, CREATETEXTURE2D_UNRECOGNIZEDUSAGE = 94, CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = 95, CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = 96, CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = 97, CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = 98, CREATETEXTURE2D_INVALIDBINDFLAGS = 99, CREATETEXTURE2D_INVALIDINITIALDATA = 100, CREATETEXTURE2D_INVALIDDIMENSIONS = 101, CREATETEXTURE2D_INVALIDMIPLEVELS = 102, CREATETEXTURE2D_INVALIDMISCFLAGS = 103, CREATETEXTURE2D_INVALIDARG_RETURN = 104, CREATETEXTURE2D_OUTOFMEMORY_RETURN = 105, CREATETEXTURE2D_NULLDESC = 106, CREATETEXTURE2D_LARGEALLOCATION = 107, CREATETEXTURE3D_UNRECOGNIZEDFORMAT = 108, CREATETEXTURE3D_UNSUPPORTEDFORMAT = 109, CREATETEXTURE3D_INVALIDSAMPLES = 110, CREATETEXTURE3D_UNRECOGNIZEDUSAGE = 111, CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = 112, CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = 113, CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = 114, CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = 115, CREATETEXTURE3D_INVALIDBINDFLAGS = 116, CREATETEXTURE3D_INVALIDINITIALDATA = 117, CREATETEXTURE3D_INVALIDDIMENSIONS = 118, CREATETEXTURE3D_INVALIDMIPLEVELS = 119, CREATETEXTURE3D_INVALIDMISCFLAGS = 120, CREATETEXTURE3D_INVALIDARG_RETURN = 121, CREATETEXTURE3D_OUTOFMEMORY_RETURN = 122, CREATETEXTURE3D_NULLDESC = 123, CREATETEXTURE3D_LARGEALLOCATION = 124, CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 125, CREATESHADERRESOURCEVIEW_INVALIDDESC = 126, CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 127, CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 128, CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 129, CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = 130, CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = 131, CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = 132, CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 133, CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 134, CREATERENDERTARGETVIEW_INVALIDDESC = 135, CREATERENDERTARGETVIEW_INVALIDFORMAT = 136, CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 137, CREATERENDERTARGETVIEW_INVALIDRESOURCE = 138, CREATERENDERTARGETVIEW_TOOMANYOBJECTS = 139, CREATERENDERTARGETVIEW_INVALIDARG_RETURN = 140, CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = 141, CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 142, CREATEDEPTHSTENCILVIEW_INVALIDDESC = 143, CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 144, CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 145, CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 146, CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = 147, CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = 148, CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = 149, CREATEINPUTLAYOUT_OUTOFMEMORY = 150, CREATEINPUTLAYOUT_TOOMANYELEMENTS = 151, CREATEINPUTLAYOUT_INVALIDFORMAT = 152, CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 153, CREATEINPUTLAYOUT_INVALIDSLOT = 154, CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 155, CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 156, CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 157, CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 158, CREATEINPUTLAYOUT_INVALIDALIGNMENT = 159, CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 160, CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 161, CREATEINPUTLAYOUT_NULLSEMANTIC = 162, CREATEINPUTLAYOUT_MISSINGELEMENT = 163, CREATEINPUTLAYOUT_NULLDESC = 164, CREATEVERTEXSHADER_OUTOFMEMORY = 165, CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 166, CREATEVERTEXSHADER_INVALIDSHADERTYPE = 167, CREATEGEOMETRYSHADER_OUTOFMEMORY = 168, CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 169, CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 170, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 171, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 172, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 173, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 174, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 175, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = 176, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = 177, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 178, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 179, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 180, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 181, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = 182, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 183, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 184, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 185, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 186, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 187, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 188, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 189, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 190, CREATEPIXELSHADER_OUTOFMEMORY = 191, CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 192, CREATEPIXELSHADER_INVALIDSHADERTYPE = 193, CREATERASTERIZERSTATE_INVALIDFILLMODE = 194, CREATERASTERIZERSTATE_INVALIDCULLMODE = 195, CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 196, CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 197, CREATERASTERIZERSTATE_TOOMANYOBJECTS = 198, CREATERASTERIZERSTATE_NULLDESC = 199, CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 200, CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 201, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 202, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 203, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 204, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 205, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 206, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 207, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 208, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 209, CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = 210, CREATEDEPTHSTENCILSTATE_NULLDESC = 211, CREATEBLENDSTATE_INVALIDSRCBLEND = 212, CREATEBLENDSTATE_INVALIDDESTBLEND = 213, CREATEBLENDSTATE_INVALIDBLENDOP = 214, CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 215, CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 216, CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 217, CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 218, CREATEBLENDSTATE_TOOMANYOBJECTS = 219, CREATEBLENDSTATE_NULLDESC = 220, CREATESAMPLERSTATE_INVALIDFILTER = 221, CREATESAMPLERSTATE_INVALIDADDRESSU = 222, CREATESAMPLERSTATE_INVALIDADDRESSV = 223, CREATESAMPLERSTATE_INVALIDADDRESSW = 224, CREATESAMPLERSTATE_INVALIDMIPLODBIAS = 225, CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = 226, CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = 227, CREATESAMPLERSTATE_INVALIDMINLOD = 228, CREATESAMPLERSTATE_INVALIDMAXLOD = 229, CREATESAMPLERSTATE_TOOMANYOBJECTS = 230, CREATESAMPLERSTATE_NULLDESC = 231, CREATEQUERYORPREDICATE_INVALIDQUERY = 232, CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = 233, CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = 234, CREATEQUERYORPREDICATE_NULLDESC = 235, DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = 236, DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = 237, IASETVERTEXBUFFERS_INVALIDBUFFER = 238, DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = 239, DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = 240, IASETINDEXBUFFER_INVALIDBUFFER = 241, DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = 242, DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = 243, DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = 244, DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = 245, VSSETCONSTANTBUFFERS_INVALIDBUFFER = 246, DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 247, DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = 248, DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = 249, GSSETCONSTANTBUFFERS_INVALIDBUFFER = 250, DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 251, DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = 252, SOSETTARGETS_INVALIDBUFFER = 253, DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = 254, DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = 255, PSSETCONSTANTBUFFERS_INVALIDBUFFER = 256, DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 257, DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = 258, DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = 259, DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = 260, CLEARRENDERTARGETVIEW_DENORMFLUSH = 261, CLEARDEPTHSTENCILVIEW_DENORMFLUSH = 262, CLEARDEPTHSTENCILVIEW_INVALID = 263, DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = 264, DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = 265, DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 266, DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = 267, DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = 268, DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 269, DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = 270, DEVICE_SOGETTARGETS_BUFFERS_EMPTY = 271, DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = 272, DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 273, DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = 274, DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = 275, DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = 276, DEVICE_GENERATEMIPS_RESOURCE_INVALID = 277, COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = 278, COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = 279, COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = 280, COPYSUBRESOURCEREGION_INVALIDSOURCE = 281, COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = 282, COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = 283, COPYRESOURCE_INVALIDSOURCE = 284, COPYRESOURCE_INVALIDDESTINATIONSTATE = 285, COPYRESOURCE_INVALIDSOURCESTATE = 286, UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = 287, UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = 288, UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = 289, DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = 290, DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = 291, DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = 292, DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = 293, DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = 294, BUFFER_MAP_INVALIDMAPTYPE = 295, BUFFER_MAP_INVALIDFLAGS = 296, BUFFER_MAP_ALREADYMAPPED = 297, BUFFER_MAP_DEVICEREMOVED_RETURN = 298, BUFFER_UNMAP_NOTMAPPED = 299, TEXTURE1D_MAP_INVALIDMAPTYPE = 300, TEXTURE1D_MAP_INVALIDSUBRESOURCE = 301, TEXTURE1D_MAP_INVALIDFLAGS = 302, TEXTURE1D_MAP_ALREADYMAPPED = 303, TEXTURE1D_MAP_DEVICEREMOVED_RETURN = 304, TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = 305, TEXTURE1D_UNMAP_NOTMAPPED = 306, TEXTURE2D_MAP_INVALIDMAPTYPE = 307, TEXTURE2D_MAP_INVALIDSUBRESOURCE = 308, TEXTURE2D_MAP_INVALIDFLAGS = 309, TEXTURE2D_MAP_ALREADYMAPPED = 310, TEXTURE2D_MAP_DEVICEREMOVED_RETURN = 311, TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = 312, TEXTURE2D_UNMAP_NOTMAPPED = 313, TEXTURE3D_MAP_INVALIDMAPTYPE = 314, TEXTURE3D_MAP_INVALIDSUBRESOURCE = 315, TEXTURE3D_MAP_INVALIDFLAGS = 316, TEXTURE3D_MAP_ALREADYMAPPED = 317, TEXTURE3D_MAP_DEVICEREMOVED_RETURN = 318, TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = 319, TEXTURE3D_UNMAP_NOTMAPPED = 320, CHECKFORMATSUPPORT_FORMAT_DEPRECATED = 321, CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = 322, SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = 323, SETEXCEPTIONMODE_INVALIDARG_RETURN = 324, SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = 325, REF_SIMULATING_INFINITELY_FAST_HARDWARE = 326, REF_THREADING_MODE = 327, REF_UMDRIVER_EXCEPTION = 328, REF_KMDRIVER_EXCEPTION = 329, REF_HARDWARE_EXCEPTION = 330, REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = 331, REF_PROBLEM_PARSING_SHADER = 332, REF_OUT_OF_MEMORY = 333, REF_INFO = 334, DEVICE_DRAW_VERTEXPOS_OVERFLOW = 335, DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = 336, DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = 337, DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = 338, DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = 339, DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = 340, DEVICE_DRAW_VERTEX_SHADER_NOT_SET = 341, DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 342, DEVICE_SHADER_LINKAGE_REGISTERINDEX = 343, DEVICE_SHADER_LINKAGE_COMPONENTTYPE = 344, DEVICE_SHADER_LINKAGE_REGISTERMASK = 345, DEVICE_SHADER_LINKAGE_SYSTEMVALUE = 346, DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 347, DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = 348, DEVICE_DRAW_INPUTLAYOUT_NOT_SET = 349, DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = 350, DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = 351, DEVICE_DRAW_SAMPLER_NOT_SET = 352, DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = 353, DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = 354, DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 355, DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = 356, DEVICE_DRAW_INDEX_BUFFER_NOT_SET = 357, DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = 358, DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = 359, DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = 360, DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = 361, DEVICE_DRAW_POSITION_NOT_PRESENT = 362, DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = 363, DEVICE_DRAW_BOUND_RESOURCE_MAPPED = 364, DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = 365, DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = 366, DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = 367, DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = 368, DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = 369, DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = 370, DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = 371, DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = 372, DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = 373, DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = 374, DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = 375, DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 376, DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 377, DEVICE_REMOVAL_PROCESS_AT_FAULT = 378, DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 379, DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 380, DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = 381, DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = 382, DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = 383, DEVICE_DRAW_VIEWPORT_NOT_SET = 384, CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 385, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 386, DEVICE_RSSETVIEWPORTS_DENORMFLUSH = 387, OMSETRENDERTARGETS_INVALIDVIEW = 388, DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = 389, DEVICE_DRAW_SAMPLER_MISMATCH = 390, CREATEINPUTLAYOUT_TYPE_MISMATCH = 391, BLENDSTATE_GETDESC_LEGACY = 392, SHADERRESOURCEVIEW_GETDESC_LEGACY = 393, CREATEQUERY_OUTOFMEMORY_RETURN = 394, CREATEPREDICATE_OUTOFMEMORY_RETURN = 395, CREATECOUNTER_OUTOFRANGE_COUNTER = 396, CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = 397, CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = 398, CREATECOUNTER_OUTOFMEMORY_RETURN = 399, CREATECOUNTER_NONEXCLUSIVE_RETURN = 400, CREATECOUNTER_NULLDESC = 401, CHECKCOUNTER_OUTOFRANGE_COUNTER = 402, CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = 403, SETPREDICATION_INVALID_PREDICATE_STATE = 404, QUERY_BEGIN_UNSUPPORTED = 405, PREDICATE_BEGIN_DURING_PREDICATION = 406, QUERY_BEGIN_DUPLICATE = 407, QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = 408, PREDICATE_END_DURING_PREDICATION = 409, QUERY_END_ABANDONING_PREVIOUS_RESULTS = 410, QUERY_END_WITHOUT_BEGIN = 411, QUERY_GETDATA_INVALID_DATASIZE = 412, QUERY_GETDATA_INVALID_FLAGS = 413, QUERY_GETDATA_INVALID_CALL = 414, DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = 415, DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = 416, DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 417, DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = 418, DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = 419, CREATEINPUTLAYOUT_EMPTY_LAYOUT = 420, DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = 421, LIVE_OBJECT_SUMMARY = 422, LIVE_BUFFER = 423, LIVE_TEXTURE1D = 424, LIVE_TEXTURE2D = 425, LIVE_TEXTURE3D = 426, LIVE_SHADERRESOURCEVIEW = 427, LIVE_RENDERTARGETVIEW = 428, LIVE_DEPTHSTENCILVIEW = 429, LIVE_VERTEXSHADER = 430, LIVE_GEOMETRYSHADER = 431, LIVE_PIXELSHADER = 432, LIVE_INPUTLAYOUT = 433, LIVE_SAMPLER = 434, LIVE_BLENDSTATE = 435, LIVE_DEPTHSTENCILSTATE = 436, LIVE_RASTERIZERSTATE = 437, LIVE_QUERY = 438, LIVE_PREDICATE = 439, LIVE_COUNTER = 440, LIVE_DEVICE = 441, LIVE_SWAPCHAIN = 442, D3D10_MESSAGES_END = 443, D3D10L9_MESSAGES_START = 1048576, CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = 1048577, CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = 1048578, CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = 1048579, CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = 1048580, CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = 1048581, VSSETSAMPLERS_NOT_SUPPORTED = 1048582, VSSETSAMPLERS_TOO_MANY_SAMPLERS = 1048583, PSSETSAMPLERS_TOO_MANY_SAMPLERS = 1048584, CREATERESOURCE_NO_ARRAYS = 1048585, CREATERESOURCE_NO_VB_AND_IB_BIND = 1048586, CREATERESOURCE_NO_TEXTURE_1D = 1048587, CREATERESOURCE_DIMENSION_OUT_OF_RANGE = 1048588, CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = 1048589, OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = 1048590, OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = 1048591, IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = 1048592, DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = 1048593, DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = 1048594, DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = 1048595, COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = 1048596, COPYRESOURCE_NO_TEXTURE_3D_READBACK = 1048597, COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = 1048598, CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = 1048599, CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = 1048600, CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = 1048601, DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = 1048602, CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = 1048603, CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = 1048604, CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = 1048605, CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = 1048606, CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = 1048607, CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = 1048608, CREATERESOURCE_NO_DWORD_INDEX_BUFFER = 1048609, CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = 1048610, CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = 1048611, CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = 1048612, CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = 1048613, CREATERESOURCE_NO_STREAM_OUT = 1048614, CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = 1048615, CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = 1048616, CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = 1048617, VSSHADERRESOURCES_NOT_SUPPORTED = 1048618, GEOMETRY_SHADER_NOT_SUPPORTED = 1048619, STREAM_OUT_NOT_SUPPORTED = 1048620, TEXT_FILTER_NOT_SUPPORTED = 1048621, CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = 1048622, CREATEBLENDSTATE_NO_MRT_BLEND = 1048623, CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = 1048624, CREATESAMPLERSTATE_NO_MIRRORONCE = 1048625, DRAWINSTANCED_NOT_SUPPORTED = 1048626, DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = 1048627, DRAWINDEXED_POINTLIST_UNSUPPORTED = 1048628, SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = 1048629, CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = 1048630, CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = 1048631, DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = 1048632, SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = 1048633, CREATERESOURCE_NON_POW_2_MIPMAP = 1048634, CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = 1048635, OMSETRENDERTARGETS_NO_SRGB_MRT = 1048636, COPYRESOURCE_NO_3D_MISMATCHED_UPDATES = 1048637, D3D10L9_MESSAGES_END = 1048638, D3D11_MESSAGES_START = 2097152, CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = 2097153, CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = 2097154, CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = 2097155, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = 2097156, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = 2097157, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = 2097158, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = 2097159, CREATEPIXELSHADER_INVALIDCLASSLINKAGE = 2097160, CREATEDEFERREDCONTEXT_INVALID_COMMANDLISTFLAGS = 2097161, CREATEDEFERREDCONTEXT_SINGLETHREADED = 2097162, CREATEDEFERREDCONTEXT_INVALIDARG_RETURN = 2097163, CREATEDEFERREDCONTEXT_INVALID_CALL_RETURN = 2097164, CREATEDEFERREDCONTEXT_OUTOFMEMORY_RETURN = 2097165, FINISHDISPLAYLIST_ONIMMEDIATECONTEXT = 2097166, FINISHDISPLAYLIST_OUTOFMEMORY_RETURN = 2097167, FINISHDISPLAYLIST_INVALID_CALL_RETURN = 2097168, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = 2097169, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = 2097170, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = 2097171, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = 2097172, DEVICE_HSSETSHADERRESOURCES_HAZARD = 2097173, DEVICE_HSSETCONSTANTBUFFERS_HAZARD = 2097174, HSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 2097175, HSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 2097176, CREATEHULLSHADER_INVALIDCALL = 2097177, CREATEHULLSHADER_OUTOFMEMORY = 2097178, CREATEHULLSHADER_INVALIDSHADERBYTECODE = 2097179, CREATEHULLSHADER_INVALIDSHADERTYPE = 2097180, CREATEHULLSHADER_INVALIDCLASSLINKAGE = 2097181, DEVICE_HSSETSHADERRESOURCES_VIEWS_EMPTY = 2097182, HSSETCONSTANTBUFFERS_INVALIDBUFFER = 2097183, DEVICE_HSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097184, DEVICE_HSSETSAMPLERS_SAMPLERS_EMPTY = 2097185, DEVICE_HSGETSHADERRESOURCES_VIEWS_EMPTY = 2097186, DEVICE_HSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097187, DEVICE_HSGETSAMPLERS_SAMPLERS_EMPTY = 2097188, DEVICE_DSSETSHADERRESOURCES_HAZARD = 2097189, DEVICE_DSSETCONSTANTBUFFERS_HAZARD = 2097190, DSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 2097191, DSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 2097192, CREATEDOMAINSHADER_INVALIDCALL = 2097193, CREATEDOMAINSHADER_OUTOFMEMORY = 2097194, CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = 2097195, CREATEDOMAINSHADER_INVALIDSHADERTYPE = 2097196, CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = 2097197, DEVICE_DSSETSHADERRESOURCES_VIEWS_EMPTY = 2097198, DSSETCONSTANTBUFFERS_INVALIDBUFFER = 2097199, DEVICE_DSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097200, DEVICE_DSSETSAMPLERS_SAMPLERS_EMPTY = 2097201, DEVICE_DSGETSHADERRESOURCES_VIEWS_EMPTY = 2097202, DEVICE_DSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097203, DEVICE_DSGETSAMPLERS_SAMPLERS_EMPTY = 2097204, DEVICE_DRAW_HS_XOR_DS_MISMATCH = 2097205, DEFERRED_CONTEXT_REMOVAL_PROCESS_AT_FAULT = 2097206, DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = 2097207, DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = 2097208, DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = 2097209, RESOURCE_MAP_INVALIDMAPTYPE = 2097210, RESOURCE_MAP_INVALIDSUBRESOURCE = 2097211, RESOURCE_MAP_INVALIDFLAGS = 2097212, RESOURCE_MAP_ALREADYMAPPED = 2097213, RESOURCE_MAP_DEVICEREMOVED_RETURN = 2097214, RESOURCE_MAP_OUTOFMEMORY_RETURN = 2097215, RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = 2097216, RESOURCE_UNMAP_INVALIDSUBRESOURCE = 2097217, RESOURCE_UNMAP_NOTMAPPED = 2097218, DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = 2097219, DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = 2097220, DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = 2097221, DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 2097222, DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 2097223, DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 2097224, CREATE_CONTEXT = 2097225, LIVE_CONTEXT = 2097226, DESTROY_CONTEXT = 2097227, CREATE_BUFFER = 2097228, LIVE_BUFFER_WIN7 = 2097229, DESTROY_BUFFER = 2097230, CREATE_TEXTURE1D = 2097231, LIVE_TEXTURE1D_WIN7 = 2097232, DESTROY_TEXTURE1D = 2097233, CREATE_TEXTURE2D = 2097234, LIVE_TEXTURE2D_WIN7 = 2097235, DESTROY_TEXTURE2D = 2097236, CREATE_TEXTURE3D = 2097237, LIVE_TEXTURE3D_WIN7 = 2097238, DESTROY_TEXTURE3D = 2097239, CREATE_SHADERRESOURCEVIEW = 2097240, LIVE_SHADERRESOURCEVIEW_WIN7 = 2097241, DESTROY_SHADERRESOURCEVIEW = 2097242, CREATE_RENDERTARGETVIEW = 2097243, LIVE_RENDERTARGETVIEW_WIN7 = 2097244, DESTROY_RENDERTARGETVIEW = 2097245, CREATE_DEPTHSTENCILVIEW = 2097246, LIVE_DEPTHSTENCILVIEW_WIN7 = 2097247, DESTROY_DEPTHSTENCILVIEW = 2097248, CREATE_VERTEXSHADER = 2097249, LIVE_VERTEXSHADER_WIN7 = 2097250, DESTROY_VERTEXSHADER = 2097251, CREATE_HULLSHADER = 2097252, LIVE_HULLSHADER = 2097253, DESTROY_HULLSHADER = 2097254, CREATE_DOMAINSHADER = 2097255, LIVE_DOMAINSHADER = 2097256, DESTROY_DOMAINSHADER = 2097257, CREATE_GEOMETRYSHADER = 2097258, LIVE_GEOMETRYSHADER_WIN7 = 2097259, DESTROY_GEOMETRYSHADER = 2097260, CREATE_PIXELSHADER = 2097261, LIVE_PIXELSHADER_WIN7 = 2097262, DESTROY_PIXELSHADER = 2097263, CREATE_INPUTLAYOUT = 2097264, LIVE_INPUTLAYOUT_WIN7 = 2097265, DESTROY_INPUTLAYOUT = 2097266, CREATE_SAMPLER = 2097267, LIVE_SAMPLER_WIN7 = 2097268, DESTROY_SAMPLER = 2097269, CREATE_BLENDSTATE = 2097270, LIVE_BLENDSTATE_WIN7 = 2097271, DESTROY_BLENDSTATE = 2097272, CREATE_DEPTHSTENCILSTATE = 2097273, LIVE_DEPTHSTENCILSTATE_WIN7 = 2097274, DESTROY_DEPTHSTENCILSTATE = 2097275, CREATE_RASTERIZERSTATE = 2097276, LIVE_RASTERIZERSTATE_WIN7 = 2097277, DESTROY_RASTERIZERSTATE = 2097278, CREATE_QUERY = 2097279, LIVE_QUERY_WIN7 = 2097280, DESTROY_QUERY = 2097281, CREATE_PREDICATE = 2097282, LIVE_PREDICATE_WIN7 = 2097283, DESTROY_PREDICATE = 2097284, CREATE_COUNTER = 2097285, DESTROY_COUNTER = 2097286, CREATE_COMMANDLIST = 2097287, LIVE_COMMANDLIST = 2097288, DESTROY_COMMANDLIST = 2097289, CREATE_CLASSINSTANCE = 2097290, LIVE_CLASSINSTANCE = 2097291, DESTROY_CLASSINSTANCE = 2097292, CREATE_CLASSLINKAGE = 2097293, LIVE_CLASSLINKAGE = 2097294, DESTROY_CLASSLINKAGE = 2097295, LIVE_DEVICE_WIN7 = 2097296, LIVE_OBJECT_SUMMARY_WIN7 = 2097297, CREATE_COMPUTESHADER = 2097298, LIVE_COMPUTESHADER = 2097299, DESTROY_COMPUTESHADER = 2097300, CREATE_UNORDEREDACCESSVIEW = 2097301, LIVE_UNORDEREDACCESSVIEW = 2097302, DESTROY_UNORDEREDACCESSVIEW = 2097303, DEVICE_SETSHADER_INTERFACES_FEATURELEVEL = 2097304, DEVICE_SETSHADER_INTERFACE_COUNT_MISMATCH = 2097305, DEVICE_SETSHADER_INVALID_INSTANCE = 2097306, DEVICE_SETSHADER_INVALID_INSTANCE_INDEX = 2097307, DEVICE_SETSHADER_INVALID_INSTANCE_TYPE = 2097308, DEVICE_SETSHADER_INVALID_INSTANCE_DATA = 2097309, DEVICE_SETSHADER_UNBOUND_INSTANCE_DATA = 2097310, DEVICE_SETSHADER_INSTANCE_DATA_BINDINGS = 2097311, DEVICE_CREATESHADER_CLASSLINKAGE_FULL = 2097312, DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = 2097313, DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = 2097314, DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = 2097315, DEVICE_CSSETSHADERRESOURCES_HAZARD = 2097316, DEVICE_CSSETCONSTANTBUFFERS_HAZARD = 2097317, CSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 2097318, CSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 2097319, CREATECOMPUTESHADER_INVALIDCALL = 2097320, CREATECOMPUTESHADER_OUTOFMEMORY = 2097321, CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = 2097322, CREATECOMPUTESHADER_INVALIDSHADERTYPE = 2097323, CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = 2097324, DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = 2097325, CSSETCONSTANTBUFFERS_INVALIDBUFFER = 2097326, DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097327, DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = 2097328, DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = 2097329, DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097330, DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = 2097331, DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097332, DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097333, DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097334, DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097335, DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = 2097336, DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097337, DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097338, CREATEBUFFER_INVALIDSTRUCTURESTRIDE = 2097339, CREATESHADERRESOURCEVIEW_INVALIDFLAGS = 2097340, CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = 2097341, CREATEUNORDEREDACCESSVIEW_INVALIDDESC = 2097342, CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = 2097343, CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = 2097344, CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = 2097345, DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_HAZARD = 2097346, DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = 2097347, DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = 2097348, CSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = 2097349, PSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = 2097350, CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = 2097351, CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = 2097352, CREATEUNORDEREDACCESSVIEW_TOOMANYOBJECTS = 2097353, DEVICE_CSSETUNORDEREDACCESSVIEWS_HAZARD = 2097354, CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = 2097355, DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = 2097356, DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = 2097357, CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = 2097358, CREATESHADERRESESOURCEVIEW_TOOMANYOBJECTS = 2097359, DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = 2097360, DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = 2097361, DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = 2097362, DEVICE_SETRESOURCEMINLOD_INVALIDCONTEXT = 2097363, DEVICE_SETRESOURCEMINLOD_INVALIDRESOURCE = 2097364, DEVICE_SETRESOURCEMINLOD_INVALIDMINLOD = 2097365, DEVICE_GETRESOURCEMINLOD_INVALIDCONTEXT = 2097366, DEVICE_GETRESOURCEMINLOD_INVALIDRESOURCE = 2097367, OMSETDEPTHSTENCIL_UNBINDDELETINGOBJECT = 2097368, CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = 2097369, CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = 2097370, CHECKFEATURESUPPORT_FORMAT_DEPRECATED = 2097371, DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = 2097372, DEVICE_UNORDEREDACCESSVIEW_NOT_SET = 2097373, DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = 2097374, DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = 2097375, DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = 2097376, DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = 2097377, DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = 2097378, DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = 2097379, DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = 2097380, DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = 2097381, DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = 2097382, DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = 2097383, DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = 2097384, DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = 2097385, DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = 2097386, DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = 2097387, DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = 2097388, DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = 2097389, DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = 2097390, DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = 2097391, DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = 2097392, DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = 2097393, DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = 2097394, DEVICE_DISPATCH_UNSUPPORTED = 2097395, DEVICE_DISPATCHINDIRECT_UNSUPPORTED = 2097396, COPYSTRUCTURECOUNT_INVALIDOFFSET = 2097397, COPYSTRUCTURECOUNT_LARGEOFFSET = 2097398, COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = 2097399, COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = 2097400, CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = 2097401, DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDVIEW = 2097402, DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDOFFSET = 2097403, DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 2097404, CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = 2097405, DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = 2097406, REF_WARNING = 2097407, DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV = 2097408, SHADER_ABORT = 2097409, SHADER_MESSAGE = 2097410, SHADER_ERROR = 2097411, OFFERRESOURCES_INVALIDRESOURCE = 2097412, HSSETSAMPLERS_UNBINDDELETINGOBJECT = 2097413, DSSETSAMPLERS_UNBINDDELETINGOBJECT = 2097414, CSSETSAMPLERS_UNBINDDELETINGOBJECT = 2097415, HSSETSHADER_UNBINDDELETINGOBJECT = 2097416, DSSETSHADER_UNBINDDELETINGOBJECT = 2097417, CSSETSHADER_UNBINDDELETINGOBJECT = 2097418, ENQUEUESETEVENT_INVALIDARG_RETURN = 2097419, ENQUEUESETEVENT_OUTOFMEMORY_RETURN = 2097420, ENQUEUESETEVENT_ACCESSDENIED_RETURN = 2097421, DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE = 2097422, USE_OF_ZERO_REFCOUNT_OBJECT = 2097423, D3D11_MESSAGES_END = 2097424, D3D11_1_MESSAGES_START = 3145728, CREATE_VIDEODECODER = 3145729, CREATE_VIDEOPROCESSORENUM = 3145730, CREATE_VIDEOPROCESSOR = 3145731, CREATE_DECODEROUTPUTVIEW = 3145732, CREATE_PROCESSORINPUTVIEW = 3145733, CREATE_PROCESSOROUTPUTVIEW = 3145734, CREATE_DEVICECONTEXTSTATE = 3145735, LIVE_VIDEODECODER = 3145736, LIVE_VIDEOPROCESSORENUM = 3145737, LIVE_VIDEOPROCESSOR = 3145738, LIVE_DECODEROUTPUTVIEW = 3145739, LIVE_PROCESSORINPUTVIEW = 3145740, LIVE_PROCESSOROUTPUTVIEW = 3145741, LIVE_DEVICECONTEXTSTATE = 3145742, DESTROY_VIDEODECODER = 3145743, DESTROY_VIDEOPROCESSORENUM = 3145744, DESTROY_VIDEOPROCESSOR = 3145745, DESTROY_DECODEROUTPUTVIEW = 3145746, DESTROY_PROCESSORINPUTVIEW = 3145747, DESTROY_PROCESSOROUTPUTVIEW = 3145748, DESTROY_DEVICECONTEXTSTATE = 3145749, CREATEDEVICECONTEXTSTATE_INVALIDFLAGS = 3145750, CREATEDEVICECONTEXTSTATE_INVALIDFEATURELEVEL = 3145751, CREATEDEVICECONTEXTSTATE_FEATURELEVELS_NOT_SUPPORTED = 3145752, CREATEDEVICECONTEXTSTATE_INVALIDREFIID = 3145753, DEVICE_DISCARDVIEW_INVALIDVIEW = 3145754, COPYSUBRESOURCEREGION1_INVALIDCOPYFLAGS = 3145755, UPDATESUBRESOURCE1_INVALIDCOPYFLAGS = 3145756, CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = 3145757, CREATEVIDEODECODER_OUTOFMEMORY_RETURN = 3145758, CREATEVIDEODECODER_NULLPARAM = 3145759, CREATEVIDEODECODER_INVALIDFORMAT = 3145760, CREATEVIDEODECODER_ZEROWIDTHHEIGHT = 3145761, CREATEVIDEODECODER_DRIVER_INVALIDBUFFERSIZE = 3145762, CREATEVIDEODECODER_DRIVER_INVALIDBUFFERUSAGE = 3145763, GETVIDEODECODERPROFILECOUNT_OUTOFMEMORY = 3145764, GETVIDEODECODERPROFILE_NULLPARAM = 3145765, GETVIDEODECODERPROFILE_INVALIDINDEX = 3145766, GETVIDEODECODERPROFILE_OUTOFMEMORY_RETURN = 3145767, CHECKVIDEODECODERFORMAT_NULLPARAM = 3145768, CHECKVIDEODECODERFORMAT_OUTOFMEMORY_RETURN = 3145769, GETVIDEODECODERCONFIGCOUNT_NULLPARAM = 3145770, GETVIDEODECODERCONFIGCOUNT_OUTOFMEMORY_RETURN = 3145771, GETVIDEODECODERCONFIG_NULLPARAM = 3145772, GETVIDEODECODERCONFIG_INVALIDINDEX = 3145773, GETVIDEODECODERCONFIG_OUTOFMEMORY_RETURN = 3145774, GETDECODERCREATIONPARAMS_NULLPARAM = 3145775, GETDECODERDRIVERHANDLE_NULLPARAM = 3145776, GETDECODERBUFFER_NULLPARAM = 3145777, GETDECODERBUFFER_INVALIDBUFFER = 3145778, GETDECODERBUFFER_INVALIDTYPE = 3145779, GETDECODERBUFFER_LOCKED = 3145780, RELEASEDECODERBUFFER_NULLPARAM = 3145781, RELEASEDECODERBUFFER_INVALIDTYPE = 3145782, RELEASEDECODERBUFFER_NOTLOCKED = 3145783, DECODERBEGINFRAME_NULLPARAM = 3145784, DECODERBEGINFRAME_HAZARD = 3145785, DECODERENDFRAME_NULLPARAM = 3145786, SUBMITDECODERBUFFERS_NULLPARAM = 3145787, SUBMITDECODERBUFFERS_INVALIDTYPE = 3145788, DECODEREXTENSION_NULLPARAM = 3145789, DECODEREXTENSION_INVALIDRESOURCE = 3145790, CREATEVIDEOPROCESSORENUMERATOR_OUTOFMEMORY_RETURN = 3145791, CREATEVIDEOPROCESSORENUMERATOR_NULLPARAM = 3145792, CREATEVIDEOPROCESSORENUMERATOR_INVALIDFRAMEFORMAT = 3145793, CREATEVIDEOPROCESSORENUMERATOR_INVALIDUSAGE = 3145794, CREATEVIDEOPROCESSORENUMERATOR_INVALIDINPUTFRAMERATE = 3145795, CREATEVIDEOPROCESSORENUMERATOR_INVALIDOUTPUTFRAMERATE = 3145796, CREATEVIDEOPROCESSORENUMERATOR_INVALIDWIDTHHEIGHT = 3145797, GETVIDEOPROCESSORCONTENTDESC_NULLPARAM = 3145798, CHECKVIDEOPROCESSORFORMAT_NULLPARAM = 3145799, GETVIDEOPROCESSORCAPS_NULLPARAM = 3145800, GETVIDEOPROCESSORRATECONVERSIONCAPS_NULLPARAM = 3145801, GETVIDEOPROCESSORRATECONVERSIONCAPS_INVALIDINDEX = 3145802, GETVIDEOPROCESSORCUSTOMRATE_NULLPARAM = 3145803, GETVIDEOPROCESSORCUSTOMRATE_INVALIDINDEX = 3145804, GETVIDEOPROCESSORFILTERRANGE_NULLPARAM = 3145805, GETVIDEOPROCESSORFILTERRANGE_UNSUPPORTED = 3145806, CREATEVIDEOPROCESSOR_OUTOFMEMORY_RETURN = 3145807, CREATEVIDEOPROCESSOR_NULLPARAM = 3145808, VIDEOPROCESSORSETOUTPUTTARGETRECT_NULLPARAM = 3145809, VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_NULLPARAM = 3145810, VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_INVALIDALPHA = 3145811, VIDEOPROCESSORSETOUTPUTCOLORSPACE_NULLPARAM = 3145812, VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_NULLPARAM = 3145813, VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_UNSUPPORTED = 3145814, VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDSTREAM = 3145815, VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDFILLMODE = 3145816, VIDEOPROCESSORSETOUTPUTCONSTRICTION_NULLPARAM = 3145817, VIDEOPROCESSORSETOUTPUTSTEREOMODE_NULLPARAM = 3145818, VIDEOPROCESSORSETOUTPUTSTEREOMODE_UNSUPPORTED = 3145819, VIDEOPROCESSORSETOUTPUTEXTENSION_NULLPARAM = 3145820, VIDEOPROCESSORGETOUTPUTTARGETRECT_NULLPARAM = 3145821, VIDEOPROCESSORGETOUTPUTBACKGROUNDCOLOR_NULLPARAM = 3145822, VIDEOPROCESSORGETOUTPUTCOLORSPACE_NULLPARAM = 3145823, VIDEOPROCESSORGETOUTPUTALPHAFILLMODE_NULLPARAM = 3145824, VIDEOPROCESSORGETOUTPUTCONSTRICTION_NULLPARAM = 3145825, VIDEOPROCESSORSETOUTPUTCONSTRICTION_UNSUPPORTED = 3145826, VIDEOPROCESSORSETOUTPUTCONSTRICTION_INVALIDSIZE = 3145827, VIDEOPROCESSORGETOUTPUTSTEREOMODE_NULLPARAM = 3145828, VIDEOPROCESSORGETOUTPUTEXTENSION_NULLPARAM = 3145829, VIDEOPROCESSORSETSTREAMFRAMEFORMAT_NULLPARAM = 3145830, VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDFORMAT = 3145831, VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDSTREAM = 3145832, VIDEOPROCESSORSETSTREAMCOLORSPACE_NULLPARAM = 3145833, VIDEOPROCESSORSETSTREAMCOLORSPACE_INVALIDSTREAM = 3145834, VIDEOPROCESSORSETSTREAMOUTPUTRATE_NULLPARAM = 3145835, VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDRATE = 3145836, VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDFLAG = 3145837, VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDSTREAM = 3145838, VIDEOPROCESSORSETSTREAMSOURCERECT_NULLPARAM = 3145839, VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDSTREAM = 3145840, VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDRECT = 3145841, VIDEOPROCESSORSETSTREAMDESTRECT_NULLPARAM = 3145842, VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDSTREAM = 3145843, VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDRECT = 3145844, VIDEOPROCESSORSETSTREAMALPHA_NULLPARAM = 3145845, VIDEOPROCESSORSETSTREAMALPHA_INVALIDSTREAM = 3145846, VIDEOPROCESSORSETSTREAMALPHA_INVALIDALPHA = 3145847, VIDEOPROCESSORSETSTREAMPALETTE_NULLPARAM = 3145848, VIDEOPROCESSORSETSTREAMPALETTE_INVALIDSTREAM = 3145849, VIDEOPROCESSORSETSTREAMPALETTE_INVALIDCOUNT = 3145850, VIDEOPROCESSORSETSTREAMPALETTE_INVALIDALPHA = 3145851, VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_NULLPARAM = 3145852, VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = 3145853, VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDRATIO = 3145854, VIDEOPROCESSORSETSTREAMLUMAKEY_NULLPARAM = 3145855, VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDSTREAM = 3145856, VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDRANGE = 3145857, VIDEOPROCESSORSETSTREAMLUMAKEY_UNSUPPORTED = 3145858, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_NULLPARAM = 3145859, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDSTREAM = 3145860, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_UNSUPPORTED = 3145861, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FLIPUNSUPPORTED = 3145862, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_MONOOFFSETUNSUPPORTED = 3145863, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FORMATUNSUPPORTED = 3145864, VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDFORMAT = 3145865, VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_NULLPARAM = 3145866, VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = 3145867, VIDEOPROCESSORSETSTREAMFILTER_NULLPARAM = 3145868, VIDEOPROCESSORSETSTREAMFILTER_INVALIDSTREAM = 3145869, VIDEOPROCESSORSETSTREAMFILTER_INVALIDFILTER = 3145870, VIDEOPROCESSORSETSTREAMFILTER_UNSUPPORTED = 3145871, VIDEOPROCESSORSETSTREAMFILTER_INVALIDLEVEL = 3145872, VIDEOPROCESSORSETSTREAMEXTENSION_NULLPARAM = 3145873, VIDEOPROCESSORSETSTREAMEXTENSION_INVALIDSTREAM = 3145874, VIDEOPROCESSORGETSTREAMFRAMEFORMAT_NULLPARAM = 3145875, VIDEOPROCESSORGETSTREAMCOLORSPACE_NULLPARAM = 3145876, VIDEOPROCESSORGETSTREAMOUTPUTRATE_NULLPARAM = 3145877, VIDEOPROCESSORGETSTREAMSOURCERECT_NULLPARAM = 3145878, VIDEOPROCESSORGETSTREAMDESTRECT_NULLPARAM = 3145879, VIDEOPROCESSORGETSTREAMALPHA_NULLPARAM = 3145880, VIDEOPROCESSORGETSTREAMPALETTE_NULLPARAM = 3145881, VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_NULLPARAM = 3145882, VIDEOPROCESSORGETSTREAMLUMAKEY_NULLPARAM = 3145883, VIDEOPROCESSORGETSTREAMSTEREOFORMAT_NULLPARAM = 3145884, VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_NULLPARAM = 3145885, VIDEOPROCESSORGETSTREAMFILTER_NULLPARAM = 3145886, VIDEOPROCESSORGETSTREAMEXTENSION_NULLPARAM = 3145887, VIDEOPROCESSORGETSTREAMEXTENSION_INVALIDSTREAM = 3145888, VIDEOPROCESSORBLT_NULLPARAM = 3145889, VIDEOPROCESSORBLT_INVALIDSTREAMCOUNT = 3145890, VIDEOPROCESSORBLT_TARGETRECT = 3145891, VIDEOPROCESSORBLT_INVALIDOUTPUT = 3145892, VIDEOPROCESSORBLT_INVALIDPASTFRAMES = 3145893, VIDEOPROCESSORBLT_INVALIDFUTUREFRAMES = 3145894, VIDEOPROCESSORBLT_INVALIDSOURCERECT = 3145895, VIDEOPROCESSORBLT_INVALIDDESTRECT = 3145896, VIDEOPROCESSORBLT_INVALIDINPUTRESOURCE = 3145897, VIDEOPROCESSORBLT_INVALIDARRAYSIZE = 3145898, VIDEOPROCESSORBLT_INVALIDARRAY = 3145899, VIDEOPROCESSORBLT_RIGHTEXPECTED = 3145900, VIDEOPROCESSORBLT_RIGHTNOTEXPECTED = 3145901, VIDEOPROCESSORBLT_STEREONOTENABLED = 3145902, VIDEOPROCESSORBLT_INVALIDRIGHTRESOURCE = 3145903, VIDEOPROCESSORBLT_NOSTEREOSTREAMS = 3145904, VIDEOPROCESSORBLT_INPUTHAZARD = 3145905, VIDEOPROCESSORBLT_OUTPUTHAZARD = 3145906, CREATEVIDEODECODEROUTPUTVIEW_OUTOFMEMORY_RETURN = 3145907, CREATEVIDEODECODEROUTPUTVIEW_NULLPARAM = 3145908, CREATEVIDEODECODEROUTPUTVIEW_INVALIDTYPE = 3145909, CREATEVIDEODECODEROUTPUTVIEW_INVALIDBIND = 3145910, CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEDFORMAT = 3145911, CREATEVIDEODECODEROUTPUTVIEW_INVALIDMIP = 3145912, CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEMIP = 3145913, CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAYSIZE = 3145914, CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAY = 3145915, CREATEVIDEODECODEROUTPUTVIEW_INVALIDDIMENSION = 3145916, CREATEVIDEOPROCESSORINPUTVIEW_OUTOFMEMORY_RETURN = 3145917, CREATEVIDEOPROCESSORINPUTVIEW_NULLPARAM = 3145918, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDTYPE = 3145919, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDBIND = 3145920, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMISC = 3145921, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDUSAGE = 3145922, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFORMAT = 3145923, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFOURCC = 3145924, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMIP = 3145925, CREATEVIDEOPROCESSORINPUTVIEW_UNSUPPORTEDMIP = 3145926, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAYSIZE = 3145927, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAY = 3145928, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDDIMENSION = 3145929, CREATEVIDEOPROCESSOROUTPUTVIEW_OUTOFMEMORY_RETURN = 3145930, CREATEVIDEOPROCESSOROUTPUTVIEW_NULLPARAM = 3145931, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDTYPE = 3145932, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDBIND = 3145933, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDFORMAT = 3145934, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMIP = 3145935, CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDMIP = 3145936, CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDARRAY = 3145937, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDARRAY = 3145938, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDDIMENSION = 3145939, DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 3145940, CREATEBLENDSTATE_INVALIDLOGICOPS = 3145941, CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = 3145942, CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = 3145943, CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = 3145944, DEVICE_LOCKEDOUT_INTERFACE = 3145945, REF_WARNING_ATOMIC_INCONSISTENT = 3145946, REF_WARNING_READING_UNINITIALIZED_RESOURCE = 3145947, REF_WARNING_RAW_HAZARD = 3145948, REF_WARNING_WAR_HAZARD = 3145949, REF_WARNING_WAW_HAZARD = 3145950, CREATECRYPTOSESSION_NULLPARAM = 3145951, CREATECRYPTOSESSION_OUTOFMEMORY_RETURN = 3145952, GETCRYPTOTYPE_NULLPARAM = 3145953, GETDECODERPROFILE_NULLPARAM = 3145954, GETCRYPTOSESSIONCERTIFICATESIZE_NULLPARAM = 3145955, GETCRYPTOSESSIONCERTIFICATE_NULLPARAM = 3145956, GETCRYPTOSESSIONCERTIFICATE_WRONGSIZE = 3145957, GETCRYPTOSESSIONHANDLE_WRONGSIZE = 3145958, NEGOTIATECRPYTOSESSIONKEYEXCHANGE_NULLPARAM = 3145959, ENCRYPTIONBLT_UNSUPPORTED = 3145960, ENCRYPTIONBLT_NULLPARAM = 3145961, ENCRYPTIONBLT_SRC_WRONGDEVICE = 3145962, ENCRYPTIONBLT_DST_WRONGDEVICE = 3145963, ENCRYPTIONBLT_FORMAT_MISMATCH = 3145964, ENCRYPTIONBLT_SIZE_MISMATCH = 3145965, ENCRYPTIONBLT_SRC_MULTISAMPLED = 3145966, ENCRYPTIONBLT_DST_NOT_STAGING = 3145967, ENCRYPTIONBLT_SRC_MAPPED = 3145968, ENCRYPTIONBLT_DST_MAPPED = 3145969, ENCRYPTIONBLT_SRC_OFFERED = 3145970, ENCRYPTIONBLT_DST_OFFERED = 3145971, ENCRYPTIONBLT_SRC_CONTENT_UNDEFINED = 3145972, DECRYPTIONBLT_UNSUPPORTED = 3145973, DECRYPTIONBLT_NULLPARAM = 3145974, DECRYPTIONBLT_SRC_WRONGDEVICE = 3145975, DECRYPTIONBLT_DST_WRONGDEVICE = 3145976, DECRYPTIONBLT_FORMAT_MISMATCH = 3145977, DECRYPTIONBLT_SIZE_MISMATCH = 3145978, DECRYPTIONBLT_DST_MULTISAMPLED = 3145979, DECRYPTIONBLT_SRC_NOT_STAGING = 3145980, DECRYPTIONBLT_DST_NOT_RENDER_TARGET = 3145981, DECRYPTIONBLT_SRC_MAPPED = 3145982, DECRYPTIONBLT_DST_MAPPED = 3145983, DECRYPTIONBLT_SRC_OFFERED = 3145984, DECRYPTIONBLT_DST_OFFERED = 3145985, DECRYPTIONBLT_SRC_CONTENT_UNDEFINED = 3145986, STARTSESSIONKEYREFRESH_NULLPARAM = 3145987, STARTSESSIONKEYREFRESH_INVALIDSIZE = 3145988, FINISHSESSIONKEYREFRESH_NULLPARAM = 3145989, GETENCRYPTIONBLTKEY_NULLPARAM = 3145990, GETENCRYPTIONBLTKEY_INVALIDSIZE = 3145991, GETCONTENTPROTECTIONCAPS_NULLPARAM = 3145992, CHECKCRYPTOKEYEXCHANGE_NULLPARAM = 3145993, CHECKCRYPTOKEYEXCHANGE_INVALIDINDEX = 3145994, CREATEAUTHENTICATEDCHANNEL_NULLPARAM = 3145995, CREATEAUTHENTICATEDCHANNEL_UNSUPPORTED = 3145996, CREATEAUTHENTICATEDCHANNEL_INVALIDTYPE = 3145997, CREATEAUTHENTICATEDCHANNEL_OUTOFMEMORY_RETURN = 3145998, GETAUTHENTICATEDCHANNELCERTIFICATESIZE_INVALIDCHANNEL = 3145999, GETAUTHENTICATEDCHANNELCERTIFICATESIZE_NULLPARAM = 3146000, GETAUTHENTICATEDCHANNELCERTIFICATE_INVALIDCHANNEL = 3146001, GETAUTHENTICATEDCHANNELCERTIFICATE_NULLPARAM = 3146002, GETAUTHENTICATEDCHANNELCERTIFICATE_WRONGSIZE = 3146003, NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDCHANNEL = 3146004, NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_NULLPARAM = 3146005, QUERYAUTHENTICATEDCHANNEL_NULLPARAM = 3146006, QUERYAUTHENTICATEDCHANNEL_WRONGCHANNEL = 3146007, QUERYAUTHENTICATEDCHANNEL_UNSUPPORTEDQUERY = 3146008, QUERYAUTHENTICATEDCHANNEL_WRONGSIZE = 3146009, QUERYAUTHENTICATEDCHANNEL_INVALIDPROCESSINDEX = 3146010, CONFIGUREAUTHENTICATEDCHANNEL_NULLPARAM = 3146011, CONFIGUREAUTHENTICATEDCHANNEL_WRONGCHANNEL = 3146012, CONFIGUREAUTHENTICATEDCHANNEL_UNSUPPORTEDCONFIGURE = 3146013, CONFIGUREAUTHENTICATEDCHANNEL_WRONGSIZE = 3146014, CONFIGUREAUTHENTICATEDCHANNEL_INVALIDPROCESSIDTYPE = 3146015, VSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146016, DSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146017, HSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146018, GSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146019, PSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146020, CSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146021, NEGOTIATECRPYTOSESSIONKEYEXCHANGE_INVALIDSIZE = 3146022, NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDSIZE = 3146023, OFFERRESOURCES_INVALIDPRIORITY = 3146024, GETCRYPTOSESSIONHANDLE_OUTOFMEMORY = 3146025, ACQUIREHANDLEFORCAPTURE_NULLPARAM = 3146026, ACQUIREHANDLEFORCAPTURE_INVALIDTYPE = 3146027, ACQUIREHANDLEFORCAPTURE_INVALIDBIND = 3146028, ACQUIREHANDLEFORCAPTURE_INVALIDARRAY = 3146029, VIDEOPROCESSORSETSTREAMROTATION_NULLPARAM = 3146030, VIDEOPROCESSORSETSTREAMROTATION_INVALIDSTREAM = 3146031, VIDEOPROCESSORSETSTREAMROTATION_INVALID = 3146032, VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED = 3146033, VIDEOPROCESSORGETSTREAMROTATION_NULLPARAM = 3146034, DEVICE_CLEARVIEW_INVALIDVIEW = 3146035, DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146036, DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146037, DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146038, DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146039, DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146040, DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146041, DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146042, DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146043, DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED = 3146044, DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED = 3146045, DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146046, DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146047, DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146048, DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146049, DEVICE_SHADER_LINKAGE_MINPRECISION = 3146050, VIDEOPROCESSORSETSTREAMALPHA_UNSUPPORTED = 3146051, VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_UNSUPPORTED = 3146052, DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = 3146053, DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = 3146054, DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = 3146055, DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = 3146056, DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = 3146057, DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = 3146058, DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = 3146059, DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET = 3146060, DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 3146061, DEVICE_CLEARVIEW_NOTSUPPORTED = 3146062, SWAPDEVICECONTEXTSTATE_NOTSUPPORTED = 3146063, UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 = 3146064, GETDC_INACCESSIBLE = 3146065, DEVICE_CLEARVIEW_INVALIDRECT = 3146066, DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9 = 3146067, DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED = 3146068, DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED = 3146069, ENQUEUESETEVENT_NOT_SUPPORTED = 3146070, OFFERRELEASE_NOT_SUPPORTED = 3146071, OFFERRESOURCES_INACCESSIBLE = 3146072, CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA = 3146073, CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA = 3146074, DEVICE_CLEARVIEW_INVALIDSOURCERECT = 3146075, DEVICE_CLEARVIEW_EMPTYRECT = 3146076, UPDATESUBRESOURCE_EMPTYDESTBOX = 3146077, COPYSUBRESOURCEREGION_EMPTYSOURCEBOX = 3146078, DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 3146079, DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET = 3146080, DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET = 3146081, DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 3146082, DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 3146083, GETDATAFORNEWHARDWAREKEY_NULLPARAM = 3146084, CHECKCRYPTOSESSIONSTATUS_NULLPARAM = 3146085, GETCRYPTOSESSIONPRIVATEDATASIZE_NULLPARAM = 3146086, GETVIDEODECODERCAPS_NULLPARAM = 3146087, GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT = 3146088, CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM = 3146089, CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 3146090, CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 3146091, VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM = 3146092, VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED = 3146093, VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM = 3146094, VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED = 3146095, CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM = 3146096, VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM = 3146097, VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM = 3146098, VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM = 3146099, VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM = 3146100, VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM = 3146101, VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM = 3146102, VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED = 3146103, VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM = 3146104, VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM = 3146105, RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM = 3146106, RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 3146107, RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 3146108, VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM = 3146109, VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM = 3146110, VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM = 3146111, VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT = 3146112, VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = 3146113, VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = 3146114, VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = 3146115, GETCRYPTOSESSIONPRIVATEDATASIZE_INVALID_KEY_EXCHANGE_TYPE = 3146116, D3D11_1_MESSAGES_END = 3146117, D3D11_2_MESSAGES_START = 3146118, CREATEBUFFER_INVALIDUSAGE = 3146119, CREATETEXTURE1D_INVALIDUSAGE = 3146120, CREATETEXTURE2D_INVALIDUSAGE = 3146121, CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1 = 3146122, CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED = 3146123, UPDATETILEMAPPINGS_INVALID_PARAMETER = 3146124, COPYTILEMAPPINGS_INVALID_PARAMETER = 3146125, COPYTILES_INVALID_PARAMETER = 3146126, UPDATETILES_INVALID_PARAMETER = 3146127, RESIZETILEPOOL_INVALID_PARAMETER = 3146128, TILEDRESOURCEBARRIER_INVALID_PARAMETER = 3146129, NULL_TILE_MAPPING_ACCESS_WARNING = 3146130, NULL_TILE_MAPPING_ACCESS_ERROR = 3146131, DIRTY_TILE_MAPPING_ACCESS = 3146132, DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA = 3146133, TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE = 3146134, TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES = 3146135, TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT = 3146136, CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS = 3146137, GETRESOURCETILING_NONTILED_RESOURCE = 3146138, RESIZETILEPOOL_SHRINK_WITH_MAPPINGS_STILL_DEFINED_PAST_END = 3146139, NEED_TO_CALL_TILEDRESOURCEBARRIER = 3146140, CREATEDEVICE_INVALIDARGS = 3146141, CREATEDEVICE_WARNING = 3146142, CLEARUNORDEREDACCESSVIEWUINT_HAZARD = 3146143, CLEARUNORDEREDACCESSVIEWFLOAT_HAZARD = 3146144, TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH = 3146145, CREATE_CRYPTOSESSION = 3146146, CREATE_AUTHENTICATEDCHANNEL = 3146147, LIVE_CRYPTOSESSION = 3146148, LIVE_AUTHENTICATEDCHANNEL = 3146149, DESTROY_CRYPTOSESSION = 3146150, DESTROY_AUTHENTICATEDCHANNEL = 3146151, D3D11_2_MESSAGES_END = 3146152, D3D11_3_MESSAGES_START = 3146153, CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = 3146154, DEVICE_DRAW_INVALID_SYSTEMVALUE = 3146155, CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = 3146156, CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = 3146157, CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = 3146158, CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = 3146159, CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = 3146160, CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = 3146161, CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = 3146162, CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX = 3146163, CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX = 3146164, CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX = 3146165, CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX = 3146166, CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX = 3146167, JPEGDECODE_INVALIDSCANDATAOFFSET = 3146168, JPEGDECODE_NOTSUPPORTED = 3146169, JPEGDECODE_DIMENSIONSTOOLARGE = 3146170, JPEGDECODE_INVALIDCOMPONENTS = 3146171, JPEGDECODE_DESTINATIONNOT2D = 3146172, JPEGDECODE_TILEDRESOURCESUNSUPPORTED = 3146173, JPEGDECODE_GUARDRECTSUNSUPPORTED = 3146174, JPEGDECODE_FORMATUNSUPPORTED = 3146175, JPEGDECODE_INVALIDSUBRESOURCE = 3146176, JPEGDECODE_INVALIDMIPLEVEL = 3146177, JPEGDECODE_EMPTYDESTBOX = 3146178, JPEGDECODE_DESTBOXNOT2D = 3146179, JPEGDECODE_DESTBOXNOTSUB = 3146180, JPEGDECODE_DESTBOXESINTERSECT = 3146181, JPEGDECODE_XSUBSAMPLEMISMATCH = 3146182, JPEGDECODE_YSUBSAMPLEMISMATCH = 3146183, JPEGDECODE_XSUBSAMPLEODD = 3146184, JPEGDECODE_YSUBSAMPLEODD = 3146185, JPEGDECODE_OUTPUTDIMENSIONSTOOLARGE = 3146186, JPEGDECODE_NONPOW2SCALEUNSUPPORTED = 3146187, JPEGDECODE_FRACTIONALDOWNSCALETOLARGE = 3146188, JPEGDECODE_CHROMASIZEMISMATCH = 3146189, JPEGDECODE_LUMACHROMASIZEMISMATCH = 3146190, JPEGDECODE_INVALIDNUMDESTINATIONS = 3146191, JPEGDECODE_SUBBOXUNSUPPORTED = 3146192, JPEGDECODE_1DESTUNSUPPORTEDFORMAT = 3146193, JPEGDECODE_3DESTUNSUPPORTEDFORMAT = 3146194, JPEGDECODE_SCALEUNSUPPORTED = 3146195, JPEGDECODE_INVALIDSOURCESIZE = 3146196, JPEGDECODE_INVALIDCOPYFLAGS = 3146197, JPEGDECODE_HAZARD = 3146198, JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE = 3146199, JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = 3146200, JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = 3146201, JPEGDECODE_BACKBUFFERNOTSUPPORTED = 3146202, JPEGDECODE_UNSUPPRTEDCOPYFLAGS = 3146203, JPEGENCODE_NOTSUPPORTED = 3146204, JPEGENCODE_INVALIDSCANDATAOFFSET = 3146205, JPEGENCODE_INVALIDCOMPONENTS = 3146206, JPEGENCODE_SOURCENOT2D = 3146207, JPEGENCODE_TILEDRESOURCESUNSUPPORTED = 3146208, JPEGENCODE_GUARDRECTSUNSUPPORTED = 3146209, JPEGENCODE_XSUBSAMPLEMISMATCH = 3146210, JPEGENCODE_YSUBSAMPLEMISMATCH = 3146211, JPEGENCODE_FORMATUNSUPPORTED = 3146212, JPEGENCODE_INVALIDSUBRESOURCE = 3146213, JPEGENCODE_INVALIDMIPLEVEL = 3146214, JPEGENCODE_DIMENSIONSTOOLARGE = 3146215, JPEGENCODE_HAZARD = 3146216, JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE = 3146217, JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = 3146218, JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = 3146219, JPEGENCODE_BACKBUFFERNOTSUPPORTED = 3146220, CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = 3146221, FLUSH1_INVALIDCONTEXTTYPE = 3146222, DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT = 3146223, VIDEOPROCESSORSETOUTPUTHDRMETADATA_NULLPARAM = 3146224, VIDEOPROCESSORSETOUTPUTHDRMETADATA_INVALIDSIZE = 3146225, VIDEOPROCESSORGETOUTPUTHDRMETADATA_NULLPARAM = 3146226, VIDEOPROCESSORGETOUTPUTHDRMETADATA_INVALIDSIZE = 3146227, VIDEOPROCESSORSETSTREAMHDRMETADATA_NULLPARAM = 3146228, VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSTREAM = 3146229, VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSIZE = 3146230, VIDEOPROCESSORGETSTREAMHDRMETADATA_NULLPARAM = 3146231, VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSTREAM = 3146232, VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSIZE = 3146233, VIDEOPROCESSORGETSTREAMFRAMEFORMAT_INVALIDSTREAM = 3146234, VIDEOPROCESSORGETSTREAMCOLORSPACE_INVALIDSTREAM = 3146235, VIDEOPROCESSORGETSTREAMOUTPUTRATE_INVALIDSTREAM = 3146236, VIDEOPROCESSORGETSTREAMSOURCERECT_INVALIDSTREAM = 3146237, VIDEOPROCESSORGETSTREAMDESTRECT_INVALIDSTREAM = 3146238, VIDEOPROCESSORGETSTREAMALPHA_INVALIDSTREAM = 3146239, VIDEOPROCESSORGETSTREAMPALETTE_INVALIDSTREAM = 3146240, VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = 3146241, VIDEOPROCESSORGETSTREAMLUMAKEY_INVALIDSTREAM = 3146242, VIDEOPROCESSORGETSTREAMSTEREOFORMAT_INVALIDSTREAM = 3146243, VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = 3146244, VIDEOPROCESSORGETSTREAMFILTER_INVALIDSTREAM = 3146245, VIDEOPROCESSORGETSTREAMROTATION_INVALIDSTREAM = 3146246, VIDEOPROCESSORGETSTREAMCOLORSPACE1_INVALIDSTREAM = 3146247, VIDEOPROCESSORGETSTREAMMIRROR_INVALIDSTREAM = 3146248, CREATE_FENCE = 3146249, LIVE_FENCE = 3146250, DESTROY_FENCE = 3146251, CREATE_SYNCHRONIZEDCHANNEL = 3146252, LIVE_SYNCHRONIZEDCHANNEL = 3146253, DESTROY_SYNCHRONIZEDCHANNEL = 3146254, CREATEFENCE_INVALIDFLAGS = 3146255, D3D11_3_MESSAGES_END = 3146256, D3D11_5_MESSAGES_START = 3146257, NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_INVALIDKEYEXCHANGETYPE = 3146258, NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_NOT_SUPPORTED = 3146259, DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT_COUNT = 3146260, DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT = 3146261, DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_SIZE = 3146262, DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_USAGE = 3146263, DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_MISC_FLAGS = 3146264, DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_OFFSET = 3146265, CREATE_TRACKEDWORKLOAD = 3146266, LIVE_TRACKEDWORKLOAD = 3146267, DESTROY_TRACKEDWORKLOAD = 3146268, CREATE_TRACKED_WORKLOAD_NULLPARAM = 3146269, CREATE_TRACKED_WORKLOAD_INVALID_MAX_INSTANCES = 3146270, CREATE_TRACKED_WORKLOAD_INVALID_DEADLINE_TYPE = 3146271, CREATE_TRACKED_WORKLOAD_INVALID_ENGINE_TYPE = 3146272, MULTIPLE_TRACKED_WORKLOADS = 3146273, MULTIPLE_TRACKED_WORKLOAD_PAIRS = 3146274, INCOMPLETE_TRACKED_WORKLOAD_PAIR = 3146275, OUT_OF_ORDER_TRACKED_WORKLOAD_PAIR = 3146276, CANNOT_ADD_TRACKED_WORKLOAD = 3146277, TRACKED_WORKLOAD_NOT_SUPPORTED = 3146278, TRACKED_WORKLOAD_ENGINE_TYPE_NOT_FOUND = 3146279, NO_TRACKED_WORKLOAD_SLOT_AVAILABLE = 3146280, END_TRACKED_WORKLOAD_INVALID_ARG = 3146281, TRACKED_WORKLOAD_DISJOINT_FAILURE = 3146282, D3D11_5_MESSAGES_END = 3146283, }; pub const MESSAGE = extern struct { Category: MESSAGE_CATEGORY, Severity: MESSAGE_SEVERITY, ID: MESSAGE_ID, pDescription: [*]const u8, DescriptionByteLength: SIZE_T, }; pub const INFO_QUEUE_FILTER_DESC = extern struct { NumCategories: UINT, pCategoryList: ?[*]MESSAGE_CATEGORY, NumSeverities: UINT, pSeverityList: ?[*]MESSAGE_SEVERITY, NumIDs: UINT, pIDList: ?[*]MESSAGE_ID, }; pub const INFO_QUEUE_FILTER = extern struct { AllowList: INFO_QUEUE_FILTER_DESC, DenyList: INFO_QUEUE_FILTER_DESC, }; pub const IID_IInfoQueue = GUID.parse("{6543dbb6-1b48-42f5-ab82-e97ec74326f6}"); pub const IInfoQueue = extern struct { const Self = @This(); v: *const extern struct { unknown: IUnknown.VTable(Self), info: VTable(Self), }, usingnamespace IUnknown.Methods(Self); usingnamespace Methods(Self); fn Methods(comptime T: type) type { return extern struct { pub inline fn GetMessage( self: *T, MessageIndex: UINT64, pMessage: ?*MESSAGE, pMessageByteLength: *SIZE_T, ) HRESULT { return self.v.info.GetMessage( self, MessageIndex, pMessage, pMessageByteLength, ); } pub inline fn GetNumStoredMessages(self: *T) UINT64 { return self.v.info.GetNumStoredMessages(self); } pub inline fn AddStorageFilterEntries(self: *T, filter: *INFO_QUEUE_FILTER) HRESULT { return self.v.info.AddStorageFilterEntries(self, filter); } pub inline fn PushEmptyStorageFilter(self: *T) HRESULT { return self.v.info.PushEmptyStorageFilter(self); } pub inline fn PushStorageFilter(self: *T, filter: *INFO_QUEUE_FILTER) HRESULT { return self.v.info.PushStorageFilter(self, filter); } pub inline fn PopStorageFilter(self: *T) void { self.v.info.PopStorageFilter(self); } pub inline fn SetMuteDebugOutput(self: *T, mute: BOOL) void { self.v.info.SetMuteDebugOutput(self, mute); } }; } fn VTable(comptime T: type) type { return extern struct { SetMessageCountLimit: *anyopaque, ClearStoredMessages: *anyopaque, GetMessage: fn (*T, UINT64, ?*MESSAGE, *SIZE_T) callconv(WINAPI) HRESULT, GetNumMessagesAllowedByStorageFilter: *anyopaque, GetNumMessagesDeniedByStorageFilter: *anyopaque, GetNumStoredMessages: fn (*T) callconv(WINAPI) UINT64, GetNumStoredMessagesAllowedByRetrievalFilter: *anyopaque, GetNumMessagesDiscardedByMessageCountLimit: *anyopaque, GetMessageCountLimit: *anyopaque, AddStorageFilterEntries: fn (*T, *INFO_QUEUE_FILTER) callconv(WINAPI) HRESULT, GetStorageFilter: *anyopaque, ClearStorageFilter: *anyopaque, PushEmptyStorageFilter: fn (*T) callconv(WINAPI) HRESULT, PushCopyOfStorageFilter: *anyopaque, PushStorageFilter: fn (*T, *INFO_QUEUE_FILTER) callconv(WINAPI) HRESULT, PopStorageFilter: fn (*T) callconv(WINAPI) void, GetStorageFilterStackSize: *anyopaque, AddRetrievalFilterEntries: *anyopaque, GetRetrievalFilter: *anyopaque, ClearRetrievalFilter: *anyopaque, PushEmptyRetrievalFilter: *anyopaque, PushCopyOfRetrievalFilter: *anyopaque, PushRetrievalFilter: *anyopaque, PopRetrievalFilter: *anyopaque, GetRetrievalFilterStackSize: *anyopaque, AddMessage: *anyopaque, AddApplicationMessage: *anyopaque, SetBreakOnCategory: *anyopaque, SetBreakOnSeverity: *anyopaque, SetBreakOnID: *anyopaque, GetBreakOnCategory: *anyopaque, GetBreakOnSeverity: *anyopaque, GetBreakOnID: *anyopaque, SetMuteDebugOutput: fn (*T, BOOL) callconv(WINAPI) void, GetMuteDebugOutput: *anyopaque, }; } };
modules/platform/vendored/zwin32/src/d3d11sdklayers.zig
const std = @import("std"); const stdx = @import("../stdx.zig"); const ds = stdx.ds; const t = stdx.testing; const log = stdx.log.scoped(.complete_tree); // Like a BTree but doesn't do self balancing. // Nodes can have at most BF (branching factor) children. // Appending a node will insert into the next slot to preserve a complete tree. // Stored in a dense array for fast access to all nodes. pub fn CompleteTreeArray(comptime BF: u16, comptime T: type) type { return struct { const Self = @This(); const NodeId = u32; nodes: std.ArrayList(T), pub fn init(alloc: std.mem.Allocator) Self { return .{ .nodes = std.ArrayList(T).init(alloc), }; } pub fn deinit(self: *Self) void { self.nodes.deinit(); } pub fn getNodePtr(self: *Self, id: NodeId) *T { return &self.nodes.items[id]; } pub fn getNode(self: *Self, id: NodeId) T { return self.nodes.items[id]; } pub fn getParent(self: *Self, id: NodeId) ?NodeId { _ = self; if (id == 0) { return null; } else { return (id - 1) / BF; } } pub fn getParentNode(self: *Self, id: NodeId) ?T { _ = self; const parent_id = self.getParent(id); return self.getNode(parent_id); } // Includes self. pub fn getSiblings(self: *Self, id: NodeId, buf: []NodeId) []const NodeId { if (id == 0) { buf[0] = 0; return buf[0..1]; } else { const parent = self.getParent(id).?; return self.getChildren(parent, buf); } } pub fn getChildrenRange(self: *Self, id: NodeId) ds.RelSlice(NodeId) { const start = BF * id + 1; const end = std.math.min(start + BF, self.nodes.items.len); return .{ .start = start, .end = end }; } pub fn getChildren(self: *Self, id: NodeId, buf: []NodeId) []const NodeId { var i: u32 = 0; const range = self.getChildrenRange(id); const len = if (range.end > range.start) range.end - range.start else 0; var cur = range.start; while (cur < range.end) : (cur += 1) { buf[i] = cur; i += 1; } return buf[0..len]; } // Leaf node before in-order. // Since leaves can only be apart by one depth, this is a simple O(1) op. pub fn isLeafNodeBefore(self: *Self, node: NodeId, target: NodeId) bool { const node_d = self.getDepthAt(node); const target_d = self.getDepthAt(target); if (node_d > target_d) { return true; } else if (node_d < target_d) { return false; } else { return node < target; } } // First leaf in-order. pub fn getFirstLeaf(self: *Self) NodeId { const d = self.getDepth(); return self.getFirstAtDepth(d); } // Last leaf in-order. pub fn getLastLeaf(self: *Self) NodeId { const d = self.getDepth(); const max_nodes = self.getMaxNodesAtDepth(d); const _size = self.size(); if (_size > max_nodes - BF) { return _size - 1; } else { // Get the last node one depth lower. return max_nodes - self.getMaxLeavesAtDepth(d) - 1; } } // Assumes leaf node and returns the previous leaf in-order. pub fn getPrevLeaf(self: *Self, leaf: NodeId) ?NodeId { const last = @intCast(u32, self.nodes.items.len) - 1; const last_d = self.getDepthAt(last); const first = self.getFirstAtDepth(last_d); if (leaf >= first) { if (leaf == first) { // First in-order. return null; } else { return leaf - 1; } } else { // Leaf is in depth-1. const max_leaves = self.getMaxLeaves(); const num_parents = (last - first) / BF + 1; const first_dm1 = first - max_leaves / BF; if (leaf == first_dm1 + num_parents) { // At first leaf in depth-1 return last; } else { return leaf - 1; } } } // Assumes leaf node and returns the next leaf in-order. pub fn getNextLeaf(self: *Self, leaf: NodeId) ?NodeId { const last = @intCast(u32, self.nodes.items.len) - 1; const last_d = self.getDepthAt(last); const first = self.getFirstAtDepth(last_d); if (leaf < last) { if (leaf == first - 1) { // Last in-order. return null; } else { return leaf + 1; } } else { const max_leaves = self.getMaxLeaves(); if (last >= first + max_leaves - BF) { // Last in-order. return null; } else { // Get leaf one depth higher. const num_parents = (last - first) / BF + 1; const first_dm1 = first - max_leaves / BF; return first_dm1 + num_parents; } } } // Assumes buffer is big enough. Caller should use getMaxLeaves() to ensure buffer size. pub fn getInOrderLeaves(self: *Self, buf: []NodeId) []const NodeId { const d = self.getDepth(); const first_d = self.getFirstAtDepth(d); var i: u32 = 0; while (i < self.nodes.items.len - first_d) : (i += 1) { buf[i] = first_d + i; } const num_parents = (@intCast(u32, self.nodes.items.len - 1) - first_d) / BF + 1; const max_parents = self.getMaxLeavesAtDepth(d - 1); if (num_parents != max_parents) { const start = self.getFirstAtDepth(d - 1) + num_parents; const buf_end = i + (max_parents - num_parents); var j: u32 = 0; while (i < buf_end) : (i += 1) { buf[i] = start + j; j += 1; } } return buf[0..i]; } pub fn getLeavesRange(self: *Self) ds.RelSlice(NodeId) { const d = self.getDepth(); if (d == 0) { return .{ .start = 0, .end = 0 }; } const first_d = self.getFirstAtDepth(d); const num_parents = (@intCast(u32, self.nodes.items.len - 1) - first_d) / BF + 1; const max_parents = self.getMaxLeavesAtDepth(d - 1); if (num_parents == max_parents) { return .{ .start = first_d, .end = first_d + self.getMaxLeavesAtDepth(d) }; } else { const start = self.getFirstAtDepth(d - 1) + num_parents; return .{ .start = start, .end = start + (max_parents - num_parents) + @intCast(u32, self.nodes.items.len - first_d) }; } } // First node at depth. // (BF^d - 1) / (BF - 1) pub fn getFirstAtDepth(self: *Self, d: u32) NodeId { _ = self; if (d < 2) { return d; } else { return (std.math.pow(u32, BF, d) - 1) / (BF - 1); } } // (BF^(d+1) - 1) / (BF - 1) pub fn getMaxNodesAtDepth(self: *Self, d: u32) u32 { _ = self; if (d < 1) { return 1; } else { return (std.math.pow(u32, BF, d + 1) - 1) / (BF - 1); } } pub fn getDepth(self: *Self) u32 { if (self.nodes.items.len == 0) { unreachable; } return self.getDepthAt(@intCast(u32, self.nodes.items.len - 1)); } // Root is depth=0 // trunc(log(BF, n * (BF - 1) + 1)) fn getDepthAt(self: *Self, id: NodeId) u32 { _ = self; if (id < 2) { return id; } else { return @floatToInt(u32, @trunc(std.math.log(f32, BF, @intToFloat(f32, id * (BF - 1) + 1)))); } } pub fn getMaxLeaves(self: *Self) u32 { return self.getMaxLeavesAtDepth(self.getDepth()); } pub fn getMaxLeavesAtDepth(self: *Self, d: u32) u32 { _ = self; return std.math.pow(u32, BF, d); } pub fn swap(self: *Self, a: NodeId, b: NodeId) void { const a_node = self.getNodePtr(a); const b_node = self.getNodePtr(b); const temp = a_node.*; a_node.* = b_node.*; b_node.* = temp; } pub fn append(self: *Self, node: T) !NodeId { const id = @intCast(u32, self.nodes.items.len); try self.nodes.append(node); return id; } pub fn resize(self: *Self, _size: u32) !void { try self.nodes.resize(_size); } pub fn clearRetainingCapacity(self: *Self) void { self.nodes.clearRetainingCapacity(); } pub fn size(self: *Self) u32 { return @intCast(u32, self.nodes.items.len); } }; } test "CompleteTreeArray BF=2" { var tree = CompleteTreeArray(2, u32).init(t.alloc); defer tree.deinit(); const root = try tree.append(1); try t.eq(root, 0); try t.eq(tree.getNode(root), 1); // Add more nodes. _ = try tree.append(2); _ = try tree.append(3); _ = try tree.append(4); var buf: [5]u32 = undefined; var children = tree.getChildren(0, &buf); try t.eq(children.len, 2); try t.eq(tree.getNode(children[0]), 2); try t.eq(tree.getNode(children[1]), 3); // Node with partial children list. children = tree.getChildren(1, &buf); try t.eq(children.len, 1); try t.eq(tree.getNode(children[0]), 4); // Node with no children list. children = tree.getChildren(2, &buf); try t.eq(children.len, 0); // Get parent. try t.eq(tree.getParent(0), null); try t.eq(tree.getParent(1), 0); try t.eq(tree.getParent(2), 0); try t.eq(tree.getParent(3), 1); // Get siblings. try t.eqSlice(u32, tree.getSiblings(0, &buf), &[_]u32{0}); try t.eqSlice(u32, tree.getSiblings(1, &buf), &[_]u32{ 1, 2 }); try t.eqSlice(u32, tree.getSiblings(2, &buf), &[_]u32{ 1, 2 }); try t.eqSlice(u32, tree.getSiblings(3, &buf), &[_]u32{3}); try t.eq(tree.getDepth(), 2); try t.eq(tree.getDepthAt(0), 0); try t.eq(tree.getDepthAt(1), 1); try t.eq(tree.getDepthAt(2), 1); try t.eq(tree.getDepthAt(3), 2); try t.eq(tree.getFirstAtDepth(2), 3); try t.eq(tree.getFirstLeaf(), 3); try t.eq(tree.getNextLeaf(3), 2); try t.eq(tree.getNextLeaf(2), null); try t.eq(tree.getPrevLeaf(2), 3); try t.eq(tree.getPrevLeaf(3), null); try t.eq(tree.getLastLeaf(), 2); try t.eq(tree.getMaxLeavesAtDepth(2), 4); try t.eq(tree.getLeavesRange(), .{ .start = 2, .end = 4 }); try t.eqSlice(u32, tree.getInOrderLeaves(&buf), &[_]u32{ 3, 2 }); try t.eq(tree.isLeafNodeBefore(2, 3), false); } test "CompleteTreeArray BF=3" { var tree = CompleteTreeArray(3, u32).init(t.alloc); defer tree.deinit(); const root = try tree.append(1); try t.eq(root, 0); try t.eq(tree.getNode(root), 1); // Add more nodes. _ = try tree.append(2); _ = try tree.append(3); _ = try tree.append(4); _ = try tree.append(5); var buf: [5]u32 = undefined; var children = tree.getChildren(0, &buf); try t.eq(children.len, 3); try t.eq(tree.getNode(children[0]), 2); try t.eq(tree.getNode(children[1]), 3); try t.eq(tree.getNode(children[2]), 4); // Node with partial children list. children = tree.getChildren(1, &buf); try t.eq(children.len, 1); try t.eq(tree.getNode(children[0]), 5); // Node with no children list. children = tree.getChildren(2, &buf); try t.eq(children.len, 0); // Get parent. try t.eq(tree.getParent(0), null); try t.eq(tree.getParent(1), 0); try t.eq(tree.getParent(2), 0); try t.eq(tree.getParent(3), 0); try t.eq(tree.getParent(4), 1); // Get siblings. try t.eqSlice(u32, tree.getSiblings(0, &buf), &[_]u32{0}); try t.eqSlice(u32, tree.getSiblings(1, &buf), &[_]u32{ 1, 2, 3 }); try t.eqSlice(u32, tree.getSiblings(2, &buf), &[_]u32{ 1, 2, 3 }); try t.eqSlice(u32, tree.getSiblings(3, &buf), &[_]u32{ 1, 2, 3 }); try t.eqSlice(u32, tree.getSiblings(4, &buf), &[_]u32{4}); try t.eq(tree.getDepth(), 2); try t.eq(tree.getDepthAt(13), 3); // Useful to test the threshold between depths. try t.eq(tree.getDepthAt(39), 3); try t.eq(tree.getDepthAt(40), 4); try t.eq(tree.getFirstAtDepth(2), 4); try t.eq(tree.getFirstAtDepth(3), 13); try t.eq(tree.getMaxNodesAtDepth(0), 1); try t.eq(tree.getMaxNodesAtDepth(1), 4); try t.eq(tree.getMaxNodesAtDepth(2), 13); try t.eq(tree.getMaxNodesAtDepth(3), 40); try t.eq(tree.getFirstLeaf(), 4); try t.eq(tree.getNextLeaf(4), 2); try t.eq(tree.getNextLeaf(2), 3); try t.eq(tree.getNextLeaf(3), null); try t.eq(tree.getPrevLeaf(3), 2); try t.eq(tree.getPrevLeaf(2), 4); try t.eq(tree.getPrevLeaf(4), null); try t.eq(tree.getLastLeaf(), 3); try t.eq(tree.getMaxLeavesAtDepth(2), 9); try t.eq(tree.getLeavesRange(), .{ .start = 2, .end = 5 }); try t.eqSlice(u32, tree.getInOrderLeaves(&buf), &[_]u32{ 4, 2, 3 }); try t.eq(tree.isLeafNodeBefore(2, 3), true); try t.eq(tree.isLeafNodeBefore(2, 4), false); } test "CompleteTreeArray BF=4" { var tree = CompleteTreeArray(4, u32).init(t.alloc); defer tree.deinit(); try t.eq(tree.getFirstAtDepth(3), 21); try t.eq(tree.getDepthAt(21), 3); }
stdx/ds/complete_tree.zig
const std = @import("std"); const is_debug = std.debug.runtime_safety; const is_single_threaded = std.builtin.single_threaded; pub const Runtime = @This(); async_scheduler: RuntimeScheduler, blocking_scheduler: if (is_single_threaded) void else RuntimeScheduler, blocking_thread: ?*OsThread, pub const RuntimeScheduler = struct { is_blocking: bool, scheduler: Scheduler, pub fn getRuntime(self: *RuntimeScheduler) *Runtime { if (self.is_blocking) { return @fieldParentPtr(Runtime, "blocking_scheduler", self); } else { return @fieldParentPtr(Runtime, "async_scheduler", self); } } }; fn ReturnTypeOf(comptime asyncFn: anytype) type { return @typeInfo(@TypeOf(asyncFn)).Fn.return_type.?; } /////////////////////////////////////////////////////////////////////// // Generic Runtime API /////////////////////////////////////////////////////////////////////// pub const RunConfig = struct { async_pool: Pool = Pool{ .threads = null, .stack_size = 16 * 1024 * 1024, }, blocking_pool: Pool = Pool{ .threads = 64, .stack_size = 1 * 1024 * 1024, }, pub const Pool = struct { threads: ?u16, stack_size: usize, }; pub fn run(self: RunConfig, comptime asyncFn: anytype, args: anytype) !ReturnTypeOf(asyncFn) { return self.runWithShutdown(true, asyncFn, args); } pub fn runForever(self: RunConfig, comptime asyncFn: anytype, args: anytype) !ReturnTypeOf(asyncFn) { return self.runWithShutdown(false, asyncFn, args); fn runWithShutdown(self: RunConfig, shutdown_after: bool, comptime asyncFn: anytype, args: anytype) !ReturnTypeOf(asyncFn) { const Decorator = struct { fn entry(task: *Task, result: *?ReturnTypeOf(asyncFn), shutdown: bool, asyncArgs: @TypeOf(args)) void { suspend task.* = Task.init(@frame()); const return_value = @call(.{}, asyncFn, asyncArgs); suspend { result.* = return_value; if (shutdown) { Worker.getCurrent().getScheduler().shutdown(); } } } }; var task: Task = undefined; var result: ?ReturnTypeOf(asyncFn) = null; var frame = async Decorator.entry(&task, &result, shutdown_after, args); self.runTasks(Batch.from(&task)); return result orelse error.DeadLocked; } pub fn runTasks(self: RunConfig, batch: Batch) void { var runtime: Runtime = undefined; // Compute the amount of threads used for the async_scheduler const async_threads: u16 = if (is_single_threaded) @as(u16, 1) else if (config.async_pool.threads) |threads| std.math.min(Scheduler.max_workers, threads) else std.math.min(Scheduler.max_workers, @intCast(u16, OsThread.cpuCount() catch 1)); // Compute the amount of threads used for the blocking_scheduler var blocking_threads = config.blocking_pool.threads orelse async_threads; blocking_threads = std.math.min(Scheduler.max_workers, blocking_threads, true); if (is_single_threaded) { blocking_threads = 0; } // Try to start a blocking scheduler thread if it has any const use_blocking_scheduler = !is_single_threaded and blocking_threads > 0; if (use_blocking_scheduler) { runtime.blocking_scheduler.is_blocking = true; runtime.blocking_scheduler.scheduler.init(blocking_threads, config.blocking_pool.stack_size, true); const StubTask = struct { task: Task, fn callback(_: *Task, _: *Worker) callconv(.C) void {} }; // Schedule a stub task onto the blocking_scheduler in another thread so it stays running. var stub_task = StubTask{ .task = Task.initCallback(StubTask.callback) }; runtime.blocking_thread = OsThread.spawn( .{ .stack_size = config.blocking_pool.stack_size }, Scheduler.scheduleBatch, .{&runtime.blocking_scheduler.scheduler, Batch.from(&stub_task.task)}, ) catch blk: { runtime.blocking_scheduler.scheduler.deinit(); break :blk null; }; } else { runtime.blocking_thread = null; } // Run the async-scheduler using the main thread runtime.async_scheduler.is_blocking = false; runtime.async_scheduler.scheduler.init(async_threads, config.async_pool.stack_size); runtime.async_scheduler.scheduler.scheduleBatch(Batch.from(task)); runtime.async_scheduler.scheduler.deinit(); // Cleanup the blocking scheduler if it has one if (runtime.blocking_thread) |blocking_thread| { // skip shutdown() as that has a protective guard runtime.blocking_scheduler.scheduler.shutdownWorkers(); bocking_thread.join(); runtime.blocking_scheduler.scheduler.deinit(); } } }; pub fn getAllocator() *Allocator { return Worker.getCurrent().getAllocator(); } pub fn runConcurrently() void { suspend { var task = Task.init(@frame()); Worker.getCurrent().schedule(&task, .{ .use_lifo = true }); } } pub fn spawn(allocator: *Allocator, comptime asyncFn: anytype, args: anytype) error{OutOfMemory}!void { if (ReturnTypeOf(asyncFn) != void) { @compileError("the return type of a spawned function must be void"); } const Decorator = struct { fn entry(frame_allocator: *Allocator, asyncArgs: @TypeOf(args)) void { runConcurrently(); @call(.{}, asyncFn, asyncArgs); suspend frame_allocator.destroy(@frame()); } }; const frame = try allocator.create(@Frame(Decorator.entry)); frame.* = async Decorator.entry(allocator, args); } pub fn yield() void { suspend { var task = Task.init(@frame()); Worker.getCurrent().schedule(&task, .{}); } } pub fn callBlocking(comptime asyncFn: anytype, args: anytype) ReturnTypeOf(asyncFn) { if (is_single_threaded) return @call(.{}, asyncFn, args); const scheduler = Worker.getCurrent().getScheduler(); const blocking_scheduler = scheduler.getRuntime().blocking_scheduler; if (scheduler != blocking_scheduler) { suspend { var task = Task.init(@frame()); blocking_scheduler.schedule(Batch.from(&task)); } } defer if (scheduler != blocking_scheduler) { suspend { var task = Task.init(@frame()); scheduler.schedule(Batch.from(&task)); } }; return @call(.{}, asyncFn, args); } /////////////////////////////////////////////////////////////////////// // Customizable Runtime API /////////////////////////////////////////////////////////////////////// pub const Task = struct { next: ?*Task = undefined, runnable: usize, pub fn init(frame: anyframe) Task { if (@alignOf(anyframe) < 2) @compileError("anyframe does not meet the minimum alignment requirement"); return Task{ .runnable = @ptrToInt(frame) }; } pub const Callback = fn(*Task, *Worker) callconv(.C) void; pub fn initCallback(callback: Callback) Task { if (@alignOf(Callback) < 2) @compileError("Callback does not meet the minimum alignment requirement"); return Task{ .runnable = @ptrToInt(callback) | 1 }; } pub fn execute(self: *Task, worker: *Worker) void { @setRuntimeSafety(false); const runnable = self.runnable; if (runnable & 1 != 0) { const callback = @intToPtr(Callback, runnable & ~@as(usize, 1)); return (callback)(self, worker); } const frame = @intToPtr(anyframe, runnable); resume frame; } }; pub const Batch = struct { head: ?*Task = null, tail: *Task = undefined, pub fn from(entity: anytype) Batch { if (@TypeOf(entity) == Batch) return entity; if (@TypeOf(entity) == *Task) { entity.next = null; return Batch{ .head = entity, .tail = entity, }; } if (@TypeOf(entity) == ?*Task) { const task: *Task = entity orelse return Batch{}; return Batch.from(task); } return @compileError(@typeName(@TypeOf(entity)) ++ " cannot be converted into a " ++ @typeName(Batch)); } pub fn isEmpty(self: Batch) bool { return self.head == null; } pub fn push(self: *Batch, entity: anytype) void { return self.pushBack(entity); } pub fn pushBack(self: *Batch, entity: anytype) void { const other = Batch.from(entity); if (self.isEmpty()) { self.* = other; } else { self.tail.next = other.head; self.tail = other.tail; } } pub fn pushFront(self: *Batch, entity: anytype) void { const other = Batch.from(entity); if (self.isEmpty()) { self.* = other; } else { other.tail.next = self.head; self.head = other.head; } } pub fn pop(self: *Batch) ?*Task { return self.popFront(); } pub fn popFront(self: *Batch) ?*Task { const task = self.head orelse return null; self.head = task.next; return task; } }; pub const Worker = struct { idle_node: IdleQueue.Node = IdleQueue.Node{}, active_node: ActiveQueue.Node = ActiveQueue.Node{}, run_queue: BoundedQueue = BoundedQueue{}, run_queue_next: ?*Task = null, run_queue_lifo: ?*Task = null, run_queue_overflow: UnboundedQueue = undefined, scheduler: *Scheduler, thread: ?*OsThread = undefined, futex: OsFutex, threadlocal var tls_current: ?*Worker = null; fn run(scheduler: *Scheduler) void { // Allocate the worker on the OS Thread's stack var self: Worker = undefined; self.* = Worker{ .scheduler = scheduler }; self.thread = OsThread.getSpawned(); self.run_queue_overflow.init(); self.futex.init(); defer self.futex.deinit(); // register the thread onto the Scheduler scheduler.active_queue.push(&self.active_node); // Set the TLS worker pointer while restoring it on exit to allow for nested Worker.run() calls. const old_tls_current = tls_current; tls_current = &self; defer tls_current = old_tls_current; var is_resuming = true; var run_queue_tick = @ptrToInt(self) ^ @ptrToInt(scheduler); var worker_iter = scheduler.getWorkers(); while (true) { // Search for any runnable tasks in the scheduler if (self.poll(scheduler, run_queue_tick, &worker_iter)) |task| { // If we find a task while resuming, we try to resume another worker. // This results in a handoff-esque thread wakup mechanism instead of thundering-herd waking scenarios. if (is_resuming) { is_resuming = false; _ = scheduler.tryResumeWorker(true); } task.execute(self); run_queue_tick +%= 1; continue; } // No tasks were found in the scheduler, try to put this worker/thread to sleep is_resuming = switch (scheduler.suspendWorker(&self, is_resuming)) { .retry => false, .resumed => true, .shutdown => break, }; } } /// Gets a refereence to the currently running Worker, panicking if called outside of a Worker thread. /// This exists primarily due to the inability for async frames to take resume parameters (for the *Worker). pub fn getCurrent() *Worker { return tls_current orelse { std.debug.panic("Worker.getCurrent() called outside of the runtime", .{}) }; } /// Gets a reference to the Scheduler which this worker is apart of. pub fn getScheduler(self: *Worker) *Scheduler { return self.scheduler; } pub const ScheduleHints = struct { use_next: bool = false, use_lifo: bool = false, }; /// Mark a batch of tasks as runnable which will eventually be executed on some Worker in the Scheduler. pub fn schedule(self: *Worker, entity: anytype, hints: ScheduleHints) void { var batch = Batch.from(entity); if (batch.isEmpty()) { return; } // Use the "next" slot when available, pushing the old entry out. // This exits earlier if theres nothing else to schedule as // a new "next" task shouldn't do resumeWorker() since other workers cant even steal it. if (hints.use_next) { const old_next = self.run_queue_next; self.run_queue_next = batch.popFront(); if (old_next) |next| { batch.pushFront(next); } if (batch.isEmpty()) { return; } } // Use the "LIFO" slot when available as well, pushing the old entry out too. if (hints.use_lifo) { if (@atomicRmw(?*Task, &self.run_queue_lifo, .Xchg, batch.popFront(), .AcqRel)) |old_lifo| { batch.pushFront(old_lifo); } } // Push any remaining tasks to the local run queue, which overflows into the overflow queue when full. if (!batch.isEmpty()) { if (self.run_queue.push(batch)) |overflowed| { self.run_queue_overflow.push(overflowed); } } // Finally, try to wake up a worker to handle these newly enqueued tasks const scheduler = self.getScheduler(); _ = scheduler.tryResumeWorker(false); } /// Tries to find a runnable task in the system/scheduler the worker is apart of and dequeues it from it's run queue. fn poll(self: *Worker, scheduler: *Scheduler, run_queue_tick: usize, workers: *Scheduler.WorkerIter) ?*Task { // TODO: if single_threaded, poll for io and timer resources here // every once in a while, check the scheduler's run queue for eventual fairness if (run_queue_tick % 61 == 0) { if (self.run_queue.popAndStealUnbounded(&scheduler.run_queue)) |task| { return task; } } // every once in a while (more frequency), check our Worker's overflow task queue for eventual fairness if (run_queue_tick % 31 == 0) { if (self.run_queue.popAndStealUnbounded(&self.run_queue_overflow)) |task| { return task; } } // first check our "next" slot as it acts like an un-stealable LIFO slot if (self.run_queue_next) |next_task| { const task = next_task; self.run_queue_next = null; return task; } // next, check our "LIFO" slot as its used to gain priority over other tasks but is also work-stealable. if (@atomicLoad(?*Task, &self.run_queue_lifo, .Monotonic) != null) { if (@atomicRmw(?*Task, &self.run_queue_lifo, .Xchg, null, .Acquire)) |lifo_task| { return lifo_task; } } // our local run queue serves as the primary place we go to look for tasks. if (self.run_queue.pop()) |task| { return task; } // If our local run queue is empty, check our local overflow queue instead. // All stealing operations have the ability to populate our local run queue for next time. if (self.run_queue.popAndStealUnbounded(&self.run_queue_overflow)) |task| { return task; } // If we have no tasks locally at all, check the global/scheduler run queue for tasks. if (self.run_queue.popAndStealUnbounded(&scheduler.run_queue)) |task| { return task; } // No tasks were found locally and globally/on-the-scheduler. // We now need to resort to work-stealing. // // Find out how many workers there are active in the scheduler. var running_workers = blk: { const count = @atomicLoad(u32, &scheduler.counter, .Monotonic); const counter = Scheduler.Counter.unpack(count); break :blk counter.spawned; }; // Iterate through the running workers in the scheduler to try and steal tasks. while (running_workers > 0) : (running_workers -= 1) { const target_worker = workers.next() orelse blk: { workers.* = scheduler.getWorkers(); break :blk workers.next() orelse std.debug.panic("No workers found when work-stealing"); }; // No point in stealing tasks from ourselves if (target_worker == self) { continue; } // Try to steal tasks directly from the target's local run queue to our local run queue if (self.run_queue.popAndStealBounded(&target_worker.run_queue)) |task| { return task; } // If that fails, look for tasks in the target's overflow queue if (self.run_queue.popAndStealUnbounded(&target_worker.run_queue_overflow)) |task| { return task; } // If even that fails, then as a really last resort, try to steal the target's LIFO task if (@atomicLoad(?*Task, &target_worker.run_queue_lifo, .Monotonic) != null) { if (@atomicRmw(?*Task, &target_worker.run_queue_lifo, .Xchg, null, .Acquire)) |lifo_task| { return lifo_task; } } } // Despite all our searching, no work/tasks seems to be available in the system/scheduler. return null; } }; pub const Scheduler = struct { run_queue: UnboundedQueue, idle_queue: IdleQueue = IdleQueue{}, active_queue: ActiveQueue = ActiveQueue{}, counter: u32 = (Counter{}).pack(), max_workers: u16, main_worker: ?*Worker = null, is_runtime: bool = false, const Counter = struct { idle: u16 = 0, spawned: u16 = 0, state: State = .pending, const State = enum(u4) { pending = 0, resuming, resumer_notified, suspend_notified, shutdown, }; fn pack(self: Counter) u32 { var value: u32 = 0; value |= @as(u32, @enumToInt(self.state)); value |= @as(u32, @intCast(u14, self.idle)) << 4; value |= @as(u32, @intCast(u14, self.spawned)) << (4 + 14); return value; } fn unpack(value: u32) Counter { var self: Counter = undefined; self.state = @intToEnum(State, @truncate(u4, value)); self.idle = @truncate(u14, value >> 4); self.spawned = @truncate(u14, value >> (4 + 14)); return self; } }; pub fn init(self: *Scheduler, max_workers: u16, stack_size: u16, is_runtime: bool) void { self.* = Scheduler{ .max_workers = max_workers }; self.run_queue.init(); self.is_runtime = is_runtime; } pub fn deinit(self: *Scheduler) void { self.* = undefined; } /// Get a reference to the RuntimeScheduler if is this a runtime Scheduler.. pub fn getRuntimeScheduler(self: *Scheduler) *RuntimeScheduler { if (self.is_runtime) { return @fieldParentPtr(RuntimeScheduler, "scheduler", self); } else { std.debug.panic("Scheduler.getRuntimeScheduler() when not a runtime-created scheduler", .{}); } } /// Get an iterator which can be used to discover all worker's reachable from the Scheduler at the time of calling. pub fn getWorkers(self: *Scheduler) WorkerIter { return WorkerIter{ .iter = self.active_queue.iter() }; } pub const WorkerIter = struct { iter: ActiveQueue.Iter, pub fn next(self: *WorkerIter) ?*Worker { const node = self.iter.next() orelse return null; return @fieldParentPtr(Worker, "active_node", node); } }; /// Enqueue a batch of tasks into the scheduler and try to resume a worker in order to handle them. pub fn schedule(self: *Scheduler, entity: anytype) void { return self.scheduleBatch(Batch.from(entity)); } fn scheduleBatch(self: *Scheduler, batch: Batch) void { if (batch.isEmpty()) { return; } self.run_queue.push(batch); _ = self.tryResumeWorker(false); } /// Mark the scheduler as shutdown pub fn shutdown(self: *Scheduler) void { // Dont allow external calls to the blocking scheduler of a Runtime to shut it down, thats the runtime's job if (self.is_runtime and self.getRuntimeScheduler().is_blocking) { return; } self.shutdownWorkers(); } /// Try to wake up or start a Worker thread in order to poll for tasks. fn tryResumeWorker(self: *Scheduler, is_caller_resuming: bool) bool { // We only need to load the max-worker value once as it never changes. const max_workers = self.max_workers; // Bound the amount of times we retry resuming a worker to prevent live-locks when scheduling is busy. var remaining_attempts: u8 = 3; var is_resuming = is_caller_resuming; var counter = Counter.unpack(@atomicLoad(u32, &self.counter, .Monotonic)); while (true) { if (counter.state == .shutdown) { return false; } // Try to resume a pending worker if theres pending workers in the idle queue or if theres unspawned workers. const has_resumables = (counter.idle > 0 or counter.spawned < max_workers); // In addition, it should only attempt the resume if: // - it was the one who set the state to .resumed (is_resuming) and it hasn't failed to resume too many times // - its a normal caller who wishes to resume a worker and sees that there isn't currently a resume/notification in progress. if (has_resumables and ( (is_resuming and remaining_attempts > 0) or (!is_resuming and counter.state == .pending) )) { var new_counter = counter; new_counter.state = .resuming; if (counter.idle > 0) { new_counter.idle -= 1; } else { new_counter.spawned += 1; } if (@cmpxchgWeak( u32, &self.counter, counter.pack(), new_counter.pack(), .Monotonic, .Monotonic, )) |updated| { counter = Counter.unpack(updated); continue; } else { is_resuming = true; } // Notify an idle worker if there is one if (counter.idle > 0) { switch (self.idle_queue.notify()) { .notified, .shutdown => return, .resumed => |idle_node| { const worker = @fieldParentPtr(Worker, "idle_node", idle_node); worker.futex.wake(); return true; }, }; } // If this is the first worker thread, use the caller's Thread (the main thread is also a Worker) if (is_single_threaded or counter.spawned == 0) { Worker.run(self); return true; } // Try to spawn an OS thread for the resuming worker if (OsThread.spawn(.{}, Worker.run, .{self})) |_| { return true; } else |spawn_err| {} // We failed to resume a worker after setting the counter state to .resume, loop back to handle this. spinLoopHint(); remaining_attempts -= 1; counter = Counter.unpack(@atomicLoad(u32, &self.counter, .Monotonic)); continue; } // We werent able to resume a possible pending worker. // Try to update the state to either leave a notification that we tried to resume or unset the .resuming state if we failed to. // Returns if theres already a notification of some kind, as then theres nothing left to do. var new_state: Counter.State = undefined; if (is_resuming and has_resumables) { new_state = .pending; } else if (is_resuming or counter.state == .pending) { new_state = .suspend_notified; } else if (counter.state == .resuming) { new_state = .resumer_notified; } else { return false; } var new_counter = counter; new_counter.state = new_state; if (@cmpxchgWeak( u32, &self.counter, counter.pack(), new_counter.pack(), .Monotonic, .Monotonic, )) |updated| { counter = Counter.unpack(updated); continue; } return true; } } const Suspend = enum { retry, resumed, shutdown, }; const SuspendCondition = struct { result: ?Suspend, scheduler: *Scheduler, worker: *Worker, is_resuming: bool, is_main_worker: bool, fn poll(condition: *Condition) bool { const self = condition.scheduler; const worker = condition.worker; const max_workers = self.max_workers; const is_resuming = condition.is_resuming; var counter = Counter.unpack(@atomicLoad(u32, &self.counter, .Monotonic)); while (true) { const has_resumables = counter.idle > 0 or counter.spawned < max_workers; const is_shutdown = counter.state == .shutdown; const is_notified = switch (counter.state) { .resumer_notified => is_resuming, .suspend_notified => true, else => false, }; // If we're about to suspend and someone left a notification for us in tryResumeWorker(), then consume it and don't suspend. // This also deregisters ourselves from the counter if we're shutting down which is used to synchronize the scheduler joining all threads. var new_counter = counter; if (is_shutdown) { new_counter.spawned -= 1; } else if (is_notified) { new_counter.state = if (is_resuming) .resuming else .pending; } else { new_counter.state = if (has_resumables) .pending else .suspend_notified; new_counter.idle += 1; } // Set the main worker on the scheduler before updating the counter. // After the update, and if we're the last to shutdown, we may end up reading it. if (condition.is_main_worker) { scheduler.main_worker = worker; } // Acquire barrier to make sure any main_worker reads aren't reordered before we mark ourselves as shutdown as it may not exist yet. // Release barrier to make sure the main_worker exists for the last worker to mark itself as shutdown below. if (@cmpxchgWeak( u32, &self.counter, counter.pack(), new_counter.pack(), .AcqRel, .Monotonic, )) |updated| { counter = Counter.unpack(updated); continue; } if (is_notified and is_resuming) { condition.result = Suspend.resumed; } else if (is_notified) { condition.result = Suspend.retry; } else if (is_shutdown) { condition.result = Suspend.shutdown; } else { condition.result = null; } // If we're the last worker to mark ourselves as shutdown, then notify the main_worker to clean everyone up. // If we *are* the main_worker, then we just dont suspend by returning true for the wait condition. if (is_shutdown and counter.spawned == 0) { if (scheduler.main_worker) |main_worker| { if (worker == main_worker) { return true; } else { main_worker.futex.wake(); } } else { std.debug.panic("Scheduler shutting down without a main worker", .{}); } } return is_notified; } } }; fn suspendWorker(self: *Scheduler, worker: *Worker, is_caller_resuming: bool) Suspend { // The main worker is the one without a thread (e.g. the one running on the main thread) const is_main_worker = worker.thread == null; var condition = SuspendCondition{ .result = undefined, .scheduler = self, .worker = worker, .is_resuming = is_caller_resuming, .is_main_worker = is_main_worker, }; // Wait on the worker's futex using the Suspend condition worker.futex.wait(&condition); // Get the result of the suspend condition or, if the Thread was woken up, assume its now resuming. const result = condition.result orelse return .resumed; // If the main worker was resumed for a shutdown, then it has to wake up everyone else and join/free their OS thread. if (result == .shutdown and is_main_worker) { var workers = self.getWorkers(); while (workers.next()) |idle_worker| { const thread = idle_worker.thread orelse continue; idle_worker.futex.wake(); thread.join(); } } return result; } /// Mark the scheduler as shutdown, waking any pending workers in the process fn shutdownWorkers(self: *Scheduler) void { var counter = Counter.unpack(@atomicLoad(u32, &self.counter, .Monotonic)); while (true) { // if the Scheduler is already shutdown then theres nothing to be done if (counter.state == .shutdown) { return; } // Transition the scheduler into a shutdown state, stopping future Workers from being woken up and eventually stopping the Scheduler. // Acquire barrier to make sure any shutdown writes below don't get reordered before we mark the counter as shutdown. var new_counter = counter; new_counter.state = .shutdown; if (@cmpxchgWeak( u32, &self.counter, counter.pack(), new_counter.pack(), .Acquire, .Monotonic, )) |updated| { counter = Counter.pack(updated); continue; } // We marked the counter as shutdown, so no more workers will be doing into the idle_queue. // Now we wake up every worker in the idle_queue so they can observe the shutdown and stop/join on the Scheduler. var idle_nodes = self.idle_queue.shutdown(); while (idle_nodes.next()) |idle_node| { const idle_worker = @fieldParentPtr(Worker, "idle_node", idle_node); idle_worker.futex.wake(); } return; } } }; /////////////////////////////////////////////////////////////////////// // Internal Runtime API /////////////////////////////////////////////////////////////////////// /// An unbounded, Multi-Producer-Single-Consumer (MPSC) queue of Tasks. /// This is based on <NAME> Intrusive MPSC with a lock-free guard: /// http://www.1024cores.net/home/lock-free-algorithms/queues/intrusive-mpsc-node-based-queue const UnboundedQueue = struct { has_consumer: bool, head: *Task, tail: *Task, stub: Task, /// Initialize the UnboundedQueue, using the self-referential stub Task as a starting point. fn init(self: *UnboundedQueue) void { self.has_consumer = false; self.head = &self.stub; self.tail = &self.stub; self.stub.next = null; } /// Returns true if the UnboundedQueue is observed to be pseudo-empty fn isEmpty(self: *const UnboundedQueue) bool { const tail = @atomicLoad(*Task, &self.tail, .Monotonic); return tail == &self.stub; } /// Pushes a batch of tasks to the UnboundedQueue in a wait-free manner. fn push(self: *UnboundedQueue, entity: anytype) void { const batch = Batch.from(entity); if (batch.isEmpty()) { return; } // Push our end of the batch to the end of the queue. // Acquire barrier as we will be dereferencing the previous tail. // Release barrier to publish the batch's task writes to other threads. batch.tail.next = null; const prev = @atomicRmw(*Task, &self.tail, .Xchg, batch.tail, .AcqRel); // (*) Before this store, the queue is in an inconsistent state. // It has a new tail, but it and the batch's tasks aren't reachable from the head of the queue yet. // This means that the consumer could incorrectly see an empty queue during this time. // // This is OK as when we push to UnboundedQueue's, we generally wake up another thread to pop from it. // Meaning that even if the consumer seems an incorrectly empty queue, it will be waken up again to see the tasks in full eventually. // Release barrier to ensure the batch writes above are visible on the consumer's side when loading the .next with Acquire. // This also fixes the queue from the inconsistent state so that the consumer has access to the batch of tasks we just pushed. @atomicStore(?*Task, &prev.next, batch.head, .Release); } /// Try to acquire ownership of the consumer-side of the queue in order to dequeue tasks. fn tryAcquireConsumer(self: *UnboundedQueue) ?Consumer { // No point in consuming anything if theres nothing to consume if (self.isEmpty()) { return null; } // Do a preemptive check to see if theres already a consumer to avoid the synchronization cost below. if (@atomicLoad(bool, &self.has_consumer, .Monotonic)) { return null; } // Try to grab the ownership rights of the consuming side of the queue. // Acquire barrier to ensure we read correct `self.head` updated from the previous consumer. if (@atomicRmw(bool, &self.has_consumer, .Xchg, true, .Acquire)) { return null; } return Consumer{ .queue = self, .head = self.head, .stub = &self.stub, }; } /// An instance of ownership on the consuming side of the UnboundedQueue. /// Given the queue is Single-Consumer, only one thread can be dequeueing tasks from it at a time. const Consumer = struct { queue: *UnboundedQueue, head: *Task, stub: *Task, /// Release ownership of the consuming side of the UnboundedQueue so other threads can start consuming. fn release(self: Consumer) void { self.queue.head = self.head; // Release barrier to ensure the next consumer reads our valid update to self.queue.head. @atomicStore(bool, &self.queue.has_consumer, false, .Release); } fn pop(self: *Consumer) ?*Task { var head = self.head; var next = @atomicLoad(?*Task, &head.next, .Acquire); // Try to skip the stub node if its at the head of our queue snapshot if (head == self.stub) { head = next orelse return null; self.head = head; next = @atomicLoad(?*Task, &head.next, .Acquire); } // If theres another node, then we can dequeue the old head. if (next) |new_head| { self.head = new_head; return head; } // Theres no node next after the head meaning the queue might be in an inconsistent state. const tail = @atomicLoad(*Task, &self.queue.tail, .Acquire); if (head != tail) { return null; } // The queue is not in an inconsistent state and our head node is still valid // In order to dequeue it, we must push back the stub node so that there will always be a tail if we do. self.queue.push(self.stub); // Try and dequeue the head node as mentioned above. next = @atomicLoad(?*Task, &head.next, .Acquire); if (next) |new_head| { self.head = new_head; return head; } return null; } }; }; /// A bounded, Single-Producer-Multi-Consumer (SPMC) queue of tasks which supports batch push/pop operations. const BoundedQueue = extern struct { head: usize = 0, tail: usize = 0, buffer: [capacity]*Task = undefined, const capacity = 256; /// Tries to enqueue a Batch entity to this BoundedQueue, returning a batch of tasks that overflowed in the process (amortized). fn push(self: *BoundedQueue, entity: anytype) ?Batch { var batch = Batch.from(entity); var tail = self.tail; var head = @atomicLoad(usize, &self.head, .Monotonic); while (true) { if (batch.isEmpty()) { return null; } var remaining = capacity - (tail -% head); if (remaining > 0) { // Unordered store to buffer to avoid UB as stealer threads could be racy-reading in parallel while (remainig > 0) : (remaining -= 1) { const task = batch.pop() orelse break; @atomicStore(*Task, &self.buffer[tail % capacity], task, .Unordered); tail +%= 1; } // Release barrier to ensure stealer threads see valid task writes when loading from the tail w/ Acquire. @atomicStore(usize, &self.tail, tail, .Release); // Retry to push tasks as theres a possibility stealer threads could have dequeued & made more room in the buffer. spinLoopHint(); head = @atomicLoad(usize, &self.head, .Monotonic); continue; } // The buffer is full, try to move half of the tasks out to allow the fast-path pushing above next times. // Acquire barrier on success to ensure that the writes we do to the migrated tasks don't get reordered before we commit the migrate. const new_head = head +% (capacity / 2); if (@cmpxchgWeak( usize, &self.head, head, new_head, .Acquire, .Monotonic, )) |updated| { head = updated; continue; } // Create a batch of the tasks we migrated ... var overflowed = Batch{}; while (head != new_head) : (head +% 1) { const task = self.buffer[head % capacity]; overflowed.push(task); } // ... and move them all to the front of the batch, returning everything remaining as overflowed. overflowed.pushBack(batch); return overflowed; } } /// Tries to dequeue a single task from the BoundedQueue, competing with other stealer threads. fn pop(self: *BoundedQueue) ?*Task { var tail = self.tail; var head = @atomicLoad(usize, &self.head, .Monotonic); while (true) { if (tail == head) { return null; } // Acquire barrier on successful pop to prevent any writes we do to the stolen tasks from being reordered before the pop. head = @cmpxchgWeak( usize, &self.head, head, head +% 1, .Acquire, .Monotonic, ) orelse return self.buffer[head % capacity]; } } /// Dequeues a batch of tasks from the target BoundedQueue into our BoundedQueue (work-stealing). fn popAndStealBounded(self: *BoundedQueue, target: *BoundedQueue) ?*Task { // Stealing from ourselves just checks our own buffer if (target == self) { return self.pop(); } // If our own queue isn't empty, we shouldn't be stealing from others const tail = self.tail; const head = @atomicLoad(usize, &self.head, .Monotonic); if (tail != head) { return self.pop(); } // Acquire barrier on the target.tail load to observe Released writes it's target.buffer tasks. 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; // Try to steal half of the target's buffer tasks to amortize the cost of stealing var steal = target_size - (target_size / 2); if (steal == 0) { return null; } // Reload the head & tail if they become un-sync'd as they're observed separetely if (steal > capacity / 2) { spinLoopHint(); target_head = @atomicLoad(usize, &target.head, .Monotonic); continue; } // We will be returning the first stolen task (hence "popAndSteal") const first_task = @atomicLoad(*Task, &target.buffer[target_head % capacity], .Unordered); var new_target_head = target_head +% 1; var new_tail = tail; steal -= 1; // Racy-copy the targets tasks from their buffer into ours. // Unordered load on targets buffer to avoid UB as it could be writing to it in push(). // Unordered store on our buffer to avoid UB as other threads could be racy-reading from ours as above. while (steal > 0) : (steal -= 1) { const task = @atomicLoad(*Task, &target.buffer[new_target_head % capacity], .Unordered); new_target_head +%= 1; @atomicStore(*Task, &self.buffer[new_tail % capacity], task, .Unordered); new_tail +%= 1; } // Try to mark the tasks we racy-copied into our buffer from the target's as "stolen". // Release on success to ensure that the copies above don't get reordering after the commit of the steal. if (@cmpxchgWeak( usize, &target.head, target_head, new_target_head, .Release, .Monotonic, )) |updated| { target_head = updated; continue; } // If we added any tasks to our local buffer, update our tail to mark then as push()'d. // Release barrier to ensure stealer threads see valid task writes when loading from the tail w/ Acquire (above) if (new_tail != tail) { @atomicStore(usize, &self.tail, new_tail, .Release); } return first_task; } } /// Dequeues a batch of tasks from the target UnboundedQueue into our BoundedQueue. fn popAndStealUnbounded(self: *BoundedQueue, target: *UnboundedQueue) ?*Task { // Try to acquire ownership of the consuming side of the UnboundedQueue in order to pop tasks from it var consumer = target.tryAcquireConsumer() orelse return null; defer consumer.release(); // Will be returning the first task (hence "popAndSteal") const first_task = consumer.pop(); // Return whatever was popped if our local buffer is full const tail = self.tail; const head = @atomicLoad(usize, &self.head, .Monotonic); if (tail == head) { return first_task; } // Try to push tasks into our local buffer using the consumer side of the UnboundedQueue. // Unordered stores on our buffer to avoid UB as other threads could be racy-reading from it (see "popAndStealBounded"). var new_tail = tail; var remaining = capacity - (tail -% head); while (remaining > 0) : (remaining -= 1) { const task = consumer.pop() orelse break; @atomicStore(*Task, &self.buffer[new_tail % capacity], task, .Unordered); new_tail +%= 1; } // If we added any tasks to our local buffer, update our tail to mark then as push()'d. // Release barrier to ensure stealer threads see valid task writes when loading from the tail w/ Acquire (above) if (new_tail != tail) { @atomicStore(usize, &self.tail, new_tail, .Release); } return first_task; } }; const ActiveQueue = struct { head: ?*Node = null, const Node = struct { next: ?*Node = null, }; const Iter = struct { node: ?*Node, fn next(self: *Iter) ?*Node { const node = self.node; self.node = node.next; return node; } }; fn push(self: *ActiveQueue, node: *Node) void { var head = @atomicLoad(?*Node, &self.head, .Monotonic); while (true) { node.next = head; head = @cmpxchgWeak( ?*Node, &self.head, head, node, .Release, .Monotonic, ) orelse break; } } fn iter(self: *ActiveQueue) Iter { const node = @atomicLoad(?*Node, &self.head, .Acquire); return Iter{ .node = node }; } }; const IdleQueue = struct { state: usize = EMPTY, const EMPTY: usize = 0; const NOTIFIED: usize = 1; const SHUTDOWN: usize = 2; const WAITING: usize = ~(EMPTY | NOTIFIED | SHUTDOWN); const Node = struct { next: ?*Node align(~WAITING + 1) = null, }; const Wait = union(enum) { suspended: *Node, notified: void, shutdown: void, }; fn wait(self: *IdleQueue, node: *Node) Wait { var state = @atomicLoad(usize, &self.state, .Monotonic); while (true) { if (state == SHUTDOWN) { return .shutdown; } if (state == NOTIFIED) { state = @cmpxchgWeak( usize, &self.state, state, EMPTY, .Monotonic, .Monotonic, ) orelse return .notified; continue; } node.next = blk: { @setRuntimeSafety(false); break :blk @intToPtr(?*Node, state & WAITING); }; state = @cmpxchgWeak( usize &self.state, state, @ptrToInt(node), .Release, .Monotonic, ) orelse return .{ .waiting = node }; } } const Notify = union(enum) { resumed: *Node, notified: void, shutdown: void, }; fn notify(self: *IdleQueue) Notify { var state = @atomicLoad(usize, &self.state, .Acquire); while (true) { if (state == SHUTDOWN) { return .shutdown; } if (state == EMPTY) { state = @cmpxchgWeak( usize, &self.state, state, NOTIFIED, .Acquire, .Acquire, ) orelse return .notified; continue; } const node = blk: { @setRuntimeSafety(false); break :blk @intToPtr(?*Node, state & WAITING); }; state = @cmpxchgWeak( usize &self.state, state, @ptrToInt(node.next), .Acquire, .Acquire, ) orelse return .{ .resumed = node }; } } const Iter = struct { node: ?*Node, fn next(self: *Iter) ?*Node { const node = self.node; self.node = node.next; return node; } }; fn shutdown(self: *IdleQueue) Iter { const state = @atomicRmw(usize, &self.state, .Xchg, SHUTDOWN, .Acquire); const node = switch (state) { NOTIFIED => null, SHUTDOWN => std.debug.panic("IdleQueue shutdown multiple times", .{}), else => blk: { @setRuntimeSafety(false); break :blk @intToPtr(?*Node, state & WAITING); }, }; return Iter{ .node = node }; } }; /////////////////////////////////////////////////////////////////////// // Platform Runtime API /////////////////////////////////////////////////////////////////////// fn spinLoopHint() void { std.SpinLock.loopHint(); } const OsFutex = struct { event: std.ResetEvent, fn init(self: *OsFutex) void { self.event = std.ResetEvent.init(); } fn deinit(self: *OsFutex) void { self.event.deinit(); } fn wait(self: *OsFutex, condition: anytype) void { self.event.reset(); if (condition.poll()) { return; } self.event.wait(); } fn wake(self: *OsFutex) void { self.event.set(); } }; const OsThread = struct { inner: std.Thread, threadlocal var tls_spawned: ?*OsThread = null; fn getSpawned() ?*OsThread { return tls_spawned; } const Affinity = struct { from_cpu: u16, to_cpu: u16, }; const SpawnHints = struct { stack_size: ?usize = null, affinity: ?Affinity = null, }; fn spawn(hints: SpawnHints, comptime entryFn: anytype, args: anytype) !*OsThread { const Args = @TypeOf(args); const Spawner = struct { fn_args: Args, inner: *std.Thread = undefined, inner_event: std.AutoResetEvent = std.AutoResetEvent{}, spawn_event: std.AutoResetEvent = std.AutoResetEvent{}, fn run(self: *Spawner) ReturnTypeOf(entryFn) { self.inner_event.wait(); const fn_args = self.fn_args; const inner = self.inner; self.spawn_event.set(); tls_spawned = @fieldParentPtr(OsThread, "inner", inner); return @call(.{}, entryFn, fn_args); } }; var spawner = Spawner{ .fn_args = args }; spawner.inner = try std.Thread.spawn(&spawner, Spawner.run); spawner.inner_event.set(); spawner.spawn_event.wait(); return @fieldParentPtr(OsThread, "inner", spawner.inner); } fn join(self: *OsThread) void { self.inner.wait(); } };
src/runtime.zig
const std = @import("std"); const os = std.os; const io = std.io; pub const PassphraseTooLong = error.PassphraseTooLong; pub const NoPassphraseGiven = error.NoPassphraseGiven; // *nix only // OpenBSD has readpassphrase in libc. // This is pretty much musl's getpass implementation. pub fn getpass(prompt: []const u8, password: []u8) ![]u8 { errdefer std.crypto.utils.secureZero(u8, password); if (@hasDecl(os.system, "termios")) { if (os.open("/dev/tty", os.O.RDWR | os.O.NOCTTY, 0)) |fd| { defer os.close(fd); const orig = try os.tcgetattr(fd); var no_echo = orig; // local (terminal) flags: don't echo, don't generate signals, canonical mode // canonical mode basically means that the terminal does line editing and only // sends complete lines. no_echo.lflag &= ~(os.system.ECHO | os.system.ISIG); no_echo.lflag |= os.system.ICANON; // input flags: newline handling - not entirely sure what's needed here and what isn't. no_echo.iflag &= ~(os.system.INLCR | os.system.IGNCR); no_echo.iflag |= os.system.ICRNL; try os.tcsetattr(fd, os.TCSA.FLUSH, no_echo); defer os.tcsetattr(fd, os.TCSA.FLUSH, orig) catch {}; //try os.tcdrain(fd); // block until the teletype port has caught up XXX: missing from std.os //try c.tcdrain(fd); _ = try os.write(fd, prompt); const read = try os.read(fd, password); _ = try os.write(fd, "\n"); if (read == password.len) return PassphraseTooLong; if (read < 2) return NoPassphraseGiven; return password[0 .. read - 1]; } else |_| {} } // no tty, print prompt to stderr and read passphrase from stdin const stderr = io.getStdErr(); const stdin = io.getStdIn(); try stderr.writeAll(prompt); if (stdin.reader().readUntilDelimiterOrEof(password, '\n')) |maybe_input| { const input = maybe_input orelse return NoPassphraseGiven; if (input.len == password.len) return PassphraseTooLong; if (input.len == 0) return NoPassphraseGiven; return input; } else |readerr| switch (readerr) { error.StreamTooLong => return PassphraseTooLong, else => return readerr, } }
getpass.zig
const std = @import("std"); // we ignore whitespace and comments pub const Token = union(enum) { comment, section: []const u8, key: []const u8, value: []const u8 }; pub const State = enum { normal, section, key, value, comment }; pub fn getTok(data: []const u8, pos: *usize, state: *State) ?Token { // if the position advances to the end of the data, there's no more tokens for us if (pos.* >= data.len) return null; var cur: u8 = 0; // used for slicing var start = pos.*; var end = start; while (cur != '\n') { cur = data[ pos.* ]; pos.* += 1; switch (state.*) { .normal => { switch (cur) { '[' => { state.* = .section; start = pos.*; end = start; }, '=' => { state.* = .value; start = pos.*; if (std.ascii.isSpace(data[start])) start += 1; end = start; }, ';' => { state.* = .comment; }, // if it is whitespace itgets skipped over anyways else => if (!std.ascii.isSpace(cur)) { state.* = .key; start = pos.* - 1; end = start; } } }, .section => { end += 1; switch (cur) { ']' => { state.* = .normal; pos.* += 1; return Token { .section = data[start..end - 1] }; }, else => {} } }, .value => { switch (cur) { ';' => { state.* = .comment; return Token { .value = data[start..end - 2] }; }, else => { end += 1; switch (cur) { '\n' => { state.* = .normal; return Token { .value = data[start..end - 2] }; }, else => {} } } } }, .comment => { end += 1; switch (cur) { '\n' => { state.* = .normal; return Token.comment; }, else => {} } }, .key => { end += 1; if (!(std.ascii.isAlNum(cur) or cur == '_')) { state.* = .normal; return Token { .key = data[start..end] }; } } } } return null; } pub fn readToStruct(comptime T: type, data: []const u8) !T { var namespace: []const u8 = ""; var pos: usize = 0; var state: State = .normal; var ret = std.mem.zeroes(T); while (getTok(data, &pos, &state)) |tok| { switch (tok) { .comment => {}, .section => |ns| { namespace = ns; }, .key => |key| { var next_tok = getTok(data, &pos, &state); // if there's nothing just give a comment which is also a syntax error switch (next_tok orelse .comment) { .value => |value| { // now we have the namespace, key, and value // namespace and key are runtime values, so we need to loop the struct instead of using @field inline for(std.meta.fields(T)) |ns_info| { if (std.mem.eql(u8, ns_info.name, namespace)) { // @field(ret, ns_info.name) contains the inner struct now // loop over the fields of the inner struct, and check for key matches inline for(std.meta.fields(@TypeOf(@field(ret, ns_info.name)))) |key_info| { if (std.mem.eql(u8, key_info.name, key)) { // now we have a key match, give it the value const my_type = @TypeOf(@field(@field(ret, ns_info.name), key_info.name)); @field(@field(ret, ns_info.name), key_info.name) = try convert(my_type, value); } } } } }, // after a key, a value must follow else => return error.SyntaxError } }, // if we get a value with no key, that's a bit nonsense .value => return error.SyntaxError } } return ret; } // I'll add more later const truthyAndFalsy = std.ComptimeStringMap(bool, .{ .{ "true", true }, .{ "false", false }, .{ "1", true }, .{ "0", false } }); pub fn convert(comptime T: type, val: []const u8) !T { return switch (@typeInfo(T)) { .Int, .ComptimeInt => try std.fmt.parseInt(T, val, 0), .Float, .ComptimeFloat => try std.fmt.parseFloat(T, val), .Bool => truthyAndFalsy.get(val).?, else => @as(T, val) }; } pub fn writeStruct(struct_value: anytype, writer: anytype) !void { inline for (std.meta.fields(@TypeOf(struct_value))) |field| { try writer.print("[{s}]\n", .{field.name}); const pairs = @field(struct_value, field.name); inline for (std.meta.fields(@TypeOf(pairs))) |pair| { const key_value = @field(pairs, pair.name); const format = switch (@TypeOf(key_value)) { []const u8 => "{s}", else => "{}" }; try writer.print("{s} = " ++ format ++ "\n", .{pair.name, key_value}); } } }
ini.zig
const builtin = @import("builtin"); const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { if (builtin.mode != .Debug) { var input_ = try input.readFile("inputs/day19"); defer input_.deinit(); var scanners = try parseInput(&input_); const next_beacon_id = identifyBeacons(scanners.slice()); { const result = part1(next_beacon_id); try stdout.print("19a: {}\n", .{ result }); std.debug.assert(result == 303); } identifyScanners(scanners.slice()); { const result = try part2(scanners.constSlice()); try stdout.print("19b: {}\n", .{ result }); std.debug.assert(result == 9621); } } } const max_num_scanners = 25; const max_num_beacons_per_scanner = 26; const NumBeacons = u16; fn parseInput(input_: anytype) !std.BoundedArray(Scanner, max_num_scanners) { var scanners = std.BoundedArray(Scanner, max_num_scanners).init(0) catch unreachable; while (try Scanner.init(input_)) |scanner| { try scanners.append(scanner); } scanners.slice()[0].pos = .{ .p = 0, .q = 0, .r = 0 }; return scanners; } fn identifyBeacons(scanners: []Scanner) NumBeacons { var next_beacon_id: NumBeacons = 0; while (nextUnidentifiedBeacon(scanners)) |beacon1x| { const scanner1_i = beacon1x.scanner_i; const scanner1 = &scanners[scanner1_i]; const beacon1a_i = beacon1x.beacon_i; const beacon1a = beacon1x.beacon; const beacon1a_id = next_beacon_id; next_beacon_id += 1; beacon1a.id = beacon1a_id; for (scanner1.beacons.constSlice()) |beacon1b, beacon1b_i| { if (beacon1b_i == beacon1a_i) { continue; } if (beacon1b.id == null) { continue; } for (scanner1.beacons.constSlice()[(beacon1b_i + 1)..]) |beacon1c, beacon1c_i_| { const beacon1c_i = beacon1b_i + 1 + beacon1c_i_; if (beacon1c_i == beacon1a_i) { continue; } if (beacon1c.id == null) { continue; } const distances1 = .{ scanner1.distances[beacon1a_i][beacon1b_i], scanner1.distances[beacon1a_i][beacon1c_i], scanner1.distances[beacon1b_i][beacon1c_i], }; for (scanners[(scanner1_i + 1)..]) |*scanner2, scanner2_i_| { const scanner2_i = scanner1_i + 1 + scanner2_i_; for (scanner2.beacons.slice()) |*beacon2a, beacon2a_i| { for (scanner2.beacons.slice()[(beacon2a_i + 1)..]) |*beacon2b, beacon2b_i_| { const beacon2b_i = beacon2a_i + 1 + beacon2b_i_; for (scanner2.beacons.slice()[(beacon2b_i + 1)..]) |*beacon2c, beacon2c_i_| { const beacon2c_i = beacon2b_i + 1 + beacon2c_i_; if (beacon2a.id != null and beacon2b.id != null and beacon2c.id != null) { continue; } const distances2 = .{ scanner2.distances[beacon2a_i][beacon2b_i], scanner2.distances[beacon2a_i][beacon2c_i], scanner2.distances[beacon2b_i][beacon2c_i], }; const congruent_i: ?[3]usize = if (distances1[0] == distances2[0] and distances1[1] == distances2[1] and distances1[2] == distances2[2]) // 2a == 1a, 2b == 1b, 2c == 1c [_]usize { beacon1a_i, beacon1b_i, beacon1c_i } else if (distances1[0] == distances2[0] and distances1[1] == distances2[2] and distances1[2] == distances2[1]) // 2a == 1b, 2b == 1a, 2c == 1c [_]usize { beacon1b_i, beacon1a_i, beacon1c_i } else if (distances1[0] == distances2[1] and distances1[1] == distances2[0] and distances1[2] == distances2[2]) // 2a == 1a, 2b == 1c, 2c == 1b [_]usize { beacon1a_i, beacon1c_i, beacon1b_i } else if (distances1[0] == distances2[1] and distances1[1] == distances2[2] and distances1[2] == distances2[0]) // 2a == 1b, 2b == 1c, 2c == 1a [_]usize { beacon1b_i, beacon1c_i, beacon1a_i } else if (distances1[0] == distances2[2] and distances1[1] == distances2[0] and distances1[2] == distances2[1]) // 2a == 1c, 2b == 1a, 2c == 1b [_]usize { beacon1c_i, beacon1a_i, beacon1b_i } else if (distances1[0] == distances2[2] and distances1[1] == distances2[1] and distances1[2] == distances2[0]) // 2a == 1c, 2b == 1b, 2c == 1a [_]usize { beacon1c_i, beacon1b_i, beacon1a_i } else null; if (congruent_i) |congruent_i_| { const congruent: [3]Beacon = .{ scanner1.beacons.constSlice()[congruent_i_[0]], scanner1.beacons.constSlice()[congruent_i_[1]], scanner1.beacons.constSlice()[congruent_i_[2]], }; const congruent0_id = congruent[0].id.?; const congruent1_id = congruent[1].id.?; const congruent2_id = congruent[2].id.?; if (beacon2a.id) |beacon2a_id| { std.debug.assert(beacon2a_id == congruent0_id); } else { beacon2a.id = congruent0_id; } if (beacon2b.id) |beacon2b_id| { std.debug.assert(beacon2b_id == congruent1_id); } else { beacon2b.id = congruent1_id; } if (beacon2c.id) |beacon2c_id| { std.debug.assert(beacon2c_id == congruent2_id); } else { beacon2c.id = congruent2_id; } scanner1.known_congruents[scanner2_i] = KnownCongruent { .beacon1a_i = beacon2a_i, .beacon1b_i = beacon2b_i, .beacon1c_i = beacon2c_i, .beacon2a_i = congruent_i_[0], .beacon2b_i = congruent_i_[1], .beacon2c_i = congruent_i_[2], }; scanner2.known_congruents[scanner1_i] = KnownCongruent { .beacon1a_i = congruent_i_[0], .beacon1b_i = congruent_i_[1], .beacon1c_i = congruent_i_[2], .beacon2a_i = beacon2a_i, .beacon2b_i = beacon2b_i, .beacon2c_i = beacon2c_i, }; } } } } } } } } return next_beacon_id; } fn part1(next_beacon_id: NumBeacons) NumBeacons { return next_beacon_id; } fn identifyScanners(scanners: []Scanner) void { while (true) { var updated_one_scanner = false; for (scanners) |*scanner2| { if (scanner2.pos != null) { continue; } for (scanner2.known_congruents) |known_congruent_, scanner1_i| { if (known_congruent_) |known_congruent| { const scanner1 = scanners[scanner1_i]; if (scanner1.pos) |scanner1_pos| { const beacon1a = scanner1.beacons.constSlice()[known_congruent.beacon1a_i]; const beacon1b = scanner1.beacons.constSlice()[known_congruent.beacon1b_i]; const beacon1c = scanner1.beacons.constSlice()[known_congruent.beacon1c_i]; const beacon2a = &scanner2.beacons.slice()[known_congruent.beacon2a_i]; const beacon2b = &scanner2.beacons.slice()[known_congruent.beacon2b_i]; const beacon2c = &scanner2.beacons.slice()[known_congruent.beacon2c_i]; var permute_i: usize = 0; var temp_beacon2a_pos: Coord = undefined; var temp_beacon2b_pos: Coord = undefined; var temp_beacon2c_pos: Coord = undefined; while (permute_i < 24) : (permute_i += 1) { temp_beacon2a_pos = permuteCoord(beacon2a.pos, permute_i); temp_beacon2b_pos = permuteCoord(beacon2b.pos, permute_i); temp_beacon2c_pos = permuteCoord(beacon2c.pos, permute_i); if (coordsLineUp( beacon1a.pos, beacon1b.pos, beacon1c.pos, temp_beacon2a_pos, temp_beacon2b_pos, temp_beacon2c_pos, )) { break; } } else { unreachable; } for (scanner2.beacons.slice()) |*beacon| { // TODO: // Can't write `beacon.pos = permuteCoord(beacon.pos, permute_i);` because it's miscompiled, // likely due to https://github.com/ziglang/zig/issues/3696 const new_pos = permuteCoord(beacon.pos, permute_i); beacon.pos = new_pos; } std.debug.assert(coordsLineUp( beacon1a.pos, beacon1b.pos, beacon1c.pos, beacon2a.pos, beacon2b.pos, beacon2c.pos, )); std.debug.assert(scanner1_pos.p + beacon1a.pos.p - beacon2a.pos.p == scanner1_pos.p + beacon1b.pos.p - beacon2b.pos.p); std.debug.assert(scanner1_pos.p + beacon1a.pos.p - beacon2a.pos.p == scanner1_pos.p + beacon1c.pos.p - beacon2c.pos.p); std.debug.assert(scanner1_pos.q + beacon1a.pos.q - beacon2a.pos.q == scanner1_pos.q + beacon1b.pos.q - beacon2b.pos.q); std.debug.assert(scanner1_pos.q + beacon1a.pos.q - beacon2a.pos.q == scanner1_pos.q + beacon1c.pos.q - beacon2c.pos.q); std.debug.assert(scanner1_pos.r + beacon1a.pos.r - beacon2a.pos.r == scanner1_pos.r + beacon1b.pos.r - beacon2b.pos.r); std.debug.assert(scanner1_pos.r + beacon1a.pos.r - beacon2a.pos.r == scanner1_pos.r + beacon1c.pos.r - beacon2c.pos.r); scanner2.pos = .{ .p = scanner1_pos.p + beacon1a.pos.p - beacon2a.pos.p, .q = scanner1_pos.q + beacon1a.pos.q - beacon2a.pos.q, .r = scanner1_pos.r + beacon1a.pos.r - beacon2a.pos.r, }; updated_one_scanner = true; } } } } if (!updated_one_scanner) { break; } } } fn part2(scanners: []const Scanner) !Dimension { var max_distance: Dimension = 0; for (scanners) |scanner1| { for (scanners) |scanner2| { max_distance = std.math.max(max_distance, try manhattanDistance(scanner1.pos.?, scanner2.pos.?)); } } return max_distance; } const Scanner = struct { beacons: std.BoundedArray(Beacon, max_num_beacons_per_scanner), distances: [max_num_beacons_per_scanner][max_num_beacons_per_scanner]Dimension, known_congruents: [max_num_scanners]?KnownCongruent, pos: ?Coord, fn init(input_: anytype) !?@This() { var result = Scanner { .beacons = std.BoundedArray(Beacon, max_num_beacons_per_scanner).init(0) catch unreachable, .distances = undefined, .known_congruents = [_]?KnownCongruent { null } ** max_num_scanners, .pos = null, }; if ((try input_.next()) == null) { return null; } while (try input_.next()) |line| { if (line.len == 0) { break; } var parts = std.mem.split(u8, line, ","); const p_s = parts.next() orelse return error.InvalidInput; const p = try std.fmt.parseInt(Dimension, p_s, 10); const q_s = parts.next() orelse return error.InvalidInput; const q = try std.fmt.parseInt(Dimension, q_s, 10); const r_s = parts.next() orelse return error.InvalidInput; const r = try std.fmt.parseInt(Dimension, r_s, 10); try result.beacons.append(.{ .pos = .{ .p = p, .q = q, .r = r }, .id = null, }); } for (result.beacons.constSlice()) |beacon1, beacon1_i| { for (result.beacons.constSlice()) |beacon2, beacon2_i| { result.distances[beacon1_i][beacon2_i] = eulerDistance(beacon1.pos, beacon2.pos); } } return result; } }; const Beacon = struct { pos: Coord, id: ?NumBeacons, }; const Coord = struct { p: Dimension, q: Dimension, r: Dimension, }; const Dimension = i32; const KnownCongruent = struct { beacon1a_i: usize, beacon1b_i: usize, beacon1c_i: usize, beacon2a_i: usize, beacon2b_i: usize, beacon2c_i: usize, }; fn eulerDistance(a: Coord, b: Coord) Dimension { return (a.p - b.p) * (a.p - b.p) + (a.q - b.q) * (a.q - b.q) + (a.r - b.r) * (a.r - b.r); } fn manhattanDistance(a: Coord, b: Coord) !Dimension { return (try std.math.absInt(a.p - b.p)) + (try std.math.absInt(a.q - b.q)) + (try std.math.absInt(a.r - b.r)); } const UnidentifiedBeacon = struct { scanner_i: usize, beacon_i: usize, beacon: *Beacon, }; fn nextUnidentifiedBeacon(scanners: []Scanner) ?UnidentifiedBeacon { for (scanners) |*scanner, scanner_i| { for (scanner.beacons.slice()) |*beacon, beacon_i| { if (beacon.id == null) { return UnidentifiedBeacon { .scanner_i = scanner_i, .beacon_i = beacon_i, .beacon = beacon, }; } } } return null; } fn coordsLineUp( a1: Coord, b1: Coord, c1: Coord, a2: Coord, b2: Coord, c2: Coord, ) bool { return (b1.p - a1.p == b2.p - a2.p) and (b1.q - a1.q == b2.q - a2.q) and (b1.r - a1.r == b2.r - a2.r) and (c1.p - a1.p == c2.p - a2.p) and (c1.q - a1.q == c2.q - a2.q) and (c1.r - a1.r == c2.r - a2.r) and (c1.p - b1.p == c2.p - b2.p) and (c1.q - b1.q == c2.q - b2.q) and (c1.r - b1.r == c2.r - b2.r); } fn permuteCoord(coord: Coord, i: usize) Coord { return switch (i) { // +x -> +x, +y -> +y, +z -> +z 0 => .{ .p = coord.p, .q = coord.q, .r = coord.r }, // +x -> -z, +y -> +y, +z -> +x 1 => .{ .p = coord.r, .q = coord.q, .r = -coord.p }, // +x -> -x, +y -> +y, +z -> -z 2 => .{ .p = -coord.p, .q = coord.q, .r = -coord.r }, // +x -> +z, +y -> +y, +z -> -x 3 => .{ .p = -coord.r, .q = coord.q, .r = coord.p }, // +x -> +x, +y -> -y, +z -> -z 4 => .{ .p = coord.p, .q = -coord.q, .r = -coord.r }, // +x -> -z, +y -> -y, +z -> -x 5 => .{ .p = -coord.r, .q = -coord.q, .r = -coord.p }, // +x -> -x, +y -> -y, +z -> +z 6 => .{ .p = -coord.p, .q = -coord.q, .r = coord.r }, // +x -> +z, +y -> -y, +z -> +x 7 => .{ .p = coord.r, .q = -coord.q, .r = coord.p }, // +x -> +z, +y -> +x, +z -> +y 8 => .{ .p = coord.q, .q = coord.r, .r = coord.p }, // +x -> -y, +y -> +x, +z -> +z 9 => .{ .p = coord.q, .q = -coord.p, .r = coord.r }, // +x -> -z, +y -> +x, +z -> -y 10 => .{ .p = coord.q, .q = -coord.r, .r = -coord.p }, // +x -> +y, +y -> +x, +z -> -z 11 => .{ .p = coord.q, .q = coord.p, .r = -coord.r }, // +x -> +z, +y -> -x, +z -> -y 12 => .{ .p = -coord.q, .q = -coord.r, .r = coord.p }, // +x -> -y, +y -> -x, +z -> -z 13 => .{ .p = -coord.q, .q = -coord.p, .r = -coord.r }, // +x -> -z, +y -> -x, +z -> +y 14 => .{ .p = -coord.q, .q = coord.r, .r = -coord.p }, // +x -> +y, +y -> -x, +z -> +z 15 => .{ .p = -coord.q, .q = coord.p, .r = coord.r }, // +x -> +x, +y -> +z, +z -> -y 16 => .{ .p = coord.p, .q = -coord.r, .r = coord.q }, // +x -> +y, +y -> +z, +z -> +x 17 => .{ .p = coord.r, .q = coord.p, .r = coord.q }, // +x -> -x, +y -> +z, +z -> +y 18 => .{ .p = -coord.p, .q = coord.r, .r = coord.q }, // +x -> -y, +y -> +z, +z -> -x 19 => .{ .p = -coord.r, .q = -coord.p, .r = coord.q }, // +x -> +x, +y -> -z, +z -> +y 20 => .{ .p = coord.p, .q = coord.r, .r = -coord.q }, // +x -> +y, +y -> -z, +z -> -x 21 => .{ .p = -coord.r, .q = coord.p, .r = -coord.q }, // +x -> -x, +y -> -z, +z -> -y 22 => .{ .p = -coord.p, .q = -coord.r, .r = -coord.q }, // +x -> -y, +y -> -z, +z -> +x 23 => .{ .p = coord.r, .q = -coord.p, .r = -coord.q }, else => unreachable, }; } test "day 19 example 1" { const input_ = \\--- scanner 0 --- \\0,2,0 \\4,1,0 \\3,3,0 \\ \\--- scanner 1 --- \\-1,-1,0 \\-5,0,0 \\-2,1,0 ; var scanners = try parseInput(&input.readString(input_)); const next_beacon_id = identifyBeacons(scanners.slice()); try std.testing.expectEqual(@as(NumBeacons, 3), part1(next_beacon_id)); } test "day 19 example 2" { if (builtin.mode != .Debug) { const input_ = \\--- scanner 0 --- \\404,-588,-901 \\528,-643,409 \\-838,591,734 \\390,-675,-793 \\-537,-823,-458 \\-485,-357,347 \\-345,-311,381 \\-661,-816,-575 \\-876,649,763 \\-618,-824,-621 \\553,345,-567 \\474,580,667 \\-447,-329,318 \\-584,868,-557 \\544,-627,-890 \\564,392,-477 \\455,729,728 \\-892,524,684 \\-689,845,-530 \\423,-701,434 \\7,-33,-71 \\630,319,-379 \\443,580,662 \\-789,900,-551 \\459,-707,401 \\ \\--- scanner 1 --- \\686,422,578 \\605,423,415 \\515,917,-361 \\-336,658,858 \\95,138,22 \\-476,619,847 \\-340,-569,-846 \\567,-361,727 \\-460,603,-452 \\669,-402,600 \\729,430,532 \\-500,-761,534 \\-322,571,750 \\-466,-666,-811 \\-429,-592,574 \\-355,545,-477 \\703,-491,-529 \\-328,-685,520 \\413,935,-424 \\-391,539,-444 \\586,-435,557 \\-364,-763,-893 \\807,-499,-711 \\755,-354,-619 \\553,889,-390 \\ \\--- scanner 2 --- \\649,640,665 \\682,-795,504 \\-784,533,-524 \\-644,584,-595 \\-588,-843,648 \\-30,6,44 \\-674,560,763 \\500,723,-460 \\609,671,-379 \\-555,-800,653 \\-675,-892,-343 \\697,-426,-610 \\578,704,681 \\493,664,-388 \\-671,-858,530 \\-667,343,800 \\571,-461,-707 \\-138,-166,112 \\-889,563,-600 \\646,-828,498 \\640,759,510 \\-630,509,768 \\-681,-892,-333 \\673,-379,-804 \\-742,-814,-386 \\577,-820,562 \\ \\--- scanner 3 --- \\-589,542,597 \\605,-692,669 \\-500,565,-823 \\-660,373,557 \\-458,-679,-417 \\-488,449,543 \\-626,468,-788 \\338,-750,-386 \\528,-832,-391 \\562,-778,733 \\-938,-730,414 \\543,643,-506 \\-524,371,-870 \\407,773,750 \\-104,29,83 \\378,-903,-323 \\-778,-728,485 \\426,699,580 \\-438,-605,-362 \\-469,-447,-387 \\509,732,623 \\647,635,-688 \\-868,-804,481 \\614,-800,639 \\595,780,-596 \\ \\--- scanner 4 --- \\727,592,562 \\-293,-554,779 \\441,611,-461 \\-714,465,-776 \\-743,427,-804 \\-660,-479,-426 \\832,-632,460 \\927,-485,-438 \\408,393,-506 \\466,436,-512 \\110,16,151 \\-258,-428,682 \\-393,719,612 \\-211,-452,876 \\808,-476,-593 \\-575,615,604 \\-485,667,467 \\-680,325,-822 \\-627,-443,-432 \\872,-547,-609 \\833,512,582 \\807,604,487 \\839,-516,451 \\891,-625,532 \\-652,-548,-490 \\30,-46,-14 ; var scanners = try parseInput(&input.readString(input_)); const next_beacon_id = identifyBeacons(scanners.slice()); try std.testing.expectEqual(@as(NumBeacons, 79), part1(next_beacon_id)); identifyScanners(scanners.slice()); try std.testing.expectEqual(@as(Dimension, 1197 + 1175 + 1249), try part2(scanners.constSlice())); } }
src/day19.zig
pub const SAFER_SCOPEID_MACHINE = @as(u32, 1); pub const SAFER_SCOPEID_USER = @as(u32, 2); pub const SAFER_LEVELID_FULLYTRUSTED = @as(u32, 262144); pub const SAFER_LEVELID_NORMALUSER = @as(u32, 131072); pub const SAFER_LEVELID_CONSTRAINED = @as(u32, 65536); pub const SAFER_LEVELID_UNTRUSTED = @as(u32, 4096); pub const SAFER_LEVELID_DISALLOWED = @as(u32, 0); pub const SAFER_LEVEL_OPEN = @as(u32, 1); pub const SAFER_MAX_FRIENDLYNAME_SIZE = @as(u32, 256); pub const SAFER_MAX_DESCRIPTION_SIZE = @as(u32, 256); pub const SAFER_MAX_HASH_SIZE = @as(u32, 64); pub const SAFER_CRITERIA_IMAGEPATH = @as(u32, 1); pub const SAFER_CRITERIA_NOSIGNEDHASH = @as(u32, 2); pub const SAFER_CRITERIA_IMAGEHASH = @as(u32, 4); pub const SAFER_CRITERIA_AUTHENTICODE = @as(u32, 8); pub const SAFER_CRITERIA_URLZONE = @as(u32, 16); pub const SAFER_CRITERIA_APPX_PACKAGE = @as(u32, 32); pub const SAFER_CRITERIA_IMAGEPATH_NT = @as(u32, 4096); pub const SAFER_POLICY_JOBID_MASK = @as(u32, 4278190080); pub const SAFER_POLICY_JOBID_CONSTRAINED = @as(u32, 67108864); pub const SAFER_POLICY_JOBID_UNTRUSTED = @as(u32, 50331648); pub const SAFER_POLICY_ONLY_EXES = @as(u32, 65536); pub const SAFER_POLICY_SANDBOX_INERT = @as(u32, 131072); pub const SAFER_POLICY_HASH_DUPLICATE = @as(u32, 262144); pub const SAFER_POLICY_ONLY_AUDIT = @as(u32, 4096); pub const SAFER_POLICY_BLOCK_CLIENT_UI = @as(u32, 8192); pub const SAFER_POLICY_UIFLAGS_MASK = @as(u32, 255); pub const SAFER_POLICY_UIFLAGS_INFORMATION_PROMPT = @as(u32, 1); pub const SAFER_POLICY_UIFLAGS_OPTION_PROMPT = @as(u32, 2); pub const SAFER_POLICY_UIFLAGS_HIDDEN = @as(u32, 4); //-------------------------------------------------------------------------------- // Section: Types (11) //-------------------------------------------------------------------------------- pub const SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS = enum(u32) { NULL_IF_EQUAL = 1, COMPARE_ONLY = 2, MAKE_INERT = 4, WANT_FLAGS = 8, _, pub fn initFlags(o: struct { NULL_IF_EQUAL: u1 = 0, COMPARE_ONLY: u1 = 0, MAKE_INERT: u1 = 0, WANT_FLAGS: u1 = 0, }) SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS { return @intToEnum(SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS, (if (o.NULL_IF_EQUAL == 1) @enumToInt(SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.NULL_IF_EQUAL) else 0) | (if (o.COMPARE_ONLY == 1) @enumToInt(SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.COMPARE_ONLY) else 0) | (if (o.MAKE_INERT == 1) @enumToInt(SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.MAKE_INERT) else 0) | (if (o.WANT_FLAGS == 1) @enumToInt(SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.WANT_FLAGS) else 0) ); } }; pub const SAFER_TOKEN_NULL_IF_EQUAL = SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.NULL_IF_EQUAL; pub const SAFER_TOKEN_COMPARE_ONLY = SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.COMPARE_ONLY; pub const SAFER_TOKEN_MAKE_INERT = SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.MAKE_INERT; pub const SAFER_TOKEN_WANT_FLAGS = SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS.WANT_FLAGS; pub const SAFER_CODE_PROPERTIES_V1 = extern struct { cbSize: u32, dwCheckFlags: u32, ImagePath: ?[*:0]const u16, hImageFileHandle: ?HANDLE, UrlZoneId: u32, ImageHash: [64]u8, dwImageHashSize: u32, ImageSize: LARGE_INTEGER, HashAlgorithm: u32, pByteBlock: ?*u8, hWndParent: ?HWND, dwWVTUIChoice: u32, }; pub const SAFER_CODE_PROPERTIES_V2 = extern struct { cbSize: u32, dwCheckFlags: u32, ImagePath: ?[*:0]const u16, hImageFileHandle: ?HANDLE, UrlZoneId: u32, ImageHash: [64]u8, dwImageHashSize: u32, ImageSize: LARGE_INTEGER, HashAlgorithm: u32, pByteBlock: ?*u8, hWndParent: ?HWND, dwWVTUIChoice: u32, PackageMoniker: ?[*:0]const u16, PackagePublisher: ?[*:0]const u16, PackageName: ?[*:0]const u16, PackageVersion: u64, PackageIsFramework: BOOL, }; pub const SAFER_POLICY_INFO_CLASS = enum(i32) { LevelList = 1, EnableTransparentEnforcement = 2, DefaultLevel = 3, EvaluateUserScope = 4, ScopeFlags = 5, DefaultLevelFlags = 6, AuthenticodeEnabled = 7, }; pub const SaferPolicyLevelList = SAFER_POLICY_INFO_CLASS.LevelList; pub const SaferPolicyEnableTransparentEnforcement = SAFER_POLICY_INFO_CLASS.EnableTransparentEnforcement; pub const SaferPolicyDefaultLevel = SAFER_POLICY_INFO_CLASS.DefaultLevel; pub const SaferPolicyEvaluateUserScope = SAFER_POLICY_INFO_CLASS.EvaluateUserScope; pub const SaferPolicyScopeFlags = SAFER_POLICY_INFO_CLASS.ScopeFlags; pub const SaferPolicyDefaultLevelFlags = SAFER_POLICY_INFO_CLASS.DefaultLevelFlags; pub const SaferPolicyAuthenticodeEnabled = SAFER_POLICY_INFO_CLASS.AuthenticodeEnabled; pub const SAFER_OBJECT_INFO_CLASS = enum(i32) { LevelId = 1, ScopeId = 2, FriendlyName = 3, Description = 4, Builtin = 5, Disallowed = 6, DisableMaxPrivilege = 7, InvertDeletedPrivileges = 8, DeletedPrivileges = 9, DefaultOwner = 10, SidsToDisable = 11, RestrictedSidsInverted = 12, RestrictedSidsAdded = 13, AllIdentificationGuids = 14, SingleIdentification = 15, ExtendedError = 16, }; pub const SaferObjectLevelId = SAFER_OBJECT_INFO_CLASS.LevelId; pub const SaferObjectScopeId = SAFER_OBJECT_INFO_CLASS.ScopeId; pub const SaferObjectFriendlyName = SAFER_OBJECT_INFO_CLASS.FriendlyName; pub const SaferObjectDescription = SAFER_OBJECT_INFO_CLASS.Description; pub const SaferObjectBuiltin = SAFER_OBJECT_INFO_CLASS.Builtin; pub const SaferObjectDisallowed = SAFER_OBJECT_INFO_CLASS.Disallowed; pub const SaferObjectDisableMaxPrivilege = SAFER_OBJECT_INFO_CLASS.DisableMaxPrivilege; pub const SaferObjectInvertDeletedPrivileges = SAFER_OBJECT_INFO_CLASS.InvertDeletedPrivileges; pub const SaferObjectDeletedPrivileges = SAFER_OBJECT_INFO_CLASS.DeletedPrivileges; pub const SaferObjectDefaultOwner = SAFER_OBJECT_INFO_CLASS.DefaultOwner; pub const SaferObjectSidsToDisable = SAFER_OBJECT_INFO_CLASS.SidsToDisable; pub const SaferObjectRestrictedSidsInverted = SAFER_OBJECT_INFO_CLASS.RestrictedSidsInverted; pub const SaferObjectRestrictedSidsAdded = SAFER_OBJECT_INFO_CLASS.RestrictedSidsAdded; pub const SaferObjectAllIdentificationGuids = SAFER_OBJECT_INFO_CLASS.AllIdentificationGuids; pub const SaferObjectSingleIdentification = SAFER_OBJECT_INFO_CLASS.SingleIdentification; pub const SaferObjectExtendedError = SAFER_OBJECT_INFO_CLASS.ExtendedError; pub const SAFER_IDENTIFICATION_TYPES = enum(i32) { Default = 0, TypeImageName = 1, TypeImageHash = 2, TypeUrlZone = 3, TypeCertificate = 4, }; pub const SaferIdentityDefault = SAFER_IDENTIFICATION_TYPES.Default; pub const SaferIdentityTypeImageName = SAFER_IDENTIFICATION_TYPES.TypeImageName; pub const SaferIdentityTypeImageHash = SAFER_IDENTIFICATION_TYPES.TypeImageHash; pub const SaferIdentityTypeUrlZone = SAFER_IDENTIFICATION_TYPES.TypeUrlZone; pub const SaferIdentityTypeCertificate = SAFER_IDENTIFICATION_TYPES.TypeCertificate; pub const SAFER_IDENTIFICATION_HEADER = extern struct { dwIdentificationType: SAFER_IDENTIFICATION_TYPES, cbStructSize: u32, IdentificationGuid: Guid, lastModified: FILETIME, }; pub const SAFER_PATHNAME_IDENTIFICATION = extern struct { header: SAFER_IDENTIFICATION_HEADER, Description: [256]u16, ImageName: ?[*]u16, dwSaferFlags: u32, }; pub const SAFER_HASH_IDENTIFICATION = extern struct { header: SAFER_IDENTIFICATION_HEADER, Description: [256]u16, FriendlyName: [256]u16, HashSize: u32, ImageHash: [64]u8, HashAlgorithm: u32, ImageSize: LARGE_INTEGER, dwSaferFlags: u32, }; pub const SAFER_HASH_IDENTIFICATION2 = extern struct { hashIdentification: SAFER_HASH_IDENTIFICATION, HashSize: u32, ImageHash: [64]u8, HashAlgorithm: u32, }; pub const SAFER_URLZONE_IDENTIFICATION = extern struct { header: SAFER_IDENTIFICATION_HEADER, UrlZoneId: u32, dwSaferFlags: u32, }; //-------------------------------------------------------------------------------- // Section: Functions (10) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferGetPolicyInformation( dwScopeId: u32, SaferPolicyInfoClass: SAFER_POLICY_INFO_CLASS, InfoBufferSize: u32, // TODO: what to do with BytesParamIndex 2? InfoBuffer: ?*anyopaque, InfoBufferRetSize: ?*u32, lpReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferSetPolicyInformation( dwScopeId: u32, SaferPolicyInfoClass: SAFER_POLICY_INFO_CLASS, InfoBufferSize: u32, // TODO: what to do with BytesParamIndex 2? InfoBuffer: ?*anyopaque, lpReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferCreateLevel( dwScopeId: u32, dwLevelId: u32, OpenFlags: u32, pLevelHandle: ?*SAFER_LEVEL_HANDLE, lpReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferCloseLevel( hLevelHandle: SAFER_LEVEL_HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferIdentifyLevel( dwNumProperties: u32, pCodeProperties: ?[*]SAFER_CODE_PROPERTIES_V2, pLevelHandle: ?*SAFER_LEVEL_HANDLE, lpReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferComputeTokenFromLevel( LevelHandle: SAFER_LEVEL_HANDLE, InAccessToken: ?HANDLE, OutAccessToken: ?*?HANDLE, dwFlags: SAFER_COMPUTE_TOKEN_FROM_LEVEL_FLAGS, lpReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferGetLevelInformation( LevelHandle: SAFER_LEVEL_HANDLE, dwInfoType: SAFER_OBJECT_INFO_CLASS, // TODO: what to do with BytesParamIndex 3? lpQueryBuffer: ?*anyopaque, dwInBufferSize: u32, lpdwOutBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferSetLevelInformation( LevelHandle: SAFER_LEVEL_HANDLE, dwInfoType: SAFER_OBJECT_INFO_CLASS, // TODO: what to do with BytesParamIndex 3? lpQueryBuffer: ?*anyopaque, dwInBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferRecordEventLogEntry( hLevel: SAFER_LEVEL_HANDLE, szTargetPath: ?[*:0]const u16, lpReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ADVAPI32" fn SaferiIsExecutableFileType( szFullPathname: ?[*:0]const u16, bFromShellExecute: BOOLEAN, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (9) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const FILETIME = @import("../foundation.zig").FILETIME; const HANDLE = @import("../foundation.zig").HANDLE; const HWND = @import("../foundation.zig").HWND; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const PWSTR = @import("../foundation.zig").PWSTR; const SAFER_LEVEL_HANDLE = @import("../security.zig").SAFER_LEVEL_HANDLE; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/security/app_locker.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_e = utils.puts_e; const putskv_e = utils.putskv_e; const strncmp = utils.strncmp; const indexOf = utils.indexOf; fn matchSpace(ch: u8) usize { if (ch == ' ' or ch == '\n') { return 1; } else { return 0; } } fn matchComment(rest: []const u8) usize { if (!strncmp(rest, "//", 2)) { return 0; } const i = utils.indexOf(rest, '\n', 2); if (i == -1) { return rest.len; } else { return @intCast(usize, i); } } fn matchStr(rest: []const u8) usize { if (rest[0] != '"') { return 0; } const i = indexOf(rest, '"', 1); if (i == -1) { panic("must not happen ({})", .{rest}); } return @intCast(usize, i) - 1; } fn isKwChar(ch: u8) bool { return (('a' <= ch and ch <= 'z') or ch == '_'); } fn matchKw(rest: []const u8) usize { var size: usize = 0; size = 8; if ((strncmp(rest, "call_set", size)) and !isKwChar(rest[size])) { return size; } size = 6; if ((strncmp(rest, "return", size)) and !isKwChar(rest[size])) { return size; } size = 5; if ((strncmp(rest, "while", size)) and !isKwChar(rest[size])) { return size; } size = 4; if ((strncmp(rest, "func", size) or strncmp(rest, "call", size) or strncmp(rest, "case", size) or strncmp(rest, "_cmt", size)) and !isKwChar(rest[size])) { return size; } size = 3; if ((strncmp(rest, "var", size) or strncmp(rest, "set", size)) and !isKwChar(rest[size])) { return size; } return 0; } fn matchInt(rest: []const u8) usize { if (!(rest[0] == '-' or utils.isNumeric(rest[0]))) { return 0; } if (rest[0] == '-') { return utils.indexOfNonNumeric(rest, 1); } else { return utils.indexOfNonNumeric(rest, 0); } } fn matchSymbol(rest: []const u8) usize { if (strncmp(rest, "==", 2) or strncmp(rest, "!=", 2)) { return 2; } else if (utils.matchAnyChar(";(){},+*=", rest[0])) { return 1; } else { return 0; } } fn isIdentChar(ch: u8) bool { return (('a' <= ch and ch <= 'z') or utils.isNumeric(ch) or utils.matchAnyChar("[]_", ch)); } fn matchIdent(rest: []const u8) usize { var i: usize = 0; while (i < rest.len) : (i += 1) { if (!isIdentChar(rest[i])) { break; } } return i; } fn putsToken(kind: []const u8, str: []const u8) void { print(kind); print(":"); print(str); print("\n"); } fn tokenize(src: []const u8) void { var pos: usize = 0; var temp: [1024]u8 = undefined; while (pos < src.len) { var size: usize = 0; const rest = src[pos..]; size = matchSpace(rest[0]); if (0 < size) { pos += size; continue; } size = matchComment(rest); if (0 < size) { pos += size; continue; } size = matchStr(rest); if (0 < size) { utils.substring(&temp, rest, 1, size + 1); putsToken("str", temp[0..size]); pos += size + 2; continue; } size = matchKw(rest); if (0 < size) { utils.substring(&temp, rest, 0, size); putsToken("kw", temp[0..size]); pos += size; continue; } size = matchInt(rest); if (0 < size) { utils.substring(&temp, rest, 0, size); putsToken("int", temp[0..size]); pos += size; continue; } size = matchSymbol(rest); if (0 < size) { utils.substring(&temp, rest, 0, size); putsToken("sym", temp[0..size]); pos += size; continue; } size = matchIdent(rest); if (0 < size) { utils.substring(&temp, rest, 0, size); putsToken("ident", temp[0..size]); pos += size; continue; } panic("Unexpected pattern ({})", .{rest}); } } pub fn main() !void { var buf: [20000]u8 = undefined; const src = utils.readStdinAll(&buf); tokenize(src); }
vglexer.zig
const std = @import("std"); const fs = std.fs; const File = std.fs.File; const CommentBuffer = struct { buf: [2048]u8 = undefined, cursor: u64 = 0, }; pub fn codegen(self: *std.build.Step) !void { // READ-FILE: https://zigforum.org/t/read-file-or-buffer-by-line/317/4 var currentDir = std.fs.cwd(); var file = try currentDir.openFile("submodules/bgfx/include/bgfx/c99/bgfx.h", .{}); defer file.close(); var buf_reader = std.io.bufferedReader(file.reader()); var in_stream = buf_reader.reader(); var readBuffer: [1024]u8 = undefined; var commentBuffer = CommentBuffer{}; var wFile = try currentDir.createFile("lib/bgfx.zig", .{}); var isReadingComment:bool = false; while (try in_stream.readUntilDelimiterOrEof(&readBuffer, '\n')) |line| { if(startsWith(line, "/**") and !startsWith(line, "/**/")) { // Leeg de buffer; for(commentBuffer.buf) |*char,i|{ char.* = 0; } // Reset de cursor commentBuffer.cursor = 0; isReadingComment = true; } if(isReadingComment == true){ const skip = 3; // Hoeveel char's we negeren if(line.len > skip){ const readLenght = line.len - skip; // Hoeveel van de lengte van de gelezen lijn we interesant vinden const commentStr = "\n/// "; // Waarmee we een comment-lijn prefixen const bufSliceStart = commentBuffer.cursor + commentStr.len; // Waar in de buffer we beginnnen met schrijven van de lijn-info const bufSliceEnd = bufSliceStart + readLenght; // Waar in de buffer we stoppen met schrijven const totalLength = commentStr.len + (bufSliceEnd - bufSliceStart) ; for(commentStr) |char, i| { commentBuffer.buf[commentBuffer.cursor+i] = char; } for(commentBuffer.buf[bufSliceStart..bufSliceEnd]) |*char, i| { char.* = line[i+skip]; } // std.debug.print("STUFF {s}", .{commentBuffer.buf[bufSliceStart..(bufSliceEnd+10)]}); commentBuffer.cursor += totalLength; } } if(startsWith(line, " */")) { isReadingComment = false; } if(find(line, "BGFX_C_API void")) |index| { var writeEnumError = try writeVoidFunction(wFile, line, commentBuffer); } } defer wFile.close(); } fn startsWith(self: []u8, search:[]const u8) bool { if(self.len < search.len) return false; var slice = self[0..search.len]; return std.mem.eql(u8, slice, search); } fn find(self: []u8, search:[]const u8) ?u16 { var index:u16 = 0; while(search.len + index < self.len){ const asd = self[index..(search.len + index)]; const eq = std.mem.eql(u8, asd, search); if(eq){ return index; } index += 1; } return null; } fn writeVoidFunction(file: File, line: []u8, comBuffer: ?CommentBuffer) !void { // Schrijf commentaar naar file wanneer dit aanwezig is if(comBuffer) |commentBuffer|{ var b = try file.write(commentBuffer.buf[0..commentBuffer.cursor]); b = try file.write("\n"); } const functionName = line[16..]; var a = try file.write("fn "); a = try file.write(functionName); a = try file.write(" = enum {};\n"); }
codegen.zig
/// image.zig /// Module image offers structs and functions for pixel /// and image data. const std = @import("std"); const Allocator = std.mem.Allocator; const stbImageWrite = @cImport({ @cInclude("stb_image_write.h"); }); const testing = std.testing; /// RGB values for a single pixel pub fn RGB(comptime T: type) type { if (T == u8 or T == f32) { return struct { const Self = @This(); r: T, g: T, b: T, /// access pixel data by index pub fn get_idx(self: Self, idx: usize) !T { return switch (idx) { 0 => self.r, 1 => self.g, 2 => self.b, else => error.OutOfBounds, }; } /// generate pixel struct from slice of values pub fn from_slice(s: []T) !Self { if (s.len != 3) return error.InvalidLength else return Self{ .r = s[0], .g = s[1], .b = s[2] }; } /// equality predicate pub fn eql(self: Self, other: Self) bool { return self.r == other.r and self.g == other.g and self.b == other.b; } }; } else unreachable; } /// Mono value for a single pixel pub fn Mono(comptime T: type) type { if (T == u8 or T == f32) { return struct { const Self = @This(); i: T, /// access pixel data by index pub fn get_idx(self: Self, idx: usize) !T { return if (idx == 0) self.i else error.OutOfBounds; } /// equality predicate pub fn eql(self: Self, other: Self) bool { return self.i == other.i; } }; } else unreachable; } /// Determines the number of channels for each pixel data type fn num_channel(comptime T: fn (type) type) usize { return if (T == RGB) 3 else if (T == Mono) 1 else unreachable; } /// Image struct, paramterized with pixel and storage types pub fn Image(comptime TPixel: fn (type) type, comptime TData: type) type { return struct { const Self = @This(); /// Pixel type //const TPixel = TPixel(TData); const TData = TData; const chans = num_channel(TPixel); //const chans = 3; /// array of pixel values data: []TData, /// image width & height width: usize, height: usize, /// number of channels /// (determined from pixel type TPixel) channels: usize, /// Allocator for image data allocator: *Allocator, /// initialize memory for image data pub fn init(allocator: *Allocator, width: usize, height: usize) !Self { var data_mem = try allocator.alloc(TData, width * height * chans); return Self{ .allocator = allocator, .width = width, .height = height, .channels = chans, .data = data_mem, }; } /// free allocated memory pub fn deinit(self: Self) void { self.allocator.free(self.data); } /// set pixel value pub fn set_pixel(self: *Self, x: usize, y: usize, value: TPixel(TData)) !void { if (x > self.width or y > self.height) return error.OutOfBound; const stride = (x + self.width * y) * self.channels; var i: usize = 0; while (i < self.channels) : (i += 1) { self.data[stride + i] = try value.get_idx(i); } } /// get pixel data pub fn get_pixel(self: *Self, x: usize, y: usize) !TPixel(TData) { if (x > self.width or y > self.height) return error.OutOfBound; const stride = (x + self.width * y) * self.channels; const s = self.data[stride .. stride + self.channels]; return TPixel(TData).from_slice(s); } /// write image data as PNM file pub fn writePPM(self: Self, allocator: *std.mem.Allocator, file_path: []const u8) !void { if (TData != u8) return error.UnsupportedDataType; const file = try std.fs.cwd().createFile(file_path, .{ .truncate = true }); defer file.close(); const w = file.writer(); var line_buf = std.ArrayList(u8).init(allocator); defer line_buf.deinit(); var buf_writer = line_buf.writer(); try w.print("P3\n", .{}); try w.print("{} {} {}\n", .{ self.width, self.height, 255 }); var idx: usize = 0; while (idx < self.width * self.height * self.channels) : (idx += self.channels) { var ichan: usize = 0; while (ichan < self.channels) : (ichan += 1) { try buf_writer.print("{} ", .{self.data[idx + ichan]}); } if (idx % 8 == 0) { _ = try buf_writer.write("\n"); _ = try w.write(line_buf.items); line_buf.shrinkRetainingCapacity(0); } } // make sure remaining pixels are written to file if (line_buf.items.len > 0) { _ = try buf_writer.write("\n"); _ = try w.write(line_buf.items); } } /// write image data to binary image file /// Currently, only PNG with 8-bit channel values is supported pub fn write(self: Self, allocator: *std.mem.Allocator, file_path: []const u8) !void { // check for supported image data if (TData != u8) return error.UnsupportedDataType; const c_width = @intCast(c_int, self.width); const c_height = @intCast(c_int, self.height); const c_chans = @intCast(c_int, self.channels); const c_stride = @intCast(c_int, self.width * self.channels); const c_file_path = try allocator.alloc(u8, file_path.len + 1); defer allocator.free(c_file_path); std.mem.copy(u8, c_file_path, file_path); c_file_path[file_path.len] = 0; const res = stbImageWrite.stbi_write_png(c_file_path.ptr, c_width, c_height, c_chans, self.data.ptr, c_stride); if (res == 0) { return error.WriteError; } } }; } test "RGB(u8)" { var pix = RGB(u8){ .r = 128, .g = 255, .b = 12 }; const pix_ary = [_]u8{ try pix.get_idx(0), try pix.get_idx(1), try pix.get_idx(2) }; try testing.expect(pix.eql(RGB(u8){ .r = 128, .g = 255, .b = 12 })); try testing.expect(pix_ary.len == 3); try testing.expect(std.mem.eql(u8, &pix_ary, &[_]u8{ 128, 255, 12 })); } test "Mono(u8)" { var pix = Mono(u8){ .i = 128 }; const pix_ary = [_]u8{try pix.get_idx(0)}; try testing.expect(pix.eql(Mono(u8){ .i = 128 })); try testing.expect(pix_ary.len == 1); try testing.expect(std.mem.eql(u8, &pix_ary, &[_]u8{128})); } test "Image(RGB).init()" { var img = try Image(RGB, u8).init(testing.allocator, 640, 480); defer img.deinit(); try testing.expect(img.data.len == 640 * 480 * 3); } test "Image(Mono).init()" { var img = try Image(Mono, u8).init(testing.allocator, 640, 480); defer img.deinit(); try testing.expect(img.data.len == 640 * 480); } test "Image(RGB).set_pixel()" { var img = try Image(RGB, u8).init(testing.allocator, 3, 3); defer img.deinit(); const RGB24 = RGB(u8); const pixel = [_]RGB24{ RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 128, .g = 0, .b = 0 }, RGB24{ .r = 255, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 128, .b = 0 }, RGB24{ .r = 0, .g = 255, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 128 }, RGB24{ .r = 0, .g = 0, .b = 255 }, }; for (pixel) |p, i| { const x = i % 3; const y = i / 3; try img.set_pixel(x, y, p); } for (pixel) |p, i| { const x = i % 3; const y = i / 3; const act = try img.get_pixel(x, y); try testing.expect(act.eql(p)); } } test "Image(RGB).writePPM" { const test_allocator = std.testing.allocator; var img = try Image(RGB, u8).init(testing.allocator, 3, 3); defer img.deinit(); const RGB24 = RGB(u8); var pixel = [_]RGB24{ RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 128, .g = 0, .b = 0 }, RGB24{ .r = 255, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 128, .b = 0 }, RGB24{ .r = 0, .g = 255, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 128 }, RGB24{ .r = 0, .g = 0, .b = 255 }, }; for (pixel) |p, i| { const x = i % 3; const y = i / 3; try img.set_pixel(x, y, p); } try img.writePPM(test_allocator, "test_image.ppm"); defer std.fs.cwd().deleteFile("test_image.ppm") catch unreachable; const file = try std.fs.cwd().openFile("test_image.ppm", .{ .read = true }); defer file.close(); const contents = try file.reader().readAllAlloc( test_allocator, 120, ); defer test_allocator.free(contents); try testing.expect(std.mem.eql(u8, contents, "P3\n3 3 255\n0 0 0 \n128 0 0 255 0 0 0 0 0 0 128 0 0 255 0 0 0 0 0 0 128 0 0 255 \n")); } test "Image(RGB).write" { const test_allocator = std.testing.allocator; var img = try Image(RGB, u8).init(testing.allocator, 3, 3); defer img.deinit(); const RGB24 = RGB(u8); var pixel = [_]RGB24{ RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 128, .g = 0, .b = 0 }, RGB24{ .r = 255, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 128, .b = 0 }, RGB24{ .r = 0, .g = 255, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 0 }, RGB24{ .r = 0, .g = 0, .b = 128 }, RGB24{ .r = 0, .g = 0, .b = 255 }, }; for (pixel) |p, i| { const x = i % 3; const y = i / 3; try img.set_pixel(x, y, p); } try img.write(test_allocator, "test_image.png"); defer std.fs.cwd().deleteFile("test_image.png") catch unreachable; }
Zig/benchmark/src/image.zig
const std = @import("std"); const math = std.math; const c = @import("c.zig"); const window_name = "generative art experiment 0000"; const window_width = 1920; const window_height = 1080; var oglppo: c.GLuint = undefined; pub fn main() !void { _ = c.glfwSetErrorCallback(handleGlfwError); if (c.glfwInit() == c.GLFW_FALSE) { std.debug.panic("glfwInit() failed.\n", .{}); } defer c.glfwTerminate(); c.glfwWindowHint(c.GLFW_DEPTH_BITS, 24); c.glfwWindowHint(c.GLFW_STENCIL_BITS, 8); c.glfwWindowHint(c.GLFW_RESIZABLE, c.GLFW_FALSE); const window = c.glfwCreateWindow(window_width, window_height, window_name, null, null) orelse { std.debug.panic("glfwCreateWindow() failed.\n", .{}); }; defer c.glfwDestroyWindow(window); c.glfwMakeContextCurrent(window); c.glfwSwapInterval(0); c.initOpenGlEntryPoints(); c.glCreateProgramPipelines(1, &oglppo); c.glBindProgramPipeline(oglppo); //c.glEnable(c.GL_DEBUG_OUTPUT); c.glDebugMessageCallback(handleGlError, null); c.glEnable(c.GL_FRAMEBUFFER_SRGB); var srgb_color_tex: c.GLuint = undefined; c.glCreateTextures(c.GL_TEXTURE_2D_MULTISAMPLE, 1, &srgb_color_tex); c.glTextureStorage2DMultisample(srgb_color_tex, 8, c.GL_SRGB8_ALPHA8, window_width, window_height, c.GL_FALSE); defer c.glDeleteTextures(1, &srgb_color_tex); var srgb_ds_tex: c.GLuint = undefined; c.glCreateTextures(c.GL_TEXTURE_2D_MULTISAMPLE, 1, &srgb_ds_tex); c.glTextureStorage2DMultisample(srgb_ds_tex, 8, c.GL_DEPTH24_STENCIL8, window_width, window_height, c.GL_FALSE); defer c.glDeleteTextures(1, &srgb_ds_tex); var srgb_fbo: c.GLuint = undefined; c.glCreateFramebuffers(1, &srgb_fbo); c.glNamedFramebufferTexture(srgb_fbo, c.GL_COLOR_ATTACHMENT0, srgb_color_tex, 0); c.glNamedFramebufferTexture(srgb_fbo, c.GL_DEPTH_STENCIL_ATTACHMENT, srgb_ds_tex, 0); c.glClearNamedFramebufferfv(srgb_fbo, c.GL_COLOR, 0, &[_]f32{ 0.0, 0.0, 0.0, 0.0 }); c.glClearNamedFramebufferfi(srgb_fbo, c.GL_DEPTH_STENCIL, 0, 1.0, 0); defer c.glDeleteFramebuffers(1, &srgb_fbo); var sys: ?*c.FMOD_SYSTEM = null; if (c.FMOD_System_Create(&sys) != .FMOD_OK) { std.debug.panic("FMOD_System_Create failed.\n", .{}); } defer _ = c.FMOD_System_Release(sys); const fs = c.glCreateShaderProgramv(c.GL_FRAGMENT_SHADER, 1, &@as([*c]const u8, \\ #version 460 compatibility \\ \\ void main() { \\ gl_FragColor = vec4(0.0, 0.8, 0.1, 1.0); \\ } )); defer c.glDeleteProgram(fs); var image_w: c_int = undefined; var image_h: c_int = undefined; const image_data = c.stbi_load("data/genart_0025_5.png", &image_w, &image_h, null, 4); if (image_data == null) { std.debug.panic("Failed to load image.\n", .{}); } var image_tex: c.GLuint = undefined; c.glCreateTextures(c.GL_TEXTURE_2D, 1, &image_tex); c.glTextureStorage2D(image_tex, 1, c.GL_SRGB8_ALPHA8, image_w, image_h); c.glTextureSubImage2D(image_tex, 0, 0, 0, image_w, image_h, c.GL_RGBA, c.GL_UNSIGNED_BYTE, image_data); c.glTextureParameteri(image_tex, c.GL_TEXTURE_MIN_FILTER, c.GL_LINEAR); c.glTextureParameteri(image_tex, c.GL_TEXTURE_MAG_FILTER, c.GL_LINEAR); c.stbi_image_free(image_data); defer c.glDeleteTextures(1, &image_tex); while (c.glfwWindowShouldClose(window) == c.GLFW_FALSE) { const stats = updateFrameStats(window, window_name); c.glClearNamedFramebufferfv(srgb_fbo, c.GL_COLOR, 0, &[_]f32{ 0.2, 0.4, 0.8, 1.0 }); c.glClearNamedFramebufferfi(srgb_fbo, c.GL_DEPTH_STENCIL, 0, 1.0, 0); c.glBindFramebuffer(c.GL_DRAW_FRAMEBUFFER, srgb_fbo); c.glMatrixLoadIdentityEXT(c.GL_PROJECTION); c.glMatrixLoadIdentityEXT(c.GL_MODELVIEW); c.glUseProgramStages(oglppo, c.GL_FRAGMENT_SHADER_BIT, fs); c.glBegin(c.GL_TRIANGLES); c.glVertex2f(-0.7, -0.7); c.glVertex2f(0.7, -0.7); c.glVertex2f(0.0, 0.7); c.glEnd(); c.glUseProgramStages(oglppo, c.GL_ALL_SHADER_BITS, 0); c.glDrawTextureNV( image_tex, 0, 0.0, // x 0.0, // y @intToFloat(f32, image_w), @intToFloat(f32, image_h), 0.0, // z 0.0, // s0 1.0, // t0 1.0, // s1 0.0, // t1 ); c.glMatrixOrthoEXT( c.GL_PROJECTION, -0.5 * @intToFloat(f32, window_width), 0.5 * @intToFloat(f32, window_width), -0.5 * @intToFloat(f32, window_height), 0.5 * @intToFloat(f32, window_height), -1.0, 1.0, ); const path_obj = 1; { const num_vertices = 11; var path_commands: [num_vertices + 1]u8 = undefined; var path_coords: [num_vertices][2]f32 = undefined; var i: u32 = 0; while (i < num_vertices) { if (i == 0) path_commands[i] = c.GL_MOVE_TO_NV else path_commands[i] = c.GL_LINE_TO_NV; const t = @floatCast(f32, stats.time); const frac_i = @intToFloat(f32, i) / num_vertices; const r = 150 + 100.0 * math.sin(t + frac_i * math.tau); const theta = frac_i * math.tau; path_coords[i] = [2]f32{ r * math.cos(theta), r * math.sin(theta) }; i += 1; } path_commands[num_vertices] = c.GL_CLOSE_PATH_NV; c.glPathCommandsNV(path_obj, path_commands.len, &path_commands, path_coords.len * 2, c.GL_FLOAT, &path_coords); c.glPathParameterfNV(path_obj, c.GL_PATH_STROKE_WIDTH_NV, 6.5); c.glPathParameteriNV(path_obj, c.GL_PATH_JOIN_STYLE_NV, c.GL_ROUND_NV); } c.glEnable(c.GL_BLEND); c.glBlendFunc(c.GL_SRC_ALPHA, c.GL_ONE_MINUS_SRC_ALPHA); c.glEnable(c.GL_STENCIL_TEST); c.glStencilFunc(c.GL_NOTEQUAL, 0, 0xFF); c.glStencilOp(c.GL_KEEP, c.GL_KEEP, c.GL_ZERO); c.glColor4f(1.0, 0.5, 1.0, 0.5); c.glStencilThenCoverFillPathNV(path_obj, c.GL_COUNT_UP_NV, 0xFF, c.GL_BOUNDING_BOX_NV); c.glColor3f(0.0, 0.0, 0.0); c.glStencilThenCoverStrokePathNV(path_obj, 0x1, 0xFF, c.GL_CONVEX_HULL_NV); { const num_vertices = 128; var path_commands: [num_vertices]u8 = undefined; var path_coords: [num_vertices][2]f32 = undefined; var i: u32 = 0; while (i < num_vertices) { if (i == 0) path_commands[i] = c.GL_MOVE_TO_NV else path_commands[i] = c.GL_LINE_TO_NV; const frac_i = @intToFloat(f32, i) / num_vertices; path_coords[i] = [2]f32{ frac_i * 900.0, 50.0 * math.sin(math.tau * frac_i * 4.0) }; i += 1; } c.glPathCommandsNV(path_obj, path_commands.len, &path_commands, path_coords.len * 2, c.GL_FLOAT, &path_coords); c.glPathParameterfNV(path_obj, c.GL_PATH_STROKE_WIDTH_NV, 5.5); } c.glColor3f(0.0, 0.0, 0.0); c.glStencilThenCoverStrokePathNV(path_obj, 0x1, 0xFF, c.GL_CONVEX_HULL_NV); c.glDisable(c.GL_STENCIL_TEST); c.glDisable(c.GL_BLEND); c.glBindFramebuffer(c.GL_DRAW_FRAMEBUFFER, 0); c.glBlitNamedFramebuffer( srgb_fbo, // src 0, // dst 0, 0, window_width, window_height, 0, 0, window_width, window_height, c.GL_COLOR_BUFFER_BIT, c.GL_NEAREST, ); if (c.glGetError() != c.GL_NO_ERROR) { std.debug.panic("OpenGL error detected.\n", .{}); } c.glfwSwapBuffers(window); c.glfwPollEvents(); } } fn updateFrameStats(window: *c.GLFWwindow, name: [*:0]const u8) struct { time: f64, delta_time: f32 } { const state = struct { var timer: std.time.Timer = undefined; var previous_time_ns: u64 = 0; var header_refresh_time_ns: u64 = 0; var frame_count: u64 = ~@as(u64, 0); }; if (state.frame_count == ~@as(u64, 0)) { state.timer = std.time.Timer.start() catch unreachable; state.previous_time_ns = 0; state.header_refresh_time_ns = 0; state.frame_count = 0; } const now_ns = state.timer.read(); const time = @intToFloat(f64, now_ns) / std.time.ns_per_s; const delta_time = @intToFloat(f32, now_ns - state.previous_time_ns) / std.time.ns_per_s; state.previous_time_ns = now_ns; if ((now_ns - state.header_refresh_time_ns) >= std.time.ns_per_s) { const t = @intToFloat(f64, now_ns - state.header_refresh_time_ns) / std.time.ns_per_s; const fps = @intToFloat(f64, state.frame_count) / t; const ms = (1.0 / fps) * 1000.0; var buffer = [_]u8{0} ** 128; const buffer_slice = buffer[0 .. buffer.len - 1]; const header = std.fmt.bufPrint( buffer_slice, "[{d:.1} fps {d:.3} ms] {s}", .{ fps, ms, name }, ) catch buffer_slice; _ = c.glfwSetWindowTitle(window, header.ptr); state.header_refresh_time_ns = now_ns; state.frame_count = 0; } state.frame_count += 1; return .{ .time = time, .delta_time = delta_time }; } fn handleGlfwError(err: c_int, description: [*c]const u8) callconv(.C) void { std.debug.panic("GLFW error: {s}\n", .{@as([*:0]const u8, description)}); } fn handleGlError( source: c.GLenum, mtype: c.GLenum, id: c.GLuint, severity: c.GLenum, length: c.GLsizei, message: [*c]const c.GLchar, user_param: ?*const c_void, ) callconv(.C) void { if (message != null) { std.debug.print("{s}\n", .{message}); } }
src/0000.zig
//-------------------------------------------------------------------------------- // Section: Types (4) //-------------------------------------------------------------------------------- pub const USER_OBJECT_INFORMATION_INDEX = enum(u32) { FLAGS = 1, HEAPSIZE = 5, IO = 6, NAME = 2, TYPE = 3, USER_SID = 4, }; pub const UOI_FLAGS = USER_OBJECT_INFORMATION_INDEX.FLAGS; pub const UOI_HEAPSIZE = USER_OBJECT_INFORMATION_INDEX.HEAPSIZE; pub const UOI_IO = USER_OBJECT_INFORMATION_INDEX.IO; pub const UOI_NAME = USER_OBJECT_INFORMATION_INDEX.NAME; pub const UOI_TYPE = USER_OBJECT_INFORMATION_INDEX.TYPE; pub const UOI_USER_SID = USER_OBJECT_INFORMATION_INDEX.USER_SID; // TODO: this type has a FreeFunc 'CloseWindowStation', what can Zig do with this information? pub const HWINSTA = *opaque{}; // TODO: this type has a FreeFunc 'CloseDesktop', what can Zig do with this information? pub const HDESK = *opaque{}; pub const USEROBJECTFLAGS = extern struct { fInherit: BOOL, fReserved: BOOL, dwFlags: u32, }; //-------------------------------------------------------------------------------- // Section: Functions (27) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CreateDesktopA( lpszDesktop: ?[*:0]const u8, lpszDevice: ?[*:0]const u8, pDevmode: ?*DEVMODEA, dwFlags: u32, dwDesiredAccess: u32, lpsa: ?*SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CreateDesktopW( lpszDesktop: ?[*:0]const u16, lpszDevice: ?[*:0]const u16, pDevmode: ?*DEVMODEW, dwFlags: u32, dwDesiredAccess: u32, lpsa: ?*SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USER32" fn CreateDesktopExA( lpszDesktop: ?[*:0]const u8, lpszDevice: ?[*:0]const u8, pDevmode: ?*DEVMODEA, dwFlags: u32, dwDesiredAccess: u32, lpsa: ?*SECURITY_ATTRIBUTES, ulHeapSize: u32, pvoid: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "USER32" fn CreateDesktopExW( lpszDesktop: ?[*:0]const u16, lpszDevice: ?[*:0]const u16, pDevmode: ?*DEVMODEW, dwFlags: u32, dwDesiredAccess: u32, lpsa: ?*SECURITY_ATTRIBUTES, ulHeapSize: u32, pvoid: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn OpenDesktopA( lpszDesktop: ?[*:0]const u8, dwFlags: u32, fInherit: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn OpenDesktopW( lpszDesktop: ?[*:0]const u16, dwFlags: u32, fInherit: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn OpenInputDesktop( dwFlags: u32, fInherit: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EnumDesktopsA( hwinsta: ?HWINSTA, lpEnumFunc: ?DESKTOPENUMPROCA, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EnumDesktopsW( hwinsta: ?HWINSTA, lpEnumFunc: ?DESKTOPENUMPROCW, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EnumDesktopWindows( hDesktop: ?HDESK, lpfn: ?WNDENUMPROC, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SwitchDesktop( hDesktop: ?HDESK, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SetThreadDesktop( hDesktop: ?HDESK, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CloseDesktop( hDesktop: ?HDESK, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetThreadDesktop( dwThreadId: u32, ) callconv(@import("std").os.windows.WINAPI) ?HDESK; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CreateWindowStationA( lpwinsta: ?[*:0]const u8, dwFlags: u32, dwDesiredAccess: u32, lpsa: ?*SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) ?HWINSTA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CreateWindowStationW( lpwinsta: ?[*:0]const u16, dwFlags: u32, dwDesiredAccess: u32, lpsa: ?*SECURITY_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) ?HWINSTA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn OpenWindowStationA( lpszWinSta: ?[*:0]const u8, fInherit: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?HWINSTA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn OpenWindowStationW( lpszWinSta: ?[*:0]const u16, fInherit: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?HWINSTA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EnumWindowStationsA( lpEnumFunc: ?WINSTAENUMPROCA, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn EnumWindowStationsW( lpEnumFunc: ?WINSTAENUMPROCW, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn CloseWindowStation( hWinSta: ?HWINSTA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SetProcessWindowStation( hWinSta: ?HWINSTA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetProcessWindowStation( ) callconv(@import("std").os.windows.WINAPI) ?HWINSTA; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetUserObjectInformationA( hObj: ?HANDLE, nIndex: USER_OBJECT_INFORMATION_INDEX, // TODO: what to do with BytesParamIndex 3? pvInfo: ?*c_void, nLength: u32, lpnLengthNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn GetUserObjectInformationW( hObj: ?HANDLE, nIndex: USER_OBJECT_INFORMATION_INDEX, // TODO: what to do with BytesParamIndex 3? pvInfo: ?*c_void, nLength: u32, lpnLengthNeeded: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SetUserObjectInformationA( hObj: ?HANDLE, nIndex: i32, // TODO: what to do with BytesParamIndex 3? pvInfo: ?*c_void, nLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "USER32" fn SetUserObjectInformationW( hObj: ?HANDLE, nIndex: i32, // TODO: what to do with BytesParamIndex 3? pvInfo: ?*c_void, nLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (9) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const CreateDesktop = thismodule.CreateDesktopA; pub const CreateDesktopEx = thismodule.CreateDesktopExA; pub const OpenDesktop = thismodule.OpenDesktopA; pub const EnumDesktops = thismodule.EnumDesktopsA; pub const CreateWindowStation = thismodule.CreateWindowStationA; pub const OpenWindowStation = thismodule.OpenWindowStationA; pub const EnumWindowStations = thismodule.EnumWindowStationsA; pub const GetUserObjectInformation = thismodule.GetUserObjectInformationA; pub const SetUserObjectInformation = thismodule.SetUserObjectInformationA; }, .wide => struct { pub const CreateDesktop = thismodule.CreateDesktopW; pub const CreateDesktopEx = thismodule.CreateDesktopExW; pub const OpenDesktop = thismodule.OpenDesktopW; pub const EnumDesktops = thismodule.EnumDesktopsW; pub const CreateWindowStation = thismodule.CreateWindowStationW; pub const OpenWindowStation = thismodule.OpenWindowStationW; pub const EnumWindowStations = thismodule.EnumWindowStationsW; pub const GetUserObjectInformation = thismodule.GetUserObjectInformationW; pub const SetUserObjectInformation = thismodule.SetUserObjectInformationW; }, .unspecified => if (@import("builtin").is_test) struct { pub const CreateDesktop = *opaque{}; pub const CreateDesktopEx = *opaque{}; pub const OpenDesktop = *opaque{}; pub const EnumDesktops = *opaque{}; pub const CreateWindowStation = *opaque{}; pub const OpenWindowStation = *opaque{}; pub const EnumWindowStations = *opaque{}; pub const GetUserObjectInformation = *opaque{}; pub const SetUserObjectInformation = *opaque{}; } else struct { pub const CreateDesktop = @compileError("'CreateDesktop' requires that UNICODE be set to true or false in the root module"); pub const CreateDesktopEx = @compileError("'CreateDesktopEx' requires that UNICODE be set to true or false in the root module"); pub const OpenDesktop = @compileError("'OpenDesktop' requires that UNICODE be set to true or false in the root module"); pub const EnumDesktops = @compileError("'EnumDesktops' requires that UNICODE be set to true or false in the root module"); pub const CreateWindowStation = @compileError("'CreateWindowStation' requires that UNICODE be set to true or false in the root module"); pub const OpenWindowStation = @compileError("'OpenWindowStation' requires that UNICODE be set to true or false in the root module"); pub const EnumWindowStations = @compileError("'EnumWindowStations' requires that UNICODE be set to true or false in the root module"); pub const GetUserObjectInformation = @compileError("'GetUserObjectInformation' requires that UNICODE be set to true or false in the root module"); pub const SetUserObjectInformation = @compileError("'SetUserObjectInformation' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (13) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const DESKTOPENUMPROCA = @import("../ui/windows_and_messaging.zig").DESKTOPENUMPROCA; const DESKTOPENUMPROCW = @import("../ui/windows_and_messaging.zig").DESKTOPENUMPROCW; const DEVMODEA = @import("../ui/display_devices.zig").DEVMODEA; const DEVMODEW = @import("../ui/display_devices.zig").DEVMODEW; const HANDLE = @import("../foundation.zig").HANDLE; const LPARAM = @import("../foundation.zig").LPARAM; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; const WINSTAENUMPROCA = @import("../ui/windows_and_messaging.zig").WINSTAENUMPROCA; const WINSTAENUMPROCW = @import("../ui/windows_and_messaging.zig").WINSTAENUMPROCW; const WNDENUMPROC = @import("../ui/windows_and_messaging.zig").WNDENUMPROC; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
deps/zigwin32/win32/system/stations_and_desktops.zig
const std = @import("std"); const command = @import("command.zig"); pub fn print_command_help(current_command: *const command.Command, command_path: []const *const command.Command) !void { var out = std.io.getStdOut().writer(); try std.fmt.format(out, "USAGE:\n ", .{}); for (command_path) |cmd| { try std.fmt.format(out, "{s} ", .{cmd.name}); } try std.fmt.format(out, "{s} [OPTIONS]\n\n{s}\n", .{ current_command.name, current_command.help, }); if (current_command.description) |desc| { try std.fmt.format(out, "\n{s}\n", .{desc}); } if (current_command.subcommands) |sc_list| { try std.fmt.format(out, "\nCOMMANDS:\n", .{}); var max_cmd_width: usize = 0; for (sc_list) |sc| { max_cmd_width = std.math.max(max_cmd_width, sc.name.len); } const cmd_column_width = max_cmd_width + 3; for (sc_list) |sc| { try std.fmt.format(out, " {s}", .{sc.name}); var i: usize = 0; while (i < cmd_column_width - sc.name.len) { try std.fmt.format(out, " ", .{}); i += 1; } try std.fmt.format(out, "{s}\n", .{sc.help}); } } try std.fmt.format(out, "\nOPTIONS:\n", .{}); var option_column_width: usize = 7; if (current_command.options) |option_list| { var max_option_width: usize = 0; for (option_list) |option| { var w = option.long_name.len + option.value_name.len + 3; max_option_width = std.math.max(max_option_width, w); } option_column_width = max_option_width + 3; for (option_list) |option| { if (option.short_alias) |alias| { try print_spaces(out, 2); try std.fmt.format(out, "-{c}, ", .{alias}); } else { try print_spaces(out, 6); } try std.fmt.format(out, "--{s}", .{option.long_name}); var width = option.long_name.len; if (option.value != .bool) { try std.fmt.format(out, " <{s}>", .{option.value_name}); width += option.value_name.len + 3; } try print_spaces(out, option_column_width - width); try std.fmt.format(out, "{s}\n", .{option.help}); } } try std.fmt.format(out, " -h, --help", .{}); try print_spaces(out, option_column_width - 4); try std.fmt.format(out, "Prints help information\n", .{}); } fn print_spaces(out: std.fs.File.Writer, cnt: usize) !void { var i: usize = 0; while (i < cnt) : (i += 1) { try std.fmt.format(out, " ", .{}); } }
src/help.zig
const getty = @import("getty"); const std = @import("std"); pub const ser = struct { pub usingnamespace @import("ser/serializer.zig"); pub usingnamespace @import("ser/interface/formatter.zig"); pub usingnamespace @import("ser/impl/formatter/compact.zig"); pub usingnamespace @import("ser/impl/formatter/pretty.zig"); }; /// Serialize the given value as JSON into the given I/O stream. pub fn toWriter(value: anytype, writer: anytype) !void { comptime concepts.@"std.io.Writer"(@TypeOf(writer)); var f = ser.CompactFormatter(@TypeOf(writer)){}; var s = ser.Serializer(@TypeOf(writer), @TypeOf(f.formatter())).init(writer, f.formatter()); try getty.serialize(value, s.serializer()); } /// Serialize the given value as pretty-printed JSON into the given I/O stream. pub fn toPrettyWriter(value: anytype, writer: anytype) !void { comptime concepts.@"std.io.Writer"(@TypeOf(writer)); var f = ser.PrettyFormatter(@TypeOf(writer)).init(); var s = ser.Serializer(@TypeOf(writer), @TypeOf(f.formatter())).init(writer, f.formatter()); try getty.serialize(value, s.serializer()); } /// Serialize the given value as JSON into the given I/O stream with the given /// `getty.Ser` interface value. pub fn toWriterWith(value: anytype, writer: anytype, _ser: anytype) !void { comptime concepts.@"std.io.Writer"(@TypeOf(writer)); comptime getty.concepts.@"getty.Ser"(@TypeOf(_ser)); var f = ser.CompactFormatter(@TypeOf(writer)){}; var s = ser.Serializer(@TypeOf(writer), @TypeOf(f.formatter())).init(writer, f.formatter()); try getty.serializeWith(value, s.serializer(), _ser); } /// Serialize the given value as pretty-printed JSON into the given I/O stream /// with the given `getty.Ser` interface value. pub fn toPrettyWriterWith(value: anytype, writer: anytype, _ser: anytype) !void { comptime concepts.@"std.io.Writer"(@TypeOf(writer)); comptime getty.concepts.@"getty.Ser"(@TypeOf(_ser)); var f = ser.PrettyFormatter(@TypeOf(writer)).init(); var s = ser.Serializer(@TypeOf(writer), @TypeOf(f.formatter())).init(writer, f.formatter()); try getty.serializeWith(value, s.serializer(), _ser); } /// Serialize the given value as a JSON string. /// /// The serialized string is an owned slice. The caller is responsible for /// freeing the returned memory. pub fn toSlice(allocator: std.mem.Allocator, value: anytype) ![]const u8 { var list = try std.ArrayList(u8).initCapacity(allocator, 128); errdefer list.deinit(); try toWriter(value, list.writer()); return list.toOwnedSlice(); } /// Serialize the given value as a pretty-printed JSON string. /// /// The serialized string is an owned slice. The caller is responsible for /// freeing the returned memory. pub fn toPrettySlice(allocator: std.mem.Allocator, value: anytype) ![]const u8 { var list = try std.ArrayList(u8).initCapacity(allocator, 128); errdefer list.deinit(); try toPrettyWriter(value, list.writer()); return list.toOwnedSlice(); } /// Serialize the given value as a JSON string with the given `getty.Ser` /// interface value. /// /// The serialized string is an owned slice. The caller is responsible for /// freeing the returned memory. pub fn toSliceWith(allocator: std.mem.Allocator, value: anytype, _ser: anytype) ![]const u8 { comptime getty.concepts.@"getty.Ser"(@TypeOf(_ser)); var list = try std.ArrayList(u8).initCapacity(allocator, 128); errdefer list.deinit(); try toWriterWith(value, list.writer(), _ser); return list.toOwnedSlice(); } /// Serialize the given value as a pretty-printed JSON string with the given /// `getty.Ser` interface value. /// /// The serialized string is an owned slice. The caller is responsible for /// freeing the returned memory. pub fn toPrettySliceWith(allocator: std.mem.Allocator, value: anytype, _ser: anytype) ![]const u8 { comptime getty.concepts.@"getty.Ser"(@TypeOf(_ser)); var list = try std.ArrayList(u8).initCapacity(allocator, 128); errdefer list.deinit(); try toPrettyWriterWith(value, list.writer(), _ser); return list.toOwnedSlice(); } const concepts = struct { fn @"std.io.Writer"(comptime T: type) void { const err = "expected `std.io.Writer` interface value, found `" ++ @typeName(T) ++ "`"; comptime { // Invariants if (!std.meta.trait.isContainer(T)) { @compileError(err); } // Constraints const has_name = std.mem.startsWith(u8, @typeName(T), "std.io.writer.Writer"); const has_field = std.meta.trait.hasField("context")(T); const has_decl = @hasDecl(T, "Error"); const has_funcs = std.meta.trait.hasFunctions(T, .{ "write", "writeAll", "print", "writeByte", "writeByteNTimes", "writeIntNative", "writeIntForeign", "writeIntLittle", "writeIntBig", "writeInt", "writeStruct", }); if (!(has_name and has_field and has_decl and has_funcs)) { @compileError(err); } } } }; test "toWriter - Array" { try t(.compact, [_]i8{}, "[]"); try t(.compact, [_]i8{1}, "[1]"); try t(.compact, [_]i8{ 1, 2, 3, 4 }, "[1,2,3,4]"); const T = struct { x: i32 }; try t(.compact, [_]T{ T{ .x = 10 }, T{ .x = 100 }, T{ .x = 1000 } }, "[{\"x\":10},{\"x\":100},{\"x\":1000}]"); } test "toWriter - ArrayList" { var list = std.ArrayList(i32).init(std.testing.allocator); defer list.deinit(); try list.append(1); try list.append(2); try list.append(3); try t(.compact, list, "[1,2,3]"); } test "toWriter - Bool" { try t(.compact, true, "true"); try t(.compact, false, "false"); } test "toWriter - Enum" { try t(.compact, enum { foo }.foo, "\"foo\""); try t(.compact, .foo, "\"foo\""); } test "toWriter - Error" { try t(.compact, error.Foobar, "\"Foobar\""); } test "toWriter - HashMap" { var map = std.StringHashMap(i32).init(std.testing.allocator); defer map.deinit(); try map.put("x", 1); try map.put("y", 2); try t(.compact, map, "{\"x\":1,\"y\":2}"); } test "toWriter - Integer" { try t(.compact, 1, "1"); try t(.compact, -1, "-1"); try t(.compact, std.math.maxInt(u8), "255"); try t(.compact, std.math.maxInt(u32), "4294967295"); try t(.compact, std.math.maxInt(u64), "18446744073709551615"); try t(.compact, std.math.maxInt(u128), "340282366920938463463374607431768211455"); try t(.compact, std.math.maxInt(i8), "127"); try t(.compact, std.math.maxInt(i32), "2147483647"); try t(.compact, std.math.maxInt(i64), "9223372036854775807"); try t(.compact, std.math.maxInt(i128), "170141183460469231731687303715884105727"); try t(.compact, std.math.minInt(i8) + 1, "-127"); try t(.compact, std.math.minInt(i32) + 1, "-2147483647"); try t(.compact, std.math.minInt(i64) + 1, "-9223372036854775807"); try t(.compact, std.math.minInt(i128) + 1, "-170141183460469231731687303715884105727"); try t(.compact, std.math.minInt(i8), "-128"); try t(.compact, std.math.minInt(i32), "-2147483648"); try t(.compact, std.math.minInt(i64), "-9223372036854775808"); try t(.compact, std.math.minInt(i128), "-170141183460469231731687303715884105728"); } test "toWriter - Float" { try t(.compact, 0.0, "0.0e+00"); try t(.compact, 1.0, "1.0e+00"); try t(.compact, -1.0, "-1.0e+00"); try t(.compact, @as(f32, 42.0), "4.2e+01"); try t(.compact, @as(f64, 42.0), "4.2e+01"); } test "toWriter - Null" { try t(.compact, null, "null"); try t(.compact, @as(?u8, null), "null"); try t(.compact, @as(?*u8, null), "null"); } test "toWriter - String" { { // Basic strings try t(.compact, "string", "\"string\""); } { // Control characters try t(.compact, "\"", "\"\\\"\""); try t(.compact, "\\", "\"\\\\\""); try t(.compact, "\x08", "\"\\b\""); try t(.compact, "\t", "\"\\t\""); try t(.compact, "\n", "\"\\n\""); try t(.compact, "\x0C", "\"\\f\""); try t(.compact, "\r", "\"\\r\""); try t(.compact, "\u{0}", "\"\\u0000\""); try t(.compact, "\u{1F}", "\"\\u001f\""); try t(.compact, "\u{7F}", "\"\\u007f\""); try t(.compact, "\u{2028}", "\"\\u2028\""); try t(.compact, "\u{2029}", "\"\\u2029\""); } { // Basic Multilingual Plane try t(.compact, "\u{FF}", "\"\u{FF}\""); try t(.compact, "\u{100}", "\"\u{100}\""); try t(.compact, "\u{800}", "\"\u{800}\""); try t(.compact, "\u{8000}", "\"\u{8000}\""); try t(.compact, "\u{D799}", "\"\u{D799}\""); } { // Non-Basic Multilingual Plane try t(.compact, "\u{10000}", "\"\\ud800\\udc00\""); try t(.compact, "\u{10FFFF}", "\"\\udbff\\udfff\""); try t(.compact, "😁", "\"\\ud83d\\ude01\""); try t(.compact, "😂", "\"\\ud83d\\ude02\""); try t(.compact, "hello😁", "\"hello\\ud83d\\ude01\""); try t(.compact, "hello😁world😂", "\"hello\\ud83d\\ude01world\\ud83d\\ude02\""); } } test "toWriter - Struct" { try t(.compact, struct {}{}, "{}"); try t(.compact, struct { x: void }{ .x = {} }, "{}"); try t( .compact, struct { x: i32, y: i32, z: struct { x: bool, y: [3]i8 } }{ .x = 1, .y = 2, .z = .{ .x = true, .y = .{ 1, 2, 3 } }, }, "{\"x\":1,\"y\":2,\"z\":{\"x\":true,\"y\":[1,2,3]}}", ); } test "toWriter - Tuple" { try t(.compact, .{ 1, true, "ring" }, "[1,true,\"ring\"]"); } test "toWriter - Tagged Union" { try t(.compact, union(enum) { Foo: i32, Bar: bool }{ .Foo = 42 }, "42"); } test "toWriter - Vector" { try t(.compact, @splat(2, @as(u32, 1)), "[1,1]"); } test "toWriter - Void" { try t(.compact, {}, "null"); } test "toPrettyWriter - Struct" { try t(.pretty, struct {}{}, "{}"); try t(.pretty, struct { x: i32, y: i32, z: struct { x: bool, y: [3]i8 } }{ .x = 1, .y = 2, .z = .{ .x = true, .y = .{ 1, 2, 3 } }, }, \\{ \\ "x": 1, \\ "y": 2, \\ "z": { \\ "x": true, \\ "y": [ \\ 1, \\ 2, \\ 3 \\ ] \\ } \\} ); } const Format = enum { compact, pretty }; fn t(format: Format, value: anytype, expected: []const u8) !void { const ValidationWriter = struct { remaining: []const u8, const Self = @This(); pub const Error = error{ TooMuchData, DifferentData, }; fn init(s: []const u8) Self { return .{ .remaining = s }; } /// Implements `std.io.Writer`. pub fn writer(self: *Self) std.io.Writer(*Self, Error, write) { return .{ .context = self }; } fn write(self: *Self, bytes: []const u8) Error!usize { if (self.remaining.len < bytes.len) { std.log.warn("\n" ++ \\======= expected: ======= \\{s} \\======== found: ========= \\{s} \\========================= , .{ self.remaining, bytes, }); return error.TooMuchData; } if (!std.mem.eql(u8, self.remaining[0..bytes.len], bytes)) { std.log.warn("\n" ++ \\======= expected: ======= \\{s} \\======== found: ========= \\{s} \\========================= , .{ self.remaining[0..bytes.len], bytes, }); return error.DifferentData; } self.remaining = self.remaining[bytes.len..]; return bytes.len; } }; var w = ValidationWriter.init(expected); try switch (format) { .compact => toWriter(value, w.writer()), .pretty => toPrettyWriter(value, w.writer()), }; if (w.remaining.len > 0) { return error.NotEnoughData; } }
src/ser.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const unicode = std.unicode; const CodePoint = @import("CodePoint.zig"); const CodePointIterator = CodePoint.CodePointIterator; const emoji = @import("../ziglyph.zig").emoji_data; const gbp = @import("../ziglyph.zig").grapheme_break_property; pub const Grapheme = @This(); bytes: []const u8, offset: usize, /// `eql` comparse `str` with the bytes of this grapheme cluster for equality. pub fn eql(self: Grapheme, str: []const u8) bool { return mem.eql(u8, self.bytes, str); } const Type = enum { control, cr, extend, han_l, han_lv, han_lvt, han_t, han_v, lf, prepend, regional, spacing, 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 (gbp.isControl(cp.scalar)) ty = .control; if (gbp.isExtend(cp.scalar)) ty = .extend; if (gbp.isL(cp.scalar)) ty = .han_l; if (gbp.isLv(cp.scalar)) ty = .han_lv; if (gbp.isLvt(cp.scalar)) ty = .han_lvt; if (gbp.isT(cp.scalar)) ty = .han_t; if (gbp.isV(cp.scalar)) ty = .han_v; if (gbp.isPrepend(cp.scalar)) ty = .prepend; if (gbp.isRegionalIndicator(cp.scalar)) ty = .regional; if (gbp.isSpacingmark(cp.scalar)) ty = .spacing; 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; } }; /// `GraphemeIterator` iterates a sting one grapheme cluster at-a-time. pub const GraphemeIterator = 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) ?Grapheme { if (self.advance()) |latest_non_ignorable| { var end = self.current.?; if (isBreaker(latest_non_ignorable)) { if (latest_non_ignorable.is(.cr)) { if (self.peek()) |p| { // GB3 if (p.is(.lf)) { _ = self.advance(); end = self.current.?; } } } } if (latest_non_ignorable.is(.regional)) { if (self.peek()) |p| { // GB12 if (p.is(.regional) and !isIgnorable(end)) { _ = self.advance(); end = self.current.?; } } } if (latest_non_ignorable.is(.han_l)) { if (self.peek()) |p| { // GB6 if ((p.is(.han_l) or p.is(.han_v) or p.is(.han_lv) or p.is(.han_lvt)) and !isIgnorable(end)) { _ = self.advance(); end = self.current.?; } } } if (latest_non_ignorable.is(.han_lv) or latest_non_ignorable.is(.han_v)) { if (self.peek()) |p| { // GBy if ((p.is(.han_v) or p.is(.han_t)) and !isIgnorable(end)) { _ = self.advance(); end = self.current.?; } } } if (latest_non_ignorable.is(.han_lvt) or latest_non_ignorable.is(.han_t)) { if (self.peek()) |p| { // GB8 if (p.is(.han_t) and !isIgnorable(end)) { _ = self.advance(); end = self.current.?; } } } if (latest_non_ignorable.is(.xpic)) { if (self.peek()) |p| { // GB11 if (p.is(.xpic) and end.is(.zwj)) { _ = self.advance(); end = self.current.?; } } } const start = self.start.?; self.start = self.peek(); // GB999 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. // GB9b if (latest_non_ignorable.is(.prepend)) { if (self.peek()) |p| { if (!isBreaker(p)) return self.advance(); } } // GB9, GBia // NOTE: This may increment self.i, making self.current a different token then latest_non_ignorable. if (!isBreaker(latest_non_ignorable)) self.skipIgnorables(); return latest_non_ignorable; } 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) Grapheme { 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 isBreaker(token: Token) bool { return token.ty == .control or token.ty == .cr or token.ty == .lf; } fn isControl(token: Token) bool { return token.ty == .control; } fn isIgnorable(token: Token) bool { return token.ty == .extend or token.ty == .spacing or token.ty == .zwj; } test "Segmentation GraphemeIterator" { 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/GraphemeBreakTest.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(Grapheme).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 sentences = mem.split(u8, line, " ÷ "); var bytes_index: usize = 0; while (sentences.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(Grapheme{ .bytes = cp_bytes.toOwnedSlice(), .offset = bytes_index, }); bytes_index += cp_index; } //debug.print("\nline {}: {s}\n", .{ line_no, all_bytes.items }); var iter = try GraphemeIterator.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 GraphemeIterator" { const want = [_][]const u8{ "H", "é", "l", "l", "o" }; comptime { var ct_iter = try GraphemeIterator.init("Héllo"); var i = 0; while (ct_iter.next()) |grapheme| : (i += 1) { try testing.expect(grapheme.eql(want[i])); } } }
src/segmenter/Grapheme.zig
const std = @import("std"); const stdx = @import("stdx"); const MaybeOwned = stdx.ds.MaybeOwned; const builtin = @import("builtin"); const uv = @import("uv"); const h2o = @import("h2o"); const ssl = @import("openssl"); const v8 = @import("v8"); const runtime = @import("runtime.zig"); const RuntimeContext = runtime.RuntimeContext; const ThisResource = runtime.ThisResource; const PromiseId = runtime.PromiseId; const ResourceId = runtime.ResourceId; const log = stdx.log.scoped(.server); pub const HttpServer = struct { const Self = @This(); rt: *RuntimeContext, listen_handle: uv.uv_tcp_t, h2o_started: bool, config: h2o.h2o_globalconf, hostconf: *h2o.h2o_hostconf, ctx: h2o.h2o_context, accept_ctx: h2o.h2o_accept_ctx, generator: h2o.h2o_generator_t, // Track active socket handles to make sure we freed all uv handles. // This is not always the number of active connections since it's incremented the moment we allocate a uv handle. socket_handles: u32, closing: bool, closed_listen_handle: bool, // When true, it means there are no handles to be cleaned up. The initial state is true. // If we end up owning additional memory in the future, we'd still need to deinit those. closed: bool, js_handler: ?v8.Persistent(v8.Function), https: bool, on_shutdown_cb: ?stdx.Callback(*anyopaque, *Self), // The initial state is closed and nothing happens until we do startHttp/startHttps. pub fn init(self: *Self, rt: *RuntimeContext) void { self.* = .{ .rt = rt, .listen_handle = undefined, .h2o_started = false, .config = undefined, .hostconf = undefined, .ctx = undefined, .accept_ctx = undefined, .js_handler = null, .generator = .{ .proceed = null, .stop = null }, .closing = false, .closed = true, .socket_handles = 0, .closed_listen_handle = true, .https = false, .on_shutdown_cb = null, }; } // Deinit before entering closing phase. pub fn deinitPreClosing(self: *Self) void { _ = self; } pub fn allocBindAddress(self: Self, alloc: std.mem.Allocator) Address { var addr: uv.sockaddr = undefined; var namelen: c_int = @sizeOf(@TypeOf(addr)); const res = uv.uv_tcp_getsockname(&self.listen_handle, &addr, &namelen); uv.assertNoError(res); const port = std.mem.readIntBig(u16, addr.sa_data[0..2]); const host = std.fmt.allocPrint(alloc, "{}.{}.{}.{}", .{addr.sa_data[2], addr.sa_data[3], addr.sa_data[4], addr.sa_data[5]}) catch unreachable; return .{ .host = host, .port = port, }; } /// This is just setting up the uv socket listener. Does not set up for http or https. /// host can be an IP address or "localhost". This does not call getaddrinfo() to resolve a hostname since most of the time it's unnecessary to do a full dns lookup. fn startListener(self: *Self, host: []const u8, port: u16) !void { const rt = self.rt; self.closed = false; var r: c_int = undefined; r = uv.uv_tcp_init(rt.uv_loop, &self.listen_handle); uv.assertNoError(r); // Need to callback with handle. self.listen_handle.data = self; self.closed_listen_handle = false; errdefer self.requestShutdown(); var addr: uv.sockaddr_in = undefined; const MaybeOwnedCstr = MaybeOwned([:0]const u8); const c_host = if (std.mem.eql(u8, host, "localhost")) MaybeOwnedCstr.initUnowned("127.0.0.1") else MaybeOwnedCstr.initOwned(std.cstr.addNullByte(rt.alloc, host) catch unreachable); defer c_host.deinit(rt.alloc); r = uv.uv_ip4_addr(c_host.inner, port, &addr); uv.assertNoError(r); r = uv.uv_tcp_bind(&self.listen_handle, @ptrCast(*uv.sockaddr, &addr), 0); if (r != 0) { log.debug("uv_tcp_bind: {s}", .{uv.uv_strerror(r)}); return error.SocketAddrBind; } r = uv.uv_listen(@ptrCast(*uv.uv_stream_t, &self.listen_handle), 128, HttpServer.onAccept); if (r != 0) { log.debug("uv_listen: {s}", .{uv.uv_strerror(r)}); return error.ListenError; } } /// Default H2O startup for both HTTP/HTTPS fn startH2O(self: *Self) void { h2o.h2o_config_init(&self.config); // H2O already has proper behavior for resending GOAWAY after 1 second. // If this is greater than 0 it will be an additional timeout to force close remaining connections. // Have not seen any need for this yet, so turn it off. self.config.http2.graceful_shutdown_timeout = 0; // Zig in release-safe has trouble with string literals if they aren't used in zig code, eg. if they are just being passed into C functions. // First noticed on windows build. var buf: [100]u8 = undefined; const default = std.fmt.bufPrint(&buf, "default", .{}) catch unreachable; self.hostconf = h2o.h2o_config_register_host(&self.config, h2o.h2o_iovec_init(default), 65535); h2o.h2o_context_init(&self.ctx, self.rt.uv_loop, &self.config); self.accept_ctx = .{ .ctx = &self.ctx, .hosts = self.config.hosts, .ssl_ctx = null, .http2_origin_frame = null, .expect_proxy_line = 0, .libmemcached_receiver = null, }; _ = self.registerHandler("/", HttpServer.defaultHandler); self.h2o_started = true; } /// If an error occurs during startup, the server will request shutdown and be in a closing state. /// "closed" should be checked later on to ensure everything was cleaned up. pub fn startHttp(self: *Self, host: []const u8, port: u16) !void { try self.startListener(host, port); self.startH2O(); } pub fn startHttps(self: *Self, host: []const u8, port: u16, cert_path: []const u8, key_path: []const u8) !void { try self.startListener(host, port); self.startH2O(); self.https = true; self.accept_ctx.ssl_ctx = ssl.SSL_CTX_new(ssl.TLS_server_method()); _ = ssl.initLibrary(); _ = ssl.addAllAlgorithms(); // Disable deprecated or vulnerable protocols. _ = ssl.SSL_CTX_set_options(self.accept_ctx.ssl_ctx, ssl.SSL_OP_NO_SSLv2); _ = ssl.SSL_CTX_set_options(self.accept_ctx.ssl_ctx, ssl.SSL_OP_NO_SSLv3); _ = ssl.SSL_CTX_set_options(self.accept_ctx.ssl_ctx, ssl.SSL_OP_NO_TLSv1); _ = ssl.SSL_CTX_set_options(self.accept_ctx.ssl_ctx, ssl.SSL_OP_NO_DTLSv1); _ = ssl.SSL_CTX_set_options(self.accept_ctx.ssl_ctx, ssl.SSL_OP_NO_TLSv1_1); errdefer self.requestShutdown(); const rt = self.rt; const c_cert = std.cstr.addNullByte(rt.alloc, cert_path) catch unreachable; defer rt.alloc.free(c_cert); const c_key = std.cstr.addNullByte(rt.alloc, key_path) catch unreachable; defer rt.alloc.free(c_key); if (ssl.SSL_CTX_use_certificate_chain_file(self.accept_ctx.ssl_ctx, c_cert) != 1) { log.debug("Failed to load server certificate file: {s}", .{cert_path}); return error.UseCertificate; } if (ssl.SSL_CTX_use_PrivateKey_file(self.accept_ctx.ssl_ctx, c_key, ssl.SSL_FILETYPE_PEM) != 1) { log.debug("Failed to load private key file: {s}", .{key_path}); return error.UsePrivateKey; } // Ciphers for TLS 1.2 and below. { const ciphers = "DEFAULT:!MD5:!DSS:!DES:!RC4:!RC2:!SEED:!IDEA:!NULL:!ADH:!EXP:!SRP:!PSK"; if (ssl.SSL_CTX_set_cipher_list(self.accept_ctx.ssl_ctx, ciphers) != 1) { log.debug("Failed to set ciphers: {s}\n", .{ciphers}); return error.UseCiphers; } } // Ciphers for TLS 1.3 { const ciphers = "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"; if (ssl.SSL_CTX_set_ciphersuites(self.accept_ctx.ssl_ctx, ciphers) != 1) { log.debug("Failed to set ciphers: {s}\n", .{ciphers}); return error.UseCiphers; } } // Accept requests using ALPN. h2o.h2o_ssl_register_alpn_protocols(self.accept_ctx.ssl_ctx.?, h2o.h2o_get_alpn_protocols()); } fn onCloseListenHandle(ptr: [*c]uv.uv_handle_t) callconv(.C) void { const handle = @ptrCast(*uv.uv_tcp_t, ptr); const self = stdx.mem.ptrCastAlign(*Self, handle.data.?); // We don't need to free the handle since it's embedded into server struct. self.closed_listen_handle = true; self.updateClosed(); } fn registerHandler(self: *Self, path: [:0]const u8, onRequest: fn (handler: *h2o.h2o_handler, req: *h2o.h2o_req) callconv(.C) c_int) *h2o.h2o_pathconf { const pathconf = h2o.h2o_config_register_path(self.hostconf, path, 0); var handler = @ptrCast(*H2oServerHandler, h2o.h2o_create_handler(pathconf, @sizeOf(H2oServerHandler)).?); handler.super.on_req = onRequest; handler.server = self; return pathconf; } fn defaultHandler(ptr: *h2o.h2o_handler, req: *h2o.h2o_req) callconv(.C) c_int { const self = @ptrCast(*H2oServerHandler, ptr).server; const iso = self.rt.isolate; const ctx = self.rt.getContext(); if (self.js_handler) |handler| { const js_req = self.rt.default_obj_t.inner.initInstance(ctx); const method = req.method.base[0..req.method.len]; _ = js_req.setValue(ctx, iso.initStringUtf8("method"), iso.initStringUtf8(method)); const path = req.path_normalized.base[0..req.path_normalized.len]; _ = js_req.setValue(ctx, iso.initStringUtf8("path"), iso.initStringUtf8(path)); if (req.proceed_req == null) { // Already received request body. if (req.entity.len > 0) { const body_buf = runtime.Uint8Array{ .buf = req.entity.base[0..req.entity.len] }; const js_val = self.rt.getJsValue(body_buf); _ = js_req.setValue(ctx, iso.initStringUtf8("body"), js_val); } else { _ = js_req.setValue(ctx, iso.initStringUtf8("body"), self.rt.js_null); } } else unreachable; ResponseWriter.cur_req = req; ResponseWriter.called_send = false; ResponseWriter.cur_generator = &self.generator; const writer = self.rt.http_response_writer.inner.initInstance(ctx); if (handler.inner.call(ctx, self.rt.js_undefined, &.{ js_req.toValue(), writer.toValue() })) |res| { // If user code returned true or called send, report as handled. if (res.toBool(iso) or ResponseWriter.called_send) { return 0; } } else { // Js exception, start shutdown. self.requestShutdown(); } } // Let H2o serve default 404 not found. return -1; } fn onAccept(listener: *uv.uv_stream_t, status: c_int) callconv(.C) void { // log.debug("on accept", .{}); if (status != 0) { return; } const self = stdx.mem.ptrCastAlign(*HttpServer, listener.data.?); // h2o will set its own data on uv_tcp_t so use a custom struct. var conn = self.rt.alloc.create(H2oUvTcp) catch unreachable; conn.server = self; _ = uv.uv_tcp_init(listener.loop, @ptrCast(*uv.uv_tcp_t, conn)); self.socket_handles += 1; if (uv.uv_accept(listener, @ptrCast(*uv.uv_stream_t, conn)) != 0) { conn.super.data = self; uv.uv_close(@ptrCast(*uv.uv_handle_t, conn), onCloseH2oSocketHandle); return; } var sock = h2o.h2o_uv_socket_create(@ptrCast(*uv.uv_handle_t, conn), onCloseH2oSocketHandle).?; h2o.h2o_accept(&self.accept_ctx, sock); } // For closing uv handles that have been attached to h2o handles. fn onCloseH2oSocketHandle(ptr: [*c]uv.uv_handle_t) callconv(.C) void { const kind = uv.uv_handle_get_type(ptr); if (kind == uv.UV_TCP) { const handle = @ptrCast(*H2oUvTcp, ptr); const self = stdx.mem.ptrCastAlign(*HttpServer, handle.server); self.rt.alloc.destroy(handle); self.socket_handles -= 1; self.updateClosed(); } else { unreachable; } } fn updateClosed(self: *Self) void { if (self.closed) { return; } if (self.socket_handles > 0) { return; } if (!self.closed_listen_handle) { return; } self.closed = true; // Even though there aren't any more connections or a listening port, // h2o's graceful timeout might still be active. // Make sure to close that since being in a closed state means this memory could be freed, // and the timeout could fire later and reference undefined memory. if (self.ctx.globalconf.http2.callbacks.request_shutdown != null) { if (self.ctx.http2._graceful_shutdown_timeout.is_linked == 1) { h2o.h2o_timer_unlink(&self.ctx.http2._graceful_shutdown_timeout); } } // h2o context and config also need to be deinited. h2o.h2o_context_dispose(&self.ctx); h2o.h2o_config_dispose(&self.config); if (self.on_shutdown_cb) |cb| { cb.call(self); } } pub fn requestShutdown(self: *Self) void { if (self.closing) { return; } if (self.h2o_started) { // Once shutdown is requested, h2o won't be accepting more connections // and will start to gracefully shutdown existing connections. // After a small delay, a timeout will force any connections to close. // We track number of socket handles and once there are no more, we mark this done in updateClosed. h2o.h2o_context_request_shutdown(&self.ctx); // Interrupt uv poller to consider any graceful shutdown timeouts set by h2o. eg. http2 resend GOAWAY const res = uv.uv_async_send(self.rt.uv_dummy_async); uv.assertNoError(res); } if (!self.closed_listen_handle) { // NOTE: libuv does not start listeners with reuseaddr on windows since it behaves differently and isn't desirable. // This means the listening port may still be in a TIME_WAIT state for some time after it was "shutdown". uv.uv_close(@ptrCast(*uv.uv_handle_t, &self.listen_handle), HttpServer.onCloseListenHandle); } self.closing = true; } }; const H2oUvTcp = struct { super: uv.uv_tcp_t, server: *HttpServer, }; // https://github.com/h2o/h2o/issues/181 const H2oServerHandler = struct { super: h2o.h2o_handler, server: *HttpServer, }; pub const ResponseWriter = struct { pub var cur_req: ?*h2o.h2o_req = null; pub var cur_generator: *h2o.h2o_generator_t = undefined; pub var called_send: bool = false; pub fn setStatus(status_code: u32) void { if (cur_req) |req| { req.res.status = @intCast(c_int, status_code); req.res.reason = getStatusReason(status_code).ptr; } } pub fn setHeader(key: []const u8, value: []const u8) void { if (cur_req) |req| { // h2o doesn't dupe the value by default. var value_slice = h2o.h2o_strdup(&req.pool, value.ptr, value.len); _ = h2o.h2o_set_header_by_str(&req.pool, &req.res.headers, key.ptr, key.len, 1, value_slice.base, value_slice.len, 1); } } pub fn send(text: []const u8) void { if (called_send) return; if (cur_req) |req| { h2o.h2o_start_response(req, cur_generator); // Send can be async so dupe. var slice = h2o.h2o_strdup(&req.pool, text.ptr, text.len); h2o.h2o_send(req, &slice, 1, h2o.H2O_SEND_STATE_FINAL); called_send = true; } } pub fn sendBytes(arr: runtime.Uint8Array) void { if (called_send) return; if (cur_req) |req| { h2o.h2o_start_response(req, cur_generator); // Send can be async so dupe. var slice = h2o.h2o_strdup(&req.pool, arr.buf.ptr, arr.buf.len); h2o.h2o_send(req, &slice, 1, h2o.H2O_SEND_STATE_FINAL); called_send = true; } } }; fn getStatusReason(code: u32) []const u8 { switch (code) { 200 => return "OK", 201 => return "Created", 301 => return "Moved Permanently", 302 => return "Found", 303 => return "See Other", 304 => return "Not Modified", 400 => return "Bad Request", 401 => return "Unauthorized", 402 => return "Payment Required", 403 => return "Forbidden", 404 => return "Not Found", 405 => return "Method Not Allowed", 500 => return "Internal Server Error", 501 => return "Not Implemented", 502 => return "Bad Gateway", 503 => return "Service Unavailable", 504 => return "Gateway Timeout", else => unreachable, } } const Address = struct { host: []const u8, port: u16, pub fn deinit(self: @This(), alloc: std.mem.Allocator) void { alloc.free(self.host); } };
runtime/server.zig
const std = @import("std"); const builtin = @import("builtin"); const maxInt = std.math.maxInt; const isNan = std.math.isNan; const is_wasm = switch (builtin.arch) { .wasm32, .wasm64 => true, else => false, }; const is_msvc = switch (builtin.abi) { .msvc => true, else => false, }; const is_freestanding = switch (builtin.os.tag) { .freestanding => true, else => false, }; comptime { if (is_freestanding and is_wasm and builtin.link_libc) { @export(wasm_start, .{ .name = "_start", .linkage = .Strong }); } if (builtin.link_libc) { @export(strcmp, .{ .name = "strcmp", .linkage = .Strong }); @export(strncmp, .{ .name = "strncmp", .linkage = .Strong }); @export(strerror, .{ .name = "strerror", .linkage = .Strong }); @export(strlen, .{ .name = "strlen", .linkage = .Strong }); @export(strcpy, .{ .name = "strcpy", .linkage = .Strong }); @export(strncpy, .{ .name = "strncpy", .linkage = .Strong }); @export(strcat, .{ .name = "strcat", .linkage = .Strong }); @export(strncat, .{ .name = "strncat", .linkage = .Strong }); } else if (is_msvc) { @export(_fltused, .{ .name = "_fltused", .linkage = .Strong }); } } var _fltused: c_int = 1; extern fn main(argc: c_int, argv: [*:null]?[*:0]u8) c_int; fn wasm_start() callconv(.C) void { _ = main(0, undefined); } fn strcpy(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 { var i: usize = 0; while (src[i] != 0) : (i += 1) { dest[i] = src[i]; } dest[i] = 0; return dest; } test "strcpy" { var s1: [9:0]u8 = undefined; s1[0] = 0; _ = strcpy(&s1, "foobarbaz"); std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.spanZ(&s1)); } fn strncpy(dest: [*:0]u8, src: [*:0]const u8, n: usize) callconv(.C) [*:0]u8 { var i: usize = 0; while (i < n and src[i] != 0) : (i += 1) { dest[i] = src[i]; } while (i < n) : (i += 1) { dest[i] = 0; } return dest; } test "strncpy" { var s1: [9:0]u8 = undefined; s1[0] = 0; _ = strncpy(&s1, "foobarbaz", 9); std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.spanZ(&s1)); } fn strcat(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 { var dest_end: usize = 0; while (dest[dest_end] != 0) : (dest_end += 1) {} var i: usize = 0; while (src[i] != 0) : (i += 1) { dest[dest_end + i] = src[i]; } dest[dest_end + i] = 0; return dest; } test "strcat" { var s1: [9:0]u8 = undefined; s1[0] = 0; _ = strcat(&s1, "foo"); _ = strcat(&s1, "bar"); _ = strcat(&s1, "baz"); std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.spanZ(&s1)); } fn strncat(dest: [*:0]u8, src: [*:0]const u8, avail: usize) callconv(.C) [*:0]u8 { var dest_end: usize = 0; while (dest[dest_end] != 0) : (dest_end += 1) {} var i: usize = 0; while (i < avail and src[i] != 0) : (i += 1) { dest[dest_end + i] = src[i]; } dest[dest_end + i] = 0; return dest; } test "strncat" { var s1: [9:0]u8 = undefined; s1[0] = 0; _ = strncat(&s1, "foo1111", 3); _ = strncat(&s1, "bar1111", 3); _ = strncat(&s1, "baz1111", 3); std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.spanZ(&s1)); } fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) callconv(.C) c_int { return std.cstr.cmp(s1, s2); } fn strlen(s: [*:0]const u8) callconv(.C) usize { return std.mem.len(s); } fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.C) c_int { if (_n == 0) return 0; var l = _l; var r = _r; var n = _n - 1; while (l[0] != 0 and r[0] != 0 and n != 0 and l[0] == r[0]) { l += 1; r += 1; n -= 1; } return @as(c_int, l[0]) - @as(c_int, r[0]); } fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 { return "TODO strerror implementation"; } test "strncmp" { std.testing.expect(strncmp("a", "b", 1) == -1); std.testing.expect(strncmp("a", "c", 1) == -2); std.testing.expect(strncmp("b", "a", 1) == 1); std.testing.expect(strncmp("\xff", "\x02", 1) == 253); } // Avoid dragging in the runtime safety mechanisms into this .o file, // unless we're trying to test this file. pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { if (builtin.is_test) { @setCold(true); std.debug.panic("{}", .{msg}); } if (builtin.os.tag != .freestanding and builtin.os.tag != .other) { std.os.abort(); } while (true) {} } export fn memset(dest: ?[*]u8, c: u8, n: usize) callconv(.C) ?[*]u8 { @setRuntimeSafety(false); var index: usize = 0; while (index != n) : (index += 1) dest.?[index] = c; return dest; } export fn __memset(dest: ?[*]u8, c: u8, n: usize, dest_n: usize) callconv(.C) ?[*]u8 { if (dest_n < n) @panic("buffer overflow"); return memset(dest, c, n); } export fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8 { @setRuntimeSafety(false); var index: usize = 0; while (index != n) : (index += 1) dest.?[index] = src.?[index]; return dest; } export fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8 { @setRuntimeSafety(false); if (@ptrToInt(dest) < @ptrToInt(src)) { var index: usize = 0; while (index != n) : (index += 1) { dest.?[index] = src.?[index]; } } else { var index = n; while (index != 0) { index -= 1; dest.?[index] = src.?[index]; } } return dest; } export fn memcmp(vl: ?[*]const u8, vr: ?[*]const u8, n: usize) callconv(.C) isize { @setRuntimeSafety(false); var index: usize = 0; while (index != n) : (index += 1) { const compare_val = @bitCast(i8, vl.?[index] -% vr.?[index]); if (compare_val != 0) { return compare_val; } } return 0; } test "test_memcmp" { const base_arr = &[_]u8{ 1, 1, 1 }; const arr1 = &[_]u8{ 1, 1, 1 }; const arr2 = &[_]u8{ 1, 0, 1 }; const arr3 = &[_]u8{ 1, 2, 1 }; std.testing.expect(memcmp(base_arr[0..], arr1[0..], base_arr.len) == 0); std.testing.expect(memcmp(base_arr[0..], arr2[0..], base_arr.len) > 0); std.testing.expect(memcmp(base_arr[0..], arr3[0..], base_arr.len) < 0); } export fn bcmp(vl: [*]allowzero const u8, vr: [*]allowzero const u8, n: usize) callconv(.C) isize { @setRuntimeSafety(false); var index: usize = 0; while (index != n) : (index += 1) { if (vl[index] != vr[index]) { return 1; } } return 0; } test "test_bcmp" { const base_arr = &[_]u8{ 1, 1, 1 }; const arr1 = &[_]u8{ 1, 1, 1 }; const arr2 = &[_]u8{ 1, 0, 1 }; const arr3 = &[_]u8{ 1, 2, 1 }; std.testing.expect(bcmp(base_arr[0..], arr1[0..], base_arr.len) == 0); std.testing.expect(bcmp(base_arr[0..], arr2[0..], base_arr.len) != 0); std.testing.expect(bcmp(base_arr[0..], arr3[0..], base_arr.len) != 0); } comptime { if (builtin.os.tag == .linux) { @export(clone, .{ .name = "clone" }); } } // TODO we should be able to put this directly in std/linux/x86_64.zig but // it causes a segfault in release mode. this is a workaround of calling it // across .o file boundaries. fix comptime @ptrCast of nakedcc functions. fn clone() callconv(.Naked) void { switch (builtin.arch) { .i386 => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // +8, +12, +16, +20, +24, +28, +32 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // eax, ebx, ecx, edx, esi, edi asm volatile ( \\ push %%ebp \\ mov %%esp,%%ebp \\ push %%ebx \\ push %%esi \\ push %%edi \\ // Setup the arguments \\ mov 16(%%ebp),%%ebx \\ mov 12(%%ebp),%%ecx \\ and $-16,%%ecx \\ sub $20,%%ecx \\ mov 20(%%ebp),%%eax \\ mov %%eax,4(%%ecx) \\ mov 8(%%ebp),%%eax \\ mov %%eax,0(%%ecx) \\ mov 24(%%ebp),%%edx \\ mov 28(%%ebp),%%esi \\ mov 32(%%ebp),%%edi \\ mov $120,%%eax \\ int $128 \\ test %%eax,%%eax \\ jnz 1f \\ pop %%eax \\ xor %%ebp,%%ebp \\ call *%%eax \\ mov %%eax,%%ebx \\ xor %%eax,%%eax \\ inc %%eax \\ int $128 \\ hlt \\1: \\ pop %%edi \\ pop %%esi \\ pop %%ebx \\ pop %%ebp \\ ret ); }, .x86_64 => { asm volatile ( \\ xor %%eax,%%eax \\ mov $56,%%al // SYS_clone \\ mov %%rdi,%%r11 \\ mov %%rdx,%%rdi \\ mov %%r8,%%rdx \\ mov %%r9,%%r8 \\ mov 8(%%rsp),%%r10 \\ mov %%r11,%%r9 \\ and $-16,%%rsi \\ sub $8,%%rsi \\ mov %%rcx,(%%rsi) \\ syscall \\ test %%eax,%%eax \\ jnz 1f \\ xor %%ebp,%%ebp \\ pop %%rdi \\ call *%%r9 \\ mov %%eax,%%edi \\ xor %%eax,%%eax \\ mov $60,%%al // SYS_exit \\ syscall \\ hlt \\1: ret \\ ); }, .aarch64 => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // x0, x1, w2, x3, x4, x5, x6 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // x8, x0, x1, x2, x3, x4 asm volatile ( \\ // align stack and save func,arg \\ and x1,x1,#-16 \\ stp x0,x3,[x1,#-16]! \\ \\ // syscall \\ uxtw x0,w2 \\ mov x2,x4 \\ mov x3,x5 \\ mov x4,x6 \\ mov x8,#220 // SYS_clone \\ svc #0 \\ \\ cbz x0,1f \\ // parent \\ ret \\ // child \\1: ldp x1,x0,[sp],#16 \\ blr x1 \\ mov x8,#93 // SYS_exit \\ svc #0 ); }, .arm => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // r0, r1, r2, r3, +0, +4, +8 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // r7 r0, r1, r2, r3, r4 asm volatile ( \\ stmfd sp!,{r4,r5,r6,r7} \\ mov r7,#120 \\ mov r6,r3 \\ mov r5,r0 \\ mov r0,r2 \\ and r1,r1,#-16 \\ ldr r2,[sp,#16] \\ ldr r3,[sp,#20] \\ ldr r4,[sp,#24] \\ svc 0 \\ tst r0,r0 \\ beq 1f \\ ldmfd sp!,{r4,r5,r6,r7} \\ bx lr \\ \\1: mov r0,r6 \\ bl 3f \\2: mov r7,#1 \\ svc 0 \\ b 2b \\3: bx r5 ); }, .riscv64 => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // a0, a1, a2, a3, a4, a5, a6 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // a7 a0, a1, a2, a3, a4 asm volatile ( \\ # Save func and arg to stack \\ addi a1, a1, -16 \\ sd a0, 0(a1) \\ sd a3, 8(a1) \\ \\ # Call SYS_clone \\ mv a0, a2 \\ mv a2, a4 \\ mv a3, a5 \\ mv a4, a6 \\ li a7, 220 # SYS_clone \\ ecall \\ \\ beqz a0, 1f \\ # Parent \\ ret \\ \\ # Child \\1: ld a1, 0(sp) \\ ld a0, 8(sp) \\ jalr a1 \\ \\ # Exit \\ li a7, 93 # SYS_exit \\ ecall ); }, .mips, .mipsel => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // 3, 4, 5, 6, 7, 8, 9 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // 2 4, 5, 6, 7, 8 asm volatile ( \\ # Save function pointer and argument pointer on new thread stack \\ and $5, $5, -8 \\ subu $5, $5, 16 \\ sw $4, 0($5) \\ sw $7, 4($5) \\ # Shuffle (fn,sp,fl,arg,ptid,tls,ctid) to (fl,sp,ptid,tls,ctid) \\ move $4, $6 \\ lw $6, 16($sp) \\ lw $7, 20($sp) \\ lw $9, 24($sp) \\ subu $sp, $sp, 16 \\ sw $9, 16($sp) \\ li $2, 4120 \\ syscall \\ beq $7, $0, 1f \\ nop \\ addu $sp, $sp, 16 \\ jr $ra \\ subu $2, $0, $2 \\1: \\ beq $2, $0, 1f \\ nop \\ addu $sp, $sp, 16 \\ jr $ra \\ nop \\1: \\ lw $25, 0($sp) \\ lw $4, 4($sp) \\ jalr $25 \\ nop \\ move $4, $2 \\ li $2, 4001 \\ syscall ); }, .powerpc64, .powerpc64le => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // 3, 4, 5, 6, 7, 8, 9 // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // 0 3, 4, 5, 6, 7 asm volatile ( \\ # create initial stack frame for new thread \\ clrrdi 4, 4, 4 \\ li 0, 0 \\ stdu 0,-32(4) \\ \\ # save fn and arg to child stack \\ std 3, 8(4) \\ std 6, 16(4) \\ \\ # shuffle args into correct registers and call SYS_clone \\ mr 3, 5 \\ #mr 4, 4 \\ mr 5, 7 \\ mr 6, 8 \\ mr 7, 9 \\ li 0, 120 # SYS_clone = 120 \\ sc \\ \\ # if error, negate return (errno) \\ bns+ 1f \\ neg 3, 3 \\ \\1: \\ # if we're the parent, return \\ cmpwi cr7, 3, 0 \\ bnelr cr7 \\ \\ # we're the child. call fn(arg) \\ ld 3, 16(1) \\ ld 12, 8(1) \\ mtctr 12 \\ bctrl \\ \\ # call SYS_exit. exit code is already in r3 from fn return value \\ li 0, 1 # SYS_exit = 1 \\ sc ); }, .sparcv9 => { // __clone(func, stack, flags, arg, ptid, tls, ctid) // i0, i1, i2, i3, i4, i5, sp // syscall(SYS_clone, flags, stack, ptid, tls, ctid) // g1 o0, o1, o2, o3, o4 asm volatile ( \\ save %%sp, -192, %%sp \\ # Save the func pointer and the arg pointer \\ mov %%i0, %%g2 \\ mov %%i3, %%g3 \\ # Shuffle the arguments \\ mov 217, %%g1 \\ mov %%i2, %%o0 \\ sub %%i1, 2047, %%o1 \\ mov %%i4, %%o2 \\ mov %%i5, %%o3 \\ ldx [%%fp + 192 - 2*8 + 2047], %%o4 \\ t 0x6d \\ bcs,pn %%xcc, 2f \\ nop \\ # sparc64 returns the child pid in o0 and a flag telling \\ # whether the process is the child in o1 \\ brnz %%o1, 1f \\ nop \\ # This is the parent process, return the child pid \\ mov %%o0, %%i0 \\ ret \\ restore \\1: \\ # This is the child process \\ mov %%g0, %%fp \\ call %%g2 \\ mov %%g3, %%o0 \\ # Exit \\ mov 1, %%g1 \\ t 0x6d \\2: \\ # The syscall failed \\ sub %%g0, %%o0, %%i0 \\ ret \\ restore ); }, else => @compileError("Implement clone() for this arch."), } } const math = std.math; export fn fmodf(x: f32, y: f32) f32 { return generic_fmod(f32, x, y); } export fn fmod(x: f64, y: f64) f64 { return generic_fmod(f64, x, y); } // TODO add intrinsics for these (and probably the double version too) // and have the math stuff use the intrinsic. same as @mod and @rem export fn floorf(x: f32) f32 { return math.floor(x); } export fn ceilf(x: f32) f32 { return math.ceil(x); } export fn floor(x: f64) f64 { return math.floor(x); } export fn ceil(x: f64) f64 { return math.ceil(x); } export fn fma(a: f64, b: f64, c: f64) f64 { return math.fma(f64, a, b, c); } export fn fmaf(a: f32, b: f32, c: f32) f32 { return math.fma(f32, a, b, c); } export fn sin(a: f64) f64 { return math.sin(a); } export fn sinf(a: f32) f32 { return math.sin(a); } export fn cos(a: f64) f64 { return math.cos(a); } export fn cosf(a: f32) f32 { return math.cos(a); } export fn exp(a: f64) f64 { return math.exp(a); } export fn expf(a: f32) f32 { return math.exp(a); } export fn exp2(a: f64) f64 { return math.exp2(a); } export fn exp2f(a: f32) f32 { return math.exp2(a); } export fn log(a: f64) f64 { return math.ln(a); } export fn logf(a: f32) f32 { return math.ln(a); } export fn log2(a: f64) f64 { return math.log2(a); } export fn log2f(a: f32) f32 { return math.log2(a); } export fn log10(a: f64) f64 { return math.log10(a); } export fn log10f(a: f32) f32 { return math.log10(a); } export fn fabs(a: f64) f64 { return math.fabs(a); } export fn fabsf(a: f32) f32 { return math.fabs(a); } export fn trunc(a: f64) f64 { return math.trunc(a); } export fn truncf(a: f32) f32 { return math.trunc(a); } export fn round(a: f64) f64 { return math.round(a); } export fn roundf(a: f32) f32 { return math.round(a); } fn generic_fmod(comptime T: type, x: T, y: T) T { @setRuntimeSafety(false); const bits = @typeInfo(T).Float.bits; const uint = std.meta.Int(.unsigned, bits); const log2uint = math.Log2Int(uint); const digits = if (T == f32) 23 else 52; const exp_bits = if (T == f32) 9 else 12; const bits_minus_1 = bits - 1; const mask = if (T == f32) 0xff else 0x7ff; var ux = @bitCast(uint, x); var uy = @bitCast(uint, y); var ex = @intCast(i32, (ux >> digits) & mask); var ey = @intCast(i32, (uy >> digits) & mask); const sx = if (T == f32) @intCast(u32, ux & 0x80000000) else @intCast(i32, ux >> bits_minus_1); var i: uint = undefined; if (uy << 1 == 0 or isNan(@bitCast(T, uy)) or ex == mask) return (x * y) / (x * y); if (ux << 1 <= uy << 1) { if (ux << 1 == uy << 1) return 0 * x; return x; } // normalize x and y if (ex == 0) { i = ux << exp_bits; while (i >> bits_minus_1 == 0) : ({ ex -= 1; i <<= 1; }) {} ux <<= @intCast(log2uint, @bitCast(u32, -ex + 1)); } else { ux &= maxInt(uint) >> exp_bits; ux |= 1 << digits; } if (ey == 0) { i = uy << exp_bits; while (i >> bits_minus_1 == 0) : ({ ey -= 1; i <<= 1; }) {} uy <<= @intCast(log2uint, @bitCast(u32, -ey + 1)); } else { uy &= maxInt(uint) >> exp_bits; uy |= 1 << digits; } // x mod y while (ex > ey) : (ex -= 1) { i = ux -% uy; if (i >> bits_minus_1 == 0) { if (i == 0) return 0 * x; ux = i; } ux <<= 1; } i = ux -% uy; if (i >> bits_minus_1 == 0) { if (i == 0) return 0 * x; ux = i; } while (ux >> digits == 0) : ({ ux <<= 1; ex -= 1; }) {} // scale result up if (ex > 0) { ux -%= 1 << digits; ux |= @as(uint, @bitCast(u32, ex)) << digits; } else { ux >>= @intCast(log2uint, @bitCast(u32, -ex + 1)); } if (T == f32) { ux |= sx; } else { ux |= @intCast(uint, sx) << bits_minus_1; } return @bitCast(T, ux); } // NOTE: The original code is full of implicit signed -> unsigned assumptions and u32 wraparound // behaviour. Most intermediate i32 values are changed to u32 where appropriate but there are // potentially some edge cases remaining that are not handled in the same way. export fn sqrt(x: f64) f64 { const tiny: f64 = 1.0e-300; const sign: u32 = 0x80000000; const u = @bitCast(u64, x); var ix0 = @intCast(u32, u >> 32); var ix1 = @intCast(u32, u & 0xFFFFFFFF); // sqrt(nan) = nan, sqrt(+inf) = +inf, sqrt(-inf) = nan if (ix0 & 0x7FF00000 == 0x7FF00000) { return x * x + x; } // sqrt(+-0) = +-0 if (x == 0.0) { return x; } // sqrt(-ve) = snan if (ix0 & sign != 0) { return math.snan(f64); } // normalize x var m = @intCast(i32, ix0 >> 20); if (m == 0) { // subnormal while (ix0 == 0) { m -= 21; ix0 |= ix1 >> 11; ix1 <<= 21; } // subnormal var i: u32 = 0; while (ix0 & 0x00100000 == 0) : (i += 1) { ix0 <<= 1; } m -= @intCast(i32, i) - 1; ix0 |= ix1 >> @intCast(u5, 32 - i); ix1 <<= @intCast(u5, i); } // unbias exponent m -= 1023; ix0 = (ix0 & 0x000FFFFF) | 0x00100000; if (m & 1 != 0) { ix0 += ix0 + (ix1 >> 31); ix1 = ix1 +% ix1; } m >>= 1; // sqrt(x) bit by bit ix0 += ix0 + (ix1 >> 31); ix1 = ix1 +% ix1; var q: u32 = 0; var q1: u32 = 0; var s0: u32 = 0; var s1: u32 = 0; var r: u32 = 0x00200000; var t: u32 = undefined; var t1: u32 = undefined; while (r != 0) { t = s0 +% r; if (t <= ix0) { s0 = t + r; ix0 -= t; q += r; } ix0 = ix0 +% ix0 +% (ix1 >> 31); ix1 = ix1 +% ix1; r >>= 1; } r = sign; while (r != 0) { t = s1 +% r; t = s0; if (t < ix0 or (t == ix0 and t1 <= ix1)) { s1 = t1 +% r; if (t1 & sign == sign and s1 & sign == 0) { s0 += 1; } ix0 -= t; if (ix1 < t1) { ix0 -= 1; } ix1 = ix1 -% t1; q1 += r; } ix0 = ix0 +% ix0 +% (ix1 >> 31); ix1 = ix1 +% ix1; r >>= 1; } // rounding direction if (ix0 | ix1 != 0) { var z = 1.0 - tiny; // raise inexact if (z >= 1.0) { z = 1.0 + tiny; if (q1 == 0xFFFFFFFF) { q1 = 0; q += 1; } else if (z > 1.0) { if (q1 == 0xFFFFFFFE) { q += 1; } q1 += 2; } else { q1 += q1 & 1; } } } ix0 = (q >> 1) + 0x3FE00000; ix1 = q1 >> 1; if (q & 1 != 0) { ix1 |= 0x80000000; } // NOTE: musl here appears to rely on signed twos-complement wraparound. +% has the same // behaviour at least. var iix0 = @intCast(i32, ix0); iix0 = iix0 +% (m << 20); const uz = (@intCast(u64, iix0) << 32) | ix1; return @bitCast(f64, uz); } test "sqrt" { const epsilon = 0.000001; std.testing.expect(sqrt(0.0) == 0.0); std.testing.expect(std.math.approxEqAbs(f64, sqrt(2.0), 1.414214, epsilon)); std.testing.expect(std.math.approxEqAbs(f64, sqrt(3.6), 1.897367, epsilon)); std.testing.expect(sqrt(4.0) == 2.0); std.testing.expect(std.math.approxEqAbs(f64, sqrt(7.539840), 2.745877, epsilon)); std.testing.expect(std.math.approxEqAbs(f64, sqrt(19.230934), 4.385309, epsilon)); std.testing.expect(sqrt(64.0) == 8.0); std.testing.expect(std.math.approxEqAbs(f64, sqrt(64.1), 8.006248, epsilon)); std.testing.expect(std.math.approxEqAbs(f64, sqrt(8942.230469), 94.563367, epsilon)); } test "sqrt special" { std.testing.expect(std.math.isPositiveInf(sqrt(std.math.inf(f64)))); std.testing.expect(sqrt(0.0) == 0.0); std.testing.expect(sqrt(-0.0) == -0.0); std.testing.expect(std.math.isNan(sqrt(-1.0))); std.testing.expect(std.math.isNan(sqrt(std.math.nan(f64)))); } export fn sqrtf(x: f32) f32 { const tiny: f32 = 1.0e-30; const sign: i32 = @bitCast(i32, @as(u32, 0x80000000)); var ix: i32 = @bitCast(i32, x); if ((ix & 0x7F800000) == 0x7F800000) { return x * x + x; // sqrt(nan) = nan, sqrt(+inf) = +inf, sqrt(-inf) = snan } // zero if (ix <= 0) { if (ix & ~sign == 0) { return x; // sqrt (+-0) = +-0 } if (ix < 0) { return math.snan(f32); } } // normalize var m = ix >> 23; if (m == 0) { // subnormal var i: i32 = 0; while (ix & 0x00800000 == 0) : (i += 1) { ix <<= 1; } m -= i - 1; } m -= 127; // unbias exponent ix = (ix & 0x007FFFFF) | 0x00800000; if (m & 1 != 0) { // odd m, double x to even ix += ix; } m >>= 1; // m = [m / 2] // sqrt(x) bit by bit ix += ix; var q: i32 = 0; // q = sqrt(x) var s: i32 = 0; var r: i32 = 0x01000000; // r = moving bit right -> left while (r != 0) { const t = s + r; if (t <= ix) { s = t + r; ix -= t; q += r; } ix += ix; r >>= 1; } // floating add to find rounding direction if (ix != 0) { var z = 1.0 - tiny; // inexact if (z >= 1.0) { z = 1.0 + tiny; if (z > 1.0) { q += 2; } else { if (q & 1 != 0) { q += 1; } } } } ix = (q >> 1) + 0x3f000000; ix += m << 23; return @bitCast(f32, ix); } test "sqrtf" { const epsilon = 0.000001; std.testing.expect(sqrtf(0.0) == 0.0); std.testing.expect(std.math.approxEqAbs(f32, sqrtf(2.0), 1.414214, epsilon)); std.testing.expect(std.math.approxEqAbs(f32, sqrtf(3.6), 1.897367, epsilon)); std.testing.expect(sqrtf(4.0) == 2.0); std.testing.expect(std.math.approxEqAbs(f32, sqrtf(7.539840), 2.745877, epsilon)); std.testing.expect(std.math.approxEqAbs(f32, sqrtf(19.230934), 4.385309, epsilon)); std.testing.expect(sqrtf(64.0) == 8.0); std.testing.expect(std.math.approxEqAbs(f32, sqrtf(64.1), 8.006248, epsilon)); std.testing.expect(std.math.approxEqAbs(f32, sqrtf(8942.230469), 94.563370, epsilon)); } test "sqrtf special" { std.testing.expect(std.math.isPositiveInf(sqrtf(std.math.inf(f32)))); std.testing.expect(sqrtf(0.0) == 0.0); std.testing.expect(sqrtf(-0.0) == -0.0); std.testing.expect(std.math.isNan(sqrtf(-1.0))); std.testing.expect(std.math.isNan(sqrtf(std.math.nan(f32)))); }
lib/std/special/c.zig
const tests = @import("tests.zig"); const std = @import("std"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add("lazy pointer with undefined element type", \\export fn foo() void { \\ comptime var T: type = undefined; \\ const S = struct { x: *T }; \\ const I = @typeInfo(S); \\} , &[_][]const u8{ "tmp.zig:3:28: error: use of undefined value here causes undefined behavior", }); cases.add("pointer arithmetic on pointer-to-array", \\export fn foo() void { \\ var x: [10]u8 = undefined; \\ var y = &x; \\ var z = y + 1; \\} , &[_][]const u8{ "tmp.zig:4:17: error: integer value 1 cannot be coerced to type '*[10]u8'", }); cases.add("pointer attributes checked when coercing pointer to anon literal", \\comptime { \\ const c: [][]const u8 = &.{"hello", "world" }; \\} \\comptime { \\ const c: *[2][]const u8 = &.{"hello", "world" }; \\} \\const S = struct {a: u8 = 1, b: u32 = 2}; \\comptime { \\ const c: *S = &.{}; \\} , &[_][]const u8{ "tmp.zig:2:31: error: expected type '[][]const u8', found '*const struct:2:31'", "tmp.zig:5:33: error: expected type '*[2][]const u8', found '*const struct:5:33'", "tmp.zig:9:21: error: expected type '*S', found '*const struct:9:21'", }); cases.add("@Type() union payload is undefined", \\const Foo = @Type(@import("std").builtin.TypeInfo{ \\ .Struct = undefined, \\}); \\comptime { _ = Foo; } , &[_][]const u8{ "tmp.zig:1:50: error: use of undefined value here causes undefined behavior", }); cases.add("wrong initializer for union payload of type 'type'", \\const U = union(enum) { \\ A: type, \\}; \\const S = struct { \\ u: U, \\}; \\export fn entry() void { \\ comptime var v: S = undefined; \\ v.u.A = U{ .A = i32 }; \\} , &[_][]const u8{ "tmp.zig:9:8: error: use of undefined value here causes undefined behavior", }); cases.add("union with too small explicit signed tag type", \\const U = union(enum(i2)) { \\ A: u8, \\ B: u8, \\ C: u8, \\ D: u8, \\}; \\export fn entry() void { \\ _ = U{ .D = 1 }; \\} , &[_][]const u8{ "tmp.zig:1:22: error: specified integer tag type cannot represent every field", "tmp.zig:1:22: note: type i2 cannot fit values in range 0...3", }); cases.add("union with too small explicit unsigned tag type", \\const U = union(enum(u2)) { \\ A: u8, \\ B: u8, \\ C: u8, \\ D: u8, \\ E: u8, \\}; \\export fn entry() void { \\ _ = U{ .E = 1 }; \\} , &[_][]const u8{ "tmp.zig:1:22: error: specified integer tag type cannot represent every field", "tmp.zig:1:22: note: type u2 cannot fit values in range 0...4", }); cases.addCase(x: { var tc = cases.create("callconv(.Interrupt) on unsupported platform", \\export fn entry() callconv(.Interrupt) void {} , &[_][]const u8{ "tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .none, }; break :x tc; }); cases.addCase(x: { var tc = cases.create("callconv(.Signal) on unsupported platform", \\export fn entry() callconv(.Signal) void {} , &[_][]const u8{ "tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none, }; break :x tc; }); cases.addCase(x: { var tc = cases.create("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", \\const F1 = fn () callconv(.Stdcall) void; \\const F2 = fn () callconv(.Fastcall) void; \\const F3 = fn () callconv(.Thiscall) void; \\export fn entry1() void { var a: F1 = undefined; } \\export fn entry2() void { var a: F2 = undefined; } \\export fn entry3() void { var a: F3 = undefined; } , &[_][]const u8{ "tmp.zig:1:27: error: callconv 'Stdcall' is only available on x86, not x86_64", "tmp.zig:2:27: error: callconv 'Fastcall' is only available on x86, not x86_64", "tmp.zig:3:27: error: callconv 'Thiscall' is only available on x86, not x86_64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none, }; break :x tc; }); cases.addCase(x: { var tc = cases.create("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform", \\export fn entry1() callconv(.Stdcall) void {} \\export fn entry2() callconv(.Fastcall) void {} \\export fn entry3() callconv(.Thiscall) void {} , &[_][]const u8{ "tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64", "tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64", "tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none, }; break :x tc; }); cases.addCase(x: { var tc = cases.create("callconv(.Vectorcall) on unsupported platform", \\export fn entry() callconv(.Vectorcall) void {} , &[_][]const u8{ "tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none, }; break :x tc; }); cases.addCase(x: { var tc = cases.create("callconv(.APCS, .AAPCS, .AAPCSVFP) on unsupported platform", \\export fn entry1() callconv(.APCS) void {} \\export fn entry2() callconv(.AAPCS) void {} \\export fn entry3() callconv(.AAPCSVFP) void {} , &[_][]const u8{ "tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64", "tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64", "tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none, }; break :x tc; }); cases.add("unreachable executed at comptime", \\fn foo(comptime x: i32) i32 { \\ comptime { \\ if (x >= 0) return -x; \\ unreachable; \\ } \\} \\export fn entry() void { \\ _ = foo(-42); \\} , &[_][]const u8{ "tmp.zig:4:9: error: reached unreachable code", "tmp.zig:8:12: note: called from here", }); cases.add("@Type with TypeInfo.Int", \\const builtin = @import("std").builtin; \\export fn entry() void { \\ _ = @Type(builtin.TypeInfo.Int { \\ .signedness = .signed, \\ .bits = 8, \\ }); \\} , &[_][]const u8{ "tmp.zig:3:36: error: expected type 'std.builtin.TypeInfo', found 'std.builtin.Int'", }); cases.add("indexing a undefined slice at comptime", \\comptime { \\ var slice: []u8 = undefined; \\ slice[0] = 2; \\} , &[_][]const u8{ "tmp.zig:3:10: error: index 0 outside slice of size 0", }); cases.add("array in c exported function", \\export fn zig_array(x: [10]u8) void { \\try expect(std.mem.eql(u8, &x, "1234567890")); \\} \\ \\export fn zig_return_array() [10]u8 { \\ return "1234567890".*; \\} , &[_][]const u8{ "tmp.zig:1:24: error: parameter of type '[10]u8' not allowed in function with calling convention 'C'", "tmp.zig:5:30: error: return type '[10]u8' not allowed in function with calling convention 'C'", }); cases.add("@Type for exhaustive enum with undefined tag type", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Tag = @Type(.{ \\ .Enum = .{ \\ .layout = .Auto, \\ .tag_type = undefined, \\ .fields = &[_]TypeInfo.EnumField{}, \\ .decls = &[_]TypeInfo.Declaration{}, \\ .is_exhaustive = false, \\ }, \\}); \\export fn entry() void { \\ _ = @intToEnum(Tag, 0); \\} , &[_][]const u8{ "tmp.zig:2:20: error: use of undefined value here causes undefined behavior", }); cases.add("extern struct with non-extern-compatible integer tag type", \\pub const E = enum(u31) { A, B, C }; \\pub const S = extern struct { \\ e: E, \\}; \\export fn entry() void { \\ const s: S = undefined; \\} , &[_][]const u8{ "tmp.zig:3:5: error: extern structs cannot contain fields of type 'E'", }); cases.add("@Type for exhaustive enum with non-integer tag type", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Tag = @Type(.{ \\ .Enum = .{ \\ .layout = .Auto, \\ .tag_type = bool, \\ .fields = &[_]TypeInfo.EnumField{}, \\ .decls = &[_]TypeInfo.Declaration{}, \\ .is_exhaustive = false, \\ }, \\}); \\export fn entry() void { \\ _ = @intToEnum(Tag, 0); \\} , &[_][]const u8{ "tmp.zig:2:20: error: TypeInfo.Enum.tag_type must be an integer type, not 'bool'", }); cases.add("extern struct with extern-compatible but inferred integer tag type", \\pub const E = enum { \\@"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", \\@"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23", \\@"24",@"25",@"26",@"27",@"28",@"29",@"30",@"31",@"32",@"33",@"34", \\@"35",@"36",@"37",@"38",@"39",@"40",@"41",@"42",@"43",@"44",@"45", \\@"46",@"47",@"48",@"49",@"50",@"51",@"52",@"53",@"54",@"55",@"56", \\@"57",@"58",@"59",@"60",@"61",@"62",@"63",@"64",@"65",@"66",@"67", \\@"68",@"69",@"70",@"71",@"72",@"73",@"74",@"75",@"76",@"77",@"78", \\@"79",@"80",@"81",@"82",@"83",@"84",@"85",@"86",@"87",@"88",@"89", \\@"90",@"91",@"92",@"93",@"94",@"95",@"96",@"97",@"98",@"99",@"100", \\@"101",@"102",@"103",@"104",@"105",@"106",@"107",@"108",@"109", \\@"110",@"111",@"112",@"113",@"114",@"115",@"116",@"117",@"118", \\@"119",@"120",@"121",@"122",@"123",@"124",@"125",@"126",@"127", \\@"128",@"129",@"130",@"131",@"132",@"133",@"134",@"135",@"136", \\@"137",@"138",@"139",@"140",@"141",@"142",@"143",@"144",@"145", \\@"146",@"147",@"148",@"149",@"150",@"151",@"152",@"153",@"154", \\@"155",@"156",@"157",@"158",@"159",@"160",@"161",@"162",@"163", \\@"164",@"165",@"166",@"167",@"168",@"169",@"170",@"171",@"172", \\@"173",@"174",@"175",@"176",@"177",@"178",@"179",@"180",@"181", \\@"182",@"183",@"184",@"185",@"186",@"187",@"188",@"189",@"190", \\@"191",@"192",@"193",@"194",@"195",@"196",@"197",@"198",@"199", \\@"200",@"201",@"202",@"203",@"204",@"205",@"206",@"207",@"208", \\@"209",@"210",@"211",@"212",@"213",@"214",@"215",@"216",@"217", \\@"218",@"219",@"220",@"221",@"222",@"223",@"224",@"225",@"226", \\@"227",@"228",@"229",@"230",@"231",@"232",@"233",@"234",@"235", \\@"236",@"237",@"238",@"239",@"240",@"241",@"242",@"243",@"244", \\@"245",@"246",@"247",@"248",@"249",@"250",@"251",@"252",@"253", \\@"254",@"255" \\}; \\pub const S = extern struct { \\ e: E, \\}; \\export fn entry() void { \\ if (@typeInfo(E).Enum.tag_type != u8) @compileError("did not infer u8 tag type"); \\ const s: S = undefined; \\} , &[_][]const u8{ "tmp.zig:31:5: error: extern structs cannot contain fields of type 'E'", }); cases.add("@Type for tagged union with extra enum field", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Tag = @Type(.{ \\ .Enum = .{ \\ .layout = .Auto, \\ .tag_type = u2, \\ .fields = &[_]TypeInfo.EnumField{ \\ .{ .name = "signed", .value = 0 }, \\ .{ .name = "unsigned", .value = 1 }, \\ .{ .name = "arst", .value = 2 }, \\ }, \\ .decls = &[_]TypeInfo.Declaration{}, \\ .is_exhaustive = true, \\ }, \\}); \\const Tagged = @Type(.{ \\ .Union = .{ \\ .layout = .Auto, \\ .tag_type = Tag, \\ .fields = &[_]TypeInfo.UnionField{ \\ .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, \\ .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, \\ }, \\ .decls = &[_]TypeInfo.Declaration{}, \\ }, \\}); \\export fn entry() void { \\ var tagged = Tagged{ .signed = -1 }; \\ tagged = .{ .unsigned = 1 }; \\} , &[_][]const u8{ "tmp.zig:15:23: error: enum field missing: 'arst'", "tmp.zig:27:24: note: referenced here", }); cases.add("field access of opaque type", \\const MyType = opaque {}; \\ \\export fn entry() bool { \\ var x: i32 = 1; \\ return bar(@ptrCast(*MyType, &x)); \\} \\ \\fn bar(x: *MyType) bool { \\ return x.blah; \\} , &[_][]const u8{ "tmp.zig:9:13: error: no member named 'blah' in opaque type 'MyType'", }); cases.add("opaque type with field", \\const Opaque = opaque { foo: i32 }; \\export fn entry() void { \\ const foo: ?*Opaque = null; \\} , &[_][]const u8{ "tmp.zig:1:25: error: opaque types cannot have fields", }); cases.add("@Type(.Fn) with is_generic = true", \\const Foo = @Type(.{ \\ .Fn = .{ \\ .calling_convention = .Unspecified, \\ .alignment = 0, \\ .is_generic = true, \\ .is_var_args = false, \\ .return_type = u0, \\ .args = &[_]@import("std").builtin.TypeInfo.FnArg{}, \\ }, \\}); \\comptime { _ = Foo; } , &[_][]const u8{ "tmp.zig:1:20: error: TypeInfo.Fn.is_generic must be false for @Type", }); cases.add("@Type(.Fn) with is_var_args = true and non-C callconv", \\const Foo = @Type(.{ \\ .Fn = .{ \\ .calling_convention = .Unspecified, \\ .alignment = 0, \\ .is_generic = false, \\ .is_var_args = true, \\ .return_type = u0, \\ .args = &[_]@import("std").builtin.TypeInfo.FnArg{}, \\ }, \\}); \\comptime { _ = Foo; } , &[_][]const u8{ "tmp.zig:1:20: error: varargs functions must have C calling convention", }); cases.add("@Type(.Fn) with return_type = null", \\const Foo = @Type(.{ \\ .Fn = .{ \\ .calling_convention = .Unspecified, \\ .alignment = 0, \\ .is_generic = false, \\ .is_var_args = false, \\ .return_type = null, \\ .args = &[_]@import("std").builtin.TypeInfo.FnArg{}, \\ }, \\}); \\comptime { _ = Foo; } , &[_][]const u8{ "tmp.zig:1:20: error: TypeInfo.Fn.return_type must be non-null for @Type", }); cases.add("@Type for union with opaque field", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Untagged = @Type(.{ \\ .Union = .{ \\ .layout = .Auto, \\ .tag_type = null, \\ .fields = &[_]TypeInfo.UnionField{ \\ .{ .name = "foo", .field_type = opaque {}, .alignment = 1 }, \\ }, \\ .decls = &[_]TypeInfo.Declaration{}, \\ }, \\}); \\export fn entry() void { \\ _ = Untagged{}; \\} , &[_][]const u8{ "tmp.zig:2:25: error: opaque types have unknown size and therefore cannot be directly embedded in unions", "tmp.zig:13:17: note: referenced here", }); cases.add("slice sentinel mismatch", \\export fn entry() void { \\ const x = @import("std").meta.Vector(3, f32){ 25, 75, 5, 0 }; \\} , &[_][]const u8{ "tmp.zig:2:62: error: index 3 outside vector of size 3", }); cases.add("slice sentinel mismatch", \\export fn entry() void { \\ const y: [:1]const u8 = &[_:2]u8{ 1, 2 }; \\} , &[_][]const u8{ "tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8'", }); cases.add("@Type for union with zero fields", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Untagged = @Type(.{ \\ .Union = .{ \\ .layout = .Auto, \\ .tag_type = null, \\ .fields = &[_]TypeInfo.UnionField{}, \\ .decls = &[_]TypeInfo.Declaration{}, \\ }, \\}); \\export fn entry() void { \\ _ = Untagged{}; \\} , &[_][]const u8{ "tmp.zig:2:25: error: unions must have 1 or more fields", "tmp.zig:11:17: note: referenced here", }); cases.add("@Type for exhaustive enum with zero fields", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Tag = @Type(.{ \\ .Enum = .{ \\ .layout = .Auto, \\ .tag_type = u1, \\ .fields = &[_]TypeInfo.EnumField{}, \\ .decls = &[_]TypeInfo.Declaration{}, \\ .is_exhaustive = true, \\ }, \\}); \\export fn entry() void { \\ _ = @intToEnum(Tag, 0); \\} , &[_][]const u8{ "tmp.zig:2:20: error: enums must have 1 or more fields", "tmp.zig:12:9: note: referenced here", }); cases.add("@Type for tagged union with extra union field", \\const TypeInfo = @import("std").builtin.TypeInfo; \\const Tag = @Type(.{ \\ .Enum = .{ \\ .layout = .Auto, \\ .tag_type = u1, \\ .fields = &[_]TypeInfo.EnumField{ \\ .{ .name = "signed", .value = 0 }, \\ .{ .name = "unsigned", .value = 1 }, \\ }, \\ .decls = &[_]TypeInfo.Declaration{}, \\ .is_exhaustive = true, \\ }, \\}); \\const Tagged = @Type(.{ \\ .Union = .{ \\ .layout = .Auto, \\ .tag_type = Tag, \\ .fields = &[_]TypeInfo.UnionField{ \\ .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) }, \\ .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) }, \\ .{ .name = "arst", .field_type = f32, .alignment = @alignOf(f32) }, \\ }, \\ .decls = &[_]TypeInfo.Declaration{}, \\ }, \\}); \\export fn entry() void { \\ var tagged = Tagged{ .signed = -1 }; \\ tagged = .{ .unsigned = 1 }; \\} , &[_][]const u8{ "tmp.zig:14:23: error: enum field not found: 'arst'", "tmp.zig:2:20: note: enum declared here", "tmp.zig:27:24: note: referenced here", }); cases.add("@Type with undefined", \\comptime { \\ _ = @Type(.{ .Array = .{ .len = 0, .child = u8, .sentinel = undefined } }); \\} \\comptime { \\ _ = @Type(.{ \\ .Struct = .{ \\ .fields = undefined, \\ .decls = undefined, \\ .is_tuple = false, \\ .layout = .Auto, \\ }, \\ }); \\} , &[_][]const u8{ "tmp.zig:2:16: error: use of undefined value here causes undefined behavior", "tmp.zig:5:16: error: use of undefined value here causes undefined behavior", }); cases.add("struct with declarations unavailable for @Type", \\export fn entry() void { \\ _ = @Type(@typeInfo(struct { const foo = 1; })); \\} , &[_][]const u8{ "tmp.zig:2:15: error: TypeInfo.Struct.decls must be empty for @Type", }); cases.add("enum with declarations unavailable for @Type", \\export fn entry() void { \\ _ = @Type(@typeInfo(enum { foo, const bar = 1; })); \\} , &[_][]const u8{ "tmp.zig:2:15: error: TypeInfo.Enum.decls must be empty for @Type", }); cases.addTest("reject extern variables with initializers", \\extern var foo: int = 2; , &[_][]const u8{ "tmp.zig:1:1: error: extern variables have no initializers", }); cases.addTest("duplicate/unused labels", \\comptime { \\ blk: { blk: while (false) {} } \\ blk: while (false) { blk: for (@as([0]void, undefined)) |_| {} } \\ blk: for (@as([0]void, undefined)) |_| { blk: {} } \\} \\comptime { \\ blk: {} \\ blk: while(false) {} \\ blk: for(@as([0]void, undefined)) |_| {} \\} , &[_][]const u8{ "tmp.zig:2:17: error: redeclaration of label 'blk'", "tmp.zig:2:10: note: previous declaration is here", "tmp.zig:3:31: error: redeclaration of label 'blk'", "tmp.zig:3:10: note: previous declaration is here", "tmp.zig:4:51: error: redeclaration of label 'blk'", "tmp.zig:4:10: note: previous declaration is here", "tmp.zig:7:10: error: unused block label", "tmp.zig:8:10: error: unused while label", "tmp.zig:9:10: error: unused for label", }); cases.addTest("@alignCast of zero sized types", \\export fn foo() void { \\ const a: *void = undefined; \\ _ = @alignCast(2, a); \\} \\export fn bar() void { \\ const a: ?*void = undefined; \\ _ = @alignCast(2, a); \\} \\export fn baz() void { \\ const a: []void = undefined; \\ _ = @alignCast(2, a); \\} \\export fn qux() void { \\ const a = struct { \\ fn a(comptime b: u32) void {} \\ }.a; \\ _ = @alignCast(2, a); \\} , &[_][]const u8{ "tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void'", "tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void'", "tmp.zig:11:23: error: cannot adjust alignment of zero sized type '[]void'", "tmp.zig:17:23: error: cannot adjust alignment of zero sized type 'fn(u32) anytype'", }); cases.addTest("invalid non-exhaustive enum to union", \\const E = enum(u8) { \\ a, \\ b, \\ _, \\}; \\const U = union(E) { \\ a, \\ b, \\}; \\export fn foo() void { \\ var e = @intToEnum(E, 15); \\ var u: U = e; \\} \\export fn bar() void { \\ const e = @intToEnum(E, 15); \\ var u: U = e; \\} , &[_][]const u8{ "tmp.zig:12:16: error: runtime cast to union 'U' from non-exhustive enum", "tmp.zig:16:16: error: no tag by value 15", }); cases.addTest("switching with exhaustive enum has '_' prong ", \\const E = enum{ \\ a, \\ b, \\}; \\pub export fn entry() void { \\ var e: E = .b; \\ switch (e) { \\ .a => {}, \\ .b => {}, \\ _ => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:7:5: error: switch on exhaustive enum has `_` prong", }); cases.addTest("invalid pointer with @Type", \\export fn entry() void { \\ _ = @Type(.{ .Pointer = .{ \\ .size = .One, \\ .is_const = false, \\ .is_volatile = false, \\ .alignment = 1, \\ .child = u8, \\ .is_allowzero = false, \\ .sentinel = 0, \\ }}); \\} , &[_][]const u8{ "tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers", }); cases.addTest("helpful return type error message", \\export fn foo() u32 { \\ return error.Ohno; \\} \\fn bar() !u32 { \\ return error.Ohno; \\} \\export fn baz() void { \\ try bar(); \\} \\export fn qux() u32 { \\ return bar(); \\} \\export fn quux() u32 { \\ var buf: u32 = 0; \\ buf = bar(); \\} , &[_][]const u8{ "tmp.zig:2:17: error: expected type 'u32', found 'error{Ohno}'", "tmp.zig:1:17: note: function cannot return an error", "tmp.zig:8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(bar)).Fn.return_type.?).ErrorUnion.error_set'", "tmp.zig:7:17: note: function cannot return an error", "tmp.zig:11:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(bar)).Fn.return_type.?).ErrorUnion.error_set!u32'", "tmp.zig:10:17: note: function cannot return an error", "tmp.zig:15:14: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(bar)).Fn.return_type.?).ErrorUnion.error_set!u32'", "tmp.zig:14:5: note: cannot store an error in type 'u32'", }); cases.addTest("int/float conversion to comptime_int/float", \\export fn foo() void { \\ var a: f32 = 2; \\ _ = @floatToInt(comptime_int, a); \\} \\export fn bar() void { \\ var a: u32 = 2; \\ _ = @intToFloat(comptime_float, a); \\} , &[_][]const u8{ "tmp.zig:3:35: error: unable to evaluate constant expression", "tmp.zig:3:9: note: referenced here", "tmp.zig:7:37: error: unable to evaluate constant expression", "tmp.zig:7:9: note: referenced here", }); cases.add("extern variable has no type", \\extern var foo; \\pub export fn entry() void { \\ foo; \\} , &[_][]const u8{ "tmp.zig:1:1: error: unable to infer variable type", }); cases.add("@src outside function", \\comptime { \\ @src(); \\} , &[_][]const u8{ "tmp.zig:2:5: error: @src outside function", }); cases.add("call assigned to constant", \\const Foo = struct { \\ x: i32, \\}; \\fn foo() Foo { \\ return .{ .x = 42 }; \\} \\fn bar(val: anytype) Foo { \\ return .{ .x = val }; \\} \\export fn entry() void { \\ const baz: Foo = undefined; \\ baz = foo(); \\} \\export fn entry1() void { \\ const baz: Foo = undefined; \\ baz = bar(42); \\} , &[_][]const u8{ "tmp.zig:12:14: error: cannot assign to constant", "tmp.zig:16:14: error: cannot assign to constant", }); cases.add("invalid pointer syntax", \\export fn foo() void { \\ var guid: *:0 const u8 = undefined; \\} , &[_][]const u8{ "tmp.zig:2:15: error: sentinels are only allowed on unknown-length pointers", }); cases.add("declaration between fields", \\const S = struct { \\ const foo = 2; \\ const bar = 2; \\ const baz = 2; \\ a: usize, \\ const foo1 = 2; \\ const bar1 = 2; \\ const baz1 = 2; \\ b: usize, \\}; \\comptime { \\ _ = S; \\} , &[_][]const u8{ "tmp.zig:6:5: error: declarations are not allowed between container fields", }); cases.add("non-extern function with var args", \\fn foo(args: ...) void {} \\export fn entry() void { \\ foo(); \\} , &[_][]const u8{ "tmp.zig:1:1: error: non-extern function is variadic", }); cases.addTest("invalid int casts", \\export fn foo() void { \\ var a: u32 = 2; \\ _ = @intCast(comptime_int, a); \\} \\export fn bar() void { \\ var a: u32 = 2; \\ _ = @intToFloat(u32, a); \\} \\export fn baz() void { \\ var a: u32 = 2; \\ _ = @floatToInt(u32, a); \\} \\export fn qux() void { \\ var a: f32 = 2; \\ _ = @intCast(u32, a); \\} , &[_][]const u8{ "tmp.zig:3:32: error: unable to evaluate constant expression", "tmp.zig:3:9: note: referenced here", "tmp.zig:7:21: error: expected float type, found 'u32'", "tmp.zig:7:9: note: referenced here", "tmp.zig:11:26: error: expected float type, found 'u32'", "tmp.zig:11:9: note: referenced here", "tmp.zig:15:23: error: expected integer type, found 'f32'", "tmp.zig:15:9: note: referenced here", }); cases.addTest("invalid float casts", \\export fn foo() void { \\ var a: f32 = 2; \\ _ = @floatCast(comptime_float, a); \\} \\export fn bar() void { \\ var a: f32 = 2; \\ _ = @floatToInt(f32, a); \\} \\export fn baz() void { \\ var a: f32 = 2; \\ _ = @intToFloat(f32, a); \\} \\export fn qux() void { \\ var a: u32 = 2; \\ _ = @floatCast(f32, a); \\} , &[_][]const u8{ "tmp.zig:3:36: error: unable to evaluate constant expression", "tmp.zig:3:9: note: referenced here", "tmp.zig:7:21: error: expected integer type, found 'f32'", "tmp.zig:7:9: note: referenced here", "tmp.zig:11:26: error: expected int type, found 'f32'", "tmp.zig:11:9: note: referenced here", "tmp.zig:15:25: error: expected float type, found 'u32'", "tmp.zig:15:9: note: referenced here", }); cases.addTest("invalid assignments", \\export fn entry1() void { \\ var a: []const u8 = "foo"; \\ a[0..2] = "bar"; \\} \\export fn entry2() void { \\ var a: u8 = 2; \\ a + 2 = 3; \\} \\export fn entry4() void { \\ 2 + 2 = 3; \\} , &[_][]const u8{ "tmp.zig:3:6: error: invalid left-hand side to assignment", "tmp.zig:7:7: error: invalid left-hand side to assignment", "tmp.zig:10:7: error: invalid left-hand side to assignment", }); cases.addTest("reassign to array parameter", \\fn reassign(a: [3]f32) void { \\ a = [3]f32{4, 5, 6}; \\} \\export fn entry() void { \\ reassign(.{1, 2, 3}); \\} , &[_][]const u8{ "tmp.zig:2:15: error: cannot assign to constant", }); cases.addTest("reassign to slice parameter", \\pub fn reassign(s: []const u8) void { \\ s = s[0..]; \\} \\export fn entry() void { \\ reassign("foo"); \\} , &[_][]const u8{ "tmp.zig:2:10: error: cannot assign to constant", }); cases.addTest("reassign to struct parameter", \\const S = struct { \\ x: u32, \\}; \\fn reassign(s: S) void { \\ s = S{.x = 2}; \\} \\export fn entry() void { \\ reassign(S{.x = 3}); \\} , &[_][]const u8{ "tmp.zig:5:10: error: cannot assign to constant", }); cases.addTest("reference to const data", \\export fn foo() void { \\ var ptr = &[_]u8{0,0,0,0}; \\ ptr[1] = 2; \\} \\export fn bar() void { \\ var ptr = &@as(u32, 2); \\ ptr.* = 2; \\} \\export fn baz() void { \\ var ptr = &true; \\ ptr.* = false; \\} \\export fn qux() void { \\ const S = struct{ \\ x: usize, \\ y: usize, \\ }; \\ var ptr = &S{.x=1,.y=2}; \\ ptr.x = 2; \\} , &[_][]const u8{ "tmp.zig:3:14: error: cannot assign to constant", "tmp.zig:7:13: error: cannot assign to constant", "tmp.zig:11:13: error: cannot assign to constant", "tmp.zig:19:13: error: cannot assign to constant", }); cases.addTest("cast between ?T where T is not a pointer", \\pub const fnty1 = ?fn (i8) void; \\pub const fnty2 = ?fn (u64) void; \\export fn entry() void { \\ var a: fnty1 = undefined; \\ var b: fnty2 = undefined; \\ a = b; \\} , &[_][]const u8{ "tmp.zig:6:9: error: expected type '?fn(i8) void', found '?fn(u64) void'", "tmp.zig:6:9: note: optional type child 'fn(u64) void' cannot cast into optional type child 'fn(i8) void'", }); cases.addTest("unused variable error on errdefer", \\fn foo() !void { \\ errdefer |a| unreachable; \\ return error.A; \\} \\export fn entry() void { \\ foo() catch unreachable; \\} , &[_][]const u8{ "tmp.zig:2:15: error: unused variable: 'a'", }); cases.addTest("comparison of non-tagged union and enum literal", \\export fn entry() void { \\ const U = union { A: u32, B: u64 }; \\ var u = U{ .A = 42 }; \\ var ok = u == .A; \\} , &[_][]const u8{ "tmp.zig:4:16: error: comparison of union and enum literal is only valid for tagged union types", "tmp.zig:2:15: note: type U is not a tagged union", }); cases.addTest("shift on type with non-power-of-two size", \\export fn entry() void { \\ const S = struct { \\ fn a() void { \\ var x: u24 = 42; \\ _ = x >> 24; \\ } \\ fn b() void { \\ var x: u24 = 42; \\ _ = x << 24; \\ } \\ fn c() void { \\ var x: u24 = 42; \\ _ = @shlExact(x, 24); \\ } \\ fn d() void { \\ var x: u24 = 42; \\ _ = @shrExact(x, 24); \\ } \\ }; \\ S.a(); \\ S.b(); \\ S.c(); \\ S.d(); \\} , &[_][]const u8{ "tmp.zig:5:19: error: RHS of shift is too large for LHS type", "tmp.zig:9:19: error: RHS of shift is too large for LHS type", "tmp.zig:13:17: error: RHS of shift is too large for LHS type", "tmp.zig:17:17: error: RHS of shift is too large for LHS type", }); cases.addTest("combination of nosuspend and async", \\export fn entry() void { \\ nosuspend { \\ const bar = async foo(); \\ suspend {} \\ resume bar; \\ } \\} \\fn foo() void {} , &[_][]const u8{ "tmp.zig:4:9: error: suspend in nosuspend scope", }); cases.add("atomicrmw with bool op not .Xchg", \\export fn entry() void { \\ var x = false; \\ _ = @atomicRmw(bool, &x, .Add, true, .SeqCst); \\} , &[_][]const u8{ "tmp.zig:3:30: error: @atomicRmw with bool only allowed with .Xchg", }); cases.addTest("@TypeOf with no arguments", \\export fn entry() void { \\ _ = @TypeOf(); \\} , &[_][]const u8{ "tmp.zig:2:9: error: expected at least 1 argument, found 0", }); cases.addTest("@TypeOf with incompatible arguments", \\export fn entry() void { \\ var var_1: f32 = undefined; \\ var var_2: u32 = undefined; \\ _ = @TypeOf(var_1, var_2); \\} , &[_][]const u8{ "tmp.zig:4:9: error: incompatible types: 'f32' and 'u32'", }); cases.addTest("type mismatch with tuple concatenation", \\export fn entry() void { \\ var x = .{}; \\ x = x ++ .{ 1, 2, 3 }; \\} , &[_][]const u8{ "tmp.zig:3:11: error: expected type 'struct:2:14', found 'struct:3:11'", }); cases.addTest("@tagName on invalid value of non-exhaustive enum", \\test "enum" { \\ const E = enum(u8) {A, B, _}; \\ _ = @tagName(@intToEnum(E, 5)); \\} , &[_][]const u8{ "tmp.zig:3:18: error: no tag by value 5", }); cases.addTest("@ptrToInt with pointer to zero-sized type", \\export fn entry() void { \\ var pointer: ?*u0 = null; \\ var x = @ptrToInt(pointer); \\} , &[_][]const u8{ "tmp.zig:3:23: error: pointer to size 0 type has no address", }); cases.addTest("access invalid @typeInfo decl", \\const A = B; \\test "Crash" { \\ _ = @typeInfo(@This()).Struct.decls[0]; \\} , &[_][]const u8{ "tmp.zig:1:11: error: use of undeclared identifier 'B'", }); cases.addTest("reject extern function definitions with body", \\extern "c" fn definitelyNotInLibC(a: i32, b: i32) i32 { \\ return a + b; \\} , &[_][]const u8{ "tmp.zig:1:1: error: extern functions have no body", }); cases.addTest("duplicate field in anonymous struct literal", \\export fn entry() void { \\ const anon = .{ \\ .inner = .{ \\ .a = .{ \\ .something = "text", \\ }, \\ .a = .{}, \\ }, \\ }; \\} , &[_][]const u8{ "tmp.zig:7:13: error: duplicate field", "tmp.zig:4:13: note: other field here", }); cases.addTest("type mismatch in C prototype with varargs", \\const fn_ty = ?fn ([*c]u8, ...) callconv(.C) void; \\extern fn fn_decl(fmt: [*:0]u8, ...) void; \\ \\export fn main() void { \\ const x: fn_ty = fn_decl; \\} , &[_][]const u8{ "tmp.zig:5:22: error: expected type 'fn([*c]u8, ...) callconv(.C) void', found 'fn([*:0]u8, ...) callconv(.C) void'", }); cases.addTest("dependency loop in top-level decl with @TypeInfo when accessing the decls", \\export const foo = @typeInfo(@This()).Struct.decls; , &[_][]const u8{ "tmp.zig:1:20: error: dependency loop detected", "tmp.zig:1:45: note: referenced here", }); cases.add("function call assigned to incorrect type", \\export fn entry() void { \\ var arr: [4]f32 = undefined; \\ arr = concat(); \\} \\fn concat() [16]f32 { \\ return [1]f32{0}**16; \\} , &[_][]const u8{ "tmp.zig:3:17: error: expected type '[4]f32', found '[16]f32'", }); cases.add("generic function call assigned to incorrect type", \\pub export fn entry() void { \\ var res: []i32 = undefined; \\ res = myAlloc(i32); \\} \\fn myAlloc(comptime arg: type) anyerror!arg{ \\ unreachable; \\} , &[_][]const u8{ "tmp.zig:3:18: error: expected type '[]i32', found 'anyerror!i32", }); cases.addTest("non-exhaustive enums", \\const A = enum { \\ a, \\ b, \\ _ = 1, \\}; \\const B = enum(u1) { \\ a, \\ _, \\ b, \\}; \\const C = enum(u1) { \\ a, \\ b, \\ _, \\}; \\pub export fn entry() void { \\ _ = A; \\ _ = B; \\ _ = C; \\} , &[_][]const u8{ "tmp.zig:4:5: error: value assigned to '_' field of non-exhaustive enum", "error: non-exhaustive enum must specify size", "error: non-exhaustive enum specifies every value", "error: '_' field of non-exhaustive enum must be last", }); cases.addTest("switching with non-exhaustive enums", \\const E = enum(u8) { \\ a, \\ b, \\ _, \\}; \\const U = union(E) { \\ a: i32, \\ b: u32, \\}; \\pub export fn entry() void { \\ var e: E = .b; \\ switch (e) { // error: switch not handling the tag `b` \\ .a => {}, \\ _ => {}, \\ } \\ switch (e) { // error: switch on non-exhaustive enum must include `else` or `_` prong \\ .a => {}, \\ .b => {}, \\ } \\ var u = U{.a = 2}; \\ switch (u) { // error: `_` prong not allowed when switching on tagged union \\ .a => {}, \\ .b => {}, \\ _ => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:12:5: error: enumeration value 'E.b' not handled in switch", "tmp.zig:16:5: error: switch on non-exhaustive enum must include `else` or `_` prong", "tmp.zig:21:5: error: `_` prong not allowed when switching on tagged union", }); cases.add("switch expression - unreachable else prong (bool)", \\fn foo(x: bool) void { \\ switch (x) { \\ true => {}, \\ false => {}, \\ else => {}, \\ } \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:5:9: error: unreachable else prong, all cases already handled", }); cases.add("switch expression - unreachable else prong (u1)", \\fn foo(x: u1) void { \\ switch (x) { \\ 0 => {}, \\ 1 => {}, \\ else => {}, \\ } \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:5:9: error: unreachable else prong, all cases already handled", }); cases.add("switch expression - unreachable else prong (u2)", \\fn foo(x: u2) void { \\ switch (x) { \\ 0 => {}, \\ 1 => {}, \\ 2 => {}, \\ 3 => {}, \\ else => {}, \\ } \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:7:9: error: unreachable else prong, all cases already handled", }); cases.add("switch expression - unreachable else prong (range u8)", \\fn foo(x: u8) void { \\ switch (x) { \\ 0 => {}, \\ 1 => {}, \\ 2 => {}, \\ 3 => {}, \\ 4...255 => {}, \\ else => {}, \\ } \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:8:9: error: unreachable else prong, all cases already handled", }); cases.add("switch expression - unreachable else prong (range i8)", \\fn foo(x: i8) void { \\ switch (x) { \\ -128...0 => {}, \\ 1 => {}, \\ 2 => {}, \\ 3 => {}, \\ 4...127 => {}, \\ else => {}, \\ } \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:8:9: error: unreachable else prong, all cases already handled", }); cases.add("switch expression - unreachable else prong (enum)", \\const TestEnum = enum{ T1, T2 }; \\ \\fn err(x: u8) TestEnum { \\ switch (x) { \\ 0 => return TestEnum.T1, \\ else => return TestEnum.T2, \\ } \\} \\ \\fn foo(x: u8) void { \\ switch (err(x)) { \\ TestEnum.T1 => {}, \\ TestEnum.T2 => {}, \\ else => {}, \\ } \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:14:9: error: unreachable else prong, all cases already handled", }); cases.addTest("@export with empty name string", \\pub export fn entry() void { } \\comptime { \\ @export(entry, .{ .name = "" }); \\} , &[_][]const u8{ "tmp.zig:3:5: error: exported symbol name cannot be empty", }); cases.addTest("switch ranges endpoints are validated", \\pub export fn entry() void { \\ var x: i32 = 0; \\ switch (x) { \\ 6...1 => {}, \\ -1...-5 => {}, \\ else => unreachable, \\ } \\} , &[_][]const u8{ "tmp.zig:4:9: error: range start value is greater than the end value", "tmp.zig:5:9: error: range start value is greater than the end value", }); cases.addTest("errors in for loop bodies are propagated", \\pub export fn entry() void { \\ var arr: [100]u8 = undefined; \\ for (arr) |bits| _ = @popCount(bits); \\} , &[_][]const u8{ "tmp.zig:3:26: error: expected 2 argument(s), found 1", }); cases.addTest("@call rejects non comptime-known fn - always_inline", \\pub export fn entry() void { \\ var call_me: fn () void = undefined; \\ @call(.{ .modifier = .always_inline }, call_me, .{}); \\} , &[_][]const u8{ "tmp.zig:3:5: error: the specified modifier requires a comptime-known function", }); cases.addTest("@call rejects non comptime-known fn - compile_time", \\pub export fn entry() void { \\ var call_me: fn () void = undefined; \\ @call(.{ .modifier = .compile_time }, call_me, .{}); \\} , &[_][]const u8{ "tmp.zig:3:5: error: the specified modifier requires a comptime-known function", }); cases.addTest("error in struct initializer doesn't crash the compiler", \\pub export fn entry() void { \\ const bitfield = struct { \\ e: u8, \\ e: u8, \\ }; \\ var a = .{@sizeOf(bitfield)}; \\} , &[_][]const u8{ "tmp.zig:4:9: error: duplicate struct field: 'e'", }); cases.addTest("repeated invalid field access to generic function returning type crashes compiler. #2655", \\pub fn A() type { \\ return Q; \\} \\test "1" { \\ _ = A().a; \\ _ = A().a; \\} , &[_][]const u8{ "tmp.zig:2:12: error: use of undeclared identifier 'Q'", }); cases.add("bitCast to enum type", \\export fn entry() void { \\ const y = @bitCast(enum(u32) { a, b }, @as(u32, 3)); \\} , &[_][]const u8{ "tmp.zig:2:24: error: cannot cast a value of type 'y'", }); cases.add("comparing against undefined produces undefined value", \\export fn entry() void { \\ if (2 == undefined) {} \\} , &[_][]const u8{ "tmp.zig:2:11: error: use of undefined value here causes undefined behavior", }); cases.add("comptime ptrcast of zero-sized type", \\fn foo() void { \\ const node: struct {} = undefined; \\ const vla_ptr = @ptrCast([*]const u8, &node); \\} \\comptime { foo(); } , &[_][]const u8{ "tmp.zig:3:21: error: '*const struct:2:17' and '[*]const u8' do not have the same in-memory representation", }); cases.add("slice sentinel mismatch", \\fn foo() [:0]u8 { \\ var x: []u8 = undefined; \\ return x; \\} \\comptime { _ = foo; } , &[_][]const u8{ "tmp.zig:3:12: error: expected type '[:0]u8', found '[]u8'", "tmp.zig:3:12: note: destination pointer requires a terminating '0' sentinel", }); cases.add("cmpxchg with float", \\export fn entry() void { \\ var x: f32 = 0; \\ _ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst); \\} , &[_][]const u8{ "tmp.zig:3:22: error: expected bool, integer, enum or pointer type, found 'f32'", }); cases.add("atomicrmw with float op not .Xchg, .Add or .Sub", \\export fn entry() void { \\ var x: f32 = 0; \\ _ = @atomicRmw(f32, &x, .And, 2, .SeqCst); \\} , &[_][]const u8{ "tmp.zig:3:29: error: @atomicRmw with float only allowed with .Xchg, .Add and .Sub", }); cases.add("intToPtr with misaligned address", \\pub fn main() void { \\ var y = @intToPtr([*]align(4) u8, 5); \\} , &[_][]const u8{ "tmp.zig:2:13: error: pointer type '[*]align(4) u8' requires aligned address", }); cases.add("invalid float literal", \\const std = @import("std"); \\ \\pub fn main() void { \\ var bad_float :f32 = 0.0; \\ bad_float = bad_float + .20; \\ std.debug.assert(bad_float < 1.0); \\} , &[_][]const u8{ "tmp.zig:5:29: error: invalid token: '.'", }); cases.add("invalid exponent in float literal - 1", \\fn main() void { \\ var bad: f128 = 0x1.0p1ab1; \\} , &[_][]const u8{ "tmp.zig:2:28: error: invalid character: 'a'", }); cases.add("invalid exponent in float literal - 2", \\fn main() void { \\ var bad: f128 = 0x1.0p50F; \\} , &[_][]const u8{ "tmp.zig:2:29: error: invalid character: 'F'", }); cases.add("invalid underscore placement in float literal - 1", \\fn main() void { \\ var bad: f128 = 0._0; \\} , &[_][]const u8{ "tmp.zig:2:23: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 2", \\fn main() void { \\ var bad: f128 = 0_.0; \\} , &[_][]const u8{ "tmp.zig:2:23: error: invalid character: '.'", }); cases.add("invalid underscore placement in float literal - 3", \\fn main() void { \\ var bad: f128 = 0.0_; \\} , &[_][]const u8{ "tmp.zig:2:25: error: invalid character: ';'", }); cases.add("invalid underscore placement in float literal - 4", \\fn main() void { \\ var bad: f128 = 1.0e_1; \\} , &[_][]const u8{ "tmp.zig:2:25: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 5", \\fn main() void { \\ var bad: f128 = 1.0e+_1; \\} , &[_][]const u8{ "tmp.zig:2:26: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 6", \\fn main() void { \\ var bad: f128 = 1.0e-_1; \\} , &[_][]const u8{ "tmp.zig:2:26: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 7", \\fn main() void { \\ var bad: f128 = 1.0e-1_; \\} , &[_][]const u8{ "tmp.zig:2:28: error: invalid character: ';'", }); cases.add("invalid underscore placement in float literal - 9", \\fn main() void { \\ var bad: f128 = 1__0.0e-1; \\} , &[_][]const u8{ "tmp.zig:2:23: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 10", \\fn main() void { \\ var bad: f128 = 1.0__0e-1; \\} , &[_][]const u8{ "tmp.zig:2:25: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 11", \\fn main() void { \\ var bad: f128 = 1.0e-1__0; \\} , &[_][]const u8{ "tmp.zig:2:28: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 12", \\fn main() void { \\ var bad: f128 = 0_x0.0; \\} , &[_][]const u8{ "tmp.zig:2:23: error: invalid character: 'x'", }); cases.add("invalid underscore placement in float literal - 13", \\fn main() void { \\ var bad: f128 = 0x_0.0; \\} , &[_][]const u8{ "tmp.zig:2:23: error: invalid character: '_'", }); cases.add("invalid underscore placement in float literal - 14", \\fn main() void { \\ var bad: f128 = 0x0.0_p1; \\} , &[_][]const u8{ "tmp.zig:2:27: error: invalid character: 'p'", }); cases.add("invalid underscore placement in int literal - 1", \\fn main() void { \\ var bad: u128 = 0010_; \\} , &[_][]const u8{ "tmp.zig:2:26: error: invalid character: ';'", }); cases.add("invalid underscore placement in int literal - 2", \\fn main() void { \\ var bad: u128 = 0b0010_; \\} , &[_][]const u8{ "tmp.zig:2:28: error: invalid character: ';'", }); cases.add("invalid underscore placement in int literal - 3", \\fn main() void { \\ var bad: u128 = 0o0010_; \\} , &[_][]const u8{ "tmp.zig:2:28: error: invalid character: ';'", }); cases.add("invalid underscore placement in int literal - 4", \\fn main() void { \\ var bad: u128 = 0x0010_; \\} , &[_][]const u8{ "tmp.zig:2:28: error: invalid character: ';'", }); cases.add("comptime struct field, no init value", \\const Foo = struct { \\ comptime b: i32, \\}; \\export fn entry() void { \\ var f: Foo = undefined; \\} , &[_][]const u8{ "tmp.zig:2:5: error: comptime struct field missing initialization value", }); cases.add("bad usage of @call", \\export fn entry1() void { \\ @call(.{}, foo, {}); \\} \\export fn entry2() void { \\ comptime @call(.{ .modifier = .never_inline }, foo, .{}); \\} \\export fn entry3() void { \\ comptime @call(.{ .modifier = .never_tail }, foo, .{}); \\} \\export fn entry4() void { \\ @call(.{ .modifier = .never_inline }, bar, .{}); \\} \\export fn entry5(c: bool) void { \\ var baz = if (c) baz1 else baz2; \\ @call(.{ .modifier = .compile_time }, baz, .{}); \\} \\fn foo() void {} \\fn bar() callconv(.Inline) void {} \\fn baz1() void {} \\fn baz2() void {} , &[_][]const u8{ "tmp.zig:2:21: error: expected tuple or struct, found 'void'", "tmp.zig:5:14: error: unable to perform 'never_inline' call at compile-time", "tmp.zig:8:14: error: unable to perform 'never_tail' call at compile-time", "tmp.zig:11:5: error: no-inline call of inline function", "tmp.zig:15:5: error: the specified modifier requires a comptime-known function", }); cases.add("exported async function", \\export fn foo() callconv(.Async) void {} , &[_][]const u8{ "tmp.zig:1:1: error: exported function cannot be async", }); cases.addExe("main missing name", \\pub fn (main) void {} , &[_][]const u8{ "tmp.zig:1:5: error: missing function name", }); cases.addCase(x: { var tc = cases.create("call with new stack on unsupported target", \\var buf: [10]u8 align(16) = undefined; \\export fn entry() void { \\ @call(.{.stack = &buf}, foo, .{}); \\} \\fn foo() void {} , &[_][]const u8{ "tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .wasm32, .os_tag = .wasi, .abi = .none, }; break :x tc; }); // Note: One of the error messages here is backwards. It would be nice to fix, but that's not // going to stop me from merging this branch which fixes a bunch of other stuff. cases.add("incompatible sentinels", \\export fn entry1(ptr: [*:255]u8) [*:0]u8 { \\ return ptr; \\} \\export fn entry2(ptr: [*]u8) [*:0]u8 { \\ return ptr; \\} \\export fn entry3() void { \\ var array: [2:0]u8 = [_:255]u8{1, 2}; \\} \\export fn entry4() void { \\ var array: [2:0]u8 = [_]u8{1, 2}; \\} , &[_][]const u8{ "tmp.zig:2:12: error: expected type '[*:0]u8', found '[*:255]u8'", "tmp.zig:2:12: note: destination pointer requires a terminating '0' sentinel, but source pointer has a terminating '255' sentinel", "tmp.zig:5:12: error: expected type '[*:0]u8', found '[*]u8'", "tmp.zig:5:12: note: destination pointer requires a terminating '0' sentinel", "tmp.zig:8:35: error: expected type '[2:255]u8', found '[2:0]u8'", "tmp.zig:8:35: note: destination array requires a terminating '255' sentinel, but source array has a terminating '0' sentinel", "tmp.zig:11:31: error: expected type '[2:0]u8', found '[2]u8'", "tmp.zig:11:31: note: destination array requires a terminating '0' sentinel", }); cases.add("empty switch on an integer", \\export fn entry() void { \\ var x: u32 = 0; \\ switch(x) {} \\} , &[_][]const u8{ "tmp.zig:3:5: error: switch must handle all possibilities", }); cases.add("incorrect return type", \\ pub export fn entry() void{ \\ _ = foo(); \\ } \\ const A = struct { \\ a: u32, \\ }; \\ fn foo() A { \\ return bar(); \\ } \\ const B = struct { \\ a: u32, \\ }; \\ fn bar() B { \\ unreachable; \\ } , &[_][]const u8{ "tmp.zig:8:16: error: expected type 'A', found 'B'", }); cases.add("regression test #2980: base type u32 is not type checked properly when assigning a value within a struct", \\const Foo = struct { \\ ptr: ?*usize, \\ uval: u32, \\}; \\fn get_uval(x: u32) !u32 { \\ return error.NotFound; \\} \\export fn entry() void { \\ const afoo = Foo{ \\ .ptr = null, \\ .uval = get_uval(42), \\ }; \\} , &[_][]const u8{ "tmp.zig:11:25: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(get_uval)).Fn.return_type.?).ErrorUnion.error_set!u32'", }); cases.add("assigning to struct or union fields that are not optionals with a function that returns an optional", \\fn maybe(is: bool) ?u8 { \\ if (is) return @as(u8, 10) else return null; \\} \\const U = union { \\ Ye: u8, \\}; \\const S = struct { \\ num: u8, \\}; \\export fn entry() void { \\ var u = U{ .Ye = maybe(false) }; \\ var s = S{ .num = maybe(false) }; \\} , &[_][]const u8{ "tmp.zig:11:27: error: expected type 'u8', found '?u8'", }); cases.add("missing result type for phi node", \\fn foo() !void { \\ return anyerror.Foo; \\} \\export fn entry() void { \\ foo() catch 0; \\} , &[_][]const u8{ "tmp.zig:5:17: error: integer value 0 cannot be coerced to type 'void'", }); cases.add("atomicrmw with enum op not .Xchg", \\export fn entry() void { \\ const E = enum(u8) { \\ a, \\ b, \\ c, \\ d, \\ }; \\ var x: E = .a; \\ _ = @atomicRmw(E, &x, .Add, .b, .SeqCst); \\} , &[_][]const u8{ "tmp.zig:9:27: error: @atomicRmw with enum only allowed with .Xchg", }); cases.add("disallow coercion from non-null-terminated pointer to null-terminated pointer", \\extern fn puts(s: [*:0]const u8) c_int; \\pub fn main() void { \\ const no_zero_array = [_]u8{'h', 'e', 'l', 'l', 'o'}; \\ const no_zero_ptr: [*]const u8 = &no_zero_array; \\ _ = puts(no_zero_ptr); \\} , &[_][]const u8{ "tmp.zig:5:14: error: expected type '[*:0]const u8', found '[*]const u8'", }); cases.add("atomic orderings of atomicStore Acquire or AcqRel", \\export fn entry() void { \\ var x: u32 = 0; \\ @atomicStore(u32, &x, 1, .Acquire); \\} , &[_][]const u8{ "tmp.zig:3:30: error: @atomicStore atomic ordering must not be Acquire or AcqRel", }); cases.add("missing const in slice with nested array type", \\const Geo3DTex2D = struct { vertices: [][2]f32 }; \\pub fn getGeo3DTex2D() Geo3DTex2D { \\ return Geo3DTex2D{ \\ .vertices = [_][2]f32{ \\ [_]f32{ -0.5, -0.5}, \\ }, \\ }; \\} \\export fn entry() void { \\ var geo_data = getGeo3DTex2D(); \\} , &[_][]const u8{ "tmp.zig:4:30: error: array literal requires address-of operator to coerce to slice type '[][2]f32'", }); cases.add("slicing of global undefined pointer", \\var buf: *[1]u8 = undefined; \\export fn entry() void { \\ _ = buf[0..1]; \\} , &[_][]const u8{ "tmp.zig:3:12: error: non-zero length slice of undefined pointer", }); cases.add("using invalid types in function call raises an error", \\const MenuEffect = enum {}; \\fn func(effect: MenuEffect) void {} \\export fn entry() void { \\ func(MenuEffect.ThisDoesNotExist); \\} , &[_][]const u8{ "tmp.zig:1:20: error: enums must have 1 or more fields", "tmp.zig:4:20: note: referenced here", }); cases.add("store vector pointer with unknown runtime index", \\export fn entry() void { \\ var v: @import("std").meta.Vector(4, i32) = [_]i32{ 1, 5, 3, undefined }; \\ \\ var i: u32 = 0; \\ storev(&v[i], 42); \\} \\ \\fn storev(ptr: anytype, val: i32) void { \\ ptr.* = val; \\} , &[_][]const u8{ "tmp.zig:9:8: error: unable to determine vector element index of type '*align(16:0:4:?) i32", }); cases.add("load vector pointer with unknown runtime index", \\export fn entry() void { \\ var v: @import("std").meta.Vector(4, i32) = [_]i32{ 1, 5, 3, undefined }; \\ \\ var i: u32 = 0; \\ var x = loadv(&v[i]); \\} \\ \\fn loadv(ptr: anytype) i32 { \\ return ptr.*; \\} , &[_][]const u8{ "tmp.zig:9:12: error: unable to determine vector element index of type '*align(16:0:4:?) i32", }); cases.add("using an unknown len ptr type instead of array", \\const resolutions = [*][*]const u8{ \\ "[320 240 ]", \\ null, \\}; \\comptime { \\ _ = resolutions; \\} , &[_][]const u8{ "tmp.zig:1:21: error: expected array type or [_], found '[*][*]const u8'", }); cases.add("comparison with error union and error value", \\export fn entry() void { \\ var number_or_error: anyerror!i32 = error.SomethingAwful; \\ _ = number_or_error == error.SomethingAwful; \\} , &[_][]const u8{ "tmp.zig:3:25: error: operator not allowed for type 'anyerror!i32'", }); cases.add("switch with overlapping case ranges", \\export fn entry() void { \\ var q: u8 = 0; \\ switch (q) { \\ 1...2 => {}, \\ 0...255 => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:5:9: error: duplicate switch value", }); cases.add("invalid optional type in extern struct", \\const stroo = extern struct { \\ moo: ?[*c]u8, \\}; \\export fn testf(fluff: *stroo) void {} , &[_][]const u8{ "tmp.zig:2:5: error: extern structs cannot contain fields of type '?[*c]u8'", }); cases.add("attempt to negate a non-integer, non-float or non-vector type", \\fn foo() anyerror!u32 { \\ return 1; \\} \\ \\export fn entry() void { \\ const x = -foo(); \\} , &[_][]const u8{ "tmp.zig:6:15: error: negation of type 'anyerror!u32'", }); cases.add("attempt to create 17 bit float type", \\const builtin = @import("std").builtin; \\comptime { \\ _ = @Type(builtin.TypeInfo { .Float = builtin.TypeInfo.Float { .bits = 17 } }); \\} , &[_][]const u8{ "tmp.zig:3:32: error: 17-bit float unsupported", }); cases.add("wrong type for @Type", \\export fn entry() void { \\ _ = @Type(0); \\} , &[_][]const u8{ "tmp.zig:2:15: error: expected type 'std.builtin.TypeInfo', found 'comptime_int'", }); cases.add("@Type with non-constant expression", \\const builtin = @import("std").builtin; \\var globalTypeInfo : builtin.TypeInfo = undefined; \\export fn entry() void { \\ _ = @Type(globalTypeInfo); \\} , &[_][]const u8{ "tmp.zig:4:15: error: unable to evaluate constant expression", }); cases.add("wrong type for argument tuple to @asyncCall", \\export fn entry1() void { \\ var frame: @Frame(foo) = undefined; \\ @asyncCall(&frame, {}, foo, {}); \\} \\ \\fn foo() i32 { \\ return 0; \\} , &[_][]const u8{ "tmp.zig:3:33: error: expected tuple or struct, found 'void'", }); cases.add("wrong type for result ptr to @asyncCall", \\export fn entry() void { \\ _ = async amain(); \\} \\fn amain() i32 { \\ var frame: @Frame(foo) = undefined; \\ return await @asyncCall(&frame, false, foo, .{}); \\} \\fn foo() i32 { \\ return 1234; \\} , &[_][]const u8{ "tmp.zig:6:37: error: expected type '*i32', found 'bool'", }); cases.add("shift amount has to be an integer type", \\export fn entry() void { \\ const x = 1 << &@as(u8, 10); \\} , &[_][]const u8{ "tmp.zig:2:21: error: shift amount has to be an integer type, but found '*const u8'", "tmp.zig:2:17: note: referenced here", }); cases.add("bit shifting only works on integer types", \\export fn entry() void { \\ const x = &@as(u8, 1) << 10; \\} , &[_][]const u8{ "tmp.zig:2:16: error: bit shifting operation expected integer type, found '*const u8'", "tmp.zig:2:27: note: referenced here", }); cases.add("struct depends on itself via optional field", \\const LhsExpr = struct { \\ rhsExpr: ?AstObject, \\}; \\const AstObject = union { \\ lhsExpr: LhsExpr, \\}; \\export fn entry() void { \\ const lhsExpr = LhsExpr{ .rhsExpr = null }; \\ const obj = AstObject{ .lhsExpr = lhsExpr }; \\} , &[_][]const u8{ "tmp.zig:1:17: error: struct 'LhsExpr' depends on itself", "tmp.zig:5:5: note: while checking this field", "tmp.zig:2:5: note: while checking this field", }); cases.add("alignment of enum field specified", \\const Number = enum { \\ a, \\ b align(i32), \\}; \\export fn entry1() void { \\ var x: Number = undefined; \\} , &[_][]const u8{ "tmp.zig:3:13: error: structs and unions, not enums, support field alignment", "tmp.zig:1:16: note: consider 'union(enum)' here", }); cases.add("bad alignment type", \\export fn entry1() void { \\ var x: []align(true) i32 = undefined; \\} \\export fn entry2() void { \\ var x: *align(@as(f64, 12.34)) i32 = undefined; \\} , &[_][]const u8{ "tmp.zig:2:20: error: expected type 'u29', found 'bool'", "tmp.zig:5:19: error: fractional component prevents float value 12.340000 from being casted to type 'u29'", }); cases.addCase(x: { var tc = cases.create("variable in inline assembly template cannot be found", \\export fn entry() void { \\ var sp = asm volatile ( \\ "mov %[foo], sp" \\ : [bar] "=r" (-> usize) \\ ); \\} , &[_][]const u8{ "tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu, }; break :x tc; }); cases.add("indirect recursion of async functions detected", \\var frame: ?anyframe = null; \\ \\export fn a() void { \\ _ = async rangeSum(10); \\ while (frame) |f| resume f; \\} \\ \\fn rangeSum(x: i32) i32 { \\ suspend { \\ frame = @frame(); \\ } \\ frame = null; \\ \\ if (x == 0) return 0; \\ var child = rangeSumIndirect(x - 1); \\ return child + 1; \\} \\ \\fn rangeSumIndirect(x: i32) i32 { \\ suspend { \\ frame = @frame(); \\ } \\ frame = null; \\ \\ if (x == 0) return 0; \\ var child = rangeSum(x - 1); \\ return child + 1; \\} , &[_][]const u8{ "tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself", "tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here", "tmp.zig:26:25: note: when analyzing type '@Frame(rangeSumIndirect)' here", }); cases.add("non-async function pointer eventually is inferred to become async", \\export fn a() void { \\ var non_async_fn: fn () void = undefined; \\ non_async_fn = func; \\} \\fn func() void { \\ suspend {} \\} , &[_][]const u8{ "tmp.zig:5:1: error: 'func' cannot be async", "tmp.zig:3:20: note: required to be non-async here", "tmp.zig:6:5: note: suspends here", }); cases.add("bad alignment in @asyncCall", \\export fn entry() void { \\ var ptr: fn () callconv(.Async) void = func; \\ var bytes: [64]u8 = undefined; \\ _ = @asyncCall(&bytes, {}, ptr, .{}); \\} \\fn func() callconv(.Async) void {} , &[_][]const u8{ // Split the check in two as the alignment value is target dependent. "tmp.zig:4:21: error: expected type '[]align(", ") u8', found '*[64]u8'", }); cases.add("atomic orderings of fence Acquire or stricter", \\export fn entry() void { \\ @fence(.Monotonic); \\} , &[_][]const u8{ "tmp.zig:2:12: error: atomic ordering must be Acquire or stricter", }); cases.add("bad alignment in implicit cast from array pointer to slice", \\export fn a() void { \\ var x: [10]u8 = undefined; \\ var y: []align(16) u8 = &x; \\} , &[_][]const u8{ "tmp.zig:3:30: error: expected type '[]align(16) u8', found '*[10]u8'", }); cases.add("result location incompatibility mismatching handle_is_ptr (generic call)", \\export fn entry() void { \\ var damn = Container{ \\ .not_optional = getOptional(i32), \\ }; \\} \\pub fn getOptional(comptime T: type) ?T { \\ return 0; \\} \\pub const Container = struct { \\ not_optional: i32, \\}; , &[_][]const u8{ "tmp.zig:3:36: error: expected type 'i32', found '?i32'", }); cases.add("result location incompatibility mismatching handle_is_ptr", \\export fn entry() void { \\ var damn = Container{ \\ .not_optional = getOptional(), \\ }; \\} \\pub fn getOptional() ?i32 { \\ return 0; \\} \\pub const Container = struct { \\ not_optional: i32, \\}; , &[_][]const u8{ "tmp.zig:3:36: error: expected type 'i32', found '?i32'", }); cases.add("const frame cast to anyframe", \\export fn a() void { \\ const f = async func(); \\ resume f; \\} \\export fn b() void { \\ const f = async func(); \\ var x: anyframe = &f; \\} \\fn func() void { \\ suspend {} \\} , &[_][]const u8{ "tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)'", "tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)'", }); cases.add("prevent bad implicit casting of anyframe types", \\export fn a() void { \\ var x: anyframe = undefined; \\ var y: anyframe->i32 = x; \\} \\export fn b() void { \\ var x: i32 = undefined; \\ var y: anyframe->i32 = x; \\} \\export fn c() void { \\ var x: @Frame(func) = undefined; \\ var y: anyframe->i32 = &x; \\} \\fn func() void {} , &[_][]const u8{ "tmp.zig:3:28: error: expected type 'anyframe->i32', found 'anyframe'", "tmp.zig:7:28: error: expected type 'anyframe->i32', found 'i32'", "tmp.zig:11:29: error: expected type 'anyframe->i32', found '*@Frame(func)'", }); cases.add("wrong frame type used for async call", \\export fn entry() void { \\ var frame: @Frame(foo) = undefined; \\ frame = async bar(); \\} \\fn foo() void { \\ suspend {} \\} \\fn bar() void { \\ suspend {} \\} , &[_][]const u8{ "tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)'", }); cases.add("@Frame() of generic function", \\export fn entry() void { \\ var frame: @Frame(func) = undefined; \\} \\fn func(comptime T: type) void { \\ var x: T = undefined; \\} , &[_][]const u8{ "tmp.zig:2:16: error: @Frame() of generic function", }); cases.add("@frame() causes function to be async", \\export fn entry() void { \\ func(); \\} \\fn func() void { \\ _ = @frame(); \\} , &[_][]const u8{ "tmp.zig:1:1: error: function with calling convention 'C' cannot be async", "tmp.zig:5:9: note: @frame() causes function to be async", }); cases.add("invalid suspend in exported function", \\export fn entry() void { \\ var frame = async func(); \\ var result = await frame; \\} \\fn func() void { \\ suspend {} \\} , &[_][]const u8{ "tmp.zig:1:1: error: function with calling convention 'C' cannot be async", "tmp.zig:3:18: note: await here is a suspend point", }); cases.add("async function indirectly depends on its own frame", \\export fn entry() void { \\ _ = async amain(); \\} \\fn amain() callconv(.Async) void { \\ other(); \\} \\fn other() void { \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined; \\} , &[_][]const u8{ "tmp.zig:4:1: error: unable to determine async function frame of 'amain'", "tmp.zig:5:10: note: analysis of function 'other' depends on the frame", "tmp.zig:8:13: note: referenced here", }); cases.add("async function depends on its own frame", \\export fn entry() void { \\ _ = async amain(); \\} \\fn amain() callconv(.Async) void { \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined; \\} , &[_][]const u8{ "tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet", "tmp.zig:5:13: note: referenced here", }); cases.add("non async function pointer passed to @asyncCall", \\export fn entry() void { \\ var ptr = afunc; \\ var bytes: [100]u8 align(16) = undefined; \\ _ = @asyncCall(&bytes, {}, ptr, .{}); \\} \\fn afunc() void { } , &[_][]const u8{ "tmp.zig:4:32: error: expected async function, found 'fn() void'", }); cases.add("runtime-known async function called", \\export fn entry() void { \\ _ = async amain(); \\} \\fn amain() void { \\ var ptr = afunc; \\ _ = ptr(); \\} \\fn afunc() callconv(.Async) void {} , &[_][]const u8{ "tmp.zig:6:12: error: function is not comptime-known; @asyncCall required", }); cases.add("runtime-known function called with async keyword", \\export fn entry() void { \\ var ptr = afunc; \\ _ = async ptr(); \\} \\ \\fn afunc() callconv(.Async) void { } , &[_][]const u8{ "tmp.zig:3:15: error: function is not comptime-known; @asyncCall required", }); cases.add("function with ccc indirectly calling async function", \\export fn entry() void { \\ foo(); \\} \\fn foo() void { \\ bar(); \\} \\fn bar() void { \\ suspend {} \\} , &[_][]const u8{ "tmp.zig:1:1: error: function with calling convention 'C' cannot be async", "tmp.zig:2:8: note: async function call here", "tmp.zig:5:8: note: async function call here", "tmp.zig:8:5: note: suspends here", }); cases.add("capture group on switch prong with incompatible payload types", \\const Union = union(enum) { \\ A: usize, \\ B: isize, \\}; \\comptime { \\ var u = Union{ .A = 8 }; \\ switch (u) { \\ .A, .B => |e| unreachable, \\ } \\} , &[_][]const u8{ "tmp.zig:8:20: error: capture group with incompatible types", "tmp.zig:8:9: note: type 'usize' here", "tmp.zig:8:13: note: type 'isize' here", }); cases.add("wrong type to @hasField", \\export fn entry() bool { \\ return @hasField(i32, "hi"); \\} , &[_][]const u8{ "tmp.zig:2:22: error: type 'i32' does not support @hasField", }); cases.add("slice passed as array init type with elems", \\export fn entry() void { \\ const x = []u8{1, 2}; \\} , &[_][]const u8{ "tmp.zig:2:15: error: array literal requires address-of operator to coerce to slice type '[]u8'", }); cases.add("slice passed as array init type", \\export fn entry() void { \\ const x = []u8{}; \\} , &[_][]const u8{ "tmp.zig:2:15: error: array literal requires address-of operator to coerce to slice type '[]u8'", }); cases.add("inferred array size invalid here", \\export fn entry() void { \\ const x = [_]u8; \\} \\export fn entry2() void { \\ const S = struct { a: *const [_]u8 }; \\ var a = .{ S{} }; \\} , &[_][]const u8{ "tmp.zig:2:15: error: inferred array size invalid here", "tmp.zig:5:34: error: inferred array size invalid here", }); cases.add("initializing array with struct syntax", \\export fn entry() void { \\ const x = [_]u8{ .y = 2 }; \\} , &[_][]const u8{ "tmp.zig:2:15: error: initializing array with struct syntax", }); cases.add("compile error in struct init expression", \\const Foo = struct { \\ a: i32 = crap, \\ b: i32, \\}; \\export fn entry() void { \\ var x = Foo{ \\ .b = 5, \\ }; \\} , &[_][]const u8{ "tmp.zig:2:14: error: use of undeclared identifier 'crap'", }); cases.add("undefined as field type is rejected", \\const Foo = struct { \\ a: undefined, \\}; \\export fn entry1() void { \\ const foo: Foo = undefined; \\} , &[_][]const u8{ "tmp.zig:2:8: error: use of undefined value here causes undefined behavior", }); cases.add("@hasDecl with non-container", \\export fn entry() void { \\ _ = @hasDecl(i32, "hi"); \\} , &[_][]const u8{ "tmp.zig:2:18: error: expected struct, enum, or union; found 'i32'", }); cases.add("field access of slices", \\export fn entry() void { \\ var slice: []i32 = undefined; \\ const info = @TypeOf(slice).unknown; \\} , &[_][]const u8{ "tmp.zig:3:32: error: type 'type' does not support field access", }); cases.add("peer cast then implicit cast const pointer to mutable C pointer", \\export fn func() void { \\ var strValue: [*c]u8 = undefined; \\ strValue = strValue orelse ""; \\} , &[_][]const u8{ "tmp.zig:3:32: error: expected type '[*c]u8', found '*const [0:0]u8'", "tmp.zig:3:32: note: cast discards const qualifier", }); cases.add("overflow in enum value allocation", \\const Moo = enum(u8) { \\ Last = 255, \\ Over, \\}; \\pub fn main() void { \\ var y = Moo.Last; \\} , &[_][]const u8{ "tmp.zig:3:5: error: enumeration value 256 too large for type 'u8'", }); cases.add("attempt to cast enum literal to error", \\export fn entry() void { \\ switch (error.Hi) { \\ .Hi => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:3:9: error: expected type 'error{Hi}', found '(enum literal)'", }); cases.add("@sizeOf bad type", \\export fn entry() usize { \\ return @sizeOf(@TypeOf(null)); \\} , &[_][]const u8{ "tmp.zig:2:20: error: no size available for type '(null)'", }); cases.add("generic function where return type is self-referenced", \\fn Foo(comptime T: type) Foo(T) { \\ return struct{ x: T }; \\} \\export fn entry() void { \\ const t = Foo(u32) { \\ .x = 1 \\ }; \\} , &[_][]const u8{ "tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches", "tmp.zig:5:18: note: referenced here", }); cases.add("@ptrToInt 0 to non optional pointer", \\export fn entry() void { \\ var b = @intToPtr(*i32, 0); \\} , &[_][]const u8{ "tmp.zig:2:13: error: pointer type '*i32' does not allow address zero", }); cases.add("cast enum literal to enum but it doesn't match", \\const Foo = enum { \\ a, \\ b, \\}; \\export fn entry() void { \\ const x: Foo = .c; \\} , &[_][]const u8{ "tmp.zig:6:20: error: enum 'Foo' has no field named 'c'", "tmp.zig:1:13: note: 'Foo' declared here", }); cases.add("discarding error value", \\export fn entry() void { \\ _ = foo(); \\} \\fn foo() !void { \\ return error.OutOfMemory; \\} , &[_][]const u8{ "tmp.zig:2:12: error: error is discarded. consider using `try`, `catch`, or `if`", }); cases.add("volatile on global assembly", \\comptime { \\ asm volatile (""); \\} , &[_][]const u8{ "tmp.zig:2:9: error: volatile is meaningless on global assembly", }); cases.add("invalid multiple dereferences", \\export fn a() void { \\ var box = Box{ .field = 0 }; \\ box.*.field = 1; \\} \\export fn b() void { \\ var box = Box{ .field = 0 }; \\ var boxPtr = &box; \\ boxPtr.*.*.field = 1; \\} \\pub const Box = struct { \\ field: i32, \\}; , &[_][]const u8{ "tmp.zig:3:8: error: attempt to dereference non-pointer type 'Box'", "tmp.zig:8:13: error: attempt to dereference non-pointer type 'Box'", }); cases.add("usingnamespace with wrong type", \\usingnamespace void; , &[_][]const u8{ "tmp.zig:1:1: error: expected struct, enum, or union; found 'void'", }); cases.add("ignored expression in while continuation", \\export fn a() void { \\ while (true) : (bad()) {} \\} \\export fn b() void { \\ var x: anyerror!i32 = 1234; \\ while (x) |_| : (bad()) {} else |_| {} \\} \\export fn c() void { \\ var x: ?i32 = 1234; \\ while (x) |_| : (bad()) {} \\} \\fn bad() anyerror!void { \\ return error.Bad; \\} , &[_][]const u8{ "tmp.zig:2:24: error: error is ignored. consider using `try`, `catch`, or `if`", "tmp.zig:6:25: error: error is ignored. consider using `try`, `catch`, or `if`", "tmp.zig:10:25: error: error is ignored. consider using `try`, `catch`, or `if`", }); cases.add("empty while loop body", \\export fn a() void { \\ while(true); \\} , &[_][]const u8{ "tmp.zig:2:16: error: expected loop body, found ';'", }); cases.add("empty for loop body", \\export fn a() void { \\ for(undefined) |x|; \\} , &[_][]const u8{ "tmp.zig:2:23: error: expected loop body, found ';'", }); cases.add("empty if body", \\export fn a() void { \\ if(true); \\} , &[_][]const u8{ "tmp.zig:2:13: error: expected if body, found ';'", }); cases.add("import outside package path", \\comptime{ \\ _ = @import("../a.zig"); \\} , &[_][]const u8{ "tmp.zig:2:9: error: import of file outside package path: '../a.zig'", }); cases.add("bogus compile var", \\const x = @import("builtin").bogus; \\export fn entry() usize { return @sizeOf(@TypeOf(x)); } , &[_][]const u8{ "tmp.zig:1:29: error: container 'builtin' has no member called 'bogus'", }); cases.add("wrong panic signature, runtime function", \\test "" {} \\ \\pub fn panic() void {} \\ , &[_][]const u8{ "error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void'", }); cases.add("wrong panic signature, generic function", \\pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { \\ while (true) {} \\} , &[_][]const u8{ "error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype'", "note: only one of the functions is generic", }); cases.add("direct struct loop", \\const A = struct { a : A, }; \\export fn entry() usize { return @sizeOf(A); } , &[_][]const u8{ "tmp.zig:1:11: error: struct 'A' depends on itself", }); cases.add("indirect struct loop", \\const A = struct { b : B, }; \\const B = struct { c : C, }; \\const C = struct { a : A, }; \\export fn entry() usize { return @sizeOf(A); } , &[_][]const u8{ "tmp.zig:1:11: error: struct 'A' depends on itself", }); cases.add("instantiating an undefined value for an invalid struct that contains itself", \\const Foo = struct { \\ x: Foo, \\}; \\ \\var foo: Foo = undefined; \\ \\export fn entry() usize { \\ return @sizeOf(@TypeOf(foo.x)); \\} , &[_][]const u8{ "tmp.zig:1:13: error: struct 'Foo' depends on itself", "tmp.zig:8:28: note: referenced here", }); cases.add("enum field value references enum", \\pub const Foo = extern enum { \\ A = Foo.B, \\ C = D, \\}; \\export fn entry() void { \\ var s: Foo = Foo.E; \\} , &[_][]const u8{ "tmp.zig:1:17: error: enum 'Foo' depends on itself", }); cases.add("top level decl dependency loop", \\const a : @TypeOf(b) = 0; \\const b : @TypeOf(a) = 0; \\export fn entry() void { \\ const c = a + b; \\} , &[_][]const u8{ "tmp.zig:2:19: error: dependency loop detected", "tmp.zig:1:19: note: referenced here", "tmp.zig:4:15: note: referenced here", }); cases.addTest("not an enum type", \\export fn entry() void { \\ var self: Error = undefined; \\ switch (self) { \\ InvalidToken => |x| return x.token, \\ ExpectedVarDeclOrFn => |x| return x.token, \\ } \\} \\const Error = union(enum) { \\ A: InvalidToken, \\ B: ExpectedVarDeclOrFn, \\}; \\const InvalidToken = struct {}; \\const ExpectedVarDeclOrFn = struct {}; , &[_][]const u8{ "tmp.zig:4:9: error: expected type '@typeInfo(Error).Union.tag_type.?', found 'type'", }); cases.addTest("binary OR operator on error sets", \\pub const A = error.A; \\pub const AB = A | error.B; \\export fn entry() void { \\ var x: AB = undefined; \\} , &[_][]const u8{ "tmp.zig:2:18: error: invalid operands to binary expression: 'error{A}' and 'error{B}'", }); if (std.Target.current.os.tag == .linux) { cases.addTest("implicit dependency on libc", \\extern "c" fn exit(u8) void; \\export fn entry() void { \\ exit(0); \\} , &[_][]const u8{ "tmp.zig:3:5: error: dependency on libc must be explicitly specified in the build command", }); cases.addTest("libc headers note", \\const c = @cImport(@cInclude("stdio.h")); \\export fn entry() void { \\ _ = c.printf("hello, world!\n"); \\} , &[_][]const u8{ "tmp.zig:1:11: error: C import failed", "tmp.zig:1:11: note: libc headers not available; compilation does not link against libc", }); } cases.addTest("comptime vector overflow shows the index", \\comptime { \\ var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 }; \\ var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 }; \\ var x = a + b; \\} , &[_][]const u8{ "tmp.zig:4:15: error: operation caused overflow", "tmp.zig:4:15: note: when computing vector element at index 2", }); cases.addTest("packed struct with fields of not allowed types", \\const A = packed struct { \\ x: anyerror, \\}; \\const B = packed struct { \\ x: [2]u24, \\}; \\const C = packed struct { \\ x: [1]anyerror, \\}; \\const D = packed struct { \\ x: [1]S, \\}; \\const E = packed struct { \\ x: [1]U, \\}; \\const F = packed struct { \\ x: ?anyerror, \\}; \\const G = packed struct { \\ x: Enum, \\}; \\export fn entry1() void { \\ var a: A = undefined; \\} \\export fn entry2() void { \\ var b: B = undefined; \\} \\export fn entry3() void { \\ var r: C = undefined; \\} \\export fn entry4() void { \\ var d: D = undefined; \\} \\export fn entry5() void { \\ var e: E = undefined; \\} \\export fn entry6() void { \\ var f: F = undefined; \\} \\export fn entry7() void { \\ var g: G = undefined; \\} \\const S = struct { \\ x: i32, \\}; \\const U = struct { \\ A: i32, \\ B: u32, \\}; \\const Enum = enum { \\ A, \\ B, \\}; , &[_][]const u8{ "tmp.zig:2:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation", "tmp.zig:5:5: error: array of 'u24' not allowed in packed struct due to padding bits", "tmp.zig:8:5: error: type 'anyerror' not allowed in packed struct; no guaranteed in-memory representation", "tmp.zig:11:5: error: non-packed, non-extern struct 'S' not allowed in packed struct; no guaranteed in-memory representation", "tmp.zig:14:5: error: non-packed, non-extern struct 'U' not allowed in packed struct; no guaranteed in-memory representation", "tmp.zig:17:5: error: type '?anyerror' not allowed in packed struct; no guaranteed in-memory representation", "tmp.zig:20:5: error: type 'Enum' not allowed in packed struct; no guaranteed in-memory representation", "tmp.zig:50:14: note: enum declaration does not specify an integer tag type", }); cases.addCase(x: { var tc = cases.create("deduplicate undeclared identifier", \\export fn a() void { \\ x += 1; \\} \\export fn b() void { \\ x += 1; \\} , &[_][]const u8{ "tmp.zig:2:5: error: use of undeclared identifier 'x'", }); tc.expect_exact = true; break :x tc; }); cases.add("export generic function", \\export fn foo(num: anytype) i32 { \\ return 0; \\} , &[_][]const u8{ "tmp.zig:1:15: error: parameter of type 'anytype' not allowed in function with calling convention 'C'", }); cases.add("C pointer to c_void", \\export fn a() void { \\ var x: *c_void = undefined; \\ var y: [*c]c_void = x; \\} , &[_][]const u8{ "tmp.zig:3:16: error: C pointers cannot point to opaque types", }); cases.add("directly embedding opaque type in struct and union", \\const O = opaque {}; \\const Foo = struct { \\ o: O, \\}; \\const Bar = union { \\ One: i32, \\ Two: O, \\}; \\export fn a() void { \\ var foo: Foo = undefined; \\} \\export fn b() void { \\ var bar: Bar = undefined; \\} \\export fn c() void { \\ var baz: *opaque {} = undefined; \\ const qux = .{baz.*}; \\} , &[_][]const u8{ "tmp.zig:3:5: error: opaque types have unknown size and therefore cannot be directly embedded in structs", "tmp.zig:7:5: error: opaque types have unknown size and therefore cannot be directly embedded in unions", "tmp.zig:17:22: error: opaque types have unknown size and therefore cannot be directly embedded in structs", }); cases.add("implicit cast between C pointer and Zig pointer - bad const/align/child", \\export fn a() void { \\ var x: [*c]u8 = undefined; \\ var y: *align(4) u8 = x; \\} \\export fn b() void { \\ var x: [*c]const u8 = undefined; \\ var y: *u8 = x; \\} \\export fn c() void { \\ var x: [*c]u8 = undefined; \\ var y: *u32 = x; \\} \\export fn d() void { \\ var y: *align(1) u32 = undefined; \\ var x: [*c]u32 = y; \\} \\export fn e() void { \\ var y: *const u8 = undefined; \\ var x: [*c]u8 = y; \\} \\export fn f() void { \\ var y: *u8 = undefined; \\ var x: [*c]u32 = y; \\} , &[_][]const u8{ "tmp.zig:3:27: error: cast increases pointer alignment", "tmp.zig:7:18: error: cast discards const qualifier", "tmp.zig:11:19: error: expected type '*u32', found '[*c]u8'", "tmp.zig:11:19: note: pointer type child 'u8' cannot cast into pointer type child 'u32'", "tmp.zig:15:22: error: cast increases pointer alignment", "tmp.zig:19:21: error: cast discards const qualifier", "tmp.zig:23:22: error: expected type '[*c]u32', found '*u8'", }); cases.add("implicit casting null c pointer to zig pointer", \\comptime { \\ var c_ptr: [*c]u8 = 0; \\ var zig_ptr: *u8 = c_ptr; \\} , &[_][]const u8{ "tmp.zig:3:24: error: null pointer casted to type '*u8'", }); cases.add("implicit casting undefined c pointer to zig pointer", \\comptime { \\ var c_ptr: [*c]u8 = undefined; \\ var zig_ptr: *u8 = c_ptr; \\} , &[_][]const u8{ "tmp.zig:3:24: error: use of undefined value here causes undefined behavior", }); cases.add("implicit casting C pointers which would mess up null semantics", \\export fn entry() void { \\ var slice: []const u8 = "aoeu"; \\ const opt_many_ptr: [*]const u8 = slice.ptr; \\ var ptr_opt_many_ptr = &opt_many_ptr; \\ var c_ptr: [*c]const [*c]const u8 = ptr_opt_many_ptr; \\ ptr_opt_many_ptr = c_ptr; \\} \\export fn entry2() void { \\ var buf: [4]u8 = "aoeu".*; \\ var slice: []u8 = &buf; \\ var opt_many_ptr: [*]u8 = slice.ptr; \\ var ptr_opt_many_ptr = &opt_many_ptr; \\ var c_ptr: [*c][*c]const u8 = ptr_opt_many_ptr; \\} , &[_][]const u8{ "tmp.zig:6:24: error: expected type '*const [*]const u8', found '[*c]const [*c]const u8'", "tmp.zig:6:24: note: pointer type child '[*c]const u8' cannot cast into pointer type child '[*]const u8'", "tmp.zig:6:24: note: '[*c]const u8' could have null values which are illegal in type '[*]const u8'", "tmp.zig:13:35: error: expected type '[*c][*c]const u8', found '*[*]u8'", "tmp.zig:13:35: note: pointer type child '[*]u8' cannot cast into pointer type child '[*c]const u8'", "tmp.zig:13:35: note: mutable '[*c]const u8' allows illegal null values stored to type '[*]u8'", }); cases.add("implicit casting too big integers to C pointers", \\export fn a() void { \\ var ptr: [*c]u8 = (1 << 64) + 1; \\} \\export fn b() void { \\ var x: u65 = 0x1234; \\ var ptr: [*c]u8 = x; \\} , &[_][]const u8{ "tmp.zig:2:33: error: integer value 18446744073709551617 cannot be coerced to type 'usize'", "tmp.zig:6:23: error: integer type 'u65' too big for implicit @intToPtr to type '[*c]u8'", }); cases.add("C pointer pointing to non C ABI compatible type or has align attr", \\const Foo = struct {}; \\export fn a() void { \\ const T = [*c]Foo; \\ var t: T = undefined; \\} , &[_][]const u8{ "tmp.zig:3:19: error: C pointers cannot point to non-C-ABI-compatible type 'Foo'", }); cases.addCase(x: { var tc = cases.create("compile log statement warning deduplication in generic fn", \\export fn entry() void { \\ inner(1); \\ inner(2); \\} \\fn inner(comptime n: usize) void { \\ comptime var i = 0; \\ inline while (i < n) : (i += 1) { @compileLog("!@#$"); } \\} , &[_][]const u8{ "tmp.zig:7:39: error: found compile log statement", }); tc.expect_exact = true; break :x tc; }); cases.add("assign to invalid dereference", \\export fn entry() void { \\ 'a'.* = 1; \\} , &[_][]const u8{ "tmp.zig:2:8: error: attempt to dereference non-pointer type 'comptime_int'", }); cases.add("take slice of invalid dereference", \\export fn entry() void { \\ const x = 'a'.*[0..]; \\} , &[_][]const u8{ "tmp.zig:2:18: error: attempt to dereference non-pointer type 'comptime_int'", }); cases.add("@truncate undefined value", \\export fn entry() void { \\ var z = @truncate(u8, @as(u16, undefined)); \\} , &[_][]const u8{ "tmp.zig:2:27: error: use of undefined value here causes undefined behavior", }); cases.addTest("return invalid type from test", \\test "example" { return 1; } , &[_][]const u8{ "tmp.zig:1:25: error: expected type 'void', found 'comptime_int'", }); cases.add("threadlocal qualifier on const", \\threadlocal const x: i32 = 1234; \\export fn entry() i32 { \\ return x; \\} , &[_][]const u8{ "tmp.zig:1:13: error: threadlocal variable cannot be constant", }); cases.add("@bitCast same size but bit count mismatch", \\export fn entry(byte: u8) void { \\ var oops = @bitCast(u7, byte); \\} , &[_][]const u8{ "tmp.zig:2:25: error: destination type 'u7' has 7 bits but source type 'u8' has 8 bits", }); cases.add("@bitCast with different sizes inside an expression", \\export fn entry() void { \\ var foo = (@bitCast(u8, @as(f32, 1.0)) == 0xf); \\} , &[_][]const u8{ "tmp.zig:2:25: error: destination type 'u8' has size 1 but source type 'f32' has size 4", }); cases.add("attempted `&&`", \\export fn entry(a: bool, b: bool) i32 { \\ if (a && b) { \\ return 1234; \\ } \\ return 5678; \\} , &[_][]const u8{ "tmp.zig:2:12: error: `&&` is invalid. Note that `and` is boolean AND", }); cases.add("attempted `||` on boolean values", \\export fn entry(a: bool, b: bool) i32 { \\ if (a || b) { \\ return 1234; \\ } \\ return 5678; \\} , &[_][]const u8{ "tmp.zig:2:9: error: expected error set type, found 'bool'", "tmp.zig:2:11: note: `||` merges error sets; `or` performs boolean OR", }); cases.add("compile log a pointer to an opaque value", \\export fn entry() void { \\ @compileLog(@ptrCast(*const c_void, &entry)); \\} , &[_][]const u8{ "tmp.zig:2:5: error: found compile log statement", }); cases.add("duplicate boolean switch value", \\comptime { \\ const x = switch (true) { \\ true => false, \\ false => true, \\ true => false, \\ }; \\} \\comptime { \\ const x = switch (true) { \\ false => true, \\ true => false, \\ false => true, \\ }; \\} , &[_][]const u8{ "tmp.zig:5:9: error: duplicate switch value", "tmp.zig:12:9: error: duplicate switch value", }); cases.add("missing boolean switch value", \\comptime { \\ const x = switch (true) { \\ true => false, \\ }; \\} \\comptime { \\ const x = switch (true) { \\ false => true, \\ }; \\} , &[_][]const u8{ "tmp.zig:2:15: error: switch must handle all possibilities", "tmp.zig:7:15: error: switch must handle all possibilities", }); cases.add("reading past end of pointer casted array", \\comptime { \\ const array: [4]u8 = "aoeu".*; \\ const sub_array = array[1..]; \\ const int_ptr = @ptrCast(*const u24, sub_array); \\ const deref = int_ptr.*; \\} , &[_][]const u8{ "tmp.zig:5:26: error: attempt to read 4 bytes from [4]u8 at index 1 which is 3 bytes", }); cases.add("error note for function parameter incompatibility", \\fn do_the_thing(func: fn (arg: i32) void) void {} \\fn bar(arg: bool) void {} \\export fn entry() void { \\ do_the_thing(bar); \\} , &[_][]const u8{ "tmp.zig:4:18: error: expected type 'fn(i32) void', found 'fn(bool) void", "tmp.zig:4:18: note: parameter 0: 'bool' cannot cast into 'i32'", }); cases.add("cast negative value to unsigned integer", \\comptime { \\ const value: i32 = -1; \\ const unsigned = @intCast(u32, value); \\} \\export fn entry1() void { \\ const value: i32 = -1; \\ const unsigned: u32 = value; \\} , &[_][]const u8{ "tmp.zig:3:22: error: attempt to cast negative value to unsigned integer", "tmp.zig:7:27: error: cannot cast negative value -1 to unsigned integer type 'u32'", }); cases.add("integer cast truncates bits", \\export fn entry1() void { \\ const spartan_count: u16 = 300; \\ const byte = @intCast(u8, spartan_count); \\} \\export fn entry2() void { \\ const spartan_count: u16 = 300; \\ const byte: u8 = spartan_count; \\} \\export fn entry3() void { \\ var spartan_count: u16 = 300; \\ var byte: u8 = spartan_count; \\} \\export fn entry4() void { \\ var signed: i8 = -1; \\ var unsigned: u64 = signed; \\} , &[_][]const u8{ "tmp.zig:3:18: error: cast from 'u16' to 'u8' truncates bits", "tmp.zig:7:22: error: integer value 300 cannot be coerced to type 'u8'", "tmp.zig:11:20: error: expected type 'u8', found 'u16'", "tmp.zig:11:20: note: unsigned 8-bit int cannot represent all possible unsigned 16-bit values", "tmp.zig:15:25: error: expected type 'u64', found 'i8'", "tmp.zig:15:25: note: unsigned 64-bit int cannot represent all possible signed 8-bit values", }); cases.add("comptime implicit cast f64 to f32", \\export fn entry() void { \\ const x: f64 = 16777217; \\ const y: f32 = x; \\} , &[_][]const u8{ "tmp.zig:3:20: error: cast of value 16777217.000000 to type 'f32' loses information", }); cases.add("implicit cast from f64 to f32", \\var x: f64 = 1.0; \\var y: f32 = x; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:2:14: error: expected type 'f32', found 'f64'", }); cases.add("exceeded maximum bit width of integer", \\export fn entry1() void { \\ const T = u65536; \\} \\export fn entry2() void { \\ var x: i65536 = 1; \\} , &[_][]const u8{ "tmp.zig:5:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535", }); cases.add("compile error when evaluating return type of inferred error set", \\const Car = struct { \\ foo: *SymbolThatDoesNotExist, \\ pub fn init() !Car {} \\}; \\export fn entry() void { \\ const car = Car.init(); \\} , &[_][]const u8{ "tmp.zig:2:11: error: use of undeclared identifier 'SymbolThatDoesNotExist'", }); cases.add("don't implicit cast double pointer to *c_void", \\export fn entry() void { \\ var a: u32 = 1; \\ var ptr: *align(@alignOf(u32)) c_void = &a; \\ var b: *u32 = @ptrCast(*u32, ptr); \\ var ptr2: *c_void = &b; \\} , &[_][]const u8{ "tmp.zig:5:26: error: expected type '*c_void', found '**u32'", }); cases.add("runtime index into comptime type slice", \\const Struct = struct { \\ a: u32, \\}; \\fn getIndex() usize { \\ return 2; \\} \\export fn entry() void { \\ const index = getIndex(); \\ const field = @typeInfo(Struct).Struct.fields[index]; \\} , &[_][]const u8{ "tmp.zig:9:51: error: values of type 'std.builtin.StructField' must be comptime known, but index value is runtime known", }); cases.add("compile log statement inside function which must be comptime evaluated", \\fn Foo(comptime T: type) type { \\ @compileLog(@typeName(T)); \\ return T; \\} \\export fn entry() void { \\ _ = Foo(i32); \\ _ = @typeName(Foo(i32)); \\} , &[_][]const u8{ "tmp.zig:2:5: error: found compile log statement", }); cases.add("comptime slice of an undefined slice", \\comptime { \\ var a: []u8 = undefined; \\ var b = a[0..10]; \\} , &[_][]const u8{ "tmp.zig:3:14: error: slice of undefined", }); cases.add("implicit cast const array to mutable slice", \\export fn entry() void { \\ const buffer: [1]u8 = [_]u8{8}; \\ const sliceA: []u8 = &buffer; \\} , &[_][]const u8{ "tmp.zig:3:27: error: expected type '[]u8', found '*const [1]u8'", }); cases.add("deref slice and get len field", \\export fn entry() void { \\ var a: []u8 = undefined; \\ _ = a.*.len; \\} , &[_][]const u8{ "tmp.zig:3:10: error: attempt to dereference non-pointer type '[]u8'", }); cases.add("@ptrCast a 0 bit type to a non- 0 bit type", \\export fn entry() bool { \\ var x: u0 = 0; \\ const p = @ptrCast(?*u0, &x); \\ return p == null; \\} , &[_][]const u8{ "tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation", "tmp.zig:3:31: note: '*u0' has no in-memory bits", "tmp.zig:3:24: note: '?*u0' has in-memory bits", }); cases.add("comparing a non-optional pointer against null", \\export fn entry() void { \\ var x: i32 = 1; \\ _ = &x == null; \\} , &[_][]const u8{ "tmp.zig:3:12: error: comparison of '*i32' with null", }); cases.add("non error sets used in merge error sets operator", \\export fn foo() void { \\ const Errors = u8 || u16; \\} \\export fn bar() void { \\ const Errors = error{} || u16; \\} , &[_][]const u8{ "tmp.zig:2:20: error: expected error set type, found type 'u8'", "tmp.zig:2:23: note: `||` merges error sets; `or` performs boolean OR", "tmp.zig:5:31: error: expected error set type, found type 'u16'", "tmp.zig:5:28: note: `||` merges error sets; `or` performs boolean OR", }); cases.add("variable initialization compile error then referenced", \\fn Undeclared() type { \\ return T; \\} \\fn Gen() type { \\ const X = Undeclared(); \\ return struct { \\ x: X, \\ }; \\} \\export fn entry() void { \\ const S = Gen(); \\} , &[_][]const u8{ "tmp.zig:2:12: error: use of undeclared identifier 'T'", }); cases.add("refer to the type of a generic function", \\export fn entry() void { \\ const Func = fn (type) void; \\ const f: Func = undefined; \\ f(i32); \\} , &[_][]const u8{ "tmp.zig:4:5: error: use of undefined value here causes undefined behavior", }); cases.add("accessing runtime parameter from outer function", \\fn outer(y: u32) fn (u32) u32 { \\ const st = struct { \\ fn get(z: u32) u32 { \\ return z + y; \\ } \\ }; \\ return st.get; \\} \\export fn entry() void { \\ var func = outer(10); \\ var x = func(3); \\} , &[_][]const u8{ "tmp.zig:4:24: error: 'y' not accessible from inner function", "tmp.zig:3:28: note: crossed function definition here", "tmp.zig:1:10: note: declared here", }); cases.add("non int passed to @intToFloat", \\export fn entry() void { \\ const x = @intToFloat(f32, 1.1); \\} , &[_][]const u8{ "tmp.zig:2:32: error: expected int type, found 'comptime_float'", }); cases.add("non float passed to @floatToInt", \\export fn entry() void { \\ const x = @floatToInt(i32, @as(i32, 54)); \\} , &[_][]const u8{ "tmp.zig:2:32: error: expected float type, found 'i32'", }); cases.add("out of range comptime_int passed to @floatToInt", \\export fn entry() void { \\ const x = @floatToInt(i8, 200); \\} , &[_][]const u8{ "tmp.zig:2:31: error: integer value 200 cannot be coerced to type 'i8'", }); cases.add("load too many bytes from comptime reinterpreted pointer", \\export fn entry() void { \\ const float: f32 = 5.99999999999994648725e-01; \\ const float_ptr = &float; \\ const int_ptr = @ptrCast(*const i64, float_ptr); \\ const int_val = int_ptr.*; \\} , &[_][]const u8{ "tmp.zig:5:28: error: attempt to read 8 bytes from pointer to f32 which is 4 bytes", }); cases.add("invalid type used in array type", \\const Item = struct { \\ field: SomeNonexistentType, \\}; \\var items: [100]Item = undefined; \\export fn entry() void { \\ const a = items[0]; \\} , &[_][]const u8{ "tmp.zig:2:12: error: use of undeclared identifier 'SomeNonexistentType'", }); cases.add("comptime continue inside runtime catch", \\export fn entry(c: bool) void { \\ const ints = [_]u8{ 1, 2 }; \\ inline for (ints) |_| { \\ bad() catch |_| continue; \\ } \\} \\fn bad() !void { \\ return error.Bad; \\} , &[_][]const u8{ "tmp.zig:4:25: error: comptime control flow inside runtime block", "tmp.zig:4:15: note: runtime block created here", }); cases.add("comptime continue inside runtime switch", \\export fn entry() void { \\ var p: i32 = undefined; \\ comptime var q = true; \\ inline while (q) { \\ switch (p) { \\ 11 => continue, \\ else => {}, \\ } \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:6:19: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("comptime continue inside runtime while error", \\export fn entry() void { \\ var p: anyerror!usize = undefined; \\ comptime var q = true; \\ outer: inline while (q) { \\ while (p) |_| { \\ continue :outer; \\ } else |_| {} \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:6:13: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("comptime continue inside runtime while optional", \\export fn entry() void { \\ var p: ?usize = undefined; \\ comptime var q = true; \\ outer: inline while (q) { \\ while (p) |_| continue :outer; \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:5:23: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("comptime continue inside runtime while bool", \\export fn entry() void { \\ var p: usize = undefined; \\ comptime var q = true; \\ outer: inline while (q) { \\ while (p == 11) continue :outer; \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:5:25: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("comptime continue inside runtime if error", \\export fn entry() void { \\ var p: anyerror!i32 = undefined; \\ comptime var q = true; \\ inline while (q) { \\ if (p) |_| continue else |_| {} \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:5:20: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("comptime continue inside runtime if optional", \\export fn entry() void { \\ var p: ?i32 = undefined; \\ comptime var q = true; \\ inline while (q) { \\ if (p) |_| continue; \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:5:20: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("comptime continue inside runtime if bool", \\export fn entry() void { \\ var p: usize = undefined; \\ comptime var q = true; \\ inline while (q) { \\ if (p == 11) continue; \\ q = false; \\ } \\} , &[_][]const u8{ "tmp.zig:5:22: error: comptime control flow inside runtime block", "tmp.zig:5:9: note: runtime block created here", }); cases.add("switch with invalid expression parameter", \\export fn entry() void { \\ Test(i32); \\} \\fn Test(comptime T: type) void { \\ const x = switch (T) { \\ []u8 => |x| 123, \\ i32 => |x| 456, \\ else => unreachable, \\ }; \\} , &[_][]const u8{ "tmp.zig:7:17: error: switch on type 'type' provides no expression parameter", }); cases.add("function prototype with no body", \\fn foo() void; \\export fn entry() void { \\ foo(); \\} , &[_][]const u8{ "tmp.zig:1:1: error: non-extern function has no body", }); cases.add("@frame() called outside of function definition", \\var handle_undef: anyframe = undefined; \\var handle_dummy: anyframe = @frame(); \\export fn entry() bool { \\ return handle_undef == handle_dummy; \\} , &[_][]const u8{ "tmp.zig:2:30: error: @frame() called outside of function definition", }); cases.add("`_` is not a declarable symbol", \\export fn f1() usize { \\ var _: usize = 2; \\ return _; \\} , &[_][]const u8{ "tmp.zig:2:5: error: `_` is not a declarable symbol", }); cases.add("`_` should not be usable inside for", \\export fn returns() void { \\ for ([_]void{}) |_, i| { \\ for ([_]void{}) |_, j| { \\ return _; \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:4:20: error: `_` may only be used to assign things to", }); cases.add("`_` should not be usable inside while", \\export fn returns() void { \\ while (optionalReturn()) |_| { \\ while (optionalReturn()) |_| { \\ return _; \\ } \\ } \\} \\fn optionalReturn() ?u32 { \\ return 1; \\} , &[_][]const u8{ "tmp.zig:4:20: error: `_` may only be used to assign things to", }); cases.add("`_` should not be usable inside while else", \\export fn returns() void { \\ while (optionalReturnError()) |_| { \\ while (optionalReturnError()) |_| { \\ return; \\ } else |_| { \\ if (_ == error.optionalReturnError) return; \\ } \\ } \\} \\fn optionalReturnError() !?u32 { \\ return error.optionalReturnError; \\} , &[_][]const u8{ "tmp.zig:6:17: error: `_` may only be used to assign things to", }); cases.add("while loop body expression ignored", \\fn returns() usize { \\ return 2; \\} \\export fn f1() void { \\ while (true) returns(); \\} \\export fn f2() void { \\ var x: ?i32 = null; \\ while (x) |_| returns(); \\} \\export fn f3() void { \\ var x: anyerror!i32 = error.Bad; \\ while (x) |_| returns() else |_| unreachable; \\} , &[_][]const u8{ "tmp.zig:5:25: error: expression value is ignored", "tmp.zig:9:26: error: expression value is ignored", "tmp.zig:13:26: error: expression value is ignored", }); cases.add("missing parameter name of generic function", \\fn dump(anytype) void {} \\export fn entry() void { \\ var a: u8 = 9; \\ dump(a); \\} , &[_][]const u8{ "tmp.zig:1:9: error: missing parameter name", }); cases.add("non-inline for loop on a type that requires comptime", \\const Foo = struct { \\ name: []const u8, \\ T: type, \\}; \\export fn entry() void { \\ const xx: [2]Foo = undefined; \\ for (xx) |f| {} \\} , &[_][]const u8{ "tmp.zig:7:5: error: values of type 'Foo' must be comptime known, but index value is runtime known", }); cases.add("generic fn as parameter without comptime keyword", \\fn f(_: fn (anytype) void) void {} \\fn g(_: anytype) void {} \\export fn entry() void { \\ f(g); \\} , &[_][]const u8{ "tmp.zig:1:9: error: parameter of type 'fn(anytype) anytype' must be declared comptime", }); cases.add("optional pointer to void in extern struct", \\const Foo = extern struct { \\ x: ?*const void, \\}; \\const Bar = extern struct { \\ foo: Foo, \\ y: i32, \\}; \\export fn entry(bar: *Bar) void {} , &[_][]const u8{ "tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void'", }); cases.add("use of comptime-known undefined function value", \\const Cmd = struct { \\ exec: fn () void, \\}; \\export fn entry() void { \\ const command = Cmd{ .exec = undefined }; \\ command.exec(); \\} , &[_][]const u8{ "tmp.zig:6:12: error: use of undefined value here causes undefined behavior", }); cases.add("use of comptime-known undefined function value", \\const Cmd = struct { \\ exec: fn () void, \\}; \\export fn entry() void { \\ const command = Cmd{ .exec = undefined }; \\ command.exec(); \\} , &[_][]const u8{ "tmp.zig:6:12: error: use of undefined value here causes undefined behavior", }); cases.add("bad @alignCast at comptime", \\comptime { \\ const ptr = @intToPtr(*align(1) i32, 0x1); \\ const aligned = @alignCast(4, ptr); \\} , &[_][]const u8{ "tmp.zig:3:35: error: pointer address 0x1 is not aligned to 4 bytes", }); cases.add("@ptrToInt on *void", \\export fn entry() bool { \\ return @ptrToInt(&{}) == @ptrToInt(&{}); \\} , &[_][]const u8{ "tmp.zig:2:23: error: pointer to size 0 type has no address", }); cases.add("@popCount - non-integer", \\export fn entry(x: f32) u32 { \\ return @popCount(f32, x); \\} , &[_][]const u8{ "tmp.zig:2:22: error: expected integer type, found 'f32'", }); cases.addCase(x: { const tc = cases.create("wrong same named struct", \\const a = @import("a.zig"); \\const b = @import("b.zig"); \\ \\export fn entry() void { \\ var a1: a.Foo = undefined; \\ bar(&a1); \\} \\ \\fn bar(x: *b.Foo) void {} , &[_][]const u8{ "tmp.zig:6:10: error: expected type '*b.Foo', found '*a.Foo'", "tmp.zig:6:10: note: pointer type child 'a.Foo' cannot cast into pointer type child 'b.Foo'", "a.zig:1:17: note: a.Foo declared here", "b.zig:1:17: note: b.Foo declared here", }); tc.addSourceFile("a.zig", \\pub const Foo = struct { \\ x: i32, \\}; ); tc.addSourceFile("b.zig", \\pub const Foo = struct { \\ z: f64, \\}; ); break :x tc; }); cases.add("@floatToInt comptime safety", \\comptime { \\ _ = @floatToInt(i8, @as(f32, -129.1)); \\} \\comptime { \\ _ = @floatToInt(u8, @as(f32, -1.1)); \\} \\comptime { \\ _ = @floatToInt(u8, @as(f32, 256.1)); \\} , &[_][]const u8{ "tmp.zig:2:9: error: integer value '-129' cannot be stored in type 'i8'", "tmp.zig:5:9: error: integer value '-1' cannot be stored in type 'u8'", "tmp.zig:8:9: error: integer value '256' cannot be stored in type 'u8'", }); cases.add("use c_void as return type of fn ptr", \\export fn entry() void { \\ const a: fn () c_void = undefined; \\} , &[_][]const u8{ "tmp.zig:2:20: error: return type cannot be opaque", }); cases.add("use implicit casts to assign null to non-nullable pointer", \\export fn entry() void { \\ var x: i32 = 1234; \\ var p: *i32 = &x; \\ var pp: *?*i32 = &p; \\ pp.* = null; \\ var y = p.*; \\} , &[_][]const u8{ "tmp.zig:4:23: error: expected type '*?*i32', found '**i32'", }); cases.add("attempted implicit cast from T to [*]const T", \\export fn entry() void { \\ const x: [*]const bool = true; \\} , &[_][]const u8{ "tmp.zig:2:30: error: expected type '[*]const bool', found 'bool'", }); cases.add("dereference unknown length pointer", \\export fn entry(x: [*]i32) i32 { \\ return x.*; \\} , &[_][]const u8{ "tmp.zig:2:13: error: index syntax required for unknown-length pointer type '[*]i32'", }); cases.add("field access of unknown length pointer", \\const Foo = extern struct { \\ a: i32, \\}; \\ \\export fn entry(foo: [*]Foo) void { \\ foo.a += 1; \\} , &[_][]const u8{ "tmp.zig:6:8: error: type '[*]Foo' does not support field access", }); cases.add("unknown length pointer to opaque", \\export const T = [*]opaque {}; , &[_][]const u8{ "tmp.zig:1:21: error: unknown-length pointer to opaque", }); cases.add("error when evaluating return type", \\const Foo = struct { \\ map: @as(i32, i32), \\ \\ fn init() Foo { \\ return undefined; \\ } \\}; \\export fn entry() void { \\ var rule_set = try Foo.init(); \\} , &[_][]const u8{ "tmp.zig:2:19: error: expected type 'i32', found 'type'", }); cases.add("slicing single-item pointer", \\export fn entry(ptr: *i32) void { \\ const slice = ptr[0..2]; \\} , &[_][]const u8{ "tmp.zig:2:22: error: slice of single-item pointer", }); cases.add("indexing single-item pointer", \\export fn entry(ptr: *i32) i32 { \\ return ptr[1]; \\} , &[_][]const u8{ "tmp.zig:2:15: error: index of single-item pointer", }); cases.add("nested error set mismatch", \\const NextError = error{NextError}; \\const OtherError = error{OutOfMemory}; \\ \\export fn entry() void { \\ const a: ?NextError!i32 = foo(); \\} \\ \\fn foo() ?OtherError!i32 { \\ return null; \\} , &[_][]const u8{ "tmp.zig:5:34: error: expected type '?NextError!i32', found '?OtherError!i32'", "tmp.zig:5:34: note: optional type child 'OtherError!i32' cannot cast into optional type child 'NextError!i32'", "tmp.zig:5:34: note: error set 'OtherError' cannot cast into error set 'NextError'", "tmp.zig:2:26: note: 'error.OutOfMemory' not a member of destination error set", }); cases.add("invalid deref on switch target", \\comptime { \\ var tile = Tile.Empty; \\ switch (tile.*) { \\ Tile.Empty => {}, \\ Tile.Filled => {}, \\ } \\} \\const Tile = enum { \\ Empty, \\ Filled, \\}; , &[_][]const u8{ "tmp.zig:3:17: error: attempt to dereference non-pointer type 'Tile'", }); cases.add("invalid field access in comptime", \\comptime { var x = doesnt_exist.whatever; } , &[_][]const u8{ "tmp.zig:1:20: error: use of undeclared identifier 'doesnt_exist'", }); cases.add("suspend inside suspend block", \\export fn entry() void { \\ _ = async foo(); \\} \\fn foo() void { \\ suspend { \\ suspend { \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:6:9: error: cannot suspend inside suspend block", "tmp.zig:5:5: note: other suspend block here", }); cases.add("assign inline fn to non-comptime var", \\export fn entry() void { \\ var a = b; \\} \\fn b() callconv(.Inline) void { } , &[_][]const u8{ "tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var", "tmp.zig:4:1: note: declared here", }); cases.add("wrong type passed to @panic", \\export fn entry() void { \\ var e = error.Foo; \\ @panic(e); \\} , &[_][]const u8{ "tmp.zig:3:12: error: expected type '[]const u8', found 'error{Foo}'", }); cases.add("@tagName used on union with no associated enum tag", \\const FloatInt = extern union { \\ Float: f32, \\ Int: i32, \\}; \\export fn entry() void { \\ var fi = FloatInt{.Float = 123.45}; \\ var tagName = @tagName(fi); \\} , &[_][]const u8{ "tmp.zig:7:19: error: union has no associated enum", "tmp.zig:1:18: note: declared here", }); cases.add("returning error from void async function", \\export fn entry() void { \\ _ = async amain(); \\} \\fn amain() callconv(.Async) void { \\ return error.ShouldBeCompileError; \\} , &[_][]const u8{ "tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}'", }); cases.add("var makes structs required to be comptime known", \\export fn entry() void { \\ const S = struct{v: anytype}; \\ var s = S{.v=@as(i32, 10)}; \\} , &[_][]const u8{ "tmp.zig:3:4: error: variable of type 'S' must be const or comptime", }); cases.add("@ptrCast discards const qualifier", \\export fn entry() void { \\ const x: i32 = 1234; \\ const y = @ptrCast(*i32, &x); \\} , &[_][]const u8{ "tmp.zig:3:15: error: cast discards const qualifier", }); cases.add("comptime slice of undefined pointer non-zero len", \\export fn entry() void { \\ const slice = @as([*]i32, undefined)[0..1]; \\} , &[_][]const u8{ "tmp.zig:2:41: error: non-zero length slice of undefined pointer", }); cases.add("type checking function pointers", \\fn a(b: fn (*const u8) void) void { \\ b('a'); \\} \\fn c(d: u8) void {} \\export fn entry() void { \\ a(c); \\} , &[_][]const u8{ "tmp.zig:6:7: error: expected type 'fn(*const u8) void', found 'fn(u8) void'", }); cases.add("no else prong on switch on global error set", \\export fn entry() void { \\ foo(error.A); \\} \\fn foo(a: anyerror) void { \\ switch (a) { \\ error.A => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:5:5: error: else prong required when switching on type 'anyerror'", }); cases.add("error not handled in switch", \\export fn entry() void { \\ foo(452) catch |err| switch (err) { \\ error.Foo => {}, \\ }; \\} \\fn foo(x: i32) !void { \\ switch (x) { \\ 0 ... 10 => return error.Foo, \\ 11 ... 20 => return error.Bar, \\ 21 ... 30 => return error.Baz, \\ else => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:2:26: error: error.Baz not handled in switch", "tmp.zig:2:26: error: error.Bar not handled in switch", }); cases.add("duplicate error in switch", \\export fn entry() void { \\ foo(452) catch |err| switch (err) { \\ error.Foo => {}, \\ error.Bar => {}, \\ error.Foo => {}, \\ else => {}, \\ }; \\} \\fn foo(x: i32) !void { \\ switch (x) { \\ 0 ... 10 => return error.Foo, \\ 11 ... 20 => return error.Bar, \\ else => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:5:14: error: duplicate switch value: '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set.Foo'", "tmp.zig:3:14: note: other value is here", }); cases.add("invalid cast from integral type to enum", \\const E = enum(usize) { One, Two }; \\ \\export fn entry() void { \\ foo(1); \\} \\ \\fn foo(x: usize) void { \\ switch (x) { \\ E.One => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:9:10: error: expected type 'usize', found 'E'", }); cases.add("range operator in switch used on error set", \\export fn entry() void { \\ try foo(452) catch |err| switch (err) { \\ error.A ... error.B => {}, \\ else => {}, \\ }; \\} \\fn foo(x: i32) !void { \\ switch (x) { \\ 0 ... 10 => return error.Foo, \\ 11 ... 20 => return error.Bar, \\ else => {}, \\ } \\} , &[_][]const u8{ "tmp.zig:3:17: error: operator not allowed for errors", }); cases.add("inferring error set of function pointer", \\comptime { \\ const z: ?fn()!void = null; \\} , &[_][]const u8{ "tmp.zig:2:15: error: inferring error set of return type valid only for function definitions", }); cases.add("access non-existent member of error set", \\const Foo = error{A}; \\comptime { \\ const z = Foo.Bar; \\} , &[_][]const u8{ "tmp.zig:3:18: error: no error named 'Bar' in 'Foo'", }); cases.add("error union operator with non error set LHS", \\comptime { \\ const z = i32!i32; \\ var x: z = undefined; \\} , &[_][]const u8{ "tmp.zig:2:15: error: expected error set type, found type 'i32'", }); cases.add("error equality but sets have no common members", \\const Set1 = error{A, C}; \\const Set2 = error{B, D}; \\export fn entry() void { \\ foo(Set1.A); \\} \\fn foo(x: Set1) void { \\ if (x == Set2.B) { \\ \\ } \\} , &[_][]const u8{ "tmp.zig:7:11: error: error sets 'Set1' and 'Set2' have no common errors", }); cases.add("only equality binary operator allowed for error sets", \\comptime { \\ const z = error.A > error.B; \\} , &[_][]const u8{ "tmp.zig:2:23: error: operator not allowed for errors", }); cases.add("explicit error set cast known at comptime violates error sets", \\const Set1 = error {A, B}; \\const Set2 = error {A, C}; \\comptime { \\ var x = Set1.B; \\ var y = @errSetCast(Set2, x); \\} , &[_][]const u8{ "tmp.zig:5:13: error: error.B not a member of error set 'Set2'", }); cases.add("cast error union of global error set to error union of smaller error set", \\const SmallErrorSet = error{A}; \\export fn entry() void { \\ var x: SmallErrorSet!i32 = foo(); \\} \\fn foo() anyerror!i32 { \\ return error.B; \\} , &[_][]const u8{ "tmp.zig:3:35: error: expected type 'SmallErrorSet!i32', found 'anyerror!i32'", "tmp.zig:3:35: note: error set 'anyerror' cannot cast into error set 'SmallErrorSet'", "tmp.zig:3:35: note: cannot cast global error set into smaller set", }); cases.add("cast global error set to error set", \\const SmallErrorSet = error{A}; \\export fn entry() void { \\ var x: SmallErrorSet = foo(); \\} \\fn foo() anyerror { \\ return error.B; \\} , &[_][]const u8{ "tmp.zig:3:31: error: expected type 'SmallErrorSet', found 'anyerror'", "tmp.zig:3:31: note: cannot cast global error set into smaller set", }); cases.add("recursive inferred error set", \\export fn entry() void { \\ foo() catch unreachable; \\} \\fn foo() !void { \\ try foo(); \\} , &[_][]const u8{ "tmp.zig:5:5: error: cannot resolve inferred error set '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set': function 'foo' not fully analyzed yet", }); cases.add("implicit cast of error set not a subset", \\const Set1 = error{A, B}; \\const Set2 = error{A, C}; \\export fn entry() void { \\ foo(Set1.B); \\} \\fn foo(set1: Set1) void { \\ var x: Set2 = set1; \\} , &[_][]const u8{ "tmp.zig:7:19: error: expected type 'Set2', found 'Set1'", "tmp.zig:1:23: note: 'error.B' not a member of destination error set", }); cases.add("int to err global invalid number", \\const Set1 = error{ \\ A, \\ B, \\}; \\comptime { \\ var x: u16 = 3; \\ var y = @intToError(x); \\} , &[_][]const u8{ "tmp.zig:7:13: error: integer value 3 represents no error", }); cases.add("int to err non global invalid number", \\const Set1 = error{ \\ A, \\ B, \\}; \\const Set2 = error{ \\ A, \\ C, \\}; \\comptime { \\ var x = @errorToInt(Set1.B); \\ var y = @errSetCast(Set2, @intToError(x)); \\} , &[_][]const u8{ "tmp.zig:11:13: error: error.B not a member of error set 'Set2'", }); cases.add("duplicate error value in error set", \\const Foo = error { \\ Bar, \\ Bar, \\}; \\export fn entry() void { \\ const a: Foo = undefined; \\} , &[_][]const u8{ "tmp.zig:3:5: error: duplicate error: 'Bar'", "tmp.zig:2:5: note: other error here", }); cases.add("cast negative integer literal to usize", \\export fn entry() void { \\ const x = @as(usize, -10); \\} , &[_][]const u8{ "tmp.zig:2:26: error: cannot cast negative value -10 to unsigned integer type 'usize'", }); cases.add("use invalid number literal as array index", \\var v = 25; \\export fn entry() void { \\ var arr: [v]u8 = undefined; \\} , &[_][]const u8{ "tmp.zig:1:1: error: unable to infer variable type", }); cases.add("duplicate struct field", \\const Foo = struct { \\ Bar: i32, \\ Bar: usize, \\}; \\export fn entry() void { \\ const a: Foo = undefined; \\} , &[_][]const u8{ "tmp.zig:3:5: error: duplicate struct field: 'Bar'", "tmp.zig:2:5: note: other field here", }); cases.add("duplicate union field", \\const Foo = union { \\ Bar: i32, \\ Bar: usize, \\}; \\export fn entry() void { \\ const a: Foo = undefined; \\} , &[_][]const u8{ "tmp.zig:3:5: error: duplicate union field: 'Bar'", "tmp.zig:2:5: note: other field here", }); cases.add("duplicate enum field", \\const Foo = enum { \\ Bar, \\ Bar, \\}; \\ \\export fn entry() void { \\ const a: Foo = undefined; \\} , &[_][]const u8{ "tmp.zig:3:5: error: duplicate enum field: 'Bar'", "tmp.zig:2:5: note: other field here", }); cases.add("calling function with naked calling convention", \\export fn entry() void { \\ foo(); \\} \\fn foo() callconv(.Naked) void { } , &[_][]const u8{ "tmp.zig:2:5: error: unable to call function with naked calling convention", "tmp.zig:4:1: note: declared here", }); cases.add("function with invalid return type", \\export fn foo() boid {} , &[_][]const u8{ "tmp.zig:1:17: error: use of undeclared identifier 'boid'", }); cases.add("function with non-extern non-packed enum parameter", \\const Foo = enum { A, B, C }; \\export fn entry(foo: Foo) void { } , &[_][]const u8{ "tmp.zig:2:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'", }); cases.add("function with non-extern non-packed struct parameter", \\const Foo = struct { \\ A: i32, \\ B: f32, \\ C: bool, \\}; \\export fn entry(foo: Foo) void { } , &[_][]const u8{ "tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'", }); cases.add("function with non-extern non-packed union parameter", \\const Foo = union { \\ A: i32, \\ B: f32, \\ C: bool, \\}; \\export fn entry(foo: Foo) void { } , &[_][]const u8{ "tmp.zig:6:22: error: parameter of type 'Foo' not allowed in function with calling convention 'C'", }); cases.add("switch on enum with 1 field with no prongs", \\const Foo = enum { M }; \\ \\export fn entry() void { \\ var f = Foo.M; \\ switch (f) {} \\} , &[_][]const u8{ "tmp.zig:5:5: error: enumeration value 'Foo.M' not handled in switch", }); cases.add("shift by negative comptime integer", \\comptime { \\ var a = 1 >> -1; \\} , &[_][]const u8{ "tmp.zig:2:18: error: shift by negative value -1", }); cases.add("@panic called at compile time", \\export fn entry() void { \\ comptime { \\ @panic("aoeu",); \\ } \\} , &[_][]const u8{ "tmp.zig:3:9: error: encountered @panic at compile-time", }); cases.add("wrong return type for main", \\pub fn main() f32 { } , &[_][]const u8{ "error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'", }); cases.add("double ?? on main return value", \\pub fn main() ??void { \\} , &[_][]const u8{ "error: expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'", }); cases.add("bad identifier in function with struct defined inside function which references local const", \\export fn entry() void { \\ const BlockKind = u32; \\ \\ const Block = struct { \\ kind: BlockKind, \\ }; \\ \\ bogus; \\} , &[_][]const u8{ "tmp.zig:8:5: error: use of undeclared identifier 'bogus'", }); cases.add("labeled break not found", \\export fn entry() void { \\ blah: while (true) { \\ while (true) { \\ break :outer; \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:4:13: error: label not found: 'outer'", }); cases.add("labeled continue not found", \\export fn entry() void { \\ var i: usize = 0; \\ blah: while (i < 10) : (i += 1) { \\ while (true) { \\ continue :outer; \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:5:13: error: labeled loop not found: 'outer'", }); cases.add("attempt to use 0 bit type in extern fn", \\extern fn foo(ptr: fn(*void) callconv(.C) void) void; \\ \\export fn entry() void { \\ foo(bar); \\} \\ \\fn bar(x: *void) callconv(.C) void { } \\export fn entry2() void { \\ bar(&{}); \\} , &[_][]const u8{ "tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", }); cases.add("implicit semicolon - block statement", \\export fn entry() void { \\ {} \\ var good = {}; \\ ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - block expr", \\export fn entry() void { \\ _ = {}; \\ var good = {}; \\ _ = {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - comptime statement", \\export fn entry() void { \\ comptime {} \\ var good = {}; \\ comptime ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - comptime expression", \\export fn entry() void { \\ _ = comptime {}; \\ var good = {}; \\ _ = comptime {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - defer", \\export fn entry() void { \\ defer {} \\ var good = {}; \\ defer ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if statement", \\export fn entry() void { \\ if(true) {} \\ var good = {}; \\ if(true) ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if expression", \\export fn entry() void { \\ _ = if(true) {}; \\ var good = {}; \\ _ = if(true) {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if-else statement", \\export fn entry() void { \\ if(true) {} else {} \\ var good = {}; \\ if(true) ({}) else ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if-else expression", \\export fn entry() void { \\ _ = if(true) {} else {}; \\ var good = {}; \\ _ = if(true) {} else {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if-else-if statement", \\export fn entry() void { \\ if(true) {} else if(true) {} \\ var good = {}; \\ if(true) ({}) else if(true) ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if-else-if expression", \\export fn entry() void { \\ _ = if(true) {} else if(true) {}; \\ var good = {}; \\ _ = if(true) {} else if(true) {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if-else-if-else statement", \\export fn entry() void { \\ if(true) {} else if(true) {} else {} \\ var good = {}; \\ if(true) ({}) else if(true) ({}) else ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - if-else-if-else expression", \\export fn entry() void { \\ _ = if(true) {} else if(true) {} else {}; \\ var good = {}; \\ _ = if(true) {} else if(true) {} else {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - test statement", \\export fn entry() void { \\ if (foo()) |_| {} \\ var good = {}; \\ if (foo()) |_| ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - test expression", \\export fn entry() void { \\ _ = if (foo()) |_| {}; \\ var good = {}; \\ _ = if (foo()) |_| {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - while statement", \\export fn entry() void { \\ while(true) {} \\ var good = {}; \\ while(true) ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - while expression", \\export fn entry() void { \\ _ = while(true) {}; \\ var good = {}; \\ _ = while(true) {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - while-continue statement", \\export fn entry() void { \\ while(true):({}) {} \\ var good = {}; \\ while(true):({}) ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - while-continue expression", \\export fn entry() void { \\ _ = while(true):({}) {}; \\ var good = {}; \\ _ = while(true):({}) {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - for statement", \\export fn entry() void { \\ for(foo()) |_| {} \\ var good = {}; \\ for(foo()) |_| ({}) \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("implicit semicolon - for expression", \\export fn entry() void { \\ _ = for(foo()) |_| {}; \\ var good = {}; \\ _ = for(foo()) |_| {} \\ var bad = {}; \\} , &[_][]const u8{ "tmp.zig:5:5: error: expected token ';', found 'var'", }); cases.add("multiple function definitions", \\fn a() void {} \\fn a() void {} \\export fn entry() void { a(); } , &[_][]const u8{ "tmp.zig:2:1: error: redefinition of 'a'", }); cases.add("unreachable with return", \\fn a() noreturn {return;} \\export fn entry() void { a(); } , &[_][]const u8{ "tmp.zig:1:18: error: expected type 'noreturn', found 'void'", }); cases.add("control reaches end of non-void function", \\fn a() i32 {} \\export fn entry() void { _ = a(); } , &[_][]const u8{ "tmp.zig:1:12: error: expected type 'i32', found 'void'", }); cases.add("undefined function call", \\export fn a() void { \\ b(); \\} , &[_][]const u8{ "tmp.zig:2:5: error: use of undeclared identifier 'b'", }); cases.add("wrong number of arguments", \\export fn a() void { \\ b(1); \\} \\fn b(a: i32, b: i32, c: i32) void { } , &[_][]const u8{ "tmp.zig:2:6: error: expected 3 argument(s), found 1", }); cases.add("invalid type", \\fn a() bogus {} \\export fn entry() void { _ = a(); } , &[_][]const u8{ "tmp.zig:1:8: error: use of undeclared identifier 'bogus'", }); cases.add("pointer to noreturn", \\fn a() *noreturn {} \\export fn entry() void { _ = a(); } , &[_][]const u8{ "tmp.zig:1:9: error: pointer to noreturn not allowed", }); cases.add("unreachable code", \\export fn a() void { \\ return; \\ b(); \\} \\ \\fn b() void {} , &[_][]const u8{ "tmp.zig:3:5: error: unreachable code", }); cases.add("bad import", \\const bogus = @import("bogus-does-not-exist.zig",); \\export fn entry() void { bogus.bogo(); } , &[_][]const u8{ "tmp.zig:1:15: error: unable to find 'bogus-does-not-exist.zig'", }); cases.add("undeclared identifier", \\export fn a() void { \\ return \\ b + \\ c; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undeclared identifier 'b'", }); cases.add("parameter redeclaration", \\fn f(a : i32, a : i32) void { \\} \\export fn entry() void { f(1, 2); } , &[_][]const u8{ "tmp.zig:1:15: error: redeclaration of variable 'a'", }); cases.add("local variable redeclaration", \\export fn f() void { \\ const a : i32 = 0; \\ const a = 0; \\} , &[_][]const u8{ "tmp.zig:3:5: error: redeclaration of variable 'a'", }); cases.add("local variable redeclares parameter", \\fn f(a : i32) void { \\ const a = 0; \\} \\export fn entry() void { f(1); } , &[_][]const u8{ "tmp.zig:2:5: error: redeclaration of variable 'a'", }); cases.add("variable has wrong type", \\export fn f() i32 { \\ const a = "a"; \\ return a; \\} , &[_][]const u8{ "tmp.zig:3:12: error: expected type 'i32', found '*const [1:0]u8'", }); cases.add("if condition is bool, not int", \\export fn f() void { \\ if (0) {} \\} , &[_][]const u8{ "tmp.zig:2:9: error: expected type 'bool', found 'comptime_int'", }); cases.add("assign unreachable", \\export fn f() void { \\ const a = return; \\} , &[_][]const u8{ "tmp.zig:2:5: error: unreachable code", }); cases.add("unreachable variable", \\export fn f() void { \\ const a: noreturn = {}; \\} , &[_][]const u8{ "tmp.zig:2:25: error: expected type 'noreturn', found 'void'", }); cases.add("unreachable parameter", \\fn f(a: noreturn) void {} \\export fn entry() void { f(); } , &[_][]const u8{ "tmp.zig:1:9: error: parameter of type 'noreturn' not allowed", }); cases.add("assign to constant variable", \\export fn f() void { \\ const a = 3; \\ a = 4; \\} , &[_][]const u8{ "tmp.zig:3:9: error: cannot assign to constant", }); cases.add("use of undeclared identifier", \\export fn f() void { \\ b = 3; \\} , &[_][]const u8{ "tmp.zig:2:5: error: use of undeclared identifier 'b'", }); cases.add("const is a statement, not an expression", \\export fn f() void { \\ (const a = 0); \\} , &[_][]const u8{ "tmp.zig:2:6: error: invalid token: 'const'", }); cases.add("array access of undeclared identifier", \\export fn f() void { \\ i[i] = i[i]; \\} , &[_][]const u8{ "tmp.zig:2:5: error: use of undeclared identifier 'i'", }); cases.add("array access of non array", \\export fn f() void { \\ var bad : bool = undefined; \\ bad[0] = bad[0]; \\} \\export fn g() void { \\ var bad : bool = undefined; \\ _ = bad[0]; \\} , &[_][]const u8{ "tmp.zig:3:8: error: array access of non-array type 'bool'", "tmp.zig:7:12: error: array access of non-array type 'bool'", }); cases.add("array access with non integer index", \\export fn f() void { \\ var array = "aoeu"; \\ var bad = false; \\ array[bad] = array[bad]; \\} \\export fn g() void { \\ var array = "aoeu"; \\ var bad = false; \\ _ = array[bad]; \\} , &[_][]const u8{ "tmp.zig:4:11: error: expected type 'usize', found 'bool'", "tmp.zig:9:15: error: expected type 'usize', found 'bool'", }); cases.add("write to const global variable", \\const x : i32 = 99; \\fn f() void { \\ x = 1; \\} \\export fn entry() void { f(); } , &[_][]const u8{ "tmp.zig:3:9: error: cannot assign to constant", }); cases.add("missing else clause", \\fn f(b: bool) void { \\ const x : i32 = if (b) h: { break :h 1; }; \\} \\fn g(b: bool) void { \\ const y = if (b) h: { break :h @as(i32, 1); }; \\} \\export fn entry() void { f(true); g(true); } , &[_][]const u8{ "tmp.zig:2:21: error: expected type 'i32', found 'void'", "tmp.zig:5:15: error: incompatible types: 'i32' and 'void'", }); cases.add("invalid struct field", \\const A = struct { x : i32, }; \\export fn f() void { \\ var a : A = undefined; \\ a.foo = 1; \\ const y = a.bar; \\} \\export fn g() void { \\ var a : A = undefined; \\ const y = a.bar; \\} , &[_][]const u8{ "tmp.zig:4:6: error: no member named 'foo' in struct 'A'", "tmp.zig:9:16: error: no member named 'bar' in struct 'A'", }); cases.add("redefinition of struct", \\const A = struct { x : i32, }; \\const A = struct { y : i32, }; , &[_][]const u8{ "tmp.zig:2:1: error: redefinition of 'A'", }); cases.add("redefinition of enums", \\const A = enum {}; \\const A = enum {}; , &[_][]const u8{ "tmp.zig:2:1: error: redefinition of 'A'", }); cases.add("redefinition of global variables", \\var a : i32 = 1; \\var a : i32 = 2; , &[_][]const u8{ "tmp.zig:2:1: error: redefinition of 'a'", "tmp.zig:1:1: note: previous definition is here", }); cases.add("duplicate field in struct value expression", \\const A = struct { \\ x : i32, \\ y : i32, \\ z : i32, \\}; \\export fn f() void { \\ const a = A { \\ .z = 1, \\ .y = 2, \\ .x = 3, \\ .z = 4, \\ }; \\} , &[_][]const u8{ "tmp.zig:11:9: error: duplicate field", }); cases.add("missing field in struct value expression", \\const A = struct { \\ x : i32, \\ y : i32, \\ z : i32, \\}; \\export fn f() void { \\ // we want the error on the '{' not the 'A' because \\ // the A could be a complicated expression \\ const a = A { \\ .z = 4, \\ .y = 2, \\ }; \\} , &[_][]const u8{ "tmp.zig:9:17: error: missing field: 'x'", }); cases.add("invalid field in struct value expression", \\const A = struct { \\ x : i32, \\ y : i32, \\ z : i32, \\}; \\export fn f() void { \\ const a = A { \\ .z = 4, \\ .y = 2, \\ .foo = 42, \\ }; \\} , &[_][]const u8{ "tmp.zig:10:9: error: no member named 'foo' in struct 'A'", }); cases.add("invalid break expression", \\export fn f() void { \\ break; \\} , &[_][]const u8{ "tmp.zig:2:5: error: break expression outside loop", }); cases.add("invalid continue expression", \\export fn f() void { \\ continue; \\} , &[_][]const u8{ "tmp.zig:2:5: error: continue expression outside loop", }); cases.add("invalid maybe type", \\export fn f() void { \\ if (true) |x| { } \\} , &[_][]const u8{ "tmp.zig:2:9: error: expected optional type, found 'bool'", }); cases.add("cast unreachable", \\fn f() i32 { \\ return @as(i32, return 1); \\} \\export fn entry() void { _ = f(); } , &[_][]const u8{ "tmp.zig:2:12: error: unreachable code", }); cases.add("invalid builtin fn", \\fn f() @bogus(foo) { \\} \\export fn entry() void { _ = f(); } , &[_][]const u8{ "tmp.zig:1:8: error: invalid builtin function: 'bogus'", }); cases.add("noalias on non pointer param", \\fn f(noalias x: i32) void {} \\export fn entry() void { f(1234); } , &[_][]const u8{ "tmp.zig:1:6: error: noalias on non-pointer parameter", }); cases.add("struct init syntax for array", \\const foo = [3]u16{ .x = 1024 }; \\comptime { \\ _ = foo; \\} , &[_][]const u8{ "tmp.zig:1:21: error: type '[3]u16' does not support struct initialization syntax", }); cases.add("type variables must be constant", \\var foo = u8; \\export fn entry() foo { \\ return 1; \\} , &[_][]const u8{ "tmp.zig:1:1: error: variable of type 'type' must be constant", }); cases.add("variables shadowing types", \\const Foo = struct {}; \\const Bar = struct {}; \\ \\fn f(Foo: i32) void { \\ var Bar : i32 = undefined; \\} \\ \\export fn entry() void { \\ f(1234); \\} , &[_][]const u8{ "tmp.zig:4:6: error: redefinition of 'Foo'", "tmp.zig:1:1: note: previous definition is here", "tmp.zig:5:5: error: redefinition of 'Bar'", "tmp.zig:2:1: note: previous definition is here", }); cases.add("switch expression - missing enumeration prong", \\const Number = enum { \\ One, \\ Two, \\ Three, \\ Four, \\}; \\fn f(n: Number) i32 { \\ switch (n) { \\ Number.One => 1, \\ Number.Two => 2, \\ Number.Three => @as(i32, 3), \\ } \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:8:5: error: enumeration value 'Number.Four' not handled in switch", }); cases.add("switch expression - duplicate enumeration prong", \\const Number = enum { \\ One, \\ Two, \\ Three, \\ Four, \\}; \\fn f(n: Number) i32 { \\ switch (n) { \\ Number.One => 1, \\ Number.Two => 2, \\ Number.Three => @as(i32, 3), \\ Number.Four => 4, \\ Number.Two => 2, \\ } \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:13:15: error: duplicate switch value", "tmp.zig:10:15: note: other value is here", }); cases.add("switch expression - duplicate enumeration prong when else present", \\const Number = enum { \\ One, \\ Two, \\ Three, \\ Four, \\}; \\fn f(n: Number) i32 { \\ switch (n) { \\ Number.One => 1, \\ Number.Two => 2, \\ Number.Three => @as(i32, 3), \\ Number.Four => 4, \\ Number.Two => 2, \\ else => 10, \\ } \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:13:15: error: duplicate switch value", "tmp.zig:10:15: note: other value is here", }); cases.add("switch expression - multiple else prongs", \\fn f(x: u32) void { \\ const value: bool = switch (x) { \\ 1234 => false, \\ else => true, \\ else => true, \\ }; \\} \\export fn entry() void { \\ f(1234); \\} , &[_][]const u8{ "tmp.zig:5:9: error: multiple else prongs in switch expression", }); cases.add("switch expression - non exhaustive integer prongs", \\fn foo(x: u8) void { \\ switch (x) { \\ 0 => {}, \\ } \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:2:5: error: switch must handle all possibilities", }); cases.add("switch expression - duplicate or overlapping integer value", \\fn foo(x: u8) u8 { \\ return switch (x) { \\ 0 ... 100 => @as(u8, 0), \\ 101 ... 200 => 1, \\ 201, 203 ... 207 => 2, \\ 206 ... 255 => 3, \\ }; \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:6:9: error: duplicate switch value", "tmp.zig:5:14: note: previous value is here", }); cases.add("switch expression - duplicate type", \\fn foo(comptime T: type, x: T) u8 { \\ return switch (T) { \\ u32 => 0, \\ u64 => 1, \\ u32 => 2, \\ else => 3, \\ }; \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } , &[_][]const u8{ "tmp.zig:5:9: error: duplicate switch value", "tmp.zig:3:9: note: previous value is here", }); cases.add("switch expression - duplicate type (struct alias)", \\const Test = struct { \\ bar: i32, \\}; \\const Test2 = Test; \\fn foo(comptime T: type, x: T) u8 { \\ return switch (T) { \\ Test => 0, \\ u64 => 1, \\ Test2 => 2, \\ else => 3, \\ }; \\} \\export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } , &[_][]const u8{ "tmp.zig:9:9: error: duplicate switch value", "tmp.zig:7:9: note: previous value is here", }); cases.add("switch expression - switch on pointer type with no else", \\fn foo(x: *u8) void { \\ switch (x) { \\ &y => {}, \\ } \\} \\const y: u8 = 100; \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:2:5: error: else prong required when switching on type '*u8'", }); cases.add("global variable initializer must be constant expression", \\extern fn foo() i32; \\const x = foo(); \\export fn entry() i32 { return x; } , &[_][]const u8{ "tmp.zig:2:11: error: unable to evaluate constant expression", }); cases.add("array concatenation with wrong type", \\const src = "aoeu"; \\const derp: usize = 1234; \\const a = derp ++ "foo"; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(a)); } , &[_][]const u8{ "tmp.zig:3:11: error: expected array, found 'usize'", }); cases.add("non compile time array concatenation", \\fn f() []u8 { \\ return s ++ "foo"; \\} \\var s: [10]u8 = undefined; \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:2:12: error: unable to evaluate constant expression", }); cases.add("@cImport with bogus include", \\const c = @cImport(@cInclude("bogus.h")); \\export fn entry() usize { return @sizeOf(@TypeOf(c.bogo)); } , &[_][]const u8{ "tmp.zig:1:11: error: C import failed", ".h:1:10: note: 'bogus.h' file not found", }); cases.add("address of number literal", \\const x = 3; \\const y = &x; \\fn foo() *const i32 { return y; } \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:3:30: error: expected type '*const i32', found '*const comptime_int'", }); cases.add("integer overflow error", \\const x : u8 = 300; \\export fn entry() usize { return @sizeOf(@TypeOf(x)); } , &[_][]const u8{ "tmp.zig:1:16: error: integer value 300 cannot be coerced to type 'u8'", }); cases.add("invalid shift amount error", \\const x : u8 = 2; \\fn f() u16 { \\ return x << 8; \\} \\export fn entry() u16 { return f(); } , &[_][]const u8{ "tmp.zig:3:17: error: integer value 8 cannot be coerced to type 'u3'", }); cases.add("missing function call param", \\const Foo = struct { \\ a: i32, \\ b: i32, \\ \\ fn member_a(foo: *const Foo) i32 { \\ return foo.a; \\ } \\ fn member_b(foo: *const Foo) i32 { \\ return foo.b; \\ } \\}; \\ \\const member_fn_type = @TypeOf(Foo.member_a); \\const members = [_]member_fn_type { \\ Foo.member_a, \\ Foo.member_b, \\}; \\ \\fn f(foo: *const Foo, index: usize) void { \\ const result = members[index](); \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:20:34: error: expected 1 argument(s), found 0", }); cases.add("missing function name", \\fn () void {} \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:1:1: error: missing function name", }); cases.add("missing param name", \\fn f(i32) void {} \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:1:6: error: missing parameter name", }); cases.add("wrong function type", \\const fns = [_]fn() void { a, b, c }; \\fn a() i32 {return 0;} \\fn b() i32 {return 1;} \\fn c() i32 {return 2;} \\export fn entry() usize { return @sizeOf(@TypeOf(fns)); } , &[_][]const u8{ "tmp.zig:1:28: error: expected type 'fn() void', found 'fn() i32'", }); cases.add("extern function pointer mismatch", \\const fns = [_](fn(i32)i32) { a, b, c }; \\pub fn a(x: i32) i32 {return x + 0;} \\pub fn b(x: i32) i32 {return x + 1;} \\export fn c(x: i32) i32 {return x + 2;} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(fns)); } , &[_][]const u8{ "tmp.zig:1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32'", }); cases.add("colliding invalid top level functions", \\fn func() bogus {} \\fn func() bogus {} \\export fn entry() usize { return @sizeOf(@TypeOf(func)); } , &[_][]const u8{ "tmp.zig:2:1: error: redefinition of 'func'", }); cases.add("non constant expression in array size", \\const Foo = struct { \\ y: [get()]u8, \\}; \\var global_var: usize = 1; \\fn get() usize { return global_var; } \\ \\export fn entry() usize { return @sizeOf(@TypeOf(Foo)); } , &[_][]const u8{ "tmp.zig:5:25: error: cannot store runtime value in compile time variable", "tmp.zig:2:12: note: called from here", }); cases.add("addition with non numbers", \\const Foo = struct { \\ field: i32, \\}; \\const x = Foo {.field = 1} + Foo {.field = 2}; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(x)); } , &[_][]const u8{ "tmp.zig:4:28: error: invalid operands to binary expression: 'Foo' and 'Foo'", }); cases.add("division by zero", \\const lit_int_x = 1 / 0; \\const lit_float_x = 1.0 / 0.0; \\const int_x = @as(u32, 1) / @as(u32, 0); \\const float_x = @as(f32, 1.0) / @as(f32, 0.0); \\ \\export fn entry1() usize { return @sizeOf(@TypeOf(lit_int_x)); } \\export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); } \\export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); } \\export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); } , &[_][]const u8{ "tmp.zig:1:21: error: division by zero", "tmp.zig:2:25: error: division by zero", "tmp.zig:3:27: error: division by zero", "tmp.zig:4:31: error: division by zero", }); cases.add("normal string with newline", \\const foo = "a \\b"; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:1:15: error: newline not allowed in string literal", }); cases.add("invalid comparison for function pointers", \\fn foo() void {} \\const invalid = foo > foo; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(invalid)); } , &[_][]const u8{ "tmp.zig:2:21: error: operator not allowed for type 'fn() void'", }); cases.add("generic function instance with non-constant expression", \\fn foo(comptime x: i32, y: i32) i32 { return x + y; } \\fn test1(a: i32, b: i32) i32 { \\ return foo(a, b); \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(test1)); } , &[_][]const u8{ "tmp.zig:3:16: error: runtime value cannot be passed to comptime arg", }); cases.add("assign null to non-optional pointer", \\const a: *u8 = null; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(a)); } , &[_][]const u8{ "tmp.zig:1:16: error: expected type '*u8', found '(null)'", }); cases.add("indexing an array of size zero", \\const array = [_]u8{}; \\export fn foo() void { \\ const pointer = &array[0]; \\} , &[_][]const u8{ "tmp.zig:3:27: error: accessing a zero length array is not allowed", }); cases.add("indexing an array of size zero with runtime index", \\const array = [_]u8{}; \\export fn foo() void { \\ var index: usize = 0; \\ const pointer = &array[index]; \\} , &[_][]const u8{ "tmp.zig:4:27: error: accessing a zero length array is not allowed", }); cases.add("compile time division by zero", \\const y = foo(0); \\fn foo(x: u32) u32 { \\ return 1 / x; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: division by zero", "tmp.zig:1:14: note: referenced here", }); cases.add("branch on undefined value", \\const x = if (undefined) true else false; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(x)); } , &[_][]const u8{ "tmp.zig:1:15: error: use of undefined value here causes undefined behavior", }); cases.add("div on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a / a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("div assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a /= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("mod on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a % a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("mod assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a %= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("add on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a + a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("add assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a += a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("add wrap on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a +% a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("add wrap assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a +%= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("sub on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a - a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("sub assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a -= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("sub wrap on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a -% a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("sub wrap assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a -%= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("mult on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a * a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("mult assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a *= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("mult wrap on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a *% a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("mult wrap assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a *%= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("shift left on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a << 2; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("shift left assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a <<= 2; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("shift right on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a >> 2; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("shift left assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a >>= 2; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("bin and on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a & a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("bin and assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a &= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("bin or on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a | a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("bin or assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a |= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("bin xor on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = a ^ a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("bin xor assign on undefined value", \\comptime { \\ var a: i64 = undefined; \\ a ^= a; \\} , &[_][]const u8{ "tmp.zig:3:5: error: use of undefined value here causes undefined behavior", }); cases.add("comparison operators with undefined value", \\// operator == \\comptime { \\ var a: i64 = undefined; \\ var x: i32 = 0; \\ if (a == a) x += 1; \\} \\// operator != \\comptime { \\ var a: i64 = undefined; \\ var x: i32 = 0; \\ if (a != a) x += 1; \\} \\// operator > \\comptime { \\ var a: i64 = undefined; \\ var x: i32 = 0; \\ if (a > a) x += 1; \\} \\// operator < \\comptime { \\ var a: i64 = undefined; \\ var x: i32 = 0; \\ if (a < a) x += 1; \\} \\// operator >= \\comptime { \\ var a: i64 = undefined; \\ var x: i32 = 0; \\ if (a >= a) x += 1; \\} \\// operator <= \\comptime { \\ var a: i64 = undefined; \\ var x: i32 = 0; \\ if (a <= a) x += 1; \\} , &[_][]const u8{ "tmp.zig:5:11: error: use of undefined value here causes undefined behavior", "tmp.zig:11:11: error: use of undefined value here causes undefined behavior", "tmp.zig:17:11: error: use of undefined value here causes undefined behavior", "tmp.zig:23:11: error: use of undefined value here causes undefined behavior", "tmp.zig:29:11: error: use of undefined value here causes undefined behavior", "tmp.zig:35:11: error: use of undefined value here causes undefined behavior", }); cases.add("and on undefined value", \\comptime { \\ var a: bool = undefined; \\ _ = a and a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("or on undefined value", \\comptime { \\ var a: bool = undefined; \\ _ = a or a; \\} , &[_][]const u8{ "tmp.zig:3:9: error: use of undefined value here causes undefined behavior", }); cases.add("negate on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = -a; \\} , &[_][]const u8{ "tmp.zig:3:10: error: use of undefined value here causes undefined behavior", }); cases.add("negate wrap on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = -%a; \\} , &[_][]const u8{ "tmp.zig:3:11: error: use of undefined value here causes undefined behavior", }); cases.add("bin not on undefined value", \\comptime { \\ var a: i64 = undefined; \\ _ = ~a; \\} , &[_][]const u8{ "tmp.zig:3:10: error: use of undefined value here causes undefined behavior", }); cases.add("bool not on undefined value", \\comptime { \\ var a: bool = undefined; \\ _ = !a; \\} , &[_][]const u8{ "tmp.zig:3:10: error: use of undefined value here causes undefined behavior", }); cases.add("orelse on undefined value", \\comptime { \\ var a: ?bool = undefined; \\ _ = a orelse false; \\} , &[_][]const u8{ "tmp.zig:3:11: error: use of undefined value here causes undefined behavior", }); cases.add("catch on undefined value", \\comptime { \\ var a: anyerror!bool = undefined; \\ _ = a catch |err| false; \\} , &[_][]const u8{ "tmp.zig:3:11: error: use of undefined value here causes undefined behavior", }); cases.add("deref on undefined value", \\comptime { \\ var a: *u8 = undefined; \\ _ = a.*; \\} , &[_][]const u8{ "tmp.zig:3:9: error: attempt to dereference undefined value", }); cases.add("endless loop in function evaluation", \\const seventh_fib_number = fibbonaci(7); \\fn fibbonaci(x: i32) i32 { \\ return fibbonaci(x - 1) + fibbonaci(x - 2); \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(seventh_fib_number)); } , &[_][]const u8{ "tmp.zig:3:21: error: evaluation exceeded 1000 backwards branches", "tmp.zig:1:37: note: referenced here", "tmp.zig:6:50: note: referenced here", }); cases.add("@embedFile with bogus file", \\const resource = @embedFile("bogus.txt",); \\ \\export fn entry() usize { return @sizeOf(@TypeOf(resource)); } , &[_][]const u8{ "tmp.zig:1:29: error: unable to find '", "bogus.txt'", }); cases.add("non-const expression in struct literal outside function", \\const Foo = struct { \\ x: i32, \\}; \\const a = Foo {.x = get_it()}; \\extern fn get_it() i32; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(a)); } , &[_][]const u8{ "tmp.zig:4:21: error: unable to evaluate constant expression", }); cases.add("non-const expression function call with struct return value outside function", \\const Foo = struct { \\ x: i32, \\}; \\const a = get_it(); \\fn get_it() Foo { \\ global_side_effect = true; \\ return Foo {.x = 13}; \\} \\var global_side_effect = false; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(a)); } , &[_][]const u8{ "tmp.zig:6:26: error: unable to evaluate constant expression", "tmp.zig:4:17: note: referenced here", }); cases.add("undeclared identifier error should mark fn as impure", \\export fn foo() void { \\ test_a_thing(); \\} \\fn test_a_thing() void { \\ bad_fn_call(); \\} , &[_][]const u8{ "tmp.zig:5:5: error: use of undeclared identifier 'bad_fn_call'", }); cases.add("illegal comparison of types", \\fn bad_eql_1(a: []u8, b: []u8) bool { \\ return a == b; \\} \\const EnumWithData = union(enum) { \\ One: void, \\ Two: i32, \\}; \\fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool { \\ return a.* == b.*; \\} \\ \\export fn entry1() usize { return @sizeOf(@TypeOf(bad_eql_1)); } \\export fn entry2() usize { return @sizeOf(@TypeOf(bad_eql_2)); } , &[_][]const u8{ "tmp.zig:2:14: error: operator not allowed for type '[]u8'", "tmp.zig:9:16: error: operator not allowed for type 'EnumWithData'", }); cases.add("non-const switch number literal", \\export fn foo() void { \\ const x = switch (bar()) { \\ 1, 2 => 1, \\ 3, 4 => 2, \\ else => 3, \\ }; \\} \\fn bar() i32 { \\ return 2; \\} , &[_][]const u8{ "tmp.zig:5:17: error: cannot store runtime value in type 'comptime_int'", }); cases.add("atomic orderings of cmpxchg - failure stricter than success", \\const AtomicOrder = @import("std").builtin.AtomicOrder; \\export fn f() void { \\ var x: i32 = 1234; \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {} \\} , &[_][]const u8{ "tmp.zig:4:81: error: failure atomic ordering must be no stricter than success", }); cases.add("atomic orderings of cmpxchg - success Monotonic or stricter", \\const AtomicOrder = @import("std").builtin.AtomicOrder; \\export fn f() void { \\ var x: i32 = 1234; \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {} \\} , &[_][]const u8{ "tmp.zig:4:58: error: success atomic ordering must be Monotonic or stricter", }); cases.add("negation overflow in function evaluation", \\const y = neg(-128); \\fn neg(x: i8) i8 { \\ return -x; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:12: error: negation caused overflow", "tmp.zig:1:14: note: referenced here", }); cases.add("add overflow in function evaluation", \\const y = add(65530, 10); \\fn add(a: u16, b: u16) u16 { \\ return a + b; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: operation caused overflow", "tmp.zig:1:14: note: referenced here", }); cases.add("sub overflow in function evaluation", \\const y = sub(10, 20); \\fn sub(a: u16, b: u16) u16 { \\ return a - b; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: operation caused overflow", "tmp.zig:1:14: note: referenced here", }); cases.add("mul overflow in function evaluation", \\const y = mul(300, 6000); \\fn mul(a: u16, b: u16) u16 { \\ return a * b; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(y)); } , &[_][]const u8{ "tmp.zig:3:14: error: operation caused overflow", "tmp.zig:1:14: note: referenced here", }); cases.add("truncate sign mismatch", \\export fn entry1() i8 { \\ var x: u32 = 10; \\ return @truncate(i8, x); \\} \\export fn entry2() u8 { \\ var x: i32 = -10; \\ return @truncate(u8, x); \\} \\export fn entry3() i8 { \\ comptime var x: u32 = 10; \\ return @truncate(i8, x); \\} \\export fn entry4() u8 { \\ comptime var x: i32 = -10; \\ return @truncate(u8, x); \\} , &[_][]const u8{ "tmp.zig:3:26: error: expected signed integer type, found 'u32'", "tmp.zig:7:26: error: expected unsigned integer type, found 'i32'", "tmp.zig:11:26: error: expected signed integer type, found 'u32'", "tmp.zig:15:26: error: expected unsigned integer type, found 'i32'", }); cases.add("try in function with non error return type", \\export fn f() void { \\ try something(); \\} \\fn something() anyerror!void { } , &[_][]const u8{ "tmp.zig:2:5: error: expected type 'void', found 'anyerror'", }); cases.add("invalid pointer for var type", \\extern fn ext() usize; \\var bytes: [ext()]u8 = undefined; \\export fn f() void { \\ for (bytes) |*b, i| { \\ b.* = @as(u8, i); \\ } \\} , &[_][]const u8{ "tmp.zig:2:13: error: unable to evaluate constant expression", }); cases.add("export function with comptime parameter", \\export fn foo(comptime x: i32, y: i32) i32{ \\ return x + y; \\} , &[_][]const u8{ "tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C'", }); cases.add("extern function with comptime parameter", \\extern fn foo(comptime x: i32, y: i32) i32; \\fn f() i32 { \\ return foo(1, 2); \\} \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:1:15: error: comptime parameter not allowed in function with calling convention 'C'", }); cases.add("non-pure function returns type", \\var a: u32 = 0; \\pub fn List(comptime T: type) type { \\ a += 1; \\ return SmallList(T, 8); \\} \\ \\pub fn SmallList(comptime T: type, comptime STATIC_SIZE: usize) type { \\ return struct { \\ items: []T, \\ length: usize, \\ prealloc_items: [STATIC_SIZE]T, \\ }; \\} \\ \\export fn function_with_return_type_type() void { \\ var list: List(i32) = undefined; \\ list.length = 10; \\} , &[_][]const u8{ "tmp.zig:3:7: error: unable to evaluate constant expression", "tmp.zig:16:19: note: referenced here", }); cases.add("bogus method call on slice", \\var self = "aoeu"; \\fn f(m: []const u8) void { \\ m.copy(u8, self[0..], m); \\} \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:3:6: error: no member named 'copy' in '[]const u8'", }); cases.add("wrong number of arguments for method fn call", \\const Foo = struct { \\ fn method(self: *const Foo, a: i32) void {} \\}; \\fn f(foo: *const Foo) void { \\ \\ foo.method(1, 2); \\} \\export fn entry() usize { return @sizeOf(@TypeOf(f)); } , &[_][]const u8{ "tmp.zig:6:15: error: expected 2 argument(s), found 3", }); cases.add("assign through constant pointer", \\export fn f() void { \\ var cstr = "Hat"; \\ cstr[0] = 'W'; \\} , &[_][]const u8{ "tmp.zig:3:13: error: cannot assign to constant", }); cases.add("assign through constant slice", \\export fn f() void { \\ var cstr: []const u8 = "Hat"; \\ cstr[0] = 'W'; \\} , &[_][]const u8{ "tmp.zig:3:13: error: cannot assign to constant", }); cases.add("main function with bogus args type", \\pub fn main(args: [][]bogus) !void {} , &[_][]const u8{ "tmp.zig:1:23: error: use of undeclared identifier 'bogus'", }); cases.add("misspelled type with pointer only reference", \\const JasonHM = u8; \\const JasonList = *JsonNode; \\ \\const JsonOA = union(enum) { \\ JSONArray: JsonList, \\ JSONObject: JasonHM, \\}; \\ \\const JsonType = union(enum) { \\ JSONNull: void, \\ JSONInteger: isize, \\ JSONDouble: f64, \\ JSONBool: bool, \\ JSONString: []u8, \\ JSONArray: void, \\ JSONObject: void, \\}; \\ \\pub const JsonNode = struct { \\ kind: JsonType, \\ jobject: ?JsonOA, \\}; \\ \\fn foo() void { \\ var jll: JasonList = undefined; \\ jll.init(1234); \\ var jd = JsonNode {.kind = JsonType.JSONArray , .jobject = JsonOA.JSONArray {jll} }; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:5:16: error: use of undeclared identifier 'JsonList'", }); cases.add("method call with first arg type primitive", \\const Foo = struct { \\ x: i32, \\ \\ fn init(x: i32) Foo { \\ return Foo { \\ .x = x, \\ }; \\ } \\}; \\ \\export fn f() void { \\ const derp = Foo.init(3); \\ \\ derp.init(); \\} , &[_][]const u8{ "tmp.zig:14:5: error: expected type 'i32', found 'Foo'", }); cases.add("method call with first arg type wrong container", \\pub const List = struct { \\ len: usize, \\ allocator: *Allocator, \\ \\ pub fn init(allocator: *Allocator) List { \\ return List { \\ .len = 0, \\ .allocator = allocator, \\ }; \\ } \\}; \\ \\pub var global_allocator = Allocator { \\ .field = 1234, \\}; \\ \\pub const Allocator = struct { \\ field: i32, \\}; \\ \\export fn foo() void { \\ var x = List.init(&global_allocator); \\ x.init(); \\} , &[_][]const u8{ "tmp.zig:23:5: error: expected type '*Allocator', found '*List'", }); cases.add("binary not on number literal", \\const TINY_QUANTUM_SHIFT = 4; \\const TINY_QUANTUM_SIZE = 1 << TINY_QUANTUM_SHIFT; \\var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - 1); \\ \\export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); } , &[_][]const u8{ "tmp.zig:3:60: error: unable to perform binary not operation on type 'comptime_int'", }); cases.addCase(x: { const tc = cases.create("multiple files with private function error", \\const foo = @import("foo.zig",); \\ \\export fn callPrivFunction() void { \\ foo.privateFunction(); \\} , &[_][]const u8{ "tmp.zig:4:8: error: 'privateFunction' is private", "foo.zig:1:1: note: declared here", }); tc.addSourceFile("foo.zig", \\fn privateFunction() void { } ); break :x tc; }); cases.addCase(x: { const tc = cases.create("multiple files with private member instance function (canonical invocation) error", \\const Foo = @import("foo.zig",).Foo; \\ \\export fn callPrivFunction() void { \\ var foo = Foo{}; \\ Foo.privateFunction(foo); \\} , &[_][]const u8{ "tmp.zig:5:8: error: 'privateFunction' is private", "foo.zig:2:5: note: declared here", }); tc.addSourceFile("foo.zig", \\pub const Foo = struct { \\ fn privateFunction(self: *Foo) void { } \\}; ); break :x tc; }); cases.addCase(x: { const tc = cases.create("multiple files with private member instance function error", \\const Foo = @import("foo.zig",).Foo; \\ \\export fn callPrivFunction() void { \\ var foo = Foo{}; \\ foo.privateFunction(); \\} , &[_][]const u8{ "tmp.zig:5:8: error: 'privateFunction' is private", "foo.zig:2:5: note: declared here", }); tc.addSourceFile("foo.zig", \\pub const Foo = struct { \\ fn privateFunction(self: *Foo) void { } \\}; ); break :x tc; }); cases.add("container init with non-type", \\const zero: i32 = 0; \\const a = zero{1}; \\ \\export fn entry() usize { return @sizeOf(@TypeOf(a)); } , &[_][]const u8{ "tmp.zig:2:11: error: expected type 'type', found 'i32'", }); cases.add("assign to constant field", \\const Foo = struct { \\ field: i32, \\}; \\export fn derp() void { \\ const f = Foo {.field = 1234,}; \\ f.field = 0; \\} , &[_][]const u8{ "tmp.zig:6:15: error: cannot assign to constant", }); cases.add("return from defer expression", \\pub fn testTrickyDefer() !void { \\ defer canFail() catch {}; \\ \\ defer try canFail(); \\ \\ const a = maybeInt() orelse return; \\} \\ \\fn canFail() anyerror!void { } \\ \\pub fn maybeInt() ?i32 { \\ return 0; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); } , &[_][]const u8{ "tmp.zig:4:11: error: cannot return from defer expression", }); cases.add("assign too big number to u16", \\export fn foo() void { \\ var vga_mem: u16 = 0xB8000; \\} , &[_][]const u8{ "tmp.zig:2:24: error: integer value 753664 cannot be coerced to type 'u16'", }); cases.add("global variable alignment non power of 2", \\const some_data: [100]u8 align(3) = undefined; \\export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } , &[_][]const u8{ "tmp.zig:1:32: error: alignment value 3 is not a power of 2", }); cases.add("function alignment non power of 2", \\extern fn foo() align(3) void; \\export fn entry() void { return foo(); } , &[_][]const u8{ "tmp.zig:1:23: error: alignment value 3 is not a power of 2", }); cases.add("compile log", \\export fn foo() void { \\ comptime bar(12, "hi",); \\} \\fn bar(a: i32, b: []const u8) void { \\ @compileLog("begin",); \\ @compileLog("a", a, "b", b); \\ @compileLog("end",); \\} , &[_][]const u8{ "tmp.zig:5:5: error: found compile log statement", "tmp.zig:6:5: error: found compile log statement", "tmp.zig:7:5: error: found compile log statement", }); cases.add("casting bit offset pointer to regular pointer", \\const BitField = packed struct { \\ a: u3, \\ b: u3, \\ c: u2, \\}; \\ \\fn foo(bit_field: *const BitField) u3 { \\ return bar(&bit_field.b); \\} \\ \\fn bar(x: *const u3) u3 { \\ return x.*; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:8:26: error: expected type '*const u3', found '*align(:3:1) const u3'", }); cases.add("referring to a struct that is invalid", \\const UsbDeviceRequest = struct { \\ Type: u8, \\}; \\ \\export fn foo() void { \\ comptime assert(@sizeOf(UsbDeviceRequest) == 0x8); \\} \\ \\fn assert(ok: bool) void { \\ if (!ok) unreachable; \\} , &[_][]const u8{ "tmp.zig:10:14: error: reached unreachable code", "tmp.zig:6:20: note: referenced here", }); cases.add("control flow uses comptime var at runtime", \\export fn foo() void { \\ comptime var i = 0; \\ while (i < 5) : (i += 1) { \\ bar(); \\ } \\} \\ \\fn bar() void { } , &[_][]const u8{ "tmp.zig:3:5: error: control flow attempts to use compile-time variable at runtime", "tmp.zig:3:24: note: compile-time variable assigned here", }); cases.add("ignored return value", \\export fn foo() void { \\ bar(); \\} \\fn bar() i32 { return 0; } , &[_][]const u8{ "tmp.zig:2:8: error: expression value is ignored", }); cases.add("ignored assert-err-ok return value", \\export fn foo() void { \\ bar() catch unreachable; \\} \\fn bar() anyerror!i32 { return 0; } , &[_][]const u8{ "tmp.zig:2:11: error: expression value is ignored", }); cases.add("ignored statement value", \\export fn foo() void { \\ 1; \\} , &[_][]const u8{ "tmp.zig:2:5: error: expression value is ignored", }); cases.add("ignored comptime statement value", \\export fn foo() void { \\ comptime {1;} \\} , &[_][]const u8{ "tmp.zig:2:15: error: expression value is ignored", }); cases.add("ignored comptime value", \\export fn foo() void { \\ comptime 1; \\} , &[_][]const u8{ "tmp.zig:2:5: error: expression value is ignored", }); cases.add("ignored defered statement value", \\export fn foo() void { \\ defer {1;} \\} , &[_][]const u8{ "tmp.zig:2:12: error: expression value is ignored", }); cases.add("ignored defered function call", \\export fn foo() void { \\ defer bar(); \\} \\fn bar() anyerror!i32 { return 0; } , &[_][]const u8{ "tmp.zig:2:14: error: error is ignored. consider using `try`, `catch`, or `if`", }); cases.add("dereference an array", \\var s_buffer: [10]u8 = undefined; \\pub fn pass(in: []u8) []u8 { \\ var out = &s_buffer; \\ out.*.* = in[0]; \\ return out.*[0..1]; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(pass)); } , &[_][]const u8{ "tmp.zig:4:10: error: attempt to dereference non-pointer type '[10]u8'", }); cases.add("pass const ptr to mutable ptr fn", \\fn foo() bool { \\ const a = @as([]const u8, "a",); \\ const b = &a; \\ return ptrEql(b, b); \\} \\fn ptrEql(a: *[]const u8, b: *[]const u8) bool { \\ return true; \\} \\ \\export fn entry() usize { return @sizeOf(@TypeOf(foo)); } , &[_][]const u8{ "tmp.zig:4:19: error: expected type '*[]const u8', found '*const []const u8'", }); cases.addCase(x: { const tc = cases.create("export collision", \\const foo = @import("foo.zig",); \\ \\export fn bar() usize { \\ return foo.baz; \\} , &[_][]const u8{ "foo.zig:1:1: error: exported symbol collision: 'bar'", "tmp.zig:3:1: note: other symbol here", }); tc.addSourceFile("foo.zig", \\export fn bar() void {} \\pub const baz = 1234; ); break :x tc; }); cases.add("implicit cast from array to mutable slice", \\var global_array: [10]i32 = undefined; \\fn foo(param: []i32) void {} \\export fn entry() void { \\ foo(global_array); \\} , &[_][]const u8{ "tmp.zig:4:9: error: expected type '[]i32', found '[10]i32'", }); cases.add("ptrcast to non-pointer", \\export fn entry(a: *i32) usize { \\ return @ptrCast(usize, a); \\} , &[_][]const u8{ "tmp.zig:2:21: error: expected pointer, found 'usize'", }); cases.add("asm at compile time", \\comptime { \\ doSomeAsm(); \\} \\ \\fn doSomeAsm() void { \\ asm volatile ( \\ \\.globl aoeu; \\ \\.type aoeu, @function; \\ \\.set aoeu, derp; \\ ); \\} , &[_][]const u8{ "tmp.zig:6:5: error: unable to evaluate constant expression", }); cases.add("invalid member of builtin enum", \\const builtin = @import("std").builtin; \\export fn entry() void { \\ const foo = builtin.Mode.x86; \\} , &[_][]const u8{ "tmp.zig:3:29: error: container 'std.builtin.Mode' has no member called 'x86'", }); cases.add("int to ptr of 0 bits", \\export fn foo() void { \\ var x: usize = 0x1000; \\ var y: *void = @intToPtr(*void, x); \\} , &[_][]const u8{ "tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information", }); cases.add("@fieldParentPtr - non struct", \\const Foo = i32; \\export fn foo(a: *i32) *Foo { \\ return @fieldParentPtr(Foo, "a", a); \\} , &[_][]const u8{ "tmp.zig:3:28: error: expected struct type, found 'i32'", }); cases.add("@fieldParentPtr - bad field name", \\const Foo = extern struct { \\ derp: i32, \\}; \\export fn foo(a: *i32) *Foo { \\ return @fieldParentPtr(Foo, "a", a); \\} , &[_][]const u8{ "tmp.zig:5:33: error: struct 'Foo' has no field 'a'", }); cases.add("@fieldParentPtr - field pointer is not pointer", \\const Foo = extern struct { \\ a: i32, \\}; \\export fn foo(a: i32) *Foo { \\ return @fieldParentPtr(Foo, "a", a); \\} , &[_][]const u8{ "tmp.zig:5:38: error: expected pointer, found 'i32'", }); cases.add("@fieldParentPtr - comptime field ptr not based on struct", \\const Foo = struct { \\ a: i32, \\ b: i32, \\}; \\const foo = Foo { .a = 1, .b = 2, }; \\ \\comptime { \\ const field_ptr = @intToPtr(*i32, 0x1234); \\ const another_foo_ptr = @fieldParentPtr(Foo, "b", field_ptr); \\} , &[_][]const u8{ "tmp.zig:9:55: error: pointer value not based on parent struct", }); cases.add("@fieldParentPtr - comptime wrong field index", \\const Foo = struct { \\ a: i32, \\ b: i32, \\}; \\const foo = Foo { .a = 1, .b = 2, }; \\ \\comptime { \\ const another_foo_ptr = @fieldParentPtr(Foo, "b", &foo.a); \\} , &[_][]const u8{ "tmp.zig:8:29: error: field 'b' has index 1 but pointer value is index 0 of struct 'Foo'", }); cases.add("@byteOffsetOf - non struct", \\const Foo = i32; \\export fn foo() usize { \\ return @byteOffsetOf(Foo, "a",); \\} , &[_][]const u8{ "tmp.zig:3:26: error: expected struct type, found 'i32'", }); cases.add("@byteOffsetOf - bad field name", \\const Foo = struct { \\ derp: i32, \\}; \\export fn foo() usize { \\ return @byteOffsetOf(Foo, "a",); \\} , &[_][]const u8{ "tmp.zig:5:31: error: struct 'Foo' has no field 'a'", }); cases.addExe("missing main fn in executable", \\ , &[_][]const u8{ "error: root source file has no member called 'main'", }); cases.addExe("private main fn", \\fn main() void {} , &[_][]const u8{ "error: 'main' is private", "tmp.zig:1:1: note: declared here", }); cases.add("setting a section on a local variable", \\export fn entry() i32 { \\ var foo: i32 linksection(".text2") = 1234; \\ return foo; \\} , &[_][]const u8{ "tmp.zig:2:30: error: cannot set section of local variable 'foo'", }); cases.add("inner struct member shadowing outer struct member", \\fn A() type { \\ return struct { \\ b: B(), \\ \\ const Self = @This(); \\ \\ fn B() type { \\ return struct { \\ const Self = @This(); \\ }; \\ } \\ }; \\} \\comptime { \\ assert(A().B().Self != A().Self); \\} \\fn assert(ok: bool) void { \\ if (!ok) unreachable; \\} , &[_][]const u8{ "tmp.zig:9:17: error: redefinition of 'Self'", "tmp.zig:5:9: note: previous definition is here", }); cases.add("while expected bool, got optional", \\export fn foo() void { \\ while (bar()) {} \\} \\fn bar() ?i32 { return 1; } , &[_][]const u8{ "tmp.zig:2:15: error: expected type 'bool', found '?i32'", }); cases.add("while expected bool, got error union", \\export fn foo() void { \\ while (bar()) {} \\} \\fn bar() anyerror!i32 { return 1; } , &[_][]const u8{ "tmp.zig:2:15: error: expected type 'bool', found 'anyerror!i32'", }); cases.add("while expected optional, got bool", \\export fn foo() void { \\ while (bar()) |x| {} \\} \\fn bar() bool { return true; } , &[_][]const u8{ "tmp.zig:2:15: error: expected optional type, found 'bool'", }); cases.add("while expected optional, got error union", \\export fn foo() void { \\ while (bar()) |x| {} \\} \\fn bar() anyerror!i32 { return 1; } , &[_][]const u8{ "tmp.zig:2:15: error: expected optional type, found 'anyerror!i32'", }); cases.add("while expected error union, got bool", \\export fn foo() void { \\ while (bar()) |x| {} else |err| {} \\} \\fn bar() bool { return true; } , &[_][]const u8{ "tmp.zig:2:15: error: expected error union type, found 'bool'", }); cases.add("while expected error union, got optional", \\export fn foo() void { \\ while (bar()) |x| {} else |err| {} \\} \\fn bar() ?i32 { return 1; } , &[_][]const u8{ "tmp.zig:2:15: error: expected error union type, found '?i32'", }); // TODO test this in stage2, but we won't even try in stage1 //cases.add("inline fn calls itself indirectly", // \\export fn foo() void { // \\ bar(); // \\} // \\fn bar() callconv(.Inline) void { // \\ baz(); // \\ quux(); // \\} // \\fn baz() callconv(.Inline) void { // \\ bar(); // \\ quux(); // \\} // \\extern fn quux() void; //, &[_][]const u8{ // "tmp.zig:4:1: error: unable to inline function", //}); //cases.add("save reference to inline function", // \\export fn foo() void { // \\ quux(@ptrToInt(bar)); // \\} // \\fn bar() callconv(.Inline) void { } // \\extern fn quux(usize) void; //, &[_][]const u8{ // "tmp.zig:4:1: error: unable to inline function", //}); cases.add("signed integer division", \\export fn foo(a: i32, b: i32) i32 { \\ return a / b; \\} , &[_][]const u8{ "tmp.zig:2:14: error: division with 'i32' and 'i32': signed integers must use @divTrunc, @divFloor, or @divExact", }); cases.add("signed integer remainder division", \\export fn foo(a: i32, b: i32) i32 { \\ return a % b; \\} , &[_][]const u8{ "tmp.zig:2:14: error: remainder division with 'i32' and 'i32': signed integers and floats must use @rem or @mod", }); cases.add("compile-time division by zero", \\comptime { \\ const a: i32 = 1; \\ const b: i32 = 0; \\ const c = a / b; \\} , &[_][]const u8{ "tmp.zig:4:17: error: division by zero", }); cases.add("compile-time remainder division by zero", \\comptime { \\ const a: i32 = 1; \\ const b: i32 = 0; \\ const c = a % b; \\} , &[_][]const u8{ "tmp.zig:4:17: error: division by zero", }); cases.add("@setRuntimeSafety twice for same scope", \\export fn foo() void { \\ @setRuntimeSafety(false); \\ @setRuntimeSafety(false); \\} , &[_][]const u8{ "tmp.zig:3:5: error: runtime safety set twice for same scope", "tmp.zig:2:5: note: first set here", }); cases.add("@setFloatMode twice for same scope", \\export fn foo() void { \\ @setFloatMode(@import("std").builtin.FloatMode.Optimized); \\ @setFloatMode(@import("std").builtin.FloatMode.Optimized); \\} , &[_][]const u8{ "tmp.zig:3:5: error: float mode set twice for same scope", "tmp.zig:2:5: note: first set here", }); cases.add("array access of type", \\export fn foo() void { \\ var b: u8[40] = undefined; \\} , &[_][]const u8{ "tmp.zig:2:14: error: array access of non-array type 'type'", }); cases.add("cannot break out of defer expression", \\export fn foo() void { \\ while (true) { \\ defer { \\ break; \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:4:13: error: cannot break out of defer expression", }); cases.add("cannot continue out of defer expression", \\export fn foo() void { \\ while (true) { \\ defer { \\ continue; \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:4:13: error: cannot continue out of defer expression", }); cases.add("calling a generic function only known at runtime", \\var foos = [_]fn(anytype) void { foo1, foo2 }; \\ \\fn foo1(arg: anytype) void {} \\fn foo2(arg: anytype) void {} \\ \\pub fn main() !void { \\ foos[0](true); \\} , &[_][]const u8{ "tmp.zig:7:9: error: calling a generic function requires compile-time known function value", }); cases.add("@compileError shows traceback of references that caused it", \\const foo = @compileError("aoeu",); \\ \\const bar = baz + foo; \\const baz = 1; \\ \\export fn entry() i32 { \\ return bar; \\} , &[_][]const u8{ "tmp.zig:1:13: error: aoeu", "tmp.zig:3:19: note: referenced here", "tmp.zig:7:12: note: referenced here", }); cases.add("float literal too large error", \\comptime { \\ const a = 0x1.0p18495; \\} , &[_][]const u8{ "tmp.zig:2:15: error: float literal out of range of any type", }); cases.add("float literal too small error (denormal)", \\comptime { \\ const a = 0x1.0p-19000; \\} , &[_][]const u8{ "tmp.zig:2:15: error: float literal out of range of any type", }); cases.add("explicit cast float literal to integer when there is a fraction component", \\export fn entry() i32 { \\ return @as(i32, 12.34); \\} , &[_][]const u8{ "tmp.zig:2:21: error: fractional component prevents float value 12.340000 from being casted to type 'i32'", }); cases.add("non pointer given to @ptrToInt", \\export fn entry(x: i32) usize { \\ return @ptrToInt(x); \\} , &[_][]const u8{ "tmp.zig:2:22: error: expected pointer, found 'i32'", }); cases.add("@shlExact shifts out 1 bits", \\comptime { \\ const x = @shlExact(@as(u8, 0b01010101), 2); \\} , &[_][]const u8{ "tmp.zig:2:15: error: operation caused overflow", }); cases.add("@shrExact shifts out 1 bits", \\comptime { \\ const x = @shrExact(@as(u8, 0b10101010), 2); \\} , &[_][]const u8{ "tmp.zig:2:15: error: exact shift shifted out 1 bits", }); cases.add("shifting without int type or comptime known", \\export fn entry(x: u8) u8 { \\ return 0x11 << x; \\} , &[_][]const u8{ "tmp.zig:2:17: error: LHS of shift must be a fixed-width integer type, or RHS must be compile-time known", }); cases.add("shifting RHS is log2 of LHS int bit width", \\export fn entry(x: u8, y: u8) u8 { \\ return x << y; \\} , &[_][]const u8{ "tmp.zig:2:17: error: expected type 'u3', found 'u8'", }); cases.add("globally shadowing a primitive type", \\const u16 = u8; \\export fn entry() void { \\ const a: u16 = 300; \\} , &[_][]const u8{ "tmp.zig:1:1: error: declaration shadows primitive type 'u16'", }); cases.add("implicitly increasing pointer alignment", \\const Foo = packed struct { \\ a: u8, \\ b: u32, \\}; \\ \\export fn entry() void { \\ var foo = Foo { .a = 1, .b = 10 }; \\ bar(&foo.b); \\} \\ \\fn bar(x: *u32) void { \\ x.* += 1; \\} , &[_][]const u8{ "tmp.zig:8:13: error: expected type '*u32', found '*align(1) u32'", }); cases.add("implicitly increasing slice alignment", \\const Foo = packed struct { \\ a: u8, \\ b: u32, \\}; \\ \\export fn entry() void { \\ var foo = Foo { .a = 1, .b = 10 }; \\ foo.b += 1; \\ bar(@as(*[1]u32, &foo.b)[0..]); \\} \\ \\fn bar(x: []u32) void { \\ x[0] += 1; \\} , &[_][]const u8{ "tmp.zig:9:26: error: cast increases pointer alignment", "tmp.zig:9:26: note: '*align(1) u32' has alignment 1", "tmp.zig:9:26: note: '*[1]u32' has alignment 4", }); cases.add("increase pointer alignment in @ptrCast", \\export fn entry() u32 { \\ var bytes: [4]u8 = [_]u8{0x01, 0x02, 0x03, 0x04}; \\ const ptr = @ptrCast(*u32, &bytes[0]); \\ return ptr.*; \\} , &[_][]const u8{ "tmp.zig:3:17: error: cast increases pointer alignment", "tmp.zig:3:38: note: '*u8' has alignment 1", "tmp.zig:3:26: note: '*u32' has alignment 4", }); cases.add("@alignCast expects pointer or slice", \\export fn entry() void { \\ @alignCast(4, @as(u32, 3)); \\} , &[_][]const u8{ "tmp.zig:2:19: error: expected pointer or slice, found 'u32'", }); cases.add("passing an under-aligned function pointer", \\export fn entry() void { \\ testImplicitlyDecreaseFnAlign(alignedSmall, 1234); \\} \\fn testImplicitlyDecreaseFnAlign(ptr: fn () align(8) i32, answer: i32) void { \\ if (ptr() != answer) unreachable; \\} \\fn alignedSmall() align(4) i32 { return 1234; } , &[_][]const u8{ "tmp.zig:2:35: error: expected type 'fn() align(8) i32', found 'fn() align(4) i32'", }); cases.add("passing a not-aligned-enough pointer to cmpxchg", \\const AtomicOrder = @import("std").builtin.AtomicOrder; \\export fn entry() bool { \\ var x: i32 align(1) = 1234; \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) {} \\ return x == 5678; \\} , &[_][]const u8{ "tmp.zig:4:32: error: expected type '*i32', found '*align(1) i32'", }); cases.add("wrong size to an array literal", \\comptime { \\ const array = [2]u8{1, 2, 3}; \\} , &[_][]const u8{ "tmp.zig:2:31: error: index 2 outside array of size 2", }); cases.add("wrong pointer coerced to pointer to opaque {}", \\const Derp = opaque {}; \\extern fn bar(d: *Derp) void; \\export fn foo() void { \\ var x = @as(u8, 1); \\ bar(@ptrCast(*c_void, &x)); \\} , &[_][]const u8{ "tmp.zig:5:9: error: expected type '*Derp', found '*c_void'", }); cases.add("non-const variables of things that require const variables", \\export fn entry1() void { \\ var m2 = &2; \\} \\export fn entry2() void { \\ var a = undefined; \\} \\export fn entry3() void { \\ var b = 1; \\} \\export fn entry4() void { \\ var c = 1.0; \\} \\export fn entry5() void { \\ var d = null; \\} \\export fn entry6(opaque_: *Opaque) void { \\ var e = opaque_.*; \\} \\export fn entry7() void { \\ var f = i32; \\} \\export fn entry8() void { \\ var h = (Foo {}).bar; \\} \\export fn entry9() void { \\ var z: noreturn = return; \\} \\const Opaque = opaque {}; \\const Foo = struct { \\ fn bar(self: *const Foo) void {} \\}; , &[_][]const u8{ "tmp.zig:2:4: error: variable of type '*const comptime_int' must be const or comptime", "tmp.zig:5:4: error: variable of type '(undefined)' must be const or comptime", "tmp.zig:8:4: error: variable of type 'comptime_int' must be const or comptime", "tmp.zig:8:4: note: to modify this variable at runtime, it must be given an explicit fixed-size number type", "tmp.zig:11:4: error: variable of type 'comptime_float' must be const or comptime", "tmp.zig:11:4: note: to modify this variable at runtime, it must be given an explicit fixed-size number type", "tmp.zig:14:4: error: variable of type '(null)' must be const or comptime", "tmp.zig:17:4: error: variable of type 'Opaque' not allowed", "tmp.zig:20:4: error: variable of type 'type' must be const or comptime", "tmp.zig:23:4: error: variable of type '(bound fn(*const Foo) void)' must be const or comptime", "tmp.zig:26:22: error: unreachable code", }); cases.add("wrong types given to atomic order args in cmpxchg", \\export fn entry() void { \\ var x: i32 = 1234; \\ while (!@cmpxchgWeak(i32, &x, 1234, 5678, @as(u32, 1234), @as(u32, 1234))) {} \\} , &[_][]const u8{ "tmp.zig:3:47: error: expected type 'std.builtin.AtomicOrder', found 'u32'", }); cases.add("wrong types given to @export", \\fn entry() callconv(.C) void { } \\comptime { \\ @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) }); \\} , &[_][]const u8{ "tmp.zig:3:59: error: expected type 'std.builtin.GlobalLinkage', found 'comptime_int'", }); cases.add("struct with invalid field", \\const std = @import("std",); \\const Allocator = std.mem.Allocator; \\const ArrayList = std.ArrayList; \\ \\const HeaderWeight = enum { \\ H1, H2, H3, H4, H5, H6, \\}; \\ \\const MdText = ArrayList(u8); \\ \\const MdNode = union(enum) { \\ Header: struct { \\ text: MdText, \\ weight: HeaderValue, \\ }, \\}; \\ \\export fn entry() void { \\ const a = MdNode.Header { \\ .text = MdText.init(&std.testing.allocator), \\ .weight = HeaderWeight.H1, \\ }; \\} , &[_][]const u8{ "tmp.zig:14:17: error: use of undeclared identifier 'HeaderValue'", }); cases.add("@setAlignStack outside function", \\comptime { \\ @setAlignStack(16); \\} , &[_][]const u8{ "tmp.zig:2:5: error: @setAlignStack outside function", }); cases.add("@setAlignStack in naked function", \\export fn entry() callconv(.Naked) void { \\ @setAlignStack(16); \\} , &[_][]const u8{ "tmp.zig:2:5: error: @setAlignStack in naked function", }); cases.add("@setAlignStack in inline function", \\export fn entry() void { \\ foo(); \\} \\fn foo() callconv(.Inline) void { \\ @setAlignStack(16); \\} , &[_][]const u8{ "tmp.zig:5:5: error: @setAlignStack in inline function", }); cases.add("@setAlignStack set twice", \\export fn entry() void { \\ @setAlignStack(16); \\ @setAlignStack(16); \\} , &[_][]const u8{ "tmp.zig:3:5: error: alignstack set twice", "tmp.zig:2:5: note: first set here", }); cases.add("@setAlignStack too big", \\export fn entry() void { \\ @setAlignStack(511 + 1); \\} , &[_][]const u8{ "tmp.zig:2:5: error: attempt to @setAlignStack(512); maximum is 256", }); cases.add("storing runtime value in compile time variable then using it", \\const Mode = @import("std").builtin.Mode; \\ \\fn Free(comptime filename: []const u8) TestCase { \\ return TestCase { \\ .filename = filename, \\ .problem_type = ProblemType.Free, \\ }; \\} \\ \\fn LibC(comptime filename: []const u8) TestCase { \\ return TestCase { \\ .filename = filename, \\ .problem_type = ProblemType.LinkLibC, \\ }; \\} \\ \\const TestCase = struct { \\ filename: []const u8, \\ problem_type: ProblemType, \\}; \\ \\const ProblemType = enum { \\ Free, \\ LinkLibC, \\}; \\ \\export fn entry() void { \\ const tests = [_]TestCase { \\ Free("001"), \\ Free("002"), \\ LibC("078"), \\ Free("116"), \\ Free("117"), \\ }; \\ \\ for ([_]Mode { Mode.Debug, Mode.ReleaseSafe, Mode.ReleaseFast }) |mode| { \\ inline for (tests) |test_case| { \\ const foo = test_case.filename ++ ".zig"; \\ } \\ } \\} , &[_][]const u8{ "tmp.zig:37:29: error: cannot store runtime value in compile time variable", }); cases.add("invalid legacy unicode escape", \\export fn entry() void { \\ const a = '\U1234'; \\} , &[_][]const u8{ "tmp.zig:2:17: error: invalid character: 'U'", }); cases.add("invalid empty unicode escape", \\export fn entry() void { \\ const a = '\u{}'; \\} , &[_][]const u8{ "tmp.zig:2:19: error: empty unicode escape sequence", }); cases.add("non-printable invalid character", "\xff\xfe" ++ \\fn test() bool {\r \\ true\r \\} , &[_][]const u8{ "tmp.zig:1:1: error: invalid character: '\\xff'", }); cases.add("non-printable invalid character with escape alternative", "fn test() bool {\n" ++ "\ttrue\n" ++ "}\n", &[_][]const u8{ "tmp.zig:2:1: error: invalid character: '\\t'", }); cases.add("calling var args extern function, passing array instead of pointer", \\export fn entry() void { \\ foo("hello".*,); \\} \\pub extern fn foo(format: *const u8, ...) void; , &[_][]const u8{ "tmp.zig:2:16: error: expected type '*const u8', found '[5:0]u8'", }); cases.add("constant inside comptime function has compile error", \\const ContextAllocator = MemoryPool(usize); \\ \\pub fn MemoryPool(comptime T: type) type { \\ const free_list_t = @compileError("aoeu",); \\ \\ return struct { \\ free_list: free_list_t, \\ }; \\} \\ \\export fn entry() void { \\ var allocator: ContextAllocator = undefined; \\} , &[_][]const u8{ "tmp.zig:4:25: error: aoeu", "tmp.zig:1:36: note: referenced here", "tmp.zig:12:20: note: referenced here", }); cases.add("specify enum tag type that is too small", \\const Small = enum (u2) { \\ One, \\ Two, \\ Three, \\ Four, \\ Five, \\}; \\ \\export fn entry() void { \\ var x = Small.One; \\} , &[_][]const u8{ "tmp.zig:6:5: error: enumeration value 4 too large for type 'u2'", }); cases.add("specify non-integer enum tag type", \\const Small = enum (f32) { \\ One, \\ Two, \\ Three, \\}; \\ \\export fn entry() void { \\ var x = Small.One; \\} , &[_][]const u8{ "tmp.zig:1:21: error: expected integer, found 'f32'", }); cases.add("implicitly casting enum to tag type", \\const Small = enum(u2) { \\ One, \\ Two, \\ Three, \\ Four, \\}; \\ \\export fn entry() void { \\ var x: u2 = Small.Two; \\} , &[_][]const u8{ "tmp.zig:9:22: error: expected type 'u2', found 'Small'", }); cases.add("explicitly casting non tag type to enum", \\const Small = enum(u2) { \\ One, \\ Two, \\ Three, \\ Four, \\}; \\ \\export fn entry() void { \\ var y = @as(u3, 3); \\ var x = @intToEnum(Small, y); \\} , &[_][]const u8{ "tmp.zig:10:31: error: expected type 'u2', found 'u3'", }); cases.add("union fields with value assignments", \\const MultipleChoice = union { \\ A: i32 = 20, \\}; \\export fn entry() void { \\ var x: MultipleChoice = undefined; \\} , &[_][]const u8{ "tmp.zig:2:14: error: untagged union field assignment", "tmp.zig:1:24: note: consider 'union(enum)' here", }); cases.add("enum with 0 fields", \\const Foo = enum {}; \\export fn entry() usize { \\ return @sizeOf(Foo); \\} , &[_][]const u8{ "tmp.zig:1:13: error: enums must have 1 or more fields", }); cases.add("union with 0 fields", \\const Foo = union {}; \\export fn entry() usize { \\ return @sizeOf(Foo); \\} , &[_][]const u8{ "tmp.zig:1:13: error: unions must have 1 or more fields", }); cases.add("enum value already taken", \\const MultipleChoice = enum(u32) { \\ A = 20, \\ B = 40, \\ C = 60, \\ D = 1000, \\ E = 60, \\}; \\export fn entry() void { \\ var x = MultipleChoice.C; \\} , &[_][]const u8{ "tmp.zig:6:5: error: enum tag value 60 already taken", "tmp.zig:4:5: note: other occurrence here", }); cases.add("union with specified enum omits field", \\const Letter = enum { \\ A, \\ B, \\ C, \\}; \\const Payload = union(Letter) { \\ A: i32, \\ B: f64, \\}; \\export fn entry() usize { \\ return @sizeOf(Payload); \\} , &[_][]const u8{ "tmp.zig:6:17: error: enum field missing: 'C'", "tmp.zig:4:5: note: declared here", }); cases.add("non-integer tag type to automatic union enum", \\const Foo = union(enum(f32)) { \\ A: i32, \\}; \\export fn entry() void { \\ const x = @typeInfo(Foo).Union.tag_type.?; \\} , &[_][]const u8{ "tmp.zig:1:24: error: expected integer tag type, found 'f32'", }); cases.add("non-enum tag type passed to union", \\const Foo = union(u32) { \\ A: i32, \\}; \\export fn entry() void { \\ const x = @typeInfo(Foo).Union.tag_type.?; \\} , &[_][]const u8{ "tmp.zig:1:19: error: expected enum tag type, found 'u32'", }); cases.add("union auto-enum value already taken", \\const MultipleChoice = union(enum(u32)) { \\ A = 20, \\ B = 40, \\ C = 60, \\ D = 1000, \\ E = 60, \\}; \\export fn entry() void { \\ var x = MultipleChoice { .C = {} }; \\} , &[_][]const u8{ "tmp.zig:6:9: error: enum tag value 60 already taken", "tmp.zig:4:9: note: other occurrence here", }); cases.add("union enum field does not match enum", \\const Letter = enum { \\ A, \\ B, \\ C, \\}; \\const Payload = union(Letter) { \\ A: i32, \\ B: f64, \\ C: bool, \\ D: bool, \\}; \\export fn entry() void { \\ var a = Payload {.A = 1234}; \\} , &[_][]const u8{ "tmp.zig:10:5: error: enum field not found: 'D'", "tmp.zig:1:16: note: enum declared here", }); cases.add("field type supplied in an enum", \\const Letter = enum { \\ A: void, \\ B, \\ C, \\}; \\export fn entry() void { \\ var b = Letter.B; \\} , &[_][]const u8{ "tmp.zig:2:8: error: structs and unions, not enums, support field types", "tmp.zig:1:16: note: consider 'union(enum)' here", }); cases.add("struct field missing type", \\const Letter = struct { \\ A, \\}; \\export fn entry() void { \\ var a = Letter { .A = {} }; \\} , &[_][]const u8{ "tmp.zig:2:5: error: struct field missing type", }); cases.add("extern union field missing type", \\const Letter = extern union { \\ A, \\}; \\export fn entry() void { \\ var a = Letter { .A = {} }; \\} , &[_][]const u8{ "tmp.zig:2:5: error: union field missing type", }); cases.add("extern union given enum tag type", \\const Letter = enum { \\ A, \\ B, \\ C, \\}; \\const Payload = extern union(Letter) { \\ A: i32, \\ B: f64, \\ C: bool, \\}; \\export fn entry() void { \\ var a = Payload { .A = 1234 }; \\} , &[_][]const u8{ "tmp.zig:6:30: error: extern union does not support enum tag type", }); cases.add("packed union given enum tag type", \\const Letter = enum { \\ A, \\ B, \\ C, \\}; \\const Payload = packed union(Letter) { \\ A: i32, \\ B: f64, \\ C: bool, \\}; \\export fn entry() void { \\ var a = Payload { .A = 1234 }; \\} , &[_][]const u8{ "tmp.zig:6:30: error: packed union does not support enum tag type", }); cases.add("packed union with automatic layout field", \\const Foo = struct { \\ a: u32, \\ b: f32, \\}; \\const Payload = packed union { \\ A: Foo, \\ B: bool, \\}; \\export fn entry() void { \\ var a = Payload { .B = true }; \\} , &[_][]const u8{ "tmp.zig:6:5: error: non-packed, non-extern struct 'Foo' not allowed in packed union; no guaranteed in-memory representation", }); cases.add("switch on union with no attached enum", \\const Payload = union { \\ A: i32, \\ B: f64, \\ C: bool, \\}; \\export fn entry() void { \\ const a = Payload { .A = 1234 }; \\ foo(a); \\} \\fn foo(a: *const Payload) void { \\ switch (a.*) { \\ Payload.A => {}, \\ else => unreachable, \\ } \\} , &[_][]const u8{ "tmp.zig:11:14: error: switch on union which has no attached enum", "tmp.zig:1:17: note: consider 'union(enum)' here", }); cases.add("enum in field count range but not matching tag", \\const Foo = enum(u32) { \\ A = 10, \\ B = 11, \\}; \\export fn entry() void { \\ var x = @intToEnum(Foo, 0); \\} , &[_][]const u8{ "tmp.zig:6:13: error: enum 'Foo' has no tag matching integer value 0", "tmp.zig:1:13: note: 'Foo' declared here", }); cases.add("comptime cast enum to union but field has payload", \\const Letter = enum { A, B, C }; \\const Value = union(Letter) { \\ A: i32, \\ B, \\ C, \\}; \\export fn entry() void { \\ var x: Value = Letter.A; \\} , &[_][]const u8{ "tmp.zig:8:26: error: cast to union 'Value' must initialize 'i32' field 'A'", "tmp.zig:3:5: note: field 'A' declared here", }); cases.add("runtime cast to union which has non-void fields", \\const Letter = enum { A, B, C }; \\const Value = union(Letter) { \\ A: i32, \\ B, \\ C, \\}; \\export fn entry() void { \\ foo(Letter.A); \\} \\fn foo(l: Letter) void { \\ var x: Value = l; \\} , &[_][]const u8{ "tmp.zig:11:20: error: runtime cast to union 'Value' which has non-void fields", "tmp.zig:3:5: note: field 'A' has type 'i32'", }); cases.add("taking byte offset of void field in struct", \\const Empty = struct { \\ val: void, \\}; \\export fn foo() void { \\ const fieldOffset = @byteOffsetOf(Empty, "val",); \\} , &[_][]const u8{ "tmp.zig:5:46: error: zero-bit field 'val' in struct 'Empty' has no offset", }); cases.add("taking bit offset of void field in struct", \\const Empty = struct { \\ val: void, \\}; \\export fn foo() void { \\ const fieldOffset = @bitOffsetOf(Empty, "val",); \\} , &[_][]const u8{ "tmp.zig:5:45: error: zero-bit field 'val' in struct 'Empty' has no offset", }); cases.add("invalid union field access in comptime", \\const Foo = union { \\ Bar: u8, \\ Baz: void, \\}; \\comptime { \\ var foo = Foo {.Baz = {}}; \\ const bar_val = foo.Bar; \\} , &[_][]const u8{ "tmp.zig:7:24: error: accessing union field 'Bar' while field 'Baz' is set", }); cases.add("unsupported modifier at start of asm output constraint", \\export fn foo() void { \\ var bar: u32 = 3; \\ asm volatile ("" : [baz]"+r"(bar) : : ""); \\} , &[_][]const u8{ "tmp.zig:3:5: error: invalid modifier starting output constraint for 'baz': '+', only '=' is supported. Compiler TODO: see https://github.com/ziglang/zig/issues/215", }); cases.add("comptime_int in asm input", \\export fn foo() void { \\ asm volatile ("" : : [bar]"r"(3) : ""); \\} , &[_][]const u8{ "tmp.zig:2:35: error: expected sized integer or sized float, found comptime_int", }); cases.add("comptime_float in asm input", \\export fn foo() void { \\ asm volatile ("" : : [bar]"r"(3.17) : ""); \\} , &[_][]const u8{ "tmp.zig:2:35: error: expected sized integer or sized float, found comptime_float", }); cases.add("runtime assignment to comptime struct type", \\const Foo = struct { \\ Bar: u8, \\ Baz: type, \\}; \\export fn f() void { \\ var x: u8 = 0; \\ const foo = Foo { .Bar = x, .Baz = u8 }; \\} , &[_][]const u8{ "tmp.zig:7:23: error: unable to evaluate constant expression", }); cases.add("runtime assignment to comptime union type", \\const Foo = union { \\ Bar: u8, \\ Baz: type, \\}; \\export fn f() void { \\ var x: u8 = 0; \\ const foo = Foo { .Bar = x }; \\} , &[_][]const u8{ "tmp.zig:7:23: error: unable to evaluate constant expression", }); cases.addTest("@shuffle with selected index past first vector length", \\export fn entry() void { \\ const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 }; \\ const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 }; \\ var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 }); \\} , &[_][]const u8{ "tmp.zig:4:39: error: mask index '4' has out-of-bounds selection", "tmp.zig:4:27: note: selected index '7' out of bounds of @Vector(4, u32)", "tmp.zig:4:30: note: selections from the second vector are specified with negative numbers", }); cases.addTest("nested vectors", \\export fn entry() void { \\ const V1 = @import("std").meta.Vector(4, u8); \\ const V2 = @Type(@import("std").builtin.TypeInfo{ .Vector = .{ .len = 4, .child = V1 } }); \\ var v: V2 = undefined; \\} , &[_][]const u8{ "tmp.zig:3:53: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid", "tmp.zig:3:16: note: referenced here", }); cases.addTest("bad @splat type", \\export fn entry() void { \\ const c = 4; \\ var v = @splat(4, c); \\} , &[_][]const u8{ "tmp.zig:3:23: error: vector element type must be integer, float, bool, or pointer; 'comptime_int' is invalid", }); cases.add("compileLog of tagged enum doesn't crash the compiler", \\const Bar = union(enum(u32)) { \\ X: i32 = 1 \\}; \\ \\fn testCompileLog(x: Bar) void { \\ @compileLog(x); \\} \\ \\pub fn main () void { \\ comptime testCompileLog(Bar{.X = 123}); \\} , &[_][]const u8{ "tmp.zig:6:5: error: found compile log statement", }); cases.add("attempted implicit cast from *const T to *[1]T", \\export fn entry(byte: u8) void { \\ const w: i32 = 1234; \\ var x: *const i32 = &w; \\ var y: *[1]i32 = x; \\ y[0] += 1; \\} , &[_][]const u8{ "tmp.zig:4:22: error: expected type '*[1]i32', found '*const i32'", "tmp.zig:4:22: note: cast discards const qualifier", }); cases.add("attempted implicit cast from *const T to []T", \\export fn entry() void { \\ const u: u32 = 42; \\ const x: []u32 = &u; \\} , &[_][]const u8{ "tmp.zig:3:23: error: expected type '[]u32', found '*const u32'", }); cases.add("for loop body expression ignored", \\fn returns() usize { \\ return 2; \\} \\export fn f1() void { \\ for ("hello") |_| returns(); \\} \\export fn f2() void { \\ var x: anyerror!i32 = error.Bad; \\ for ("hello") |_| returns() else unreachable; \\} , &[_][]const u8{ "tmp.zig:5:30: error: expression value is ignored", "tmp.zig:9:30: error: expression value is ignored", }); cases.add("aligned variable of zero-bit type", \\export fn f() void { \\ var s: struct {} align(4) = undefined; \\} , &[_][]const u8{ "tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned", }); cases.add("function returning opaque type", \\const FooType = opaque {}; \\export fn bar() !FooType { \\ return error.InvalidValue; \\} \\export fn bav() !@TypeOf(null) { \\ return error.InvalidValue; \\} \\export fn baz() !@TypeOf(undefined) { \\ return error.InvalidValue; \\} , &[_][]const u8{ "tmp.zig:2:18: error: Opaque return type 'FooType' not allowed", "tmp.zig:1:1: note: type declared here", "tmp.zig:5:18: error: Null return type '(null)' not allowed", "tmp.zig:8:18: error: Undefined return type '(undefined)' not allowed", }); cases.add("generic function returning opaque type", \\const FooType = opaque {}; \\fn generic(comptime T: type) !T { \\ return undefined; \\} \\export fn bar() void { \\ _ = generic(FooType); \\} \\export fn bav() void { \\ _ = generic(@TypeOf(null)); \\} \\export fn baz() void { \\ _ = generic(@TypeOf(undefined)); \\} , &[_][]const u8{ "tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed", "tmp.zig:2:1: note: function declared here", "tmp.zig:1:1: note: type declared here", "tmp.zig:9:16: error: call to generic function with Null return type '(null)' not allowed", "tmp.zig:2:1: note: function declared here", "tmp.zig:12:16: error: call to generic function with Undefined return type '(undefined)' not allowed", "tmp.zig:2:1: note: function declared here", }); cases.add("function parameter is opaque", \\const FooType = opaque {}; \\export fn entry1() void { \\ const someFuncPtr: fn (FooType) void = undefined; \\} \\ \\export fn entry2() void { \\ const someFuncPtr: fn (@TypeOf(null)) void = undefined; \\} \\ \\fn foo(p: FooType) void {} \\export fn entry3() void { \\ _ = foo; \\} \\ \\fn bar(p: @TypeOf(null)) void {} \\export fn entry4() void { \\ _ = bar; \\} , &[_][]const u8{ "tmp.zig:3:28: error: parameter of opaque type 'FooType' not allowed", "tmp.zig:7:28: error: parameter of type '(null)' not allowed", "tmp.zig:10:11: error: parameter of opaque type 'FooType' not allowed", "tmp.zig:15:11: error: parameter of type '(null)' not allowed", }); cases.add( // fixed bug #2032 "compile diagnostic string for top level decl type", \\export fn entry() void { \\ var foo: u32 = @This(){}; \\} , &[_][]const u8{ "tmp.zig:2:27: error: type 'u32' does not support array initialization", }); cases.add("issue #2687: coerce from undefined array pointer to slice", \\export fn foo1() void { \\ const a: *[1]u8 = undefined; \\ var b: []u8 = a; \\} \\export fn foo2() void { \\ comptime { \\ var a: *[1]u8 = undefined; \\ var b: []u8 = a; \\ } \\} \\export fn foo3() void { \\ comptime { \\ const a: *[1]u8 = undefined; \\ var b: []u8 = a; \\ } \\} , &[_][]const u8{ "tmp.zig:3:19: error: use of undefined value here causes undefined behavior", "tmp.zig:8:23: error: use of undefined value here causes undefined behavior", "tmp.zig:14:23: error: use of undefined value here causes undefined behavior", }); cases.add("issue #3818: bitcast from parray/slice to u16", \\export fn foo1() void { \\ var bytes = [_]u8{1, 2}; \\ const word: u16 = @bitCast(u16, bytes[0..]); \\} \\export fn foo2() void { \\ var bytes: []const u8 = &[_]u8{1, 2}; \\ const word: u16 = @bitCast(u16, bytes); \\} , &[_][]const u8{ "tmp.zig:3:42: error: unable to @bitCast from pointer type '*[2]u8'", "tmp.zig:7:32: error: destination type 'u16' has size 2 but source type '[]const u8' has size 16", "tmp.zig:7:37: note: referenced here", }); // issue #7810 cases.add("comptime slice-len increment beyond bounds", \\export fn foo_slice_len_increment_beyond_bounds() void { \\ comptime { \\ var buf_storage: [8]u8 = undefined; \\ var buf: []const u8 = buf_storage[0..]; \\ buf.len += 1; \\ buf[8] = 42; \\ } \\} , &[_][]const u8{ ":6:12: error: out of bounds slice", }); cases.add("comptime slice-sentinel is out of bounds (unterminated)", \\export fn foo_array() void { \\ comptime { \\ var target = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ const slice = target[0..14 :0]; \\ } \\} \\export fn foo_ptr_array() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target = &buf; \\ const slice = target[0..14 :0]; \\ } \\} \\export fn foo_vector_ConstPtrSpecialBaseArray() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*]u8 = &buf; \\ const slice = target[0..14 :0]; \\ } \\} \\export fn foo_vector_ConstPtrSpecialRef() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*]u8 = @ptrCast([*]u8, &buf); \\ const slice = target[0..14 :0]; \\ } \\} \\export fn foo_cvector_ConstPtrSpecialBaseArray() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*c]u8 = &buf; \\ const slice = target[0..14 :0]; \\ } \\} \\export fn foo_cvector_ConstPtrSpecialRef() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*c]u8 = @ptrCast([*c]u8, &buf); \\ const slice = target[0..14 :0]; \\ } \\} \\export fn foo_slice() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: []u8 = &buf; \\ const slice = target[0..14 :0]; \\ } \\} , &[_][]const u8{ ":4:29: error: slice-sentinel is out of bounds", ":11:29: error: slice-sentinel is out of bounds", ":18:29: error: slice-sentinel is out of bounds", ":25:29: error: slice-sentinel is out of bounds", ":32:29: error: slice-sentinel is out of bounds", ":39:29: error: slice-sentinel is out of bounds", ":46:29: error: slice-sentinel is out of bounds", }); cases.add("comptime slice-sentinel is out of bounds (terminated)", \\export fn foo_array() void { \\ comptime { \\ var target = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ const slice = target[0..15 :1]; \\ } \\} \\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..15 :0]; \\ } \\} \\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..15 :0]; \\ } \\} \\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..15 :0]; \\ } \\} \\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..15 :0]; \\ } \\} \\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..15 :0]; \\ } \\} \\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..15 :0]; \\ } \\} , &[_][]const u8{ ":4:29: error: out of bounds slice", ":11:29: error: out of bounds slice", ":18:29: error: out of bounds slice", ":25:29: error: out of bounds slice", ":32:29: error: out of bounds slice", ":39:29: error: out of bounds slice", ":46:29: error: out of bounds slice", }); cases.add("comptime slice-sentinel does not match memory at target index (unterminated)", \\export fn foo_array() void { \\ comptime { \\ var target = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ const slice = target[0..3 :0]; \\ } \\} \\export fn foo_ptr_array() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target = &buf; \\ const slice = target[0..3 :0]; \\ } \\} \\export fn foo_vector_ConstPtrSpecialBaseArray() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*]u8 = &buf; \\ const slice = target[0..3 :0]; \\ } \\} \\export fn foo_vector_ConstPtrSpecialRef() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*]u8 = @ptrCast([*]u8, &buf); \\ const slice = target[0..3 :0]; \\ } \\} \\export fn foo_cvector_ConstPtrSpecialBaseArray() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*c]u8 = &buf; \\ const slice = target[0..3 :0]; \\ } \\} \\export fn foo_cvector_ConstPtrSpecialRef() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: [*c]u8 = @ptrCast([*c]u8, &buf); \\ const slice = target[0..3 :0]; \\ } \\} \\export fn foo_slice() void { \\ comptime { \\ var buf = [_]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ var target: []u8 = &buf; \\ const slice = target[0..3 :0]; \\ } \\} , &[_][]const u8{ ":4:29: error: slice-sentinel does not match memory at target index", ":11:29: error: slice-sentinel does not match memory at target index", ":18:29: error: slice-sentinel does not match memory at target index", ":25:29: error: slice-sentinel does not match memory at target index", ":32:29: error: slice-sentinel does not match memory at target index", ":39:29: error: slice-sentinel does not match memory at target index", ":46:29: error: slice-sentinel does not match memory at target index", }); cases.add("comptime slice-sentinel does not match memory at target index (terminated)", \\export fn foo_array() void { \\ comptime { \\ var target = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ const slice = target[0..3 :0]; \\ } \\} \\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]; \\ } \\} \\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]; \\ } \\} \\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]; \\ } \\} \\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]; \\ } \\} \\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]; \\ } \\} \\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]; \\ } \\} , &[_][]const u8{ ":4:29: error: slice-sentinel does not match memory at target index", ":11:29: error: slice-sentinel does not match memory at target index", ":18:29: error: slice-sentinel does not match memory at target index", ":25:29: error: slice-sentinel does not match memory at target index", ":32:29: error: slice-sentinel does not match memory at target index", ":39:29: error: slice-sentinel does not match memory at target index", ":46:29: error: slice-sentinel does not match memory at target index", }); cases.add("comptime slice-sentinel does not match target-sentinel", \\export fn foo_array() void { \\ comptime { \\ var target = [_:0]u8{ 'a', 'b', 'c', 'd' } ++ [_]u8{undefined} ** 10; \\ const slice = target[0..14 :255]; \\ } \\} \\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..14 :255]; \\ } \\} \\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..14 :255]; \\ } \\} \\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..14 :255]; \\ } \\} \\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..14 :255]; \\ } \\} \\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..14 :255]; \\ } \\} \\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..14 :255]; \\ } \\} , &[_][]const u8{ ":4:29: error: slice-sentinel does not match target-sentinel", ":11:29: error: slice-sentinel does not match target-sentinel", ":18:29: error: slice-sentinel does not match target-sentinel", ":25:29: error: slice-sentinel does not match target-sentinel", ":32:29: error: slice-sentinel does not match target-sentinel", ":39:29: error: slice-sentinel does not match target-sentinel", ":46:29: error: slice-sentinel does not match target-sentinel", }); cases.add("issue #4207: coerce from non-terminated-slice to terminated-pointer", \\export fn foo() [*:0]const u8 { \\ var buffer: [64]u8 = undefined; \\ return buffer[0..]; \\} , &[_][]const u8{ ":3:18: error: expected type '[*:0]const u8', found '*[64]u8'", ":3:18: note: destination pointer requires a terminating '0' sentinel", }); cases.add("issue #5221: invalid struct init type referenced by @typeInfo and passed into function", \\fn ignore(comptime param: anytype) void {} \\ \\export fn foo() void { \\ const MyStruct = struct { \\ wrong_type: []u8 = "foo", \\ }; \\ \\ comptime ignore(@typeInfo(MyStruct).Struct.fields[0]); \\} , &[_][]const u8{ ":5:28: error: expected type '[]u8', found '*const [3:0]u8'", }); cases.add("integer underflow error", \\export fn entry() void { \\ _ = @intToPtr(*c_void, ~@as(usize, @import("std").math.maxInt(usize)) - 1); \\} , &[_][]const u8{ ":2:75: error: operation caused overflow", }); cases.addCase(x: { var tc = cases.create("align(N) expr function pointers is a compile error", \\export fn foo() align(1) void { \\ return; \\} , &[_][]const u8{ "tmp.zig:1:23: error: align(N) expr is not allowed on function prototypes in wasm32/wasm64", }); tc.target = std.zig.CrossTarget{ .cpu_arch = .wasm32, .os_tag = .freestanding, .abi = .none, }; break :x tc; }); cases.add("compare optional to non-optional with invalid types", \\export fn inconsistentChildType() void { \\ var x: ?i32 = undefined; \\ const y: comptime_int = 10; \\ _ = (x == y); \\} \\ \\export fn optionalToOptional() void { \\ var x: ?i32 = undefined; \\ var y: ?i32 = undefined; \\ _ = (x == y); \\} \\ \\export fn optionalVector() void { \\ var x: ?@Vector(10, i32) = undefined; \\ var y: @Vector(10, i32) = undefined; \\ _ = (x == y); \\} \\ \\export fn invalidChildType() void { \\ var x: ?[3]i32 = undefined; \\ var y: [3]i32 = undefined; \\ _ = (x == y); \\} , &[_][]const u8{ ":4:12: error: cannot compare types '?i32' and 'comptime_int'", ":4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'", ":10:12: error: cannot compare types '?i32' and '?i32'", ":10:12: note: optional to optional comparison is only supported for optional pointer types", ":16:12: error: TODO add comparison of optional vector", ":22:12: error: cannot compare types '?[3]i32' and '[3]i32'", ":22:12: note: operator not supported for type '[3]i32'", }); cases.add("slice cannot have its bytes reinterpreted", \\export fn foo() void { \\ const bytes = [1]u8{ 0xfa } ** 16; \\ var value = @ptrCast(*const []const u8, &bytes).*; \\} , &[_][]const u8{ ":3:52: error: slice '[]const u8' cannot have its bytes reinterpreted", }); cases.add("wasmMemorySize is a compile error in non-Wasm targets", \\export fn foo() void { \\ _ = @wasmMemorySize(0); \\ return; \\} , &[_][]const u8{ "tmp.zig:2:9: error: @wasmMemorySize is a wasm32 feature only", }); cases.add("wasmMemoryGrow is a compile error in non-Wasm targets", \\export fn foo() void { \\ _ = @wasmMemoryGrow(0, 1); \\ return; \\} , &[_][]const u8{ "tmp.zig:2:9: error: @wasmMemoryGrow is a wasm32 feature only", }); cases.add("Issue #5586: Make unary minus for unsigned types a compile error", \\export fn f1(x: u32) u32 { \\ const y = -%x; \\ return -y; \\} \\const V = @import("std").meta.Vector; \\export fn f2(x: V(4, u32)) V(4, u32) { \\ const y = -%x; \\ return -y; \\} , &[_][]const u8{ "tmp.zig:3:12: error: negation of type 'u32'", "tmp.zig:8:12: error: negation of type 'u32'", }); cases.add("Issue #5618: coercion of ?*c_void to *c_void must fail.", \\export fn foo() void { \\ var u: ?*c_void = null; \\ var v: *c_void = undefined; \\ v = u; \\} , &[_][]const u8{ "tmp.zig:4:9: error: expected type '*c_void', found '?*c_void'", }); cases.add("Issue #6823: don't allow .* to be followed by **", \\fn foo() void { \\ var sequence = "repeat".*** 10; \\} , &[_][]const u8{ "tmp.zig:2:30: error: `.*` cannot be followed by `*`. Are you missing a space?", }); }
test/compile_errors.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualSlices = std.testing.expectEqualSlices; const maxInt = std.math.maxInt; const minInt = std.math.minInt; const mem = std.mem; test "assignment operators" { var i: u32 = 0; i += 5; try expect(i == 5); i -= 2; try expect(i == 3); i *= 20; try expect(i == 60); i /= 3; try expect(i == 20); i %= 11; try expect(i == 9); i <<= 1; try expect(i == 18); i >>= 2; try expect(i == 4); i = 6; i &= 5; try expect(i == 4); i ^= 6; try expect(i == 2); i = 6; i |= 3; try expect(i == 7); } test "three expr in a row" { try testThreeExprInARow(false, true); comptime try testThreeExprInARow(false, true); } fn testThreeExprInARow(f: bool, t: bool) !void { try assertFalse(f or f or f); try assertFalse(t and t and f); try assertFalse(1 | 2 | 4 != 7); try assertFalse(3 ^ 6 ^ 8 != 13); try assertFalse(7 & 14 & 28 != 4); try assertFalse(9 << 1 << 2 != 9 << 3); try assertFalse(90 >> 1 >> 2 != 90 >> 3); try assertFalse(100 - 1 + 1000 != 1099); try assertFalse(5 * 4 / 2 % 3 != 1); try assertFalse(@as(i32, @as(i32, 5)) != 5); try assertFalse(!!false); try assertFalse(@as(i32, 7) != --(@as(i32, 7))); } fn assertFalse(b: bool) !void { try expect(!b); } test "@clz" { try testClz(); comptime try testClz(); } fn testClz() !void { try expect(testOneClz(u8, 0b10001010) == 0); try expect(testOneClz(u8, 0b00001010) == 4); try expect(testOneClz(u8, 0b00011010) == 3); try expect(testOneClz(u8, 0b00000000) == 8); try expect(testOneClz(u128, 0xffffffffffffffff) == 64); try expect(testOneClz(u128, 0x10000000000000000) == 63); } fn testOneClz(comptime T: type, x: T) u32 { return @clz(T, x); } test "const number literal" { const one = 1; const eleven = ten + one; try expect(eleven == 11); } const ten = 10; test "float equality" { const x: f64 = 0.012; const y: f64 = x + 1.0; try testFloatEqualityImpl(x, y); comptime try testFloatEqualityImpl(x, y); } fn testFloatEqualityImpl(x: f64, y: f64) !void { const y2 = x + 1.0; try expect(y == y2); } test "hex float literal parsing" { comptime try expect(0x1.0 == 1.0); } test "quad hex float literal parsing in range" { const a = 0x1.af23456789bbaaab347645365cdep+5; const b = 0x1.dedafcff354b6ae9758763545432p-9; const c = 0x1.2f34dd5f437e849b4baab754cdefp+4534; const d = 0x1.edcbff8ad76ab5bf46463233214fp-435; _ = a; _ = b; _ = c; _ = d; } test "underscore separator parsing" { try expect(0_0_0_0 == 0); try expect(1_234_567 == 1234567); try expect(001_234_567 == 1234567); try expect(0_0_1_2_3_4_5_6_7 == 1234567); try expect(0b0_0_0_0 == 0); try expect(0b1010_1010 == 0b10101010); try expect(0b0000_1010_1010 == 0b10101010); try expect(0b1_0_1_0_1_0_1_0 == 0b10101010); try expect(0o0_0_0_0 == 0); try expect(0o1010_1010 == 0o10101010); try expect(0o0000_1010_1010 == 0o10101010); try expect(0o1_0_1_0_1_0_1_0 == 0o10101010); try expect(0x0_0_0_0 == 0); try expect(0x1010_1010 == 0x10101010); try expect(0x0000_1010_1010 == 0x10101010); try expect(0x1_0_1_0_1_0_1_0 == 0x10101010); try expect(123_456.789_000e1_0 == 123456.789000e10); try expect(0_1_2_3_4_5_6.7_8_9_0_0_0e0_0_1_0 == 123456.789000e10); try expect(0x1234_5678.9ABC_DEF0p-1_0 == 0x12345678.9ABCDEF0p-10); try expect(0x1_2_3_4_5_6_7_8.9_A_B_C_D_E_F_0p-0_0_0_1_0 == 0x12345678.9ABCDEF0p-10); } test "hex float literal within range" { const a = 0x1.0p16383; const b = 0x0.1p16387; const c = 0x1.0p-16382; _ = a; _ = b; _ = c; } test "comptime_int addition" { comptime { try expect(35361831660712422535336160538497375248 + 101752735581729509668353361206450473702 == 137114567242441932203689521744947848950); try expect(594491908217841670578297176641415611445982232488944558774612 + 390603545391089362063884922208143568023166603618446395589768 == 985095453608931032642182098849559179469148836107390954364380); } } test "comptime_int multiplication" { comptime { try expect( 45960427431263824329884196484953148229 * 128339149605334697009938835852565949723 == 5898522172026096622534201617172456926982464453350084962781392314016180490567, ); try expect( 594491908217841670578297176641415611445982232488944558774612 * 390603545391089362063884922208143568023166603618446395589768 == 232210647056203049913662402532976186578842425262306016094292237500303028346593132411865381225871291702600263463125370016, ); } } test "comptime_int shifting" { comptime { try expect((@as(u128, 1) << 127) == 0x80000000000000000000000000000000); } } test "comptime_int multi-limb shift and mask" { comptime { var a = 0xefffffffa0000001eeeeeeefaaaaaaab; try expect(@as(u32, a & 0xffffffff) == 0xaaaaaaab); a >>= 32; try expect(@as(u32, a & 0xffffffff) == 0xeeeeeeef); a >>= 32; try expect(@as(u32, a & 0xffffffff) == 0xa0000001); a >>= 32; try expect(@as(u32, a & 0xffffffff) == 0xefffffff); a >>= 32; try expect(a == 0); } } test "comptime_int multi-limb partial shift right" { comptime { var a = 0x1ffffffffeeeeeeee; a >>= 16; try expect(a == 0x1ffffffffeeee); } } test "xor" { try test_xor(); comptime try test_xor(); } fn test_xor() !void { try testOneXor(0xFF, 0x00, 0xFF); try testOneXor(0xF0, 0x0F, 0xFF); try testOneXor(0xFF, 0xF0, 0x0F); try testOneXor(0xFF, 0x0F, 0xF0); try testOneXor(0xFF, 0xFF, 0x00); } fn testOneXor(a: u8, b: u8, c: u8) !void { try expect(a ^ b == c); } test "comptime_int xor" { comptime { try expect(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ^ 0x00000000000000000000000000000000 == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); try expect(0xFFFFFFFFFFFFFFFF0000000000000000 ^ 0x0000000000000000FFFFFFFFFFFFFFFF == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); try expect(0xFFFFFFFFFFFFFFFF0000000000000000 ^ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0x0000000000000000FFFFFFFFFFFFFFFF); try expect(0x0000000000000000FFFFFFFFFFFFFFFF ^ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0xFFFFFFFFFFFFFFFF0000000000000000); try expect(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ^ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0x00000000000000000000000000000000); try expect(0xFFFFFFFF00000000FFFFFFFF00000000 ^ 0x00000000FFFFFFFF00000000FFFFFFFF == 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); try expect(0xFFFFFFFF00000000FFFFFFFF00000000 ^ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0x00000000FFFFFFFF00000000FFFFFFFF); try expect(0x00000000FFFFFFFF00000000FFFFFFFF ^ 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF == 0xFFFFFFFF00000000FFFFFFFF00000000); } } test "comptime_int param and return" { const a = comptimeAdd(35361831660712422535336160538497375248, 101752735581729509668353361206450473702); try expect(a == 137114567242441932203689521744947848950); const b = comptimeAdd(594491908217841670578297176641415611445982232488944558774612, 390603545391089362063884922208143568023166603618446395589768); try expect(b == 985095453608931032642182098849559179469148836107390954364380); } fn comptimeAdd(comptime a: comptime_int, comptime b: comptime_int) comptime_int { return a + b; } test "binary not" { try expect(comptime x: { break :x ~@as(u16, 0b1010101010101010) == 0b0101010101010101; }); try expect(comptime x: { break :x ~@as(u64, 2147483647) == 18446744071562067968; }); try testBinaryNot(0b1010101010101010); } fn testBinaryNot(x: u16) !void { try expect(~x == 0b0101010101010101); } test "division" { try testDivision(); comptime try testDivision(); } fn testDivision() !void { try expect(div(u32, 13, 3) == 4); try expect(div(f16, 1.0, 2.0) == 0.5); try expect(div(f32, 1.0, 2.0) == 0.5); try expect(divExact(u32, 55, 11) == 5); try expect(divExact(i32, -55, 11) == -5); try expect(divExact(f16, 55.0, 11.0) == 5.0); try expect(divExact(f16, -55.0, 11.0) == -5.0); try expect(divExact(f32, 55.0, 11.0) == 5.0); try expect(divExact(f32, -55.0, 11.0) == -5.0); try expect(divFloor(i32, 5, 3) == 1); try expect(divFloor(i32, -5, 3) == -2); try expect(divFloor(f16, 5.0, 3.0) == 1.0); try expect(divFloor(f16, -5.0, 3.0) == -2.0); try expect(divFloor(f32, 5.0, 3.0) == 1.0); try expect(divFloor(f32, -5.0, 3.0) == -2.0); try expect(divFloor(i32, -0x80000000, -2) == 0x40000000); try expect(divFloor(i32, 0, -0x80000000) == 0); try expect(divFloor(i32, -0x40000001, 0x40000000) == -2); try expect(divFloor(i32, -0x80000000, 1) == -0x80000000); try expect(divFloor(i32, 10, 12) == 0); try expect(divFloor(i32, -14, 12) == -2); try expect(divFloor(i32, -2, 12) == -1); try expect(divTrunc(i32, 5, 3) == 1); try expect(divTrunc(i32, -5, 3) == -1); try expect(divTrunc(f16, 5.0, 3.0) == 1.0); try expect(divTrunc(f16, -5.0, 3.0) == -1.0); try expect(divTrunc(f32, 5.0, 3.0) == 1.0); try expect(divTrunc(f32, -5.0, 3.0) == -1.0); try expect(divTrunc(f64, 5.0, 3.0) == 1.0); try expect(divTrunc(f64, -5.0, 3.0) == -1.0); try expect(divTrunc(i32, 10, 12) == 0); try expect(divTrunc(i32, -14, 12) == -1); try expect(divTrunc(i32, -2, 12) == 0); try expect(mod(i32, 10, 12) == 10); try expect(mod(i32, -14, 12) == 10); try expect(mod(i32, -2, 12) == 10); comptime { try expect( 1194735857077236777412821811143690633098347576 % 508740759824825164163191790951174292733114988 == 177254337427586449086438229241342047632117600, ); try expect( @rem(-1194735857077236777412821811143690633098347576, 508740759824825164163191790951174292733114988) == -177254337427586449086438229241342047632117600, ); try expect( 1194735857077236777412821811143690633098347576 / 508740759824825164163191790951174292733114988 == 2, ); try expect( @divTrunc(-1194735857077236777412821811143690633098347576, 508740759824825164163191790951174292733114988) == -2, ); try expect( @divTrunc(1194735857077236777412821811143690633098347576, -508740759824825164163191790951174292733114988) == -2, ); try expect( @divTrunc(-1194735857077236777412821811143690633098347576, -508740759824825164163191790951174292733114988) == 2, ); try expect( 4126227191251978491697987544882340798050766755606969681711 % 10 == 1, ); } } fn div(comptime T: type, a: T, b: T) T { return a / b; } fn divExact(comptime T: type, a: T, b: T) T { return @divExact(a, b); } fn divFloor(comptime T: type, a: T, b: T) T { return @divFloor(a, b); } fn divTrunc(comptime T: type, a: T, b: T) T { return @divTrunc(a, b); } fn mod(comptime T: type, a: T, b: T) T { return @mod(a, b); } test "unsigned wrapping" { try testUnsignedWrappingEval(maxInt(u32)); comptime try testUnsignedWrappingEval(maxInt(u32)); } fn testUnsignedWrappingEval(x: u32) !void { const zero = x +% 1; try expect(zero == 0); const orig = zero -% 1; try expect(orig == maxInt(u32)); } test "signed wrapping" { try testSignedWrappingEval(maxInt(i32)); comptime try testSignedWrappingEval(maxInt(i32)); } fn testSignedWrappingEval(x: i32) !void { const min_val = x +% 1; try expect(min_val == minInt(i32)); const max_val = min_val -% 1; try expect(max_val == maxInt(i32)); } test "signed negation wrapping" { try testSignedNegationWrappingEval(minInt(i16)); comptime try testSignedNegationWrappingEval(minInt(i16)); } fn testSignedNegationWrappingEval(x: i16) !void { try expect(x == -32768); const neg = -%x; try expect(neg == -32768); } test "unsigned negation wrapping" { try testUnsignedNegationWrappingEval(1); comptime try testUnsignedNegationWrappingEval(1); } fn testUnsignedNegationWrappingEval(x: u16) !void { try expect(x == 1); const neg = -%x; try expect(neg == maxInt(u16)); } test "unsigned 64-bit division" { try test_u64_div(); comptime try test_u64_div(); } fn test_u64_div() !void { const result = divWithResult(1152921504606846976, 34359738365); try expect(result.quotient == 33554432); try expect(result.remainder == 100663296); } fn divWithResult(a: u64, b: u64) DivResult { return DivResult{ .quotient = a / b, .remainder = a % b, }; } const DivResult = struct { quotient: u64, remainder: u64, }; test "truncating shift right" { try testShrTrunc(maxInt(u16)); comptime try testShrTrunc(maxInt(u16)); } fn testShrTrunc(x: u16) !void { const shifted = x >> 1; try expect(shifted == 32767); } test "f128" { try test_f128(); comptime try test_f128(); } fn make_f128(x: f128) f128 { return x; } fn test_f128() !void { try expect(@sizeOf(f128) == 16); try expect(make_f128(1.0) == 1.0); try expect(make_f128(1.0) != 1.1); try expect(make_f128(1.0) > 0.9); try expect(make_f128(1.0) >= 0.9); try expect(make_f128(1.0) >= 1.0); try should_not_be_zero(1.0); } fn should_not_be_zero(x: f128) !void { try expect(x != 0.0); } test "128-bit multiplication" { var a: i128 = 3; var b: i128 = 2; var c = a * b; try expect(c == 6); }
test/behavior/math.zig
const Allocator = std.mem.Allocator; const FormatInterface = @import("../format_interface.zig").FormatInterface; const ImageFormat = image.ImageFormat; const ImageReader = image.ImageReader; const ImageInfo = image.ImageInfo; const ImageSeekStream = image.ImageSeekStream; const PixelFormat = @import("../pixel_format.zig").PixelFormat; const color = @import("../color.zig"); const errors = @import("../errors.zig"); const image = @import("../image.zig"); const std = @import("std"); const utils = @import("../utils.zig"); pub const PCXHeader = packed struct { id: u8 = 0x0A, version: u8, compression: u8, bpp: u8, xmin: u16, ymin: u16, xmax: u16, ymax: u16, horizontalDPI: u16, verticalDPI: u16, builtinPalette: [48]u8, _reserved0: u8 = 0, planes: u8, stride: u16, paletteInformation: u16, screenWidth: u16, screenHeight: u16, // HACK: For some reason, padding as field does not report 128 bytes for the header. var padding: [54]u8 = undefined; comptime { std.debug.assert(@sizeOf(@This()) == 74); } }; const RLEDecoder = struct { const Run = struct { value: u8, remaining: usize, }; stream: ImageReader, currentRun: ?Run, fn init(stream: ImageReader) RLEDecoder { return RLEDecoder{ .stream = stream, .currentRun = null, }; } fn readByte(self: *RLEDecoder) !u8 { if (self.currentRun) |*run| { var result = run.value; run.remaining -= 1; if (run.remaining == 0) self.currentRun = null; return result; } else { while (true) { var byte = try self.stream.readByte(); if (byte == 0xC0) // skip over "zero length runs" continue; if ((byte & 0xC0) == 0xC0) { const len = byte & 0x3F; std.debug.assert(len > 0); const result = try self.stream.readByte(); if (len > 1) { // we only need to store a run in the decoder if it is longer than 1 self.currentRun = .{ .value = result, .remaining = len - 1, }; } return result; } else { return byte; } } } } fn finish(decoder: RLEDecoder) !void { if (decoder.currentRun != null) { return error.RLEStreamIncomplete; } } }; pub const PCX = struct { header: PCXHeader = undefined, width: usize = 0, height: usize = 0, pixel_format: PixelFormat = undefined, const Self = @This(); pub fn formatInterface() FormatInterface { return FormatInterface{ .format = @ptrCast(FormatInterface.FormatFn, format), .formatDetect = @ptrCast(FormatInterface.FormatDetectFn, formatDetect), .readForImage = @ptrCast(FormatInterface.ReadForImageFn, readForImage), .writeForImage = @ptrCast(FormatInterface.WriteForImageFn, writeForImage), }; } pub fn format() ImageFormat { return ImageFormat.Pcx; } pub fn formatDetect(reader: ImageReader, seekStream: ImageSeekStream) !bool { var magicNumberBuffer: [2]u8 = undefined; _ = try reader.read(magicNumberBuffer[0..]); if (magicNumberBuffer[0] != 0x0A) { return false; } if (magicNumberBuffer[1] > 0x05) { return false; } return true; } pub fn readForImage(allocator: *Allocator, reader: ImageReader, seekStream: ImageSeekStream, pixels: *?color.ColorStorage) !ImageInfo { var pcx = PCX{}; try pcx.read(allocator, reader, seekStream, pixels); var imageInfo = ImageInfo{}; imageInfo.width = pcx.width; imageInfo.height = pcx.height; imageInfo.pixel_format = pcx.pixel_format; return imageInfo; } pub fn writeForImage(allocator: *Allocator, write_stream: image.ImageWriterStream, seek_stream: ImageSeekStream, pixels: color.ColorStorage, save_info: image.ImageSaveInfo) !void {} pub fn read(self: *Self, allocator: *Allocator, reader: ImageReader, seekStream: ImageSeekStream, pixelsOpt: *?color.ColorStorage) !void { self.header = try utils.readStructLittle(reader, PCXHeader); _ = try reader.read(PCXHeader.padding[0..]); if (self.header.id != 0x0A) { return errors.ImageError.InvalidMagicHeader; } if (self.header.version > 0x05) { return errors.ImageError.InvalidMagicHeader; } if (self.header.planes > 3) { return errors.ImageError.UnsupportedPixelFormat; } self.pixel_format = blk: { if (self.header.planes == 1) { switch (self.header.bpp) { 1 => break :blk PixelFormat.Bpp1, 4 => break :blk PixelFormat.Bpp4, 8 => break :blk PixelFormat.Bpp8, else => return errors.ImageError.UnsupportedPixelFormat, } } else if (self.header.planes == 3) { switch (self.header.bpp) { 8 => break :blk PixelFormat.Rgb24, else => return errors.ImageError.UnsupportedPixelFormat, } } else { return errors.ImageError.UnsupportedPixelFormat; } }; self.width = @as(usize, self.header.xmax - self.header.xmin + 1); self.height = @as(usize, self.header.ymax - self.header.ymin + 1); const hasDummyByte = (@bitCast(i16, self.header.stride) - @bitCast(isize, self.width)) == 1; const actualWidth = if (hasDummyByte) self.width + 1 else self.width; pixelsOpt.* = try color.ColorStorage.init(allocator, self.pixel_format, self.width * self.height); if (pixelsOpt.*) |pixels| { var decoder = RLEDecoder.init(reader); const scanlineLength = (self.header.stride * self.header.planes); var y: usize = 0; while (y < self.height) : (y += 1) { var offset: usize = 0; var x: usize = 0; const yStride = y * self.width; // read all pixels from the current row while (offset < scanlineLength and x < self.width) : (offset += 1) { const byte = try decoder.readByte(); switch (pixels) { .Bpp1 => |storage| { var i: usize = 0; while (i < 8) : (i += 1) { if (x < self.width) { storage.indices[yStride + x] = @intCast(u1, (byte >> (7 - @intCast(u3, i))) & 0x01); x += 1; } } }, .Bpp4 => |storage| { storage.indices[yStride + x] = @truncate(u4, byte >> 4); x += 1; if (x < self.width) { storage.indices[yStride + x] = @truncate(u4, byte); x += 1; } }, .Bpp8 => |storage| { storage.indices[yStride + x] = byte; x += 1; }, .Rgb24 => |storage| { if (hasDummyByte and byte == 0x00) { continue; } const pixelX = offset % (actualWidth); const currentColor = offset / (actualWidth); switch (currentColor) { 0 => { storage[yStride + pixelX].R = byte; }, 1 => { storage[yStride + pixelX].G = byte; }, 2 => { storage[yStride + pixelX].B = byte; }, else => {}, } if (pixelX > 0 and (pixelX % self.header.planes) == 0) { x += 1; } }, else => return error.UnsupportedPixelFormat, } } // discard the rest of the bytes in the current row while (offset < self.header.stride) : (offset += 1) { _ = try decoder.readByte(); } } try decoder.finish(); if (self.pixel_format == .Bpp1 or self.pixel_format == .Bpp4 or self.pixel_format == .Bpp8) { var pal = switch (pixels) { .Bpp1 => |*storage| storage.palette[0..], .Bpp4 => |*storage| storage.palette[0..], .Bpp8 => |*storage| storage.palette[0..], else => undefined, }; var i: usize = 0; while (i < std.math.min(pal.len, self.header.builtinPalette.len / 3)) : (i += 1) { pal[i].R = color.toColorFloat(self.header.builtinPalette[3 * i + 0]); pal[i].G = color.toColorFloat(self.header.builtinPalette[3 * i + 1]); pal[i].B = color.toColorFloat(self.header.builtinPalette[3 * i + 2]); pal[i].A = 1.0; } if (pixels == .Bpp8) { const endPos = try seekStream.getEndPos(); try seekStream.seekTo(endPos - 769); if ((try reader.readByte()) != 0x0C) return error.MissingPalette; for (pal) |*c| { c.R = color.toColorFloat(try reader.readByte()); c.G = color.toColorFloat(try reader.readByte()); c.B = color.toColorFloat(try reader.readByte()); c.A = 1.0; } } } } } };
src/formats/pcx.zig
const std = @import("std"); const network = @import("network"); const Allocator = std.mem.Allocator; const print = std.debug.print; const log = std.math.log; const G = @import("global_config.zig"); const I = @import("instruments.zig"); const Note = struct { instr_id: u8, note: u8, octave: u8, fn getFreq(self: Note) f32 { var log_f = @intToFloat(f32, self.note) * log(f32, std.math.e, 2.0) / 24 + log(f32, std.math.e, 16.0); const f: f32 = std.math.exp(log_f) * std.math.pow(f32, @intToFloat(f32, self.octave) + 1.0, 2); print("Converted freq {}\n", .{f}); return f; } }; const MsgType = enum(u8) { note_start = 0, note_end = 1, tweak_param = 4, }; const DecodeError = error{ WrongMsgType, }; /// Intermediary representation of sounds that can be logged and serialized, to be replayed, edited, etc. const Event = union(enum) { note_start: Note, note_end, // not impl tweak_param, // not impl fn fromBytes(raw_data: []const u8) DecodeError!Event { const msg_type = @intToEnum(MsgType, raw_data[0]); return switch (msg_type) { .note_start => Event{ .note_start = Note{ .instr_id = raw_data[1], .note = raw_data[2], .octave = raw_data[3], } }, .note_end => Event.note_end, .tweak_param => Event.tweak_param, }; } fn process(self: *Event, alloc: Allocator, events: *I.NoteQueue) !void { switch (self.*) { .note_start => { const N = self.note_start; const now = G.nowSeconds() + 0.1; var new_instrument: ?*I.Instrument = null; var f = N.getFreq(); if (N.instr_id == 0) { print("New Kick at t={}\n", .{now}); new_instrument = try I.createKick(alloc, now, 0.5, f, 0.45, true); } else { print("Unrecognized instr {}\n", .{N.instr_id}); } if (new_instrument) |ii| { try events.add(ii); // TODO handle error } }, else => { print("Not implemented!\n", .{}); }, } } }; var buf = [_]u8{0} ** 100; /// TODO find a better name for instruments... pub fn listenToEvents(alloc: Allocator, events: *I.NoteQueue) !void { try network.init(); defer network.deinit(); var sock = try network.Socket.create(.ipv4, .udp); defer sock.close(); try sock.bindToPort(4321); // parse messages while (true) { var size_received = try sock.receive(&buf); var data = buf[0..size_received]; print("Received raw {s}\n", .{data}); var event = try Event.fromBytes(data); print("is event {}\n", .{event}); try event.process(alloc, events); } } test { // }
src/network.zig
const std = @import("std"); const core = @import("../core.zig"); const debug = std.debug; const math = std.math; const mem = std.mem; const unicode = std.unicode; // TODO: Currently we are using this location abstraction to get line, column from a // Cursor. Think about replacing this with the Cursor being a line, column pair, // and text being a list of lines (imut.List(Content)). // // Pros: - No need to find the location when we move. // // Cons: - Currently, we can mmap a file and call List(u8).fromSlice on it. This takes // 2-3 seconds on a 4.5 Gig file. This is a really fast load speed for such // a large file. pub const Location = struct { line: usize = 0, column: usize = 0, index: usize = 0, pub fn equal(a: Location, b: Location) bool { if (a.index == b.index) { debug.assert(a.column == b.column); debug.assert(a.line == b.line); return true; } return false; } /// Get the location of an index in some text. pub fn fromIndex(index: usize, text: Text.Content) Location { var res = Location{}; return res.moveForwardTo(index, text); } /// Get the location of an index in some text. This function starts /// at 'loc' and goes forward/backward until it hits 'index'. This /// can be faster than 'fromIndex', when 'index' is close to 'loc'. pub fn moveTo(loc: Location, index: usize, text: Text.Content) Location { if (loc.index <= index) { return loc.moveForwardTo(index, text); } else { return loc.moveBackwardTo(index, text); } } /// Get the location of an index in some text. This function starts /// at 'loc' and goes backward until it hits 'index'. This can be /// faster than 'fromIndex', when 'index' is close to 'loc'. /// Requirements: /// - 'index' must be located before 'loc'. pub fn moveBackwardTo(loc: Location, index: usize, text: Text.Content) Location { debug.assert(index <= text.len()); debug.assert(index <= loc.index); const half = loc.index / 2; if (index <= half) return fromIndex(index, text); var res = loc; while (res.index != index) : (res.index -= 1) { const c = text.at(res.index - 1); if (c == '\n') res.line -= 1; } var i: usize = res.index; while (i != 0) : (i -= 1) { const c = text.at(i - 1); if (c == '\n') break; } res.column = calcColumn(i, res.index, text); return res; } /// Get the location of an index in some text. This function starts /// at 'loc' and goes forward until it hits 'index'. This can be /// faster than 'fromIndex', when 'index' is close to 'loc'. /// Requirements: /// - 'index' must be located after 'loc'. pub fn moveForwardTo(location: Location, index: usize, text: Text.Content) Location { debug.assert(index <= text.len()); debug.assert(location.index <= index); const ForeachContext = struct { index: usize, loc: *Location, }; // This foreach impl is about 2 seconds faster than the iterator version // on 4.5 Gig file, when cursor is at the end. Look at assembly to figure // out why. Do more profiling. var res = location; text.foreach(res.index, ForeachContext{ .index = index, .loc = &res }, struct { fn each(context: ForeachContext, i: usize, c: u8) error{Break}!void { const loc = context.loc; if (i == context.index) return error.Break; if (c == '\n') { loc.line += 1; loc.index = i + 1; } } }.each) catch {}; res.column = calcColumn(res.index, index, text) + if (res.line == location.line) res.column else 0; res.index = index; return res; } /// Get the location of 'line'. If 'loc.line == line' then 'loc' will /// be returned. If the end of the text is reached before we reached /// the desired line, then the location returned will be at the end /// of the 'loc.text'. Otherwise the location returned with always be /// at the start of the line it moved to. pub fn moveToLine(loc: Location, line: usize, text: Text.Content) Location { if (loc.line <= line) { return loc.moveForwardToLine(line, text); } else { return loc.moveBackwardToLine(line, text); } } /// Get the location of 'line'. If 'loc.line == line' then 'loc' will /// be returned. If the end of the text is reached before we reached /// the desired line, then the location returned will be at the end /// of the 'loc.text'. Otherwise the location returned with always be /// at the start of the line it moved to. /// Requirements: /// - 'line' must be located after 'loc'. pub fn moveForwardToLine(loc: Location, line: usize, text: Text.Content) Location { debug.assert(loc.line <= line); var res = loc; while (res.line < line and res.index != text.len()) res = res.nextLine(text); return res; } /// Get the location of 'line'. If 'loc.line == line' then 'loc' will /// be returned. Otherwise the location returned with always be at /// the start of the line it moved to. /// Requirements: /// - 'line' must be located before 'loc'. pub fn moveBackwardToLine(loc: Location, line: usize, text: Text.Content) Location { debug.assert(line <= loc.line); var res = loc; if (line != 0) { while (line <= res.line) : (res.index -= 1) { const c = text.at(res.index - 1); if (c == '\n') res.line -= 1; } debug.assert(text.at(res.index) == '\n'); debug.assert(res.line == line - 1); res.line += 1; res.index += 1; } else { res.index = 0; res.line = 0; } const column = res.column; res.column = 0; return res.moveToColumn(column, text); } /// Get the location of the line after 'loc'. If the end of the text /// is reached, then the location returned will be at the end of /// 'loc.text'. pub fn nextLine(location: Location, text: Text.Content) Location { var res = location; text.foreach(res.index, &res, struct { fn each(loc: *Location, i: usize, c: u8) error{Break}!void { if (c == '\n') { loc.line += 1; loc.index = i + 1; return error.Break; } } }.each) catch { const column = res.column; res.column = 0; return res.moveToColumn(column, text); }; return res.moveForwardTo(text.len(), text); } /// Get the index of the line this location is on. pub fn lineStart(loc: Location, text: Text.Content) usize { var res: usize = loc.index; while (res != 0 and text.at(res - 1) != '\n') : (res -= 1) {} return res; } /// Get the length of the line this location is on (lenght in utf8 codepoints). pub fn lineLen(loc: Location, text: Text.Content) usize { const start = loc.lineStart(text); var end: usize = loc.index; var it = text.iterator(loc.index); while (it.next()) |c| : (end += 1) { if (c == '\n') break; } return calcColumn(start, end, text); } fn calcColumn(start: usize, index: usize, text: Text.Content) usize { var it = text.iterator(start); var i: usize = start; var res: usize = 0; while (i < index) : (res += 1) { const char = it.next() orelse break; // TODO: Assumes fully valid UTF8 var len = unicode.utf8ByteSequenceLength(char) catch 1; i += len; while (len - 1 != 0) : (len -= 1) _ = it.next(); } return res; } pub fn moveToColumn(loc: Location, column: usize, text: Text.Content) Location { var res = loc; var it = text.iterator(res.index); while (res.column < column) : (res.column += 1) { const char = it.next() orelse break; if (char == '\n') break; // TODO: Assumes fully valid UTF8 var len = unicode.utf8ByteSequenceLength(char) catch 1; res.index += len; while (len - 1 != 0) : (len -= 1) debug.assert((it.next() orelse '\x00') != '\n'); } res.column = column; return res; } }; pub const Cursor = struct { // The primary location of the cursor. This should be treated // as the cursors location. index: Location = Location{}, // The secondary location of the cursor. Represents where the // selection ends. Can be both before and after 'index' selection: Location = Location{}, pub fn start(cursor: Cursor) Location { return if (cursor.index.index < cursor.selection.index) cursor.index else cursor.selection; } pub fn end(cursor: Cursor) Location { return if (cursor.index.index < cursor.selection.index) cursor.selection else cursor.index; } pub fn equal(a: Cursor, b: Cursor) bool { return Location.equal(a.start(), b.start()) and Location.equal(a.end(), b.end()); } pub const ToMove = enum { Index, Selection, Both, }; pub const Direction = enum { Up, Down, Left, Right, }; pub fn move(cursor: Cursor, text: Text.Content, amount: usize, to_move: ToMove, dir: Direction) Cursor { debug.assert(cursor.index.index <= text.len()); debug.assert(cursor.selection.index <= text.len()); if (amount == 0) return cursor; var res = cursor; var ptr: *Location = undefined; var other_ptr: *Location = undefined; switch (to_move) { .Index => { ptr = &res.index; other_ptr = &res.index; }, .Selection => { ptr = &res.selection; other_ptr = &res.selection; }, .Both => { ptr = &res.index; other_ptr = &res.selection; }, } switch (dir) { .Up => blk: { if (ptr.line < amount) { ptr.* = Location{}; break :blk; } ptr.* = ptr.moveBackwardToLine(ptr.line - amount, text); }, .Down => ptr.* = ptr.moveForwardToLine(ptr.line + amount, text), .Left => ptr.* = ptr.moveBackwardTo(math.sub(usize, ptr.index, amount) catch 0, text), .Right => { const index = math.add(usize, ptr.index, amount) catch math.maxInt(usize); ptr.* = ptr.moveForwardTo(math.min(index, text.len()), text); }, } other_ptr.* = ptr.*; return res; } fn toBefore(index: usize, text: Text.Content, find: u8) ?usize { var i: usize = index; while (i != 0) : (i -= 1) { const c = text.at(i - 1); if (c == '\n') return i - 1; } return null; } fn column(index: usize, text: Text.Content) usize { const before = toBefore(index, text, '\n') orelse return index; return index - (before + 1); } }; pub const Text = struct { allocator: *mem.Allocator, content: Content = Content{}, cursors: Cursors = Cursors.fromSliceSmall(&[_]Cursor{Cursor{}}), main_cursor: MainCursorIs = MainCursorIs.Last, pub const Content = core.NoAllocatorList(u8); pub const Cursors = core.NoAllocatorList(Cursor); const MainCursorIs = enum { First, Last, }; pub const DeleteDir = enum { Left, Right, }; pub fn fromString(allocator: *mem.Allocator, str: []const u8) !Text { return Text{ .allocator = allocator, .content = try Content.fromSlice(allocator, str), }; } pub fn equal(a: Text, b: Text) bool { return a.content.equal(b.content) and a.cursors.equal(b.cursors) and a.main_cursor == b.main_cursor; } pub fn spawnCursor(text: Text, dir: Cursor.Direction) !Text { var res = text; res.main_cursor = switch (dir) { .Left, .Up => MainCursorIs.First, .Right, .Down => MainCursorIs.Last, }; const main = res.mainCursor(); const new = main.move(text.content, 1, .Both, dir); switch (res.main_cursor) { .First => { if (mergeCursors(new, main) == null) res.cursors = try res.cursors.insert(text.allocator, 0, new); }, .Last => { if (mergeCursors(main, new) == null) res.cursors = try res.cursors.append(text.allocator, new); }, } return res; } pub fn mainCursor(text: Text) Cursor { debug.assert(text.cursors.len() != 0); switch (text.main_cursor) { .First => return text.cursors.at(0), .Last => return text.cursors.at(text.cursors.len() - 1), } } pub fn removeAllButMainCursor(text: Text) Text { var res = text; const main = res.mainCursor(); res.cursors = Cursors.fromSliceSmall(&[_]Cursor{main}); return res; } pub fn moveCursors(text: Text, amount: usize, to_move: Cursor.ToMove, dir: Cursor.Direction) !Text { const Args = struct { amount: usize, to_move: Cursor.ToMove, dir: Cursor.Direction, }; return text.foreachCursor(Args{ .amount = amount, .to_move = to_move, .dir = dir }, struct { fn action(args: Args, allocator: *mem.Allocator, cc: CursorContent, i: usize) error{}!CursorContent { var res = cc; res.cursor = res.cursor.move(res.content, args.amount, args.to_move, args.dir); return res; } }.action); } pub fn delete(text: Text, direction: DeleteDir) !Text { return text.foreachCursor(direction, struct { fn action(dir: DeleteDir, allocator: *mem.Allocator, cc: CursorContent, i: usize) !CursorContent { var res = cc; if (Location.equal(res.cursor.index, res.cursor.selection)) { switch (dir) { .Left => { if (res.cursor.index.index != 0) { res.cursor = res.cursor.move(res.content, 1, .Both, .Left); res.content = try res.content.remove(allocator, res.cursor.index.index); } }, .Right => { if (res.cursor.index.index != res.content.len()) res.content = try res.content.remove(allocator, res.cursor.index.index); }, } } else { const s = res.cursor.start(); const e = res.cursor.end(); res.cursor.index = s; res.cursor.selection = s; res.content = try res.content.removeItems(allocator, s.index, e.index - s.index); } return res; } }.action); } pub fn insert(text: Text, string: []const u8) !Text { return text.foreachCursor(string, struct { fn action(str: []const u8, allocator: *mem.Allocator, cc: CursorContent, i: usize) !CursorContent { var res = cc; const s = res.cursor.start(); const e = res.cursor.end(); res.cursor.index = s; res.cursor.selection = s; res.content = try res.content.removeItems(allocator, s.index, e.index - s.index); res.content = try res.content.insertSlice(allocator, s.index, str); res.cursor = res.cursor.move(res.content, str.len, .Both, .Right); return res; } }.action); } pub fn paste(text: Text, string: []const u8) !Text { var it = mem.split(string, "\n"); var lines: usize = 0; while (it.next()) |_| : (lines += 1) {} if (text.cursors.len() != lines) return insert(text, string); it = mem.split(string, "\n"); return text.foreachCursor(&it, struct { fn each(split: *mem.SplitIterator, allocator: *mem.Allocator, cc: CursorContent, i: usize) !CursorContent { var res = cc; const s = res.cursor.start(); const e = res.cursor.end(); res.cursor.index = s; res.cursor.selection = s; const line = split.next().?; res.content = try res.content.removeItems(allocator, s.index, e.index - s.index); res.content = try res.content.insertSlice(allocator, res.cursor.start().index, line); res.cursor = res.cursor.move(res.content, line.len, .Both, .Right); return res; } }.each); } pub fn insertText(text: Text, other: Text) !Text { return text.foreachCursor(other, struct { fn each(t: Text, allocator: *mem.Allocator, cc: CursorContent, i: usize) !CursorContent { var res = cc; const s = res.cursor.start(); const e = res.cursor.end(); res.cursor.index = s; res.cursor.selection = s; res.content = try res.content.removeItems(allocator, s.index, e.index - s.index); var it = t.cursors.iterator(0); while (it.next()) |cursor| { const to_insert = try t.content.slice(allocator, cursor.start().index, cursor.end().index); res.content = try res.content.insertList(allocator, res.cursor.start().index, to_insert); res.cursor = res.cursor.move(res.content, to_insert.len(), .Both, .Right); } return res; } }.each); } /// Paste the selected text from 'other' into the selections /// of 'text'. If an equal number of cursors is present in both /// 'text' and 'other', then each cursor selection in 'other' /// will be pasted into each cursor selection of 'text' in order. /// Otherwise, the behavior will be the same as 'insertText'. pub fn pasteText(text: Text, other: Text) !Text { if (text.cursors.len() != other.cursors.len()) return insertText(text, other); return text.foreachCursor(other, struct { fn each(t: Text, allocator: *mem.Allocator, cc: CursorContent, i: usize) !CursorContent { var res = cc; const s = res.cursor.start(); const e = res.cursor.end(); res.cursor.index = s; res.cursor.selection = s; const selection = t.cursors.at(i); const to_insert = try t.content.slice(allocator, selection.start().index, selection.end().index); res.content = try res.content.removeItems(allocator, s.index, e.index - s.index); res.content = try res.content.insertList(allocator, res.cursor.start().index, to_insert); res.cursor = res.cursor.move(res.content, to_insert.len(), .Both, .Right); return res; } }.each); } pub fn indent(text: Text, char: u8, num: usize) !Text { const Context = struct { char: u8, num: usize, }; return text.foreachCursor(Context{ .char = char, .num = num, }, struct { fn each(context: Context, allocator: *mem.Allocator, cc: CursorContent, _: usize) !CursorContent { var res = cc; const s = res.cursor.start(); const e = res.cursor.end(); res.cursor.index = s; res.cursor.selection = s; res.content = try res.content.removeItems(allocator, s.index, e.index - s.index); const to_insert = context.num - s.column % context.num; var i = to_insert; while (i != 0) : (i -= 1) res.content = try res.content.insert(allocator, res.cursor.start().index, context.char); res.cursor = res.cursor.move(res.content, to_insert, .Both, .Right); return res; } }.each); } const CursorContent = struct { cursor: Cursor, content: Content, }; // action: fn (@typeOf(content), CursorContent, usize) !CursorContent fn foreachCursor(text: Text, context: var, action: var) !Text { debug.assert(text.cursors.len() != 0); var res = text; res.cursors = Cursors{}; var deleted: usize = 0; var added: usize = 0; var it = text.cursors.iterator(0); var i: usize = 0; var prev_loc: Location = text.cursors.at(0).start(); var m_prev: ?Cursor = null; while (it.next()) |cursor| : (i += 1) { const index_index = (cursor.index.index + added) - deleted; const selection_index = (cursor.selection.index + added) - deleted; const old_len = res.content.len(); const pair = try action( context, res.allocator, CursorContent{ .cursor = Cursor{ .index = prev_loc.moveTo(index_index, res.content), .selection = prev_loc.moveTo(selection_index, res.content), }, .content = res.content, }, i, ); res.content = pair.content; if (math.sub(usize, old_len, res.content.len())) |taken| { deleted += taken; } else |_| { added += res.content.len() - old_len; } prev_loc = pair.cursor.end(); if (m_prev) |prev| { if (mergeCursors(prev, pair.cursor)) |merged| { m_prev = merged; } else { try res.cursors.appendMut(text.allocator, prev); m_prev = pair.cursor; } } else { m_prev = pair.cursor; } } if (m_prev) |prev| try res.cursors.appendMut(text.allocator, prev); return res; } fn mergeCursors(left: Cursor, right: Cursor) ?Cursor { debug.assert(left.start().index <= right.start().index); if (left.end().index < right.start().index) return null; return Cursor{ .selection = left.start(), .index = right.end(), }; } };
src/core/text.zig
pub const SOCKET_DEFAULT2_QM_POLICY = Guid.initString("aec2ef9c-3a4d-4d3e-8842-239942e39a47"); pub const REAL_TIME_NOTIFICATION_CAPABILITY = Guid.initString("6b59819a-5cae-492d-a901-2a3c2c50164f"); pub const REAL_TIME_NOTIFICATION_CAPABILITY_EX = Guid.initString("6843da03-154a-4616-a508-44371295f96b"); pub const ASSOCIATE_NAMERES_CONTEXT = Guid.initString("59a38b67-d4fe-46e1-ba3c-87ea74ca3049"); pub const TIMESTAMPING_FLAG_RX = @as(u32, 1); pub const TIMESTAMPING_FLAG_TX = @as(u32, 2); pub const SO_TIMESTAMP = @as(u32, 12298); pub const SO_TIMESTAMP_ID = @as(u32, 12299); pub const TCP_INITIAL_RTO_DEFAULT_RTT = @as(u32, 0); pub const TCP_INITIAL_RTO_DEFAULT_MAX_SYN_RETRANSMISSIONS = @as(u32, 0); pub const SOCKET_SETTINGS_GUARANTEE_ENCRYPTION = @as(u32, 1); pub const SOCKET_SETTINGS_ALLOW_INSECURE = @as(u32, 2); pub const SOCKET_SETTINGS_IPSEC_SKIP_FILTER_INSTANTIATION = @as(u32, 1); pub const SOCKET_SETTINGS_IPSEC_OPTIONAL_PEER_NAME_VERIFICATION = @as(u32, 2); pub const SOCKET_SETTINGS_IPSEC_ALLOW_FIRST_INBOUND_PKT_UNENCRYPTED = @as(u32, 4); pub const SOCKET_SETTINGS_IPSEC_PEER_NAME_IS_RAW_FORMAT = @as(u32, 8); pub const SOCKET_QUERY_IPSEC2_ABORT_CONNECTION_ON_FIELD_CHANGE = @as(u32, 1); pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_MM_SA_ID = @as(u32, 1); pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_QM_SA_ID = @as(u32, 2); pub const SOCKET_INFO_CONNECTION_SECURED = @as(u32, 1); pub const SOCKET_INFO_CONNECTION_ENCRYPTED = @as(u32, 2); pub const SOCKET_INFO_CONNECTION_IMPERSONATED = @as(u32, 4); pub const IN4ADDR_LOOPBACK = @as(u32, 16777343); pub const IN4ADDR_LOOPBACKPREFIX_LENGTH = @as(u32, 8); pub const IN4ADDR_LINKLOCALPREFIX_LENGTH = @as(u32, 16); pub const IN4ADDR_MULTICASTPREFIX_LENGTH = @as(u32, 4); pub const RIO_MSG_DONT_NOTIFY = @as(u32, 1); pub const RIO_MSG_DEFER = @as(u32, 2); pub const RIO_MSG_WAITALL = @as(u32, 4); pub const RIO_MSG_COMMIT_ONLY = @as(u32, 8); pub const RIO_MAX_CQ_SIZE = @as(u32, 134217728); pub const RIO_CORRUPT_CQ = @as(u32, 4294967295); pub const AF_UNIX = @as(u16, 1); pub const AF_IMPLINK = @as(u16, 3); pub const AF_PUP = @as(u16, 4); pub const AF_CHAOS = @as(u16, 5); pub const AF_NS = @as(u16, 6); pub const AF_IPX = @as(u16, 6); pub const AF_ISO = @as(u16, 7); pub const AF_OSI = @as(u16, 7); pub const AF_ECMA = @as(u16, 8); pub const AF_DATAKIT = @as(u16, 9); pub const AF_CCITT = @as(u16, 10); pub const AF_SNA = @as(u16, 11); pub const AF_DECnet = @as(u16, 12); pub const AF_DLI = @as(u16, 13); pub const AF_LAT = @as(u16, 14); pub const AF_HYLINK = @as(u16, 15); pub const AF_APPLETALK = @as(u16, 16); pub const AF_NETBIOS = @as(u16, 17); pub const AF_VOICEVIEW = @as(u16, 18); pub const AF_FIREFOX = @as(u16, 19); pub const AF_UNKNOWN1 = @as(u16, 20); pub const AF_BAN = @as(u16, 21); pub const AF_ATM = @as(u16, 22); pub const AF_CLUSTER = @as(u16, 24); pub const AF_12844 = @as(u16, 25); pub const AF_IRDA = @as(u16, 26); pub const AF_NETDES = @as(u16, 28); pub const AF_MAX = @as(u16, 29); pub const AF_TCNPROCESS = @as(u16, 29); pub const AF_TCNMESSAGE = @as(u16, 30); pub const AF_ICLFXBM = @as(u16, 31); pub const AF_LINK = @as(u16, 33); pub const AF_HYPERV = @as(u16, 34); pub const SOCK_STREAM = @as(u16, 1); pub const SOCK_DGRAM = @as(u16, 2); pub const SOCK_RAW = @as(u16, 3); pub const SOCK_RDM = @as(u16, 4); pub const SOCK_SEQPACKET = @as(u16, 5); pub const SOL_SOCKET = @as(u32, 65535); pub const SO_DEBUG = @as(u32, 1); pub const SO_ACCEPTCONN = @as(u32, 2); pub const SO_REUSEADDR = @as(u32, 4); pub const SO_KEEPALIVE = @as(u32, 8); pub const SO_DONTROUTE = @as(u32, 16); pub const SO_BROADCAST = @as(u32, 32); pub const SO_USELOOPBACK = @as(u32, 64); pub const SO_LINGER = @as(u32, 128); pub const SO_OOBINLINE = @as(u32, 256); pub const SO_SNDBUF = @as(u32, 4097); pub const SO_RCVBUF = @as(u32, 4098); pub const SO_SNDLOWAT = @as(u32, 4099); pub const SO_RCVLOWAT = @as(u32, 4100); pub const SO_SNDTIMEO = @as(u32, 4101); pub const SO_RCVTIMEO = @as(u32, 4102); pub const SO_ERROR = @as(u32, 4103); pub const SO_TYPE = @as(u32, 4104); pub const SO_BSP_STATE = @as(u32, 4105); pub const SO_GROUP_ID = @as(u32, 8193); pub const SO_GROUP_PRIORITY = @as(u32, 8194); pub const SO_MAX_MSG_SIZE = @as(u32, 8195); pub const SO_CONDITIONAL_ACCEPT = @as(u32, 12290); pub const SO_PAUSE_ACCEPT = @as(u32, 12291); pub const SO_COMPARTMENT_ID = @as(u32, 12292); pub const SO_RANDOMIZE_PORT = @as(u32, 12293); pub const SO_PORT_SCALABILITY = @as(u32, 12294); pub const SO_REUSE_UNICASTPORT = @as(u32, 12295); pub const SO_REUSE_MULTICASTPORT = @as(u32, 12296); pub const SO_ORIGINAL_DST = @as(u32, 12303); pub const IP6T_SO_ORIGINAL_DST = @as(u32, 12303); pub const WSK_SO_BASE = @as(u32, 16384); pub const TCP_NODELAY = @as(u32, 1); pub const _SS_MAXSIZE = @as(u32, 128); pub const IOC_UNIX = @as(u32, 0); pub const IOC_WS2 = @as(u32, 134217728); pub const IOC_PROTOCOL = @as(u32, 268435456); pub const IOC_VENDOR = @as(u32, 402653184); pub const IPPROTO_IP = @as(u32, 0); pub const IPPORT_TCPMUX = @as(u32, 1); pub const IPPORT_ECHO = @as(u32, 7); pub const IPPORT_DISCARD = @as(u32, 9); pub const IPPORT_SYSTAT = @as(u32, 11); pub const IPPORT_DAYTIME = @as(u32, 13); pub const IPPORT_NETSTAT = @as(u32, 15); pub const IPPORT_QOTD = @as(u32, 17); pub const IPPORT_MSP = @as(u32, 18); pub const IPPORT_CHARGEN = @as(u32, 19); pub const IPPORT_FTP_DATA = @as(u32, 20); pub const IPPORT_FTP = @as(u32, 21); pub const IPPORT_TELNET = @as(u32, 23); pub const IPPORT_SMTP = @as(u32, 25); pub const IPPORT_TIMESERVER = @as(u32, 37); pub const IPPORT_NAMESERVER = @as(u32, 42); pub const IPPORT_WHOIS = @as(u32, 43); pub const IPPORT_MTP = @as(u32, 57); pub const IPPORT_TFTP = @as(u32, 69); pub const IPPORT_RJE = @as(u32, 77); pub const IPPORT_FINGER = @as(u32, 79); pub const IPPORT_TTYLINK = @as(u32, 87); pub const IPPORT_SUPDUP = @as(u32, 95); pub const IPPORT_POP3 = @as(u32, 110); pub const IPPORT_NTP = @as(u32, 123); pub const IPPORT_EPMAP = @as(u32, 135); pub const IPPORT_NETBIOS_NS = @as(u32, 137); pub const IPPORT_NETBIOS_DGM = @as(u32, 138); pub const IPPORT_NETBIOS_SSN = @as(u32, 139); pub const IPPORT_IMAP = @as(u32, 143); pub const IPPORT_SNMP = @as(u32, 161); pub const IPPORT_SNMP_TRAP = @as(u32, 162); pub const IPPORT_IMAP3 = @as(u32, 220); pub const IPPORT_LDAP = @as(u32, 389); pub const IPPORT_HTTPS = @as(u32, 443); pub const IPPORT_MICROSOFT_DS = @as(u32, 445); pub const IPPORT_EXECSERVER = @as(u32, 512); pub const IPPORT_LOGINSERVER = @as(u32, 513); pub const IPPORT_CMDSERVER = @as(u32, 514); pub const IPPORT_EFSSERVER = @as(u32, 520); pub const IPPORT_BIFFUDP = @as(u32, 512); pub const IPPORT_WHOSERVER = @as(u32, 513); pub const IPPORT_ROUTESERVER = @as(u32, 520); pub const IPPORT_RESERVED = @as(u32, 1024); pub const IPPORT_REGISTERED_MIN = @as(u32, 1024); pub const IPPORT_REGISTERED_MAX = @as(u32, 49151); pub const IPPORT_DYNAMIC_MIN = @as(u32, 49152); pub const IPPORT_DYNAMIC_MAX = @as(u32, 65535); pub const IN_CLASSA_NET = @as(u32, 4278190080); pub const IN_CLASSA_NSHIFT = @as(u32, 24); pub const IN_CLASSA_HOST = @as(u32, 16777215); pub const IN_CLASSA_MAX = @as(u32, 128); pub const IN_CLASSB_NET = @as(u32, 4294901760); pub const IN_CLASSB_NSHIFT = @as(u32, 16); pub const IN_CLASSB_HOST = @as(u32, 65535); pub const IN_CLASSB_MAX = @as(u32, 65536); pub const IN_CLASSC_NET = @as(u32, 4294967040); pub const IN_CLASSC_NSHIFT = @as(u32, 8); pub const IN_CLASSC_HOST = @as(u32, 255); pub const IN_CLASSD_NET = @as(u32, 4026531840); pub const IN_CLASSD_NSHIFT = @as(u32, 28); pub const IN_CLASSD_HOST = @as(u32, 268435455); pub const INADDR_LOOPBACK = @as(u32, 2130706433); pub const INADDR_NONE = @as(u32, 4294967295); pub const IOCPARM_MASK = @as(u32, 127); pub const IOC_VOID = @as(u32, 536870912); pub const IOC_OUT = @as(u32, 1073741824); pub const IOC_IN = @as(u32, 2147483648); pub const MSG_TRUNC = @as(u32, 256); pub const MSG_CTRUNC = @as(u32, 512); pub const MSG_BCAST = @as(u32, 1024); pub const MSG_MCAST = @as(u32, 2048); pub const MSG_ERRQUEUE = @as(u32, 4096); pub const AI_PASSIVE = @as(u32, 1); pub const AI_CANONNAME = @as(u32, 2); pub const AI_NUMERICHOST = @as(u32, 4); pub const AI_NUMERICSERV = @as(u32, 8); pub const AI_DNS_ONLY = @as(u32, 16); pub const AI_FORCE_CLEAR_TEXT = @as(u32, 32); pub const AI_BYPASS_DNS_CACHE = @as(u32, 64); pub const AI_RETURN_TTL = @as(u32, 128); pub const AI_ALL = @as(u32, 256); pub const AI_ADDRCONFIG = @as(u32, 1024); pub const AI_V4MAPPED = @as(u32, 2048); pub const AI_NON_AUTHORITATIVE = @as(u32, 16384); pub const AI_SECURE = @as(u32, 32768); pub const AI_RETURN_PREFERRED_NAMES = @as(u32, 65536); pub const AI_FQDN = @as(u32, 131072); pub const AI_FILESERVER = @as(u32, 262144); pub const AI_DISABLE_IDN_ENCODING = @as(u32, 524288); pub const AI_SECURE_WITH_FALLBACK = @as(u32, 1048576); pub const AI_EXCLUSIVE_CUSTOM_SERVERS = @as(u32, 2097152); pub const AI_RETURN_RESPONSE_FLAGS = @as(u32, 268435456); pub const AI_REQUIRE_SECURE = @as(u32, 536870912); pub const AI_RESOLUTION_HANDLE = @as(u32, 1073741824); pub const AI_EXTENDED = @as(u32, 2147483648); pub const ADDRINFOEX_VERSION_2 = @as(u32, 2); pub const ADDRINFOEX_VERSION_3 = @as(u32, 3); pub const ADDRINFOEX_VERSION_4 = @as(u32, 4); pub const ADDRINFOEX_VERSION_5 = @as(u32, 5); pub const ADDRINFOEX_VERSION_6 = @as(u32, 6); pub const AI_DNS_SERVER_TYPE_UDP = @as(u32, 1); pub const AI_DNS_SERVER_TYPE_DOH = @as(u32, 2); pub const AI_DNS_SERVER_UDP_FALLBACK = @as(u32, 1); pub const AI_DNS_RESPONSE_SECURE = @as(u32, 1); pub const AI_DNS_RESPONSE_HOSTFILE = @as(u32, 2); pub const NS_ALL = @as(u32, 0); pub const NS_SAP = @as(u32, 1); pub const NS_NDS = @as(u32, 2); pub const NS_PEER_BROWSE = @as(u32, 3); pub const NS_SLP = @as(u32, 5); pub const NS_DHCP = @as(u32, 6); pub const NS_TCPIP_LOCAL = @as(u32, 10); pub const NS_TCPIP_HOSTS = @as(u32, 11); pub const NS_DNS = @as(u32, 12); pub const NS_NETBT = @as(u32, 13); pub const NS_WINS = @as(u32, 14); pub const NS_NLA = @as(u32, 15); pub const NS_NBP = @as(u32, 20); pub const NS_MS = @as(u32, 30); pub const NS_STDA = @as(u32, 31); pub const NS_NTDS = @as(u32, 32); pub const NS_EMAIL = @as(u32, 37); pub const NS_X500 = @as(u32, 40); pub const NS_NIS = @as(u32, 41); pub const NS_NISPLUS = @as(u32, 42); pub const NS_WRQ = @as(u32, 50); pub const NS_NETDES = @as(u32, 60); pub const NI_NOFQDN = @as(u32, 1); pub const NI_NUMERICHOST = @as(u32, 2); pub const NI_NAMEREQD = @as(u32, 4); pub const NI_NUMERICSERV = @as(u32, 8); pub const NI_DGRAM = @as(u32, 16); pub const NI_MAXHOST = @as(u32, 1025); pub const NI_MAXSERV = @as(u32, 32); pub const IFF_UP = @as(u32, 1); pub const IFF_BROADCAST = @as(u32, 2); pub const IFF_LOOPBACK = @as(u32, 4); pub const IFF_POINTTOPOINT = @as(u32, 8); pub const IFF_MULTICAST = @as(u32, 16); pub const IP_OPTIONS = @as(u32, 1); pub const IP_HDRINCL = @as(u32, 2); pub const IP_TOS = @as(u32, 3); pub const IP_TTL = @as(u32, 4); pub const IP_MULTICAST_IF = @as(u32, 9); pub const IP_MULTICAST_TTL = @as(u32, 10); pub const IP_MULTICAST_LOOP = @as(u32, 11); pub const IP_ADD_MEMBERSHIP = @as(u32, 12); pub const IP_DROP_MEMBERSHIP = @as(u32, 13); pub const IP_DONTFRAGMENT = @as(u32, 14); pub const IP_ADD_SOURCE_MEMBERSHIP = @as(u32, 15); pub const IP_DROP_SOURCE_MEMBERSHIP = @as(u32, 16); pub const IP_BLOCK_SOURCE = @as(u32, 17); pub const IP_UNBLOCK_SOURCE = @as(u32, 18); pub const IP_PKTINFO = @as(u32, 19); pub const IP_HOPLIMIT = @as(u32, 21); pub const IP_RECVTTL = @as(u32, 21); pub const IP_RECEIVE_BROADCAST = @as(u32, 22); pub const IP_RECVIF = @as(u32, 24); pub const IP_RECVDSTADDR = @as(u32, 25); pub const IP_IFLIST = @as(u32, 28); pub const IP_ADD_IFLIST = @as(u32, 29); pub const IP_DEL_IFLIST = @as(u32, 30); pub const IP_UNICAST_IF = @as(u32, 31); pub const IP_RTHDR = @as(u32, 32); pub const IP_GET_IFLIST = @as(u32, 33); pub const IP_RECVRTHDR = @as(u32, 38); pub const IP_TCLASS = @as(u32, 39); pub const IP_RECVTCLASS = @as(u32, 40); pub const IP_RECVTOS = @as(u32, 40); pub const IP_ORIGINAL_ARRIVAL_IF = @as(u32, 47); pub const IP_ECN = @as(u32, 50); pub const IP_RECVECN = @as(u32, 50); pub const IP_PKTINFO_EX = @as(u32, 51); pub const IP_WFP_REDIRECT_RECORDS = @as(u32, 60); pub const IP_WFP_REDIRECT_CONTEXT = @as(u32, 70); pub const IP_MTU_DISCOVER = @as(u32, 71); pub const IP_MTU = @as(u32, 73); pub const IP_NRT_INTERFACE = @as(u32, 74); pub const IP_RECVERR = @as(u32, 75); pub const IP_USER_MTU = @as(u32, 76); pub const IP_UNSPECIFIED_TYPE_OF_SERVICE = @as(i32, -1); pub const IP_UNSPECIFIED_USER_MTU = @as(u32, 4294967295); pub const IN6ADDR_LINKLOCALPREFIX_LENGTH = @as(u32, 64); pub const IN6ADDR_MULTICASTPREFIX_LENGTH = @as(u32, 8); pub const IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_LENGTH = @as(u32, 104); pub const IN6ADDR_V4MAPPEDPREFIX_LENGTH = @as(u32, 96); pub const IN6ADDR_6TO4PREFIX_LENGTH = @as(u32, 16); pub const IN6ADDR_TEREDOPREFIX_LENGTH = @as(u32, 32); pub const MCAST_JOIN_GROUP = @as(u32, 41); pub const MCAST_LEAVE_GROUP = @as(u32, 42); pub const MCAST_BLOCK_SOURCE = @as(u32, 43); pub const MCAST_UNBLOCK_SOURCE = @as(u32, 44); pub const MCAST_JOIN_SOURCE_GROUP = @as(u32, 45); pub const MCAST_LEAVE_SOURCE_GROUP = @as(u32, 46); pub const IPV6_HOPOPTS = @as(u32, 1); pub const IPV6_HDRINCL = @as(u32, 2); pub const IPV6_UNICAST_HOPS = @as(u32, 4); pub const IPV6_MULTICAST_IF = @as(u32, 9); pub const IPV6_MULTICAST_HOPS = @as(u32, 10); pub const IPV6_MULTICAST_LOOP = @as(u32, 11); pub const IPV6_ADD_MEMBERSHIP = @as(u32, 12); pub const IPV6_JOIN_GROUP = @as(u32, 12); pub const IPV6_DROP_MEMBERSHIP = @as(u32, 13); pub const IPV6_LEAVE_GROUP = @as(u32, 13); pub const IPV6_DONTFRAG = @as(u32, 14); pub const IPV6_PKTINFO = @as(u32, 19); pub const IPV6_HOPLIMIT = @as(u32, 21); pub const IPV6_PROTECTION_LEVEL = @as(u32, 23); pub const IPV6_RECVIF = @as(u32, 24); pub const IPV6_RECVDSTADDR = @as(u32, 25); pub const IPV6_CHECKSUM = @as(u32, 26); pub const IPV6_V6ONLY = @as(u32, 27); pub const IPV6_IFLIST = @as(u32, 28); pub const IPV6_ADD_IFLIST = @as(u32, 29); pub const IPV6_DEL_IFLIST = @as(u32, 30); pub const IPV6_UNICAST_IF = @as(u32, 31); pub const IPV6_RTHDR = @as(u32, 32); pub const IPV6_GET_IFLIST = @as(u32, 33); pub const IPV6_RECVRTHDR = @as(u32, 38); pub const IPV6_TCLASS = @as(u32, 39); pub const IPV6_RECVTCLASS = @as(u32, 40); pub const IPV6_ECN = @as(u32, 50); pub const IPV6_RECVECN = @as(u32, 50); pub const IPV6_PKTINFO_EX = @as(u32, 51); pub const IPV6_WFP_REDIRECT_RECORDS = @as(u32, 60); pub const IPV6_WFP_REDIRECT_CONTEXT = @as(u32, 70); pub const IPV6_MTU_DISCOVER = @as(u32, 71); pub const IPV6_MTU = @as(u32, 72); pub const IPV6_NRT_INTERFACE = @as(u32, 74); pub const IPV6_RECVERR = @as(u32, 75); pub const IPV6_USER_MTU = @as(u32, 76); pub const IP_UNSPECIFIED_HOP_LIMIT = @as(i32, -1); pub const IP_PROTECTION_LEVEL = @as(u32, 23); pub const PROTECTION_LEVEL_UNRESTRICTED = @as(u32, 10); pub const PROTECTION_LEVEL_EDGERESTRICTED = @as(u32, 20); pub const PROTECTION_LEVEL_RESTRICTED = @as(u32, 30); pub const PROTECTION_LEVEL_DEFAULT = @as(u32, 20); pub const INET_ADDRSTRLEN = @as(u32, 22); pub const INET6_ADDRSTRLEN = @as(u32, 65); pub const TCP_OFFLOAD_NO_PREFERENCE = @as(u32, 0); pub const TCP_OFFLOAD_NOT_PREFERRED = @as(u32, 1); pub const TCP_OFFLOAD_PREFERRED = @as(u32, 2); pub const TCP_EXPEDITED_1122 = @as(u32, 2); pub const TCP_KEEPALIVE = @as(u32, 3); pub const TCP_MAXSEG = @as(u32, 4); pub const TCP_MAXRT = @as(u32, 5); pub const TCP_STDURG = @as(u32, 6); pub const TCP_NOURG = @as(u32, 7); pub const TCP_ATMARK = @as(u32, 8); pub const TCP_NOSYNRETRIES = @as(u32, 9); pub const TCP_TIMESTAMPS = @as(u32, 10); pub const TCP_OFFLOAD_PREFERENCE = @as(u32, 11); pub const TCP_CONGESTION_ALGORITHM = @as(u32, 12); pub const TCP_DELAY_FIN_ACK = @as(u32, 13); pub const TCP_MAXRTMS = @as(u32, 14); pub const TCP_FASTOPEN = @as(u32, 15); pub const TCP_KEEPCNT = @as(u32, 16); pub const TCP_KEEPIDLE = @as(u32, 3); pub const TCP_KEEPINTVL = @as(u32, 17); pub const TCP_FAIL_CONNECT_ON_ICMP_ERROR = @as(u32, 18); pub const TCP_ICMP_ERROR_INFO = @as(u32, 19); pub const UDP_SEND_MSG_SIZE = @as(u32, 2); pub const UDP_RECV_MAX_COALESCED_SIZE = @as(u32, 3); pub const UDP_COALESCED_INFO = @as(u32, 3); pub const WINDOWS_AF_IRDA = @as(u32, 26); pub const WINDOWS_PF_IRDA = @as(u32, 26); pub const WCE_AF_IRDA = @as(u32, 22); pub const WCE_PF_IRDA = @as(u32, 22); pub const IRDA_PROTO_SOCK_STREAM = @as(u32, 1); pub const PF_IRDA = @as(u16, 26); pub const SOL_IRLMP = @as(u32, 255); pub const IRLMP_ENUMDEVICES = @as(u32, 16); pub const IRLMP_IAS_SET = @as(u32, 17); pub const IRLMP_IAS_QUERY = @as(u32, 18); pub const IRLMP_SEND_PDU_LEN = @as(u32, 19); pub const IRLMP_EXCLUSIVE_MODE = @as(u32, 20); pub const IRLMP_IRLPT_MODE = @as(u32, 21); pub const IRLMP_9WIRE_MODE = @as(u32, 22); pub const IRLMP_TINYTP_MODE = @as(u32, 23); pub const IRLMP_PARAMETERS = @as(u32, 24); pub const IRLMP_DISCOVERY_MODE = @as(u32, 25); pub const IRLMP_SHARP_MODE = @as(u32, 32); pub const IAS_ATTRIB_NO_CLASS = @as(u32, 16); pub const IAS_ATTRIB_NO_ATTRIB = @as(u32, 0); pub const IAS_ATTRIB_INT = @as(u32, 1); pub const IAS_ATTRIB_OCTETSEQ = @as(u32, 2); pub const IAS_ATTRIB_STR = @as(u32, 3); pub const IAS_MAX_USER_STRING = @as(u32, 256); pub const IAS_MAX_OCTET_STRING = @as(u32, 1024); pub const IAS_MAX_CLASSNAME = @as(u32, 64); pub const IAS_MAX_ATTRIBNAME = @as(u32, 256); pub const LmCharSetASCII = @as(u32, 0); pub const LmCharSetISO_8859_1 = @as(u32, 1); pub const LmCharSetISO_8859_2 = @as(u32, 2); pub const LmCharSetISO_8859_3 = @as(u32, 3); pub const LmCharSetISO_8859_4 = @as(u32, 4); pub const LmCharSetISO_8859_5 = @as(u32, 5); pub const LmCharSetISO_8859_6 = @as(u32, 6); pub const LmCharSetISO_8859_7 = @as(u32, 7); pub const LmCharSetISO_8859_8 = @as(u32, 8); pub const LmCharSetISO_8859_9 = @as(u32, 9); pub const LmCharSetUNICODE = @as(u32, 255); pub const LM_BAUD_1200 = @as(u32, 1200); pub const LM_BAUD_2400 = @as(u32, 2400); pub const LM_BAUD_9600 = @as(u32, 9600); pub const LM_BAUD_19200 = @as(u32, 19200); pub const LM_BAUD_38400 = @as(u32, 38400); pub const LM_BAUD_57600 = @as(u32, 57600); pub const LM_BAUD_115200 = @as(u32, 115200); pub const LM_BAUD_576K = @as(u32, 576000); pub const LM_BAUD_1152K = @as(u32, 1152000); pub const LM_BAUD_4M = @as(u32, 4000000); pub const LM_BAUD_16M = @as(u32, 16000000); pub const SO_CONNDATA = @as(u32, 28672); pub const SO_CONNOPT = @as(u32, 28673); pub const SO_DISCDATA = @as(u32, 28674); pub const SO_DISCOPT = @as(u32, 28675); pub const SO_CONNDATALEN = @as(u32, 28676); pub const SO_CONNOPTLEN = @as(u32, 28677); pub const SO_DISCDATALEN = @as(u32, 28678); pub const SO_DISCOPTLEN = @as(u32, 28679); pub const SO_OPENTYPE = @as(u32, 28680); pub const SO_SYNCHRONOUS_ALERT = @as(u32, 16); pub const SO_SYNCHRONOUS_NONALERT = @as(u32, 32); pub const SO_MAXDG = @as(u32, 28681); pub const SO_MAXPATHDG = @as(u32, 28682); pub const SO_UPDATE_ACCEPT_CONTEXT = @as(u32, 28683); pub const SO_CONNECT_TIME = @as(u32, 28684); pub const SO_UPDATE_CONNECT_CONTEXT = @as(u32, 28688); pub const TCP_BSDURGENT = @as(u32, 28672); pub const TF_DISCONNECT = @as(u32, 1); pub const TF_REUSE_SOCKET = @as(u32, 2); pub const TF_WRITE_BEHIND = @as(u32, 4); pub const TF_USE_DEFAULT_WORKER = @as(u32, 0); pub const TF_USE_SYSTEM_THREAD = @as(u32, 16); pub const TF_USE_KERNEL_APC = @as(u32, 32); pub const TP_ELEMENT_MEMORY = @as(u32, 1); pub const TP_ELEMENT_FILE = @as(u32, 2); pub const TP_ELEMENT_EOP = @as(u32, 4); pub const TP_DISCONNECT = @as(u32, 1); pub const TP_REUSE_SOCKET = @as(u32, 2); pub const TP_USE_DEFAULT_WORKER = @as(u32, 0); pub const TP_USE_SYSTEM_THREAD = @as(u32, 16); pub const TP_USE_KERNEL_APC = @as(u32, 32); pub const DE_REUSE_SOCKET = @as(u32, 2); pub const NLA_ALLUSERS_NETWORK = @as(u32, 1); pub const NLA_FRIENDLY_NAME = @as(u32, 2); pub const SERVICE_RESOURCE = @as(u32, 1); pub const SERVICE_SERVICE = @as(u32, 2); pub const SERVICE_LOCAL = @as(u32, 4); pub const SERVICE_FLAG_DEFER = @as(u32, 1); pub const SERVICE_FLAG_HARD = @as(u32, 2); pub const PROP_COMMENT = @as(u32, 1); pub const PROP_LOCALE = @as(u32, 2); pub const PROP_DISPLAY_HINT = @as(u32, 4); pub const PROP_VERSION = @as(u32, 8); pub const PROP_START_TIME = @as(u32, 16); pub const PROP_MACHINE = @as(u32, 32); pub const PROP_ADDRESSES = @as(u32, 256); pub const PROP_SD = @as(u32, 512); pub const PROP_ALL = @as(u32, 2147483648); pub const SERVICE_ADDRESS_FLAG_RPC_CN = @as(u32, 1); pub const SERVICE_ADDRESS_FLAG_RPC_DG = @as(u32, 2); pub const SERVICE_ADDRESS_FLAG_RPC_NB = @as(u32, 4); pub const NS_DEFAULT = @as(u32, 0); pub const NS_VNS = @as(u32, 50); pub const NSTYPE_HIERARCHICAL = @as(u32, 1); pub const NSTYPE_DYNAMIC = @as(u32, 2); pub const NSTYPE_ENUMERABLE = @as(u32, 4); pub const NSTYPE_WORKGROUP = @as(u32, 8); pub const XP_CONNECTIONLESS = @as(u32, 1); pub const XP_GUARANTEED_DELIVERY = @as(u32, 2); pub const XP_GUARANTEED_ORDER = @as(u32, 4); pub const XP_MESSAGE_ORIENTED = @as(u32, 8); pub const XP_PSEUDO_STREAM = @as(u32, 16); pub const XP_GRACEFUL_CLOSE = @as(u32, 32); pub const XP_EXPEDITED_DATA = @as(u32, 64); pub const XP_CONNECT_DATA = @as(u32, 128); pub const XP_DISCONNECT_DATA = @as(u32, 256); pub const XP_SUPPORTS_BROADCAST = @as(u32, 512); pub const XP_SUPPORTS_MULTICAST = @as(u32, 1024); pub const XP_BANDWIDTH_ALLOCATION = @as(u32, 2048); pub const XP_FRAGMENTATION = @as(u32, 4096); pub const XP_ENCRYPTS = @as(u32, 8192); pub const RES_SOFT_SEARCH = @as(u32, 1); pub const RES_FIND_MULTIPLE = @as(u32, 2); pub const RES_SERVICE = @as(u32, 4); pub const SET_SERVICE_PARTIAL_SUCCESS = @as(u32, 1); pub const FD_SETSIZE = @as(u32, 64); pub const IMPLINK_IP = @as(u32, 155); pub const IMPLINK_LOWEXPER = @as(u32, 156); pub const IMPLINK_HIGHEXPER = @as(u32, 158); pub const WSADESCRIPTION_LEN = @as(u32, 256); pub const WSASYS_STATUS_LEN = @as(u32, 128); pub const IP_DEFAULT_MULTICAST_TTL = @as(u32, 1); pub const IP_DEFAULT_MULTICAST_LOOP = @as(u32, 1); pub const IP_MAX_MEMBERSHIPS = @as(u32, 20); pub const SOCKET_ERROR = @as(i32, -1); pub const PF_UNIX = @as(u16, 1); pub const PF_IMPLINK = @as(u16, 3); pub const PF_PUP = @as(u16, 4); pub const PF_CHAOS = @as(u16, 5); pub const PF_NS = @as(u16, 6); pub const PF_IPX = @as(u16, 6); pub const PF_ISO = @as(u16, 7); pub const PF_OSI = @as(u16, 7); pub const PF_ECMA = @as(u16, 8); pub const PF_DATAKIT = @as(u16, 9); pub const PF_CCITT = @as(u16, 10); pub const PF_SNA = @as(u16, 11); pub const PF_DECnet = @as(u16, 12); pub const PF_DLI = @as(u16, 13); pub const PF_LAT = @as(u16, 14); pub const PF_HYLINK = @as(u16, 15); pub const PF_APPLETALK = @as(u16, 16); pub const PF_VOICEVIEW = @as(u16, 18); pub const PF_FIREFOX = @as(u16, 19); pub const PF_UNKNOWN1 = @as(u16, 20); pub const PF_BAN = @as(u16, 21); pub const PF_MAX = @as(u16, 29); pub const SOMAXCONN = @as(u32, 5); pub const MSG_PEEK = @as(u32, 2); pub const MSG_MAXIOVLEN = @as(u32, 16); pub const MSG_PARTIAL = @as(u32, 32768); pub const MAXGETHOSTSTRUCT = @as(u32, 1024); pub const FD_READ = @as(u32, 1); pub const FD_WRITE = @as(u32, 2); pub const FD_OOB = @as(u32, 4); pub const FD_ACCEPT = @as(u32, 8); pub const FD_CONNECT = @as(u32, 16); pub const FD_CLOSE = @as(u32, 32); pub const INCL_WINSOCK_API_PROTOTYPES = @as(u32, 1); pub const INCL_WINSOCK_API_TYPEDEFS = @as(u32, 0); pub const FROM_PROTOCOL_INFO = @as(i32, -1); pub const SO_PROTOCOL_INFOA = @as(u32, 8196); pub const SO_PROTOCOL_INFOW = @as(u32, 8197); pub const SO_PROTOCOL_INFO = @as(u32, 8197); pub const PVD_CONFIG = @as(u32, 12289); pub const PF_ATM = @as(u16, 22); pub const MSG_WAITALL = @as(u32, 8); pub const MSG_PUSH_IMMEDIATE = @as(u32, 32); pub const MSG_INTERRUPT = @as(u32, 16); pub const FD_READ_BIT = @as(u32, 0); pub const FD_WRITE_BIT = @as(u32, 1); pub const FD_OOB_BIT = @as(u32, 2); pub const FD_ACCEPT_BIT = @as(u32, 3); pub const FD_CONNECT_BIT = @as(u32, 4); pub const FD_CLOSE_BIT = @as(u32, 5); pub const FD_QOS_BIT = @as(u32, 6); pub const FD_GROUP_QOS_BIT = @as(u32, 7); pub const FD_ROUTING_INTERFACE_CHANGE_BIT = @as(u32, 8); pub const FD_ADDRESS_LIST_CHANGE_BIT = @as(u32, 9); pub const FD_MAX_EVENTS = @as(u32, 10); pub const WSA_MAXIMUM_WAIT_EVENTS = @as(u32, 64); pub const WSA_WAIT_EVENT_0 = @as(u32, 0); pub const WSA_WAIT_IO_COMPLETION = @as(u32, 192); pub const WSA_WAIT_FAILED = @as(u32, 4294967295); pub const CF_ACCEPT = @as(u32, 0); pub const CF_REJECT = @as(u32, 1); pub const CF_DEFER = @as(u32, 2); pub const SD_RECEIVE = @as(u32, 0); pub const SD_SEND = @as(u32, 1); pub const SD_BOTH = @as(u32, 2); pub const SG_UNCONSTRAINED_GROUP = @as(u32, 1); pub const SG_CONSTRAINED_GROUP = @as(u32, 2); pub const MAX_PROTOCOL_CHAIN = @as(u32, 7); pub const BASE_PROTOCOL = @as(u32, 1); pub const LAYERED_PROTOCOL = @as(u32, 0); pub const WSAPROTOCOL_LEN = @as(u32, 255); pub const PFL_MULTIPLE_PROTO_ENTRIES = @as(u32, 1); pub const PFL_RECOMMENDED_PROTO_ENTRY = @as(u32, 2); pub const PFL_HIDDEN = @as(u32, 4); pub const PFL_MATCHES_PROTOCOL_ZERO = @as(u32, 8); pub const PFL_NETWORKDIRECT_PROVIDER = @as(u32, 16); pub const XP1_CONNECTIONLESS = @as(u32, 1); pub const XP1_GUARANTEED_DELIVERY = @as(u32, 2); pub const XP1_GUARANTEED_ORDER = @as(u32, 4); pub const XP1_MESSAGE_ORIENTED = @as(u32, 8); pub const XP1_PSEUDO_STREAM = @as(u32, 16); pub const XP1_GRACEFUL_CLOSE = @as(u32, 32); pub const XP1_EXPEDITED_DATA = @as(u32, 64); pub const XP1_CONNECT_DATA = @as(u32, 128); pub const XP1_DISCONNECT_DATA = @as(u32, 256); pub const XP1_SUPPORT_BROADCAST = @as(u32, 512); pub const XP1_SUPPORT_MULTIPOINT = @as(u32, 1024); pub const XP1_MULTIPOINT_CONTROL_PLANE = @as(u32, 2048); pub const XP1_MULTIPOINT_DATA_PLANE = @as(u32, 4096); pub const XP1_QOS_SUPPORTED = @as(u32, 8192); pub const XP1_INTERRUPT = @as(u32, 16384); pub const XP1_UNI_SEND = @as(u32, 32768); pub const XP1_UNI_RECV = @as(u32, 65536); pub const XP1_IFS_HANDLES = @as(u32, 131072); pub const XP1_PARTIAL_MESSAGE = @as(u32, 262144); pub const XP1_SAN_SUPPORT_SDP = @as(u32, 524288); pub const BIGENDIAN = @as(u32, 0); pub const LITTLEENDIAN = @as(u32, 1); pub const SECURITY_PROTOCOL_NONE = @as(u32, 0); pub const JL_SENDER_ONLY = @as(u32, 1); pub const JL_RECEIVER_ONLY = @as(u32, 2); pub const JL_BOTH = @as(u32, 4); pub const WSA_FLAG_OVERLAPPED = @as(u32, 1); pub const WSA_FLAG_MULTIPOINT_C_ROOT = @as(u32, 2); pub const WSA_FLAG_MULTIPOINT_C_LEAF = @as(u32, 4); pub const WSA_FLAG_MULTIPOINT_D_ROOT = @as(u32, 8); pub const WSA_FLAG_MULTIPOINT_D_LEAF = @as(u32, 16); pub const WSA_FLAG_ACCESS_SYSTEM_SECURITY = @as(u32, 64); pub const WSA_FLAG_NO_HANDLE_INHERIT = @as(u32, 128); pub const WSA_FLAG_REGISTERED_IO = @as(u32, 256); pub const TH_NETDEV = @as(u32, 1); pub const TH_TAPI = @as(u32, 2); pub const SERVICE_MULTIPLE = @as(u32, 1); pub const NS_LOCALNAME = @as(u32, 19); pub const RES_UNUSED_1 = @as(u32, 1); pub const RES_FLUSH_CACHE = @as(u32, 2); pub const LUP_DEEP = @as(u32, 1); pub const LUP_CONTAINERS = @as(u32, 2); pub const LUP_NOCONTAINERS = @as(u32, 4); pub const LUP_NEAREST = @as(u32, 8); pub const LUP_RETURN_NAME = @as(u32, 16); pub const LUP_RETURN_TYPE = @as(u32, 32); pub const LUP_RETURN_VERSION = @as(u32, 64); pub const LUP_RETURN_COMMENT = @as(u32, 128); pub const LUP_RETURN_ADDR = @as(u32, 256); pub const LUP_RETURN_BLOB = @as(u32, 512); pub const LUP_RETURN_ALIASES = @as(u32, 1024); pub const LUP_RETURN_QUERY_STRING = @as(u32, 2048); pub const LUP_RETURN_ALL = @as(u32, 4080); pub const LUP_RES_SERVICE = @as(u32, 32768); pub const LUP_FLUSHCACHE = @as(u32, 4096); pub const LUP_FLUSHPREVIOUS = @as(u32, 8192); pub const LUP_NON_AUTHORITATIVE = @as(u32, 16384); pub const LUP_SECURE = @as(u32, 32768); pub const LUP_RETURN_PREFERRED_NAMES = @as(u32, 65536); pub const LUP_DNS_ONLY = @as(u32, 131072); pub const LUP_RETURN_RESPONSE_FLAGS = @as(u32, 262144); pub const LUP_ADDRCONFIG = @as(u32, 1048576); pub const LUP_DUAL_ADDR = @as(u32, 2097152); pub const LUP_FILESERVER = @as(u32, 4194304); pub const LUP_DISABLE_IDN_ENCODING = @as(u32, 8388608); pub const LUP_API_ANSI = @as(u32, 16777216); pub const LUP_EXTENDED_QUERYSET = @as(u32, 33554432); pub const LUP_SECURE_WITH_FALLBACK = @as(u32, 67108864); pub const LUP_EXCLUSIVE_CUSTOM_SERVERS = @as(u32, 134217728); pub const LUP_REQUIRE_SECURE = @as(u32, 268435456); pub const LUP_RETURN_TTL = @as(u32, 536870912); pub const LUP_FORCE_CLEAR_TEXT = @as(u32, 1073741824); pub const LUP_RESOLUTION_HANDLE = @as(u32, 2147483648); pub const RESULT_IS_ALIAS = @as(u32, 1); pub const RESULT_IS_ADDED = @as(u32, 16); pub const RESULT_IS_CHANGED = @as(u32, 32); pub const RESULT_IS_DELETED = @as(u32, 64); pub const POLLRDNORM = @as(u32, 256); pub const POLLRDBAND = @as(u32, 512); pub const POLLPRI = @as(u32, 1024); pub const POLLWRNORM = @as(u32, 16); pub const POLLOUT = @as(u32, 16); pub const POLLWRBAND = @as(u32, 32); pub const POLLERR = @as(u32, 1); pub const POLLHUP = @as(u32, 2); pub const POLLNVAL = @as(u32, 4); pub const SOCK_NOTIFY_REGISTER_EVENT_NONE = @as(u32, 0); pub const SOCK_NOTIFY_REGISTER_EVENT_IN = @as(u32, 1); pub const SOCK_NOTIFY_REGISTER_EVENT_OUT = @as(u32, 2); pub const SOCK_NOTIFY_REGISTER_EVENT_HANGUP = @as(u32, 4); pub const SOCK_NOTIFY_EVENT_IN = @as(u32, 1); pub const SOCK_NOTIFY_EVENT_OUT = @as(u32, 2); pub const SOCK_NOTIFY_EVENT_HANGUP = @as(u32, 4); pub const SOCK_NOTIFY_EVENT_ERR = @as(u32, 64); pub const SOCK_NOTIFY_EVENT_REMOVE = @as(u32, 128); pub const SOCK_NOTIFY_OP_NONE = @as(u32, 0); pub const SOCK_NOTIFY_OP_ENABLE = @as(u32, 1); pub const SOCK_NOTIFY_OP_DISABLE = @as(u32, 2); pub const SOCK_NOTIFY_OP_REMOVE = @as(u32, 4); pub const SOCK_NOTIFY_TRIGGER_ONESHOT = @as(u32, 1); pub const SOCK_NOTIFY_TRIGGER_PERSISTENT = @as(u32, 2); pub const SOCK_NOTIFY_TRIGGER_LEVEL = @as(u32, 4); pub const SOCK_NOTIFY_TRIGGER_EDGE = @as(u32, 8); pub const ATMPROTO_AALUSER = @as(u32, 0); pub const ATMPROTO_AAL1 = @as(u32, 1); pub const ATMPROTO_AAL2 = @as(u32, 2); pub const ATMPROTO_AAL34 = @as(u32, 3); pub const ATMPROTO_AAL5 = @as(u32, 5); pub const SAP_FIELD_ABSENT = @as(u32, 4294967294); pub const SAP_FIELD_ANY = @as(u32, 4294967295); pub const SAP_FIELD_ANY_AESA_SEL = @as(u32, 4294967290); pub const SAP_FIELD_ANY_AESA_REST = @as(u32, 4294967291); pub const ATM_E164 = @as(u32, 1); pub const ATM_NSAP = @as(u32, 2); pub const ATM_AESA = @as(u32, 2); pub const ATM_ADDR_SIZE = @as(u32, 20); pub const BLLI_L2_ISO_1745 = @as(u32, 1); pub const BLLI_L2_Q921 = @as(u32, 2); pub const BLLI_L2_X25L = @as(u32, 6); pub const BLLI_L2_X25M = @as(u32, 7); pub const BLLI_L2_ELAPB = @as(u32, 8); pub const BLLI_L2_HDLC_ARM = @as(u32, 9); pub const BLLI_L2_HDLC_NRM = @as(u32, 10); pub const BLLI_L2_HDLC_ABM = @as(u32, 11); pub const BLLI_L2_LLC = @as(u32, 12); pub const BLLI_L2_X75 = @as(u32, 13); pub const BLLI_L2_Q922 = @as(u32, 14); pub const BLLI_L2_USER_SPECIFIED = @as(u32, 16); pub const BLLI_L2_ISO_7776 = @as(u32, 17); pub const BLLI_L3_X25 = @as(u32, 6); pub const BLLI_L3_ISO_8208 = @as(u32, 7); pub const BLLI_L3_X223 = @as(u32, 8); pub const BLLI_L3_SIO_8473 = @as(u32, 9); pub const BLLI_L3_T70 = @as(u32, 10); pub const BLLI_L3_ISO_TR9577 = @as(u32, 11); pub const BLLI_L3_USER_SPECIFIED = @as(u32, 16); pub const BLLI_L3_IPI_SNAP = @as(u32, 128); pub const BLLI_L3_IPI_IP = @as(u32, 204); pub const BHLI_ISO = @as(u32, 0); pub const BHLI_UserSpecific = @as(u32, 1); pub const BHLI_HighLayerProfile = @as(u32, 2); pub const BHLI_VendorSpecificAppId = @as(u32, 3); pub const AAL5_MODE_MESSAGE = @as(u32, 1); pub const AAL5_MODE_STREAMING = @as(u32, 2); pub const AAL5_SSCS_NULL = @as(u32, 0); pub const AAL5_SSCS_SSCOP_ASSURED = @as(u32, 1); pub const AAL5_SSCS_SSCOP_NON_ASSURED = @as(u32, 2); pub const AAL5_SSCS_FRAME_RELAY = @as(u32, 4); pub const BCOB_A = @as(u32, 1); pub const BCOB_C = @as(u32, 3); pub const BCOB_X = @as(u32, 16); pub const TT_NOIND = @as(u32, 0); pub const TT_CBR = @as(u32, 4); pub const TT_VBR = @as(u32, 8); pub const TR_NOIND = @as(u32, 0); pub const TR_END_TO_END = @as(u32, 1); pub const TR_NO_END_TO_END = @as(u32, 2); pub const CLIP_NOT = @as(u32, 0); pub const CLIP_SUS = @as(u32, 32); pub const UP_P2P = @as(u32, 0); pub const UP_P2MP = @as(u32, 1); pub const BLLI_L2_MODE_NORMAL = @as(u32, 64); pub const BLLI_L2_MODE_EXT = @as(u32, 128); pub const BLLI_L3_MODE_NORMAL = @as(u32, 64); pub const BLLI_L3_MODE_EXT = @as(u32, 128); pub const BLLI_L3_PACKET_16 = @as(u32, 4); pub const BLLI_L3_PACKET_32 = @as(u32, 5); pub const BLLI_L3_PACKET_64 = @as(u32, 6); pub const BLLI_L3_PACKET_128 = @as(u32, 7); pub const BLLI_L3_PACKET_256 = @as(u32, 8); pub const BLLI_L3_PACKET_512 = @as(u32, 9); pub const BLLI_L3_PACKET_1024 = @as(u32, 10); pub const BLLI_L3_PACKET_2048 = @as(u32, 11); pub const BLLI_L3_PACKET_4096 = @as(u32, 12); pub const PI_ALLOWED = @as(u32, 0); pub const PI_RESTRICTED = @as(u32, 64); pub const PI_NUMBER_NOT_AVAILABLE = @as(u32, 128); pub const SI_USER_NOT_SCREENED = @as(u32, 0); pub const SI_USER_PASSED = @as(u32, 1); pub const SI_USER_FAILED = @as(u32, 2); pub const SI_NETWORK = @as(u32, 3); pub const CAUSE_LOC_USER = @as(u32, 0); pub const CAUSE_LOC_PRIVATE_LOCAL = @as(u32, 1); pub const CAUSE_LOC_PUBLIC_LOCAL = @as(u32, 2); pub const CAUSE_LOC_TRANSIT_NETWORK = @as(u32, 3); pub const CAUSE_LOC_PUBLIC_REMOTE = @as(u32, 4); pub const CAUSE_LOC_PRIVATE_REMOTE = @as(u32, 5); pub const CAUSE_LOC_INTERNATIONAL_NETWORK = @as(u32, 7); pub const CAUSE_LOC_BEYOND_INTERWORKING = @as(u32, 10); pub const CAUSE_UNALLOCATED_NUMBER = @as(u32, 1); pub const CAUSE_NO_ROUTE_TO_TRANSIT_NETWORK = @as(u32, 2); pub const CAUSE_NO_ROUTE_TO_DESTINATION = @as(u32, 3); pub const CAUSE_VPI_VCI_UNACCEPTABLE = @as(u32, 10); pub const CAUSE_NORMAL_CALL_CLEARING = @as(u32, 16); pub const CAUSE_USER_BUSY = @as(u32, 17); pub const CAUSE_NO_USER_RESPONDING = @as(u32, 18); pub const CAUSE_CALL_REJECTED = @as(u32, 21); pub const CAUSE_NUMBER_CHANGED = @as(u32, 22); pub const CAUSE_USER_REJECTS_CLIR = @as(u32, 23); pub const CAUSE_DESTINATION_OUT_OF_ORDER = @as(u32, 27); pub const CAUSE_INVALID_NUMBER_FORMAT = @as(u32, 28); pub const CAUSE_STATUS_ENQUIRY_RESPONSE = @as(u32, 30); pub const CAUSE_NORMAL_UNSPECIFIED = @as(u32, 31); pub const CAUSE_VPI_VCI_UNAVAILABLE = @as(u32, 35); pub const CAUSE_NETWORK_OUT_OF_ORDER = @as(u32, 38); pub const CAUSE_TEMPORARY_FAILURE = @as(u32, 41); pub const CAUSE_ACCESS_INFORMAION_DISCARDED = @as(u32, 43); pub const CAUSE_NO_VPI_VCI_AVAILABLE = @as(u32, 45); pub const CAUSE_RESOURCE_UNAVAILABLE = @as(u32, 47); pub const CAUSE_QOS_UNAVAILABLE = @as(u32, 49); pub const CAUSE_USER_CELL_RATE_UNAVAILABLE = @as(u32, 51); pub const CAUSE_BEARER_CAPABILITY_UNAUTHORIZED = @as(u32, 57); pub const CAUSE_BEARER_CAPABILITY_UNAVAILABLE = @as(u32, 58); pub const CAUSE_OPTION_UNAVAILABLE = @as(u32, 63); pub const CAUSE_BEARER_CAPABILITY_UNIMPLEMENTED = @as(u32, 65); pub const CAUSE_UNSUPPORTED_TRAFFIC_PARAMETERS = @as(u32, 73); pub const CAUSE_INVALID_CALL_REFERENCE = @as(u32, 81); pub const CAUSE_CHANNEL_NONEXISTENT = @as(u32, 82); pub const CAUSE_INCOMPATIBLE_DESTINATION = @as(u32, 88); pub const CAUSE_INVALID_ENDPOINT_REFERENCE = @as(u32, 89); pub const CAUSE_INVALID_TRANSIT_NETWORK_SELECTION = @as(u32, 91); pub const CAUSE_TOO_MANY_PENDING_ADD_PARTY = @as(u32, 92); pub const CAUSE_AAL_PARAMETERS_UNSUPPORTED = @as(u32, 93); pub const CAUSE_MANDATORY_IE_MISSING = @as(u32, 96); pub const CAUSE_UNIMPLEMENTED_MESSAGE_TYPE = @as(u32, 97); pub const CAUSE_UNIMPLEMENTED_IE = @as(u32, 99); pub const CAUSE_INVALID_IE_CONTENTS = @as(u32, 100); pub const CAUSE_INVALID_STATE_FOR_MESSAGE = @as(u32, 101); pub const CAUSE_RECOVERY_ON_TIMEOUT = @as(u32, 102); pub const CAUSE_INCORRECT_MESSAGE_LENGTH = @as(u32, 104); pub const CAUSE_PROTOCOL_ERROR = @as(u32, 111); pub const CAUSE_COND_UNKNOWN = @as(u32, 0); pub const CAUSE_COND_PERMANENT = @as(u32, 1); pub const CAUSE_COND_TRANSIENT = @as(u32, 2); pub const CAUSE_REASON_USER = @as(u32, 0); pub const CAUSE_REASON_IE_MISSING = @as(u32, 4); pub const CAUSE_REASON_IE_INSUFFICIENT = @as(u32, 8); pub const CAUSE_PU_PROVIDER = @as(u32, 0); pub const CAUSE_PU_USER = @as(u32, 8); pub const CAUSE_NA_NORMAL = @as(u32, 0); pub const CAUSE_NA_ABNORMAL = @as(u32, 4); pub const QOS_CLASS0 = @as(u32, 0); pub const QOS_CLASS1 = @as(u32, 1); pub const QOS_CLASS2 = @as(u32, 2); pub const QOS_CLASS3 = @as(u32, 3); pub const QOS_CLASS4 = @as(u32, 4); pub const TNS_TYPE_NATIONAL = @as(u32, 64); pub const TNS_PLAN_CARRIER_ID_CODE = @as(u32, 1); pub const SIO_GET_NUMBER_OF_ATM_DEVICES = @as(u32, 1343619073); pub const SIO_GET_ATM_ADDRESS = @as(u32, 3491102722); pub const SIO_ASSOCIATE_PVC = @as(u32, 2417360899); pub const SIO_GET_ATM_CONNECTION_ID = @as(u32, 1343619076); pub const WSPDESCRIPTION_LEN = @as(u32, 255); pub const WSS_OPERATION_IN_PROGRESS = @as(i32, 259); pub const LSP_SYSTEM = @as(u32, 2147483648); pub const LSP_INSPECTOR = @as(u32, 1); pub const LSP_REDIRECTOR = @as(u32, 2); pub const LSP_PROXY = @as(u32, 4); pub const LSP_FIREWALL = @as(u32, 8); pub const LSP_INBOUND_MODIFY = @as(u32, 16); pub const LSP_OUTBOUND_MODIFY = @as(u32, 32); pub const LSP_CRYPTO_COMPRESS = @as(u32, 64); pub const LSP_LOCAL_CACHE = @as(u32, 128); pub const UDP_NOCHECKSUM = @as(u32, 1); pub const UDP_CHECKSUM_COVERAGE = @as(u32, 20); pub const GAI_STRERROR_BUFFER_SIZE = @as(u32, 1024); pub const IPX_PTYPE = @as(u32, 16384); pub const IPX_FILTERPTYPE = @as(u32, 16385); pub const IPX_STOPFILTERPTYPE = @as(u32, 16387); pub const IPX_DSTYPE = @as(u32, 16386); pub const IPX_EXTENDED_ADDRESS = @as(u32, 16388); pub const IPX_RECVHDR = @as(u32, 16389); pub const IPX_MAXSIZE = @as(u32, 16390); pub const IPX_ADDRESS = @as(u32, 16391); pub const IPX_GETNETINFO = @as(u32, 16392); pub const IPX_GETNETINFO_NORIP = @as(u32, 16393); pub const IPX_SPXGETCONNECTIONSTATUS = @as(u32, 16395); pub const IPX_ADDRESS_NOTIFY = @as(u32, 16396); pub const IPX_MAX_ADAPTER_NUM = @as(u32, 16397); pub const IPX_RERIPNETNUMBER = @as(u32, 16398); pub const IPX_RECEIVE_BROADCAST = @as(u32, 16399); pub const IPX_IMMEDIATESPXACK = @as(u32, 16400); pub const IPPROTO_RM = @as(u32, 113); pub const MAX_MCAST_TTL = @as(u32, 255); pub const RM_OPTIONSBASE = @as(u32, 1000); pub const RM_RATE_WINDOW_SIZE = @as(u32, 1001); pub const RM_SET_MESSAGE_BOUNDARY = @as(u32, 1002); pub const RM_FLUSHCACHE = @as(u32, 1003); pub const RM_SENDER_WINDOW_ADVANCE_METHOD = @as(u32, 1004); pub const RM_SENDER_STATISTICS = @as(u32, 1005); pub const RM_LATEJOIN = @as(u32, 1006); pub const RM_SET_SEND_IF = @as(u32, 1007); pub const RM_ADD_RECEIVE_IF = @as(u32, 1008); pub const RM_DEL_RECEIVE_IF = @as(u32, 1009); pub const RM_SEND_WINDOW_ADV_RATE = @as(u32, 1010); pub const RM_USE_FEC = @as(u32, 1011); pub const RM_SET_MCAST_TTL = @as(u32, 1012); pub const RM_RECEIVER_STATISTICS = @as(u32, 1013); pub const RM_HIGH_SPEED_INTRANET_OPT = @as(u32, 1014); pub const SENDER_DEFAULT_RATE_KBITS_PER_SEC = @as(u32, 56); pub const SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE = @as(u32, 15); pub const MAX_WINDOW_INCREMENT_PERCENTAGE = @as(u32, 25); pub const SENDER_DEFAULT_LATE_JOINER_PERCENTAGE = @as(u32, 0); pub const SENDER_MAX_LATE_JOINER_PERCENTAGE = @as(u32, 75); pub const BITS_PER_BYTE = @as(u32, 8); pub const LOG2_BITS_PER_BYTE = @as(u32, 3); pub const UNIX_PATH_MAX = @as(u32, 108); pub const ISOPROTO_TP0 = @as(u32, 25); pub const ISOPROTO_TP1 = @as(u32, 26); pub const ISOPROTO_TP2 = @as(u32, 27); pub const ISOPROTO_TP3 = @as(u32, 28); pub const ISOPROTO_TP4 = @as(u32, 29); pub const ISOPROTO_TP = @as(u32, 29); pub const ISOPROTO_CLTP = @as(u32, 30); pub const ISOPROTO_CLNP = @as(u32, 31); pub const ISOPROTO_X25 = @as(u32, 32); pub const ISOPROTO_INACT_NL = @as(u32, 33); pub const ISOPROTO_ESIS = @as(u32, 34); pub const ISOPROTO_INTRAISIS = @as(u32, 35); pub const ISO_MAX_ADDR_LENGTH = @as(u32, 64); pub const ISO_HIERARCHICAL = @as(u32, 0); pub const ISO_NON_HIERARCHICAL = @as(u32, 1); pub const ISO_EXP_DATA_USE = @as(u32, 0); pub const ISO_EXP_DATA_NUSE = @as(u32, 1); pub const NSPROTO_IPX = @as(u32, 1000); pub const NSPROTO_SPX = @as(u32, 1256); pub const NSPROTO_SPXII = @as(u32, 1257); pub const NETBIOS_NAME_LENGTH = @as(u32, 16); pub const NETBIOS_UNIQUE_NAME = @as(u32, 0); pub const NETBIOS_GROUP_NAME = @as(u32, 1); pub const NETBIOS_TYPE_QUICK_UNIQUE = @as(u32, 2); pub const NETBIOS_TYPE_QUICK_GROUP = @as(u32, 3); pub const VNSPROTO_IPC = @as(u32, 1); pub const VNSPROTO_RELIABLE_IPC = @as(u32, 2); pub const VNSPROTO_SPP = @as(u32, 3); pub const INVALID_SOCKET = @import("../zig.zig").typedConst(SOCKET, @as(u32, 4294967295)); pub const WSA_INFINITE = @as(u32, 4294967295); pub const IOC_INOUT = @as(u32, 3221225472); pub const FIONREAD = @as(i32, 1074030207); pub const FIONBIO = @as(i32, -2147195266); pub const FIOASYNC = @as(i32, -2147195267); pub const SIOCSHIWAT = @as(i32, -2147192064); pub const SIOCGHIWAT = @as(i32, 1074033409); pub const SIOCSLOWAT = @as(i32, -2147192062); pub const SIOCGLOWAT = @as(i32, 1074033411); pub const SIOCATMARK = @as(i32, 1074033415); pub const LM_HB_Extension = @as(i32, 128); pub const LM_HB1_PnP = @as(i32, 1); pub const LM_HB1_PDA_Palmtop = @as(i32, 2); pub const LM_HB1_Computer = @as(i32, 4); pub const LM_HB1_Printer = @as(i32, 8); pub const LM_HB1_Modem = @as(i32, 16); pub const LM_HB1_Fax = @as(i32, 32); pub const LM_HB1_LANAccess = @as(i32, 64); pub const LM_HB2_Telephony = @as(i32, 1); pub const LM_HB2_FileServer = @as(i32, 2); //-------------------------------------------------------------------------------- // Section: Types (337) //-------------------------------------------------------------------------------- pub const WSA_ERROR = enum(i32) { _IO_PENDING = 997, _IO_INCOMPLETE = 996, _INVALID_HANDLE = 6, _INVALID_PARAMETER = 87, _NOT_ENOUGH_MEMORY = 8, _OPERATION_ABORTED = 995, BASEERR = 10000, EINTR = 10004, EBADF = 10009, EACCES = 10013, EFAULT = 10014, EINVAL = 10022, EMFILE = 10024, EWOULDBLOCK = 10035, EINPROGRESS = 10036, EALREADY = 10037, ENOTSOCK = 10038, EDESTADDRREQ = 10039, EMSGSIZE = 10040, EPROTOTYPE = 10041, ENOPROTOOPT = 10042, EPROTONOSUPPORT = 10043, ESOCKTNOSUPPORT = 10044, EOPNOTSUPP = 10045, EPFNOSUPPORT = 10046, EAFNOSUPPORT = 10047, EADDRINUSE = 10048, EADDRNOTAVAIL = 10049, ENETDOWN = 10050, ENETUNREACH = 10051, ENETRESET = 10052, ECONNABORTED = 10053, ECONNRESET = 10054, ENOBUFS = 10055, EISCONN = 10056, ENOTCONN = 10057, ESHUTDOWN = 10058, ETOOMANYREFS = 10059, ETIMEDOUT = 10060, ECONNREFUSED = 10061, ELOOP = 10062, ENAMETOOLONG = 10063, EHOSTDOWN = 10064, EHOSTUNREACH = 10065, ENOTEMPTY = 10066, EPROCLIM = 10067, EUSERS = 10068, EDQUOT = 10069, ESTALE = 10070, EREMOTE = 10071, SYSNOTREADY = 10091, VERNOTSUPPORTED = 10092, NOTINITIALISED = 10093, EDISCON = 10101, ENOMORE = 10102, ECANCELLED = 10103, EINVALIDPROCTABLE = 10104, EINVALIDPROVIDER = 10105, EPROVIDERFAILEDINIT = 10106, SYSCALLFAILURE = 10107, SERVICE_NOT_FOUND = 10108, TYPE_NOT_FOUND = 10109, _E_NO_MORE = 10110, _E_CANCELLED = 10111, EREFUSED = 10112, HOST_NOT_FOUND = 11001, TRY_AGAIN = 11002, NO_RECOVERY = 11003, NO_DATA = 11004, _QOS_RECEIVERS = 11005, _QOS_SENDERS = 11006, _QOS_NO_SENDERS = 11007, _QOS_NO_RECEIVERS = 11008, _QOS_REQUEST_CONFIRMED = 11009, _QOS_ADMISSION_FAILURE = 11010, _QOS_POLICY_FAILURE = 11011, _QOS_BAD_STYLE = 11012, _QOS_BAD_OBJECT = 11013, _QOS_TRAFFIC_CTRL_ERROR = 11014, _QOS_GENERIC_ERROR = 11015, _QOS_ESERVICETYPE = 11016, _QOS_EFLOWSPEC = 11017, _QOS_EPROVSPECBUF = 11018, _QOS_EFILTERSTYLE = 11019, _QOS_EFILTERTYPE = 11020, _QOS_EFILTERCOUNT = 11021, _QOS_EOBJLENGTH = 11022, _QOS_EFLOWCOUNT = 11023, _QOS_EUNKOWNPSOBJ = 11024, _QOS_EPOLICYOBJ = 11025, _QOS_EFLOWDESC = 11026, _QOS_EPSFLOWSPEC = 11027, _QOS_EPSFILTERSPEC = 11028, _QOS_ESDMODEOBJ = 11029, _QOS_ESHAPERATEOBJ = 11030, _QOS_RESERVED_PETYPE = 11031, _SECURE_HOST_NOT_FOUND = 11032, _IPSEC_NAME_POLICY_ERROR = 11033, }; pub const WSA_IO_PENDING = WSA_ERROR._IO_PENDING; pub const WSA_IO_INCOMPLETE = WSA_ERROR._IO_INCOMPLETE; pub const WSA_INVALID_HANDLE = WSA_ERROR._INVALID_HANDLE; pub const WSA_INVALID_PARAMETER = WSA_ERROR._INVALID_PARAMETER; pub const WSA_NOT_ENOUGH_MEMORY = WSA_ERROR._NOT_ENOUGH_MEMORY; pub const WSA_OPERATION_ABORTED = WSA_ERROR._OPERATION_ABORTED; pub const WSABASEERR = WSA_ERROR.BASEERR; pub const WSAEINTR = WSA_ERROR.EINTR; pub const WSAEBADF = WSA_ERROR.EBADF; pub const WSAEACCES = WSA_ERROR.EACCES; pub const WSAEFAULT = WSA_ERROR.EFAULT; pub const WSAEINVAL = WSA_ERROR.EINVAL; pub const WSAEMFILE = WSA_ERROR.EMFILE; pub const WSAEWOULDBLOCK = WSA_ERROR.EWOULDBLOCK; pub const WSAEINPROGRESS = WSA_ERROR.EINPROGRESS; pub const WSAEALREADY = WSA_ERROR.EALREADY; pub const WSAENOTSOCK = WSA_ERROR.ENOTSOCK; pub const WSAEDESTADDRREQ = WSA_ERROR.EDESTADDRREQ; pub const WSAEMSGSIZE = WSA_ERROR.EMSGSIZE; pub const WSAEPROTOTYPE = WSA_ERROR.EPROTOTYPE; pub const WSAENOPROTOOPT = WSA_ERROR.ENOPROTOOPT; pub const WSAEPROTONOSUPPORT = WSA_ERROR.EPROTONOSUPPORT; pub const WSAESOCKTNOSUPPORT = WSA_ERROR.ESOCKTNOSUPPORT; pub const WSAEOPNOTSUPP = WSA_ERROR.EOPNOTSUPP; pub const WSAEPFNOSUPPORT = WSA_ERROR.EPFNOSUPPORT; pub const WSAEAFNOSUPPORT = WSA_ERROR.EAFNOSUPPORT; pub const WSAEADDRINUSE = WSA_ERROR.EADDRINUSE; pub const WSAEADDRNOTAVAIL = WSA_ERROR.EADDRNOTAVAIL; pub const WSAENETDOWN = WSA_ERROR.ENETDOWN; pub const WSAENETUNREACH = WSA_ERROR.ENETUNREACH; pub const WSAENETRESET = WSA_ERROR.ENETRESET; pub const WSAECONNABORTED = WSA_ERROR.ECONNABORTED; pub const WSAECONNRESET = WSA_ERROR.ECONNRESET; pub const WSAENOBUFS = WSA_ERROR.ENOBUFS; pub const WSAEISCONN = WSA_ERROR.EISCONN; pub const WSAENOTCONN = WSA_ERROR.ENOTCONN; pub const WSAESHUTDOWN = WSA_ERROR.ESHUTDOWN; pub const WSAETOOMANYREFS = WSA_ERROR.ETOOMANYREFS; pub const WSAETIMEDOUT = WSA_ERROR.ETIMEDOUT; pub const WSAECONNREFUSED = WSA_ERROR.ECONNREFUSED; pub const WSAELOOP = WSA_ERROR.ELOOP; pub const WSAENAMETOOLONG = WSA_ERROR.ENAMETOOLONG; pub const WSAEHOSTDOWN = WSA_ERROR.EHOSTDOWN; pub const WSAEHOSTUNREACH = WSA_ERROR.EHOSTUNREACH; pub const WSAENOTEMPTY = WSA_ERROR.ENOTEMPTY; pub const WSAEPROCLIM = WSA_ERROR.EPROCLIM; pub const WSAEUSERS = WSA_ERROR.EUSERS; pub const WSAEDQUOT = WSA_ERROR.EDQUOT; pub const WSAESTALE = WSA_ERROR.ESTALE; pub const WSAEREMOTE = WSA_ERROR.EREMOTE; pub const WSASYSNOTREADY = WSA_ERROR.SYSNOTREADY; pub const WSAVERNOTSUPPORTED = WSA_ERROR.VERNOTSUPPORTED; pub const WSANOTINITIALISED = WSA_ERROR.NOTINITIALISED; pub const WSAEDISCON = WSA_ERROR.EDISCON; pub const WSAENOMORE = WSA_ERROR.ENOMORE; pub const WSAECANCELLED = WSA_ERROR.ECANCELLED; pub const WSAEINVALIDPROCTABLE = WSA_ERROR.EINVALIDPROCTABLE; pub const WSAEINVALIDPROVIDER = WSA_ERROR.EINVALIDPROVIDER; pub const WSAEPROVIDERFAILEDINIT = WSA_ERROR.EPROVIDERFAILEDINIT; pub const WSASYSCALLFAILURE = WSA_ERROR.SYSCALLFAILURE; pub const WSASERVICE_NOT_FOUND = WSA_ERROR.SERVICE_NOT_FOUND; pub const WSATYPE_NOT_FOUND = WSA_ERROR.TYPE_NOT_FOUND; pub const WSA_E_NO_MORE = WSA_ERROR._E_NO_MORE; pub const WSA_E_CANCELLED = WSA_ERROR._E_CANCELLED; pub const WSAEREFUSED = WSA_ERROR.EREFUSED; pub const WSAHOST_NOT_FOUND = WSA_ERROR.HOST_NOT_FOUND; pub const WSATRY_AGAIN = WSA_ERROR.TRY_AGAIN; pub const WSANO_RECOVERY = WSA_ERROR.NO_RECOVERY; pub const WSANO_DATA = WSA_ERROR.NO_DATA; pub const WSA_QOS_RECEIVERS = WSA_ERROR._QOS_RECEIVERS; pub const WSA_QOS_SENDERS = WSA_ERROR._QOS_SENDERS; pub const WSA_QOS_NO_SENDERS = WSA_ERROR._QOS_NO_SENDERS; pub const WSA_QOS_NO_RECEIVERS = WSA_ERROR._QOS_NO_RECEIVERS; pub const WSA_QOS_REQUEST_CONFIRMED = WSA_ERROR._QOS_REQUEST_CONFIRMED; pub const WSA_QOS_ADMISSION_FAILURE = WSA_ERROR._QOS_ADMISSION_FAILURE; pub const WSA_QOS_POLICY_FAILURE = WSA_ERROR._QOS_POLICY_FAILURE; pub const WSA_QOS_BAD_STYLE = WSA_ERROR._QOS_BAD_STYLE; pub const WSA_QOS_BAD_OBJECT = WSA_ERROR._QOS_BAD_OBJECT; pub const WSA_QOS_TRAFFIC_CTRL_ERROR = WSA_ERROR._QOS_TRAFFIC_CTRL_ERROR; pub const WSA_QOS_GENERIC_ERROR = WSA_ERROR._QOS_GENERIC_ERROR; pub const WSA_QOS_ESERVICETYPE = WSA_ERROR._QOS_ESERVICETYPE; pub const WSA_QOS_EFLOWSPEC = WSA_ERROR._QOS_EFLOWSPEC; pub const WSA_QOS_EPROVSPECBUF = WSA_ERROR._QOS_EPROVSPECBUF; pub const WSA_QOS_EFILTERSTYLE = WSA_ERROR._QOS_EFILTERSTYLE; pub const WSA_QOS_EFILTERTYPE = WSA_ERROR._QOS_EFILTERTYPE; pub const WSA_QOS_EFILTERCOUNT = WSA_ERROR._QOS_EFILTERCOUNT; pub const WSA_QOS_EOBJLENGTH = WSA_ERROR._QOS_EOBJLENGTH; pub const WSA_QOS_EFLOWCOUNT = WSA_ERROR._QOS_EFLOWCOUNT; pub const WSA_QOS_EUNKOWNPSOBJ = WSA_ERROR._QOS_EUNKOWNPSOBJ; pub const WSA_QOS_EPOLICYOBJ = WSA_ERROR._QOS_EPOLICYOBJ; pub const WSA_QOS_EFLOWDESC = WSA_ERROR._QOS_EFLOWDESC; pub const WSA_QOS_EPSFLOWSPEC = WSA_ERROR._QOS_EPSFLOWSPEC; pub const WSA_QOS_EPSFILTERSPEC = WSA_ERROR._QOS_EPSFILTERSPEC; pub const WSA_QOS_ESDMODEOBJ = WSA_ERROR._QOS_ESDMODEOBJ; pub const WSA_QOS_ESHAPERATEOBJ = WSA_ERROR._QOS_ESHAPERATEOBJ; pub const WSA_QOS_RESERVED_PETYPE = WSA_ERROR._QOS_RESERVED_PETYPE; pub const WSA_SECURE_HOST_NOT_FOUND = WSA_ERROR._SECURE_HOST_NOT_FOUND; pub const WSA_IPSEC_NAME_POLICY_ERROR = WSA_ERROR._IPSEC_NAME_POLICY_ERROR; pub const SET_SERVICE_OPERATION = enum(u32) { REGISTER = 1, DEREGISTER = 2, FLUSH = 3, ADD_TYPE = 4, DELETE_TYPE = 5, }; pub const SERVICE_REGISTER = SET_SERVICE_OPERATION.REGISTER; pub const SERVICE_DEREGISTER = SET_SERVICE_OPERATION.DEREGISTER; pub const SERVICE_FLUSH = SET_SERVICE_OPERATION.FLUSH; pub const SERVICE_ADD_TYPE = SET_SERVICE_OPERATION.ADD_TYPE; pub const SERVICE_DELETE_TYPE = SET_SERVICE_OPERATION.DELETE_TYPE; pub const SEND_FLAGS = enum(u32) { DONTROUTE = 4, OOB = 1, _, }; pub const MSG_DONTROUTE = SEND_FLAGS.DONTROUTE; pub const MSG_OOB = SEND_FLAGS.OOB; pub const RESOURCE_DISPLAY_TYPE = enum(u32) { DOMAIN = 1, FILE = 4, GENERIC = 0, GROUP = 5, SERVER = 2, SHARE = 3, TREE = 10, }; pub const RESOURCEDISPLAYTYPE_DOMAIN = RESOURCE_DISPLAY_TYPE.DOMAIN; pub const RESOURCEDISPLAYTYPE_FILE = RESOURCE_DISPLAY_TYPE.FILE; pub const RESOURCEDISPLAYTYPE_GENERIC = RESOURCE_DISPLAY_TYPE.GENERIC; pub const RESOURCEDISPLAYTYPE_GROUP = RESOURCE_DISPLAY_TYPE.GROUP; pub const RESOURCEDISPLAYTYPE_SERVER = RESOURCE_DISPLAY_TYPE.SERVER; pub const RESOURCEDISPLAYTYPE_SHARE = RESOURCE_DISPLAY_TYPE.SHARE; pub const RESOURCEDISPLAYTYPE_TREE = RESOURCE_DISPLAY_TYPE.TREE; pub const RIO_BUFFERID_t = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const RIO_CQ_t = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const RIO_RQ_t = extern struct { placeholder: usize, // TODO: why is this type empty? }; // TODO: this type has a FreeFunc 'WSACloseEvent', what can Zig do with this information? pub const HWSAEVENT = *opaque{}; // TODO: this type has a FreeFunc 'closesocket', what can Zig do with this information? pub const SOCKET = @import("std").os.windows.ws2_32.SOCKET; pub const IN_ADDR = extern struct { S_un: extern union { S_un_b: extern struct { s_b1: u8, s_b2: u8, s_b3: u8, s_b4: u8, }, S_un_w: extern struct { s_w1: u16, s_w2: u16, }, S_addr: u32, }, }; pub const SOCKADDR = extern struct { sa_family: u16, sa_data: [14]CHAR, }; pub const SOCKET_ADDRESS = extern struct { lpSockaddr: ?*SOCKADDR, iSockaddrLength: i32, }; pub const SOCKET_ADDRESS_LIST = extern struct { iAddressCount: i32, Address: [1]SOCKET_ADDRESS, }; pub const CSADDR_INFO = extern struct { LocalAddr: SOCKET_ADDRESS, RemoteAddr: SOCKET_ADDRESS, iSocketType: i32, iProtocol: i32, }; pub const SOCKADDR_STORAGE = extern struct { ss_family: u16, __ss_pad1: [6]CHAR, __ss_align: i64, __ss_pad2: [112]CHAR, }; pub const SOCKADDR_STORAGE_XP = extern struct { ss_family: i16, __ss_pad1: [6]CHAR, __ss_align: i64, __ss_pad2: [112]CHAR, }; pub const SOCKET_PROCESSOR_AFFINITY = extern struct { Processor: PROCESSOR_NUMBER, NumaNodeId: u16, Reserved: u16, }; pub const IPPROTO = enum(i32) { HOPOPTS = 0, ICMP = 1, IGMP = 2, GGP = 3, IPV4 = 4, ST = 5, TCP = 6, CBT = 7, EGP = 8, IGP = 9, PUP = 12, UDP = 17, IDP = 22, RDP = 27, IPV6 = 41, ROUTING = 43, FRAGMENT = 44, ESP = 50, AH = 51, ICMPV6 = 58, NONE = 59, DSTOPTS = 60, ND = 77, ICLFXBM = 78, PIM = 103, PGM = 113, L2TP = 115, SCTP = 132, RAW = 255, MAX = 256, RESERVED_RAW = 257, RESERVED_IPSEC = 258, RESERVED_IPSECOFFLOAD = 259, RESERVED_WNV = 260, RESERVED_MAX = 261, }; pub const IPPROTO_HOPOPTS = IPPROTO.HOPOPTS; pub const IPPROTO_ICMP = IPPROTO.ICMP; pub const IPPROTO_IGMP = IPPROTO.IGMP; pub const IPPROTO_GGP = IPPROTO.GGP; pub const IPPROTO_IPV4 = IPPROTO.IPV4; pub const IPPROTO_ST = IPPROTO.ST; pub const IPPROTO_TCP = IPPROTO.TCP; pub const IPPROTO_CBT = IPPROTO.CBT; pub const IPPROTO_EGP = IPPROTO.EGP; pub const IPPROTO_IGP = IPPROTO.IGP; pub const IPPROTO_PUP = IPPROTO.PUP; pub const IPPROTO_UDP = IPPROTO.UDP; pub const IPPROTO_IDP = IPPROTO.IDP; pub const IPPROTO_RDP = IPPROTO.RDP; pub const IPPROTO_IPV6 = IPPROTO.IPV6; pub const IPPROTO_ROUTING = IPPROTO.ROUTING; pub const IPPROTO_FRAGMENT = IPPROTO.FRAGMENT; pub const IPPROTO_ESP = IPPROTO.ESP; pub const IPPROTO_AH = IPPROTO.AH; pub const IPPROTO_ICMPV6 = IPPROTO.ICMPV6; pub const IPPROTO_NONE = IPPROTO.NONE; pub const IPPROTO_DSTOPTS = IPPROTO.DSTOPTS; pub const IPPROTO_ND = IPPROTO.ND; pub const IPPROTO_ICLFXBM = IPPROTO.ICLFXBM; pub const IPPROTO_PIM = IPPROTO.PIM; pub const IPPROTO_PGM = IPPROTO.PGM; pub const IPPROTO_L2TP = IPPROTO.L2TP; pub const IPPROTO_SCTP = IPPROTO.SCTP; pub const IPPROTO_RAW = IPPROTO.RAW; pub const IPPROTO_MAX = IPPROTO.MAX; pub const IPPROTO_RESERVED_RAW = IPPROTO.RESERVED_RAW; pub const IPPROTO_RESERVED_IPSEC = IPPROTO.RESERVED_IPSEC; pub const IPPROTO_RESERVED_IPSECOFFLOAD = IPPROTO.RESERVED_IPSECOFFLOAD; pub const IPPROTO_RESERVED_WNV = IPPROTO.RESERVED_WNV; pub const IPPROTO_RESERVED_MAX = IPPROTO.RESERVED_MAX; pub const SCOPE_LEVEL = enum(i32) { Interface = 1, Link = 2, Subnet = 3, Admin = 4, Site = 5, Organization = 8, Global = 14, Count = 16, }; pub const ScopeLevelInterface = SCOPE_LEVEL.Interface; pub const ScopeLevelLink = SCOPE_LEVEL.Link; pub const ScopeLevelSubnet = SCOPE_LEVEL.Subnet; pub const ScopeLevelAdmin = SCOPE_LEVEL.Admin; pub const ScopeLevelSite = SCOPE_LEVEL.Site; pub const ScopeLevelOrganization = SCOPE_LEVEL.Organization; pub const ScopeLevelGlobal = SCOPE_LEVEL.Global; pub const ScopeLevelCount = SCOPE_LEVEL.Count; pub const SCOPE_ID = extern struct { Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, Value: u32, }, }; pub const SOCKADDR_IN = extern struct { sin_family: u16, sin_port: u16, sin_addr: IN_ADDR, sin_zero: [8]CHAR, }; pub const SOCKADDR_DL = extern struct { sdl_family: u16, sdl_data: [8]u8, sdl_zero: [4]u8, }; pub const WSABUF = extern struct { len: u32, buf: ?PSTR, }; pub const WSAMSG = extern struct { name: ?*SOCKADDR, namelen: i32, lpBuffers: ?*WSABUF, dwBufferCount: u32, Control: WSABUF, dwFlags: u32, }; pub const cmsghdr = extern struct { cmsg_len: usize, cmsg_level: i32, cmsg_type: i32, }; pub const ADDRINFOA = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PSTR, ai_addr: ?*SOCKADDR, ai_next: ?*ADDRINFOA, }; pub const addrinfoW = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_next: ?*addrinfoW, }; pub const addrinfoexA = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoexA, }; pub const addrinfoexW = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoexW, }; pub const addrinfoex2A = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoex2A, ai_version: i32, ai_fqdn: ?PSTR, }; pub const addrinfoex2W = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoex2W, ai_version: i32, ai_fqdn: ?PWSTR, }; pub const addrinfoex3 = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoex3, ai_version: i32, ai_fqdn: ?PWSTR, ai_interfaceindex: i32, }; pub const addrinfoex4 = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoex4, ai_version: i32, ai_fqdn: ?PWSTR, ai_interfaceindex: i32, ai_resolutionhandle: ?HANDLE, }; pub const addrinfoex5 = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoex5, ai_version: i32, ai_fqdn: ?PWSTR, ai_interfaceindex: i32, ai_resolutionhandle: ?HANDLE, ai_ttl: u32, }; pub const addrinfo_dns_server = extern struct { ai_servertype: u32, ai_flags: u64, ai_addrlen: u32, ai_addr: ?*SOCKADDR, Anonymous: extern union { ai_template: ?PWSTR, }, }; pub const addrinfoex6 = extern struct { ai_flags: i32, ai_family: i32, ai_socktype: i32, ai_protocol: i32, ai_addrlen: usize, ai_canonname: ?PWSTR, ai_addr: ?*SOCKADDR, ai_blob: ?*anyopaque, ai_bloblen: usize, ai_provider: ?*Guid, ai_next: ?*addrinfoex5, ai_version: i32, ai_fqdn: ?PWSTR, ai_interfaceindex: i32, ai_resolutionhandle: ?HANDLE, ai_ttl: u32, ai_numservers: u32, ai_servers: ?*addrinfo_dns_server, ai_responseflags: u64, }; pub const fd_set = extern struct { fd_count: u32, fd_array: [64]?SOCKET, }; pub const timeval = extern struct { tv_sec: i32, tv_usec: i32, }; pub const hostent = extern struct { h_name: ?PSTR, h_aliases: ?*?*i8, h_addrtype: i16, h_length: i16, h_addr_list: ?*?*i8, }; pub const netent = extern struct { n_name: ?PSTR, n_aliases: ?*?*i8, n_addrtype: i16, n_net: u32, }; pub const protoent = extern struct { p_name: ?PSTR, p_aliases: ?*?*i8, p_proto: i16, }; pub const sockproto = extern struct { sp_family: u16, sp_protocol: u16, }; pub const linger = extern struct { l_onoff: u16, l_linger: u16, }; pub const WSANETWORKEVENTS = extern struct { lNetworkEvents: i32, iErrorCode: [10]i32, }; pub const WSAPROTOCOLCHAIN = extern struct { ChainLen: i32, ChainEntries: [7]u32, }; pub const WSAPROTOCOL_INFOA = extern struct { dwServiceFlags1: u32, dwServiceFlags2: u32, dwServiceFlags3: u32, dwServiceFlags4: u32, dwProviderFlags: u32, ProviderId: Guid, dwCatalogEntryId: u32, ProtocolChain: WSAPROTOCOLCHAIN, iVersion: i32, iAddressFamily: i32, iMaxSockAddr: i32, iMinSockAddr: i32, iSocketType: i32, iProtocol: i32, iProtocolMaxOffset: i32, iNetworkByteOrder: i32, iSecurityScheme: i32, dwMessageSize: u32, dwProviderReserved: u32, szProtocol: [256]CHAR, }; pub const WSAPROTOCOL_INFOW = extern struct { dwServiceFlags1: u32, dwServiceFlags2: u32, dwServiceFlags3: u32, dwServiceFlags4: u32, dwProviderFlags: u32, ProviderId: Guid, dwCatalogEntryId: u32, ProtocolChain: WSAPROTOCOLCHAIN, iVersion: i32, iAddressFamily: i32, iMaxSockAddr: i32, iMinSockAddr: i32, iSocketType: i32, iProtocol: i32, iProtocolMaxOffset: i32, iNetworkByteOrder: i32, iSecurityScheme: i32, dwMessageSize: u32, dwProviderReserved: u32, szProtocol: [256]u16, }; pub const LPCONDITIONPROC = fn( lpCallerId: ?*WSABUF, lpCallerData: ?*WSABUF, lpSQOS: ?*QOS, lpGQOS: ?*QOS, lpCalleeId: ?*WSABUF, lpCalleeData: ?*WSABUF, g: ?*u32, dwCallbackData: usize, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = fn( dwError: u32, cbTransferred: u32, lpOverlapped: ?*OVERLAPPED, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) void; pub const WSACOMPLETIONTYPE = enum(i32) { IMMEDIATELY = 0, HWND = 1, EVENT = 2, PORT = 3, APC = 4, }; pub const NSP_NOTIFY_IMMEDIATELY = WSACOMPLETIONTYPE.IMMEDIATELY; pub const NSP_NOTIFY_HWND = WSACOMPLETIONTYPE.HWND; pub const NSP_NOTIFY_EVENT = WSACOMPLETIONTYPE.EVENT; pub const NSP_NOTIFY_PORT = WSACOMPLETIONTYPE.PORT; pub const NSP_NOTIFY_APC = WSACOMPLETIONTYPE.APC; pub const WSACOMPLETION = extern struct { Type: WSACOMPLETIONTYPE, Parameters: extern union { WindowMessage: extern struct { hWnd: ?HWND, uMsg: u32, context: WPARAM, }, Event: extern struct { lpOverlapped: ?*OVERLAPPED, }, Apc: extern struct { lpOverlapped: ?*OVERLAPPED, lpfnCompletionProc: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, }, Port: extern struct { lpOverlapped: ?*OVERLAPPED, hPort: ?HANDLE, Key: usize, }, }, }; pub const AFPROTOCOLS = extern struct { iAddressFamily: i32, iProtocol: i32, }; pub const WSAECOMPARATOR = enum(i32) { EQUAL = 0, NOTLESS = 1, }; pub const COMP_EQUAL = WSAECOMPARATOR.EQUAL; pub const COMP_NOTLESS = WSAECOMPARATOR.NOTLESS; pub const WSAVERSION = extern struct { dwVersion: u32, ecHow: WSAECOMPARATOR, }; pub const WSAQUERYSETA = extern struct { dwSize: u32, lpszServiceInstanceName: ?PSTR, lpServiceClassId: ?*Guid, lpVersion: ?*WSAVERSION, lpszComment: ?PSTR, dwNameSpace: u32, lpNSProviderId: ?*Guid, lpszContext: ?PSTR, dwNumberOfProtocols: u32, lpafpProtocols: ?*AFPROTOCOLS, lpszQueryString: ?PSTR, dwNumberOfCsAddrs: u32, lpcsaBuffer: ?*CSADDR_INFO, dwOutputFlags: u32, lpBlob: ?*BLOB, }; pub const WSAQUERYSETW = extern struct { dwSize: u32, lpszServiceInstanceName: ?PWSTR, lpServiceClassId: ?*Guid, lpVersion: ?*WSAVERSION, lpszComment: ?PWSTR, dwNameSpace: u32, lpNSProviderId: ?*Guid, lpszContext: ?PWSTR, dwNumberOfProtocols: u32, lpafpProtocols: ?*AFPROTOCOLS, lpszQueryString: ?PWSTR, dwNumberOfCsAddrs: u32, lpcsaBuffer: ?*CSADDR_INFO, dwOutputFlags: u32, lpBlob: ?*BLOB, }; pub const WSAQUERYSET2A = extern struct { dwSize: u32, lpszServiceInstanceName: ?PSTR, lpVersion: ?*WSAVERSION, lpszComment: ?PSTR, dwNameSpace: u32, lpNSProviderId: ?*Guid, lpszContext: ?PSTR, dwNumberOfProtocols: u32, lpafpProtocols: ?*AFPROTOCOLS, lpszQueryString: ?PSTR, dwNumberOfCsAddrs: u32, lpcsaBuffer: ?*CSADDR_INFO, dwOutputFlags: u32, lpBlob: ?*BLOB, }; pub const WSAQUERYSET2W = extern struct { dwSize: u32, lpszServiceInstanceName: ?PWSTR, lpVersion: ?*WSAVERSION, lpszComment: ?PWSTR, dwNameSpace: u32, lpNSProviderId: ?*Guid, lpszContext: ?PWSTR, dwNumberOfProtocols: u32, lpafpProtocols: ?*AFPROTOCOLS, lpszQueryString: ?PWSTR, dwNumberOfCsAddrs: u32, lpcsaBuffer: ?*CSADDR_INFO, dwOutputFlags: u32, lpBlob: ?*BLOB, }; pub const WSAESETSERVICEOP = enum(i32) { REGISTER = 0, DEREGISTER = 1, DELETE = 2, }; pub const RNRSERVICE_REGISTER = WSAESETSERVICEOP.REGISTER; pub const RNRSERVICE_DEREGISTER = WSAESETSERVICEOP.DEREGISTER; pub const RNRSERVICE_DELETE = WSAESETSERVICEOP.DELETE; pub const WSANSCLASSINFOA = extern struct { lpszName: ?PSTR, dwNameSpace: u32, dwValueType: u32, dwValueSize: u32, lpValue: ?*anyopaque, }; pub const WSANSCLASSINFOW = extern struct { lpszName: ?PWSTR, dwNameSpace: u32, dwValueType: u32, dwValueSize: u32, lpValue: ?*anyopaque, }; pub const WSASERVICECLASSINFOA = extern struct { lpServiceClassId: ?*Guid, lpszServiceClassName: ?PSTR, dwCount: u32, lpClassInfos: ?*WSANSCLASSINFOA, }; pub const WSASERVICECLASSINFOW = extern struct { lpServiceClassId: ?*Guid, lpszServiceClassName: ?PWSTR, dwCount: u32, lpClassInfos: ?*WSANSCLASSINFOW, }; pub const WSANAMESPACE_INFOA = extern struct { NSProviderId: Guid, dwNameSpace: u32, fActive: BOOL, dwVersion: u32, lpszIdentifier: ?PSTR, }; pub const WSANAMESPACE_INFOW = extern struct { NSProviderId: Guid, dwNameSpace: u32, fActive: BOOL, dwVersion: u32, lpszIdentifier: ?PWSTR, }; pub const WSANAMESPACE_INFOEXA = extern struct { NSProviderId: Guid, dwNameSpace: u32, fActive: BOOL, dwVersion: u32, lpszIdentifier: ?PSTR, ProviderSpecific: BLOB, }; pub const WSANAMESPACE_INFOEXW = extern struct { NSProviderId: Guid, dwNameSpace: u32, fActive: BOOL, dwVersion: u32, lpszIdentifier: ?PWSTR, ProviderSpecific: BLOB, }; pub const WSAPOLLFD = extern struct { fd: ?SOCKET, events: i16, revents: i16, }; pub const SOCK_NOTIFY_REGISTRATION = extern struct { socket: ?SOCKET, completionKey: ?*anyopaque, eventFilter: u16, operation: u8, triggerFlags: u8, registrationResult: u32, }; pub const IN6_ADDR = extern struct { u: extern union { Byte: [16]u8, Word: [8]u16, }, }; pub const sockaddr_in6_old = extern struct { sin6_family: i16, sin6_port: u16, sin6_flowinfo: u32, sin6_addr: IN6_ADDR, }; pub const sockaddr_gen = extern union { Address: SOCKADDR, AddressIn: SOCKADDR_IN, AddressIn6: sockaddr_in6_old, }; pub const INTERFACE_INFO = extern struct { iiFlags: u32, iiAddress: sockaddr_gen, iiBroadcastAddress: sockaddr_gen, iiNetmask: sockaddr_gen, }; pub const INTERFACE_INFO_EX = extern struct { iiFlags: u32, iiAddress: SOCKET_ADDRESS, iiBroadcastAddress: SOCKET_ADDRESS, iiNetmask: SOCKET_ADDRESS, }; pub const PMTUD_STATE = enum(i32) { NOT_SET = 0, DO = 1, DONT = 2, PROBE = 3, MAX = 4, }; pub const IP_PMTUDISC_NOT_SET = PMTUD_STATE.NOT_SET; pub const IP_PMTUDISC_DO = PMTUD_STATE.DO; pub const IP_PMTUDISC_DONT = PMTUD_STATE.DONT; pub const IP_PMTUDISC_PROBE = PMTUD_STATE.PROBE; pub const IP_PMTUDISC_MAX = PMTUD_STATE.MAX; pub const SOCKADDR_IN6 = extern struct { sin6_family: u16, sin6_port: u16, sin6_flowinfo: u32, sin6_addr: IN6_ADDR, Anonymous: extern union { sin6_scope_id: u32, sin6_scope_struct: SCOPE_ID, }, }; pub const SOCKADDR_IN6_W2KSP1 = extern struct { sin6_family: i16, sin6_port: u16, sin6_flowinfo: u32, sin6_addr: IN6_ADDR, sin6_scope_id: u32, }; pub const SOCKADDR_INET = extern union { Ipv4: SOCKADDR_IN, Ipv6: SOCKADDR_IN6, si_family: u16, }; pub const SOCKADDR_IN6_PAIR = extern struct { SourceAddress: ?*SOCKADDR_IN6, DestinationAddress: ?*SOCKADDR_IN6, }; pub const MULTICAST_MODE_TYPE = enum(i32) { INCLUDE = 0, EXCLUDE = 1, }; pub const MCAST_INCLUDE = MULTICAST_MODE_TYPE.INCLUDE; pub const MCAST_EXCLUDE = MULTICAST_MODE_TYPE.EXCLUDE; pub const IP_MREQ = extern struct { imr_multiaddr: IN_ADDR, imr_interface: IN_ADDR, }; pub const IP_MREQ_SOURCE = extern struct { imr_multiaddr: IN_ADDR, imr_sourceaddr: IN_ADDR, imr_interface: IN_ADDR, }; pub const IP_MSFILTER = extern struct { imsf_multiaddr: IN_ADDR, imsf_interface: IN_ADDR, imsf_fmode: MULTICAST_MODE_TYPE, imsf_numsrc: u32, imsf_slist: [1]IN_ADDR, }; pub const IPV6_MREQ = extern struct { ipv6mr_multiaddr: IN6_ADDR, ipv6mr_interface: u32, }; pub const GROUP_REQ = extern struct { gr_interface: u32, gr_group: SOCKADDR_STORAGE, }; pub const GROUP_SOURCE_REQ = extern struct { gsr_interface: u32, gsr_group: SOCKADDR_STORAGE, gsr_source: SOCKADDR_STORAGE, }; pub const GROUP_FILTER = extern struct { gf_interface: u32, gf_group: SOCKADDR_STORAGE, gf_fmode: MULTICAST_MODE_TYPE, gf_numsrc: u32, gf_slist: [1]SOCKADDR_STORAGE, }; pub const IN_PKTINFO = extern struct { ipi_addr: IN_ADDR, ipi_ifindex: u32, }; pub const IN6_PKTINFO = extern struct { ipi6_addr: IN6_ADDR, ipi6_ifindex: u32, }; pub const IN_PKTINFO_EX = extern struct { pkt_info: IN_PKTINFO, scope_id: SCOPE_ID, }; pub const in6_pktinfo_ex = extern struct { pkt_info: IN6_PKTINFO, scope_id: SCOPE_ID, }; pub const IN_RECVERR = extern struct { protocol: IPPROTO, info: u32, type: u8, code: u8, }; pub const ICMP_ERROR_INFO = extern struct { srcaddress: SOCKADDR_INET, protocol: IPPROTO, type: u8, code: u8, }; pub const eWINDOW_ADVANCE_METHOD = enum(i32) { ADVANCE_BY_TIME = 1, USE_AS_DATA_CACHE = 2, }; pub const E_WINDOW_ADVANCE_BY_TIME = eWINDOW_ADVANCE_METHOD.ADVANCE_BY_TIME; pub const E_WINDOW_USE_AS_DATA_CACHE = eWINDOW_ADVANCE_METHOD.USE_AS_DATA_CACHE; pub const RM_SEND_WINDOW = extern struct { RateKbitsPerSec: u32, WindowSizeInMSecs: u32, WindowSizeInBytes: u32, }; pub const RM_SENDER_STATS = extern struct { DataBytesSent: u64, TotalBytesSent: u64, NaksReceived: u64, NaksReceivedTooLate: u64, NumOutstandingNaks: u64, NumNaksAfterRData: u64, RepairPacketsSent: u64, BufferSpaceAvailable: u64, TrailingEdgeSeqId: u64, LeadingEdgeSeqId: u64, RateKBitsPerSecOverall: u64, RateKBitsPerSecLast: u64, TotalODataPacketsSent: u64, }; pub const RM_RECEIVER_STATS = extern struct { NumODataPacketsReceived: u64, NumRDataPacketsReceived: u64, NumDuplicateDataPackets: u64, DataBytesReceived: u64, TotalBytesReceived: u64, RateKBitsPerSecOverall: u64, RateKBitsPerSecLast: u64, TrailingEdgeSeqId: u64, LeadingEdgeSeqId: u64, AverageSequencesInWindow: u64, MinSequencesInWindow: u64, MaxSequencesInWindow: u64, FirstNakSequenceNumber: u64, NumPendingNaks: u64, NumOutstandingNaks: u64, NumDataPacketsBuffered: u64, TotalSelectiveNaksSent: u64, TotalParityNaksSent: u64, }; pub const RM_FEC_INFO = extern struct { FECBlockSize: u16, FECProActivePackets: u16, FECGroupSize: u8, fFECOnDemandParityEnabled: BOOLEAN, }; pub const IPX_ADDRESS_DATA = extern struct { adapternum: i32, netnum: [4]u8, nodenum: [6]u8, wan: BOOLEAN, status: BOOLEAN, maxpkt: i32, linkspeed: u32, }; pub const IPX_NETNUM_DATA = extern struct { netnum: [4]u8, hopcount: u16, netdelay: u16, cardnum: i32, router: [6]u8, }; pub const IPX_SPXCONNSTATUS_DATA = extern struct { ConnectionState: u8, WatchDogActive: u8, LocalConnectionId: u16, RemoteConnectionId: u16, LocalSequenceNumber: u16, LocalAckNumber: u16, LocalAllocNumber: u16, RemoteAckNumber: u16, RemoteAllocNumber: u16, LocalSocket: u16, ImmediateAddress: [6]u8, RemoteNetwork: [4]u8, RemoteNode: [6]u8, RemoteSocket: u16, RetransmissionCount: u16, EstimatedRoundTripDelay: u16, RetransmittedPackets: u16, SuppressedPacket: u16, }; pub const LM_IRPARMS = extern struct { nTXDataBytes: u32, nRXDataBytes: u32, nBaudRate: u32, thresholdTime: u32, discTime: u32, nMSLinkTurn: u16, nTXPackets: u8, nRXPackets: u8, }; pub const SOCKADDR_IRDA = extern struct { irdaAddressFamily: u16, irdaDeviceID: [4]u8, irdaServiceName: [25]CHAR, }; pub const WINDOWS_IRDA_DEVICE_INFO = extern struct { irdaDeviceID: [4]u8, irdaDeviceName: [22]CHAR, irdaDeviceHints1: u8, irdaDeviceHints2: u8, irdaCharSet: u8, }; pub const WCE_IRDA_DEVICE_INFO = extern struct { irdaDeviceID: [4]u8, irdaDeviceName: [22]CHAR, Reserved: [2]u8, }; pub const WINDOWS_DEVICELIST = extern struct { numDevice: u32, Device: [1]WINDOWS_IRDA_DEVICE_INFO, }; pub const WCE_DEVICELIST = extern struct { numDevice: u32, Device: [1]WCE_IRDA_DEVICE_INFO, }; pub const WINDOWS_IAS_SET = extern struct { irdaClassName: [64]CHAR, irdaAttribName: [256]CHAR, irdaAttribType: u32, irdaAttribute: extern union { irdaAttribInt: i32, irdaAttribOctetSeq: extern struct { Len: u16, OctetSeq: [1024]u8, }, irdaAttribUsrStr: extern struct { Len: u8, CharSet: u8, UsrStr: [256]u8, }, }, }; pub const WINDOWS_IAS_QUERY = extern struct { irdaDeviceID: [4]u8, irdaClassName: [64]CHAR, irdaAttribName: [256]CHAR, irdaAttribType: u32, irdaAttribute: extern union { irdaAttribInt: i32, irdaAttribOctetSeq: extern struct { Len: u32, OctetSeq: [1024]u8, }, irdaAttribUsrStr: extern struct { Len: u32, CharSet: u32, UsrStr: [256]u8, }, }, }; pub const NL_PREFIX_ORIGIN = enum(i32) { Other = 0, Manual = 1, WellKnown = 2, Dhcp = 3, RouterAdvertisement = 4, Unchanged = 16, }; pub const IpPrefixOriginOther = NL_PREFIX_ORIGIN.Other; pub const IpPrefixOriginManual = NL_PREFIX_ORIGIN.Manual; pub const IpPrefixOriginWellKnown = NL_PREFIX_ORIGIN.WellKnown; pub const IpPrefixOriginDhcp = NL_PREFIX_ORIGIN.Dhcp; pub const IpPrefixOriginRouterAdvertisement = NL_PREFIX_ORIGIN.RouterAdvertisement; pub const IpPrefixOriginUnchanged = NL_PREFIX_ORIGIN.Unchanged; pub const NL_SUFFIX_ORIGIN = enum(i32) { NlsoOther = 0, NlsoManual = 1, NlsoWellKnown = 2, NlsoDhcp = 3, NlsoLinkLayerAddress = 4, NlsoRandom = 5, // IpSuffixOriginOther = 0, this enum value conflicts with NlsoOther // IpSuffixOriginManual = 1, this enum value conflicts with NlsoManual // IpSuffixOriginWellKnown = 2, this enum value conflicts with NlsoWellKnown // IpSuffixOriginDhcp = 3, this enum value conflicts with NlsoDhcp // IpSuffixOriginLinkLayerAddress = 4, this enum value conflicts with NlsoLinkLayerAddress // IpSuffixOriginRandom = 5, this enum value conflicts with NlsoRandom IpSuffixOriginUnchanged = 16, }; pub const NlsoOther = NL_SUFFIX_ORIGIN.NlsoOther; pub const NlsoManual = NL_SUFFIX_ORIGIN.NlsoManual; pub const NlsoWellKnown = NL_SUFFIX_ORIGIN.NlsoWellKnown; pub const NlsoDhcp = NL_SUFFIX_ORIGIN.NlsoDhcp; pub const NlsoLinkLayerAddress = NL_SUFFIX_ORIGIN.NlsoLinkLayerAddress; pub const NlsoRandom = NL_SUFFIX_ORIGIN.NlsoRandom; pub const IpSuffixOriginOther = NL_SUFFIX_ORIGIN.NlsoOther; pub const IpSuffixOriginManual = NL_SUFFIX_ORIGIN.NlsoManual; pub const IpSuffixOriginWellKnown = NL_SUFFIX_ORIGIN.NlsoWellKnown; pub const IpSuffixOriginDhcp = NL_SUFFIX_ORIGIN.NlsoDhcp; pub const IpSuffixOriginLinkLayerAddress = NL_SUFFIX_ORIGIN.NlsoLinkLayerAddress; pub const IpSuffixOriginRandom = NL_SUFFIX_ORIGIN.NlsoRandom; pub const IpSuffixOriginUnchanged = NL_SUFFIX_ORIGIN.IpSuffixOriginUnchanged; pub const NL_DAD_STATE = enum(i32) { NldsInvalid = 0, NldsTentative = 1, NldsDuplicate = 2, NldsDeprecated = 3, NldsPreferred = 4, // IpDadStateInvalid = 0, this enum value conflicts with NldsInvalid // IpDadStateTentative = 1, this enum value conflicts with NldsTentative // IpDadStateDuplicate = 2, this enum value conflicts with NldsDuplicate // IpDadStateDeprecated = 3, this enum value conflicts with NldsDeprecated // IpDadStatePreferred = 4, this enum value conflicts with NldsPreferred }; pub const NldsInvalid = NL_DAD_STATE.NldsInvalid; pub const NldsTentative = NL_DAD_STATE.NldsTentative; pub const NldsDuplicate = NL_DAD_STATE.NldsDuplicate; pub const NldsDeprecated = NL_DAD_STATE.NldsDeprecated; pub const NldsPreferred = NL_DAD_STATE.NldsPreferred; pub const IpDadStateInvalid = NL_DAD_STATE.NldsInvalid; pub const IpDadStateTentative = NL_DAD_STATE.NldsTentative; pub const IpDadStateDuplicate = NL_DAD_STATE.NldsDuplicate; pub const IpDadStateDeprecated = NL_DAD_STATE.NldsDeprecated; pub const IpDadStatePreferred = NL_DAD_STATE.NldsPreferred; pub const NL_ROUTE_PROTOCOL = enum(i32) { RouteProtocolOther = 1, RouteProtocolLocal = 2, RouteProtocolNetMgmt = 3, RouteProtocolIcmp = 4, RouteProtocolEgp = 5, RouteProtocolGgp = 6, RouteProtocolHello = 7, RouteProtocolRip = 8, RouteProtocolIsIs = 9, RouteProtocolEsIs = 10, RouteProtocolCisco = 11, RouteProtocolBbn = 12, RouteProtocolOspf = 13, RouteProtocolBgp = 14, RouteProtocolIdpr = 15, RouteProtocolEigrp = 16, RouteProtocolDvmrp = 17, RouteProtocolRpl = 18, RouteProtocolDhcp = 19, // MIB_IPPROTO_OTHER = 1, this enum value conflicts with RouteProtocolOther // PROTO_IP_OTHER = 1, this enum value conflicts with RouteProtocolOther // MIB_IPPROTO_LOCAL = 2, this enum value conflicts with RouteProtocolLocal // PROTO_IP_LOCAL = 2, this enum value conflicts with RouteProtocolLocal // MIB_IPPROTO_NETMGMT = 3, this enum value conflicts with RouteProtocolNetMgmt // PROTO_IP_NETMGMT = 3, this enum value conflicts with RouteProtocolNetMgmt // MIB_IPPROTO_ICMP = 4, this enum value conflicts with RouteProtocolIcmp // PROTO_IP_ICMP = 4, this enum value conflicts with RouteProtocolIcmp // MIB_IPPROTO_EGP = 5, this enum value conflicts with RouteProtocolEgp // PROTO_IP_EGP = 5, this enum value conflicts with RouteProtocolEgp // MIB_IPPROTO_GGP = 6, this enum value conflicts with RouteProtocolGgp // PROTO_IP_GGP = 6, this enum value conflicts with RouteProtocolGgp // MIB_IPPROTO_HELLO = 7, this enum value conflicts with RouteProtocolHello // PROTO_IP_HELLO = 7, this enum value conflicts with RouteProtocolHello // MIB_IPPROTO_RIP = 8, this enum value conflicts with RouteProtocolRip // PROTO_IP_RIP = 8, this enum value conflicts with RouteProtocolRip // MIB_IPPROTO_IS_IS = 9, this enum value conflicts with RouteProtocolIsIs // PROTO_IP_IS_IS = 9, this enum value conflicts with RouteProtocolIsIs // MIB_IPPROTO_ES_IS = 10, this enum value conflicts with RouteProtocolEsIs // PROTO_IP_ES_IS = 10, this enum value conflicts with RouteProtocolEsIs // MIB_IPPROTO_CISCO = 11, this enum value conflicts with RouteProtocolCisco // PROTO_IP_CISCO = 11, this enum value conflicts with RouteProtocolCisco // MIB_IPPROTO_BBN = 12, this enum value conflicts with RouteProtocolBbn // PROTO_IP_BBN = 12, this enum value conflicts with RouteProtocolBbn // MIB_IPPROTO_OSPF = 13, this enum value conflicts with RouteProtocolOspf // PROTO_IP_OSPF = 13, this enum value conflicts with RouteProtocolOspf // MIB_IPPROTO_BGP = 14, this enum value conflicts with RouteProtocolBgp // PROTO_IP_BGP = 14, this enum value conflicts with RouteProtocolBgp // MIB_IPPROTO_IDPR = 15, this enum value conflicts with RouteProtocolIdpr // PROTO_IP_IDPR = 15, this enum value conflicts with RouteProtocolIdpr // MIB_IPPROTO_EIGRP = 16, this enum value conflicts with RouteProtocolEigrp // PROTO_IP_EIGRP = 16, this enum value conflicts with RouteProtocolEigrp // MIB_IPPROTO_DVMRP = 17, this enum value conflicts with RouteProtocolDvmrp // PROTO_IP_DVMRP = 17, this enum value conflicts with RouteProtocolDvmrp // MIB_IPPROTO_RPL = 18, this enum value conflicts with RouteProtocolRpl // PROTO_IP_RPL = 18, this enum value conflicts with RouteProtocolRpl // MIB_IPPROTO_DHCP = 19, this enum value conflicts with RouteProtocolDhcp // PROTO_IP_DHCP = 19, this enum value conflicts with RouteProtocolDhcp MIB_IPPROTO_NT_AUTOSTATIC = 10002, // PROTO_IP_NT_AUTOSTATIC = 10002, this enum value conflicts with MIB_IPPROTO_NT_AUTOSTATIC MIB_IPPROTO_NT_STATIC = 10006, // PROTO_IP_NT_STATIC = 10006, this enum value conflicts with MIB_IPPROTO_NT_STATIC MIB_IPPROTO_NT_STATIC_NON_DOD = 10007, // PROTO_IP_NT_STATIC_NON_DOD = 10007, this enum value conflicts with MIB_IPPROTO_NT_STATIC_NON_DOD }; pub const RouteProtocolOther = NL_ROUTE_PROTOCOL.RouteProtocolOther; pub const RouteProtocolLocal = NL_ROUTE_PROTOCOL.RouteProtocolLocal; pub const RouteProtocolNetMgmt = NL_ROUTE_PROTOCOL.RouteProtocolNetMgmt; pub const RouteProtocolIcmp = NL_ROUTE_PROTOCOL.RouteProtocolIcmp; pub const RouteProtocolEgp = NL_ROUTE_PROTOCOL.RouteProtocolEgp; pub const RouteProtocolGgp = NL_ROUTE_PROTOCOL.RouteProtocolGgp; pub const RouteProtocolHello = NL_ROUTE_PROTOCOL.RouteProtocolHello; pub const RouteProtocolRip = NL_ROUTE_PROTOCOL.RouteProtocolRip; pub const RouteProtocolIsIs = NL_ROUTE_PROTOCOL.RouteProtocolIsIs; pub const RouteProtocolEsIs = NL_ROUTE_PROTOCOL.RouteProtocolEsIs; pub const RouteProtocolCisco = NL_ROUTE_PROTOCOL.RouteProtocolCisco; pub const RouteProtocolBbn = NL_ROUTE_PROTOCOL.RouteProtocolBbn; pub const RouteProtocolOspf = NL_ROUTE_PROTOCOL.RouteProtocolOspf; pub const RouteProtocolBgp = NL_ROUTE_PROTOCOL.RouteProtocolBgp; pub const RouteProtocolIdpr = NL_ROUTE_PROTOCOL.RouteProtocolIdpr; pub const RouteProtocolEigrp = NL_ROUTE_PROTOCOL.RouteProtocolEigrp; pub const RouteProtocolDvmrp = NL_ROUTE_PROTOCOL.RouteProtocolDvmrp; pub const RouteProtocolRpl = NL_ROUTE_PROTOCOL.RouteProtocolRpl; pub const RouteProtocolDhcp = NL_ROUTE_PROTOCOL.RouteProtocolDhcp; pub const MIB_IPPROTO_OTHER = NL_ROUTE_PROTOCOL.RouteProtocolOther; pub const PROTO_IP_OTHER = NL_ROUTE_PROTOCOL.RouteProtocolOther; pub const MIB_IPPROTO_LOCAL = NL_ROUTE_PROTOCOL.RouteProtocolLocal; pub const PROTO_IP_LOCAL = NL_ROUTE_PROTOCOL.RouteProtocolLocal; pub const MIB_IPPROTO_NETMGMT = NL_ROUTE_PROTOCOL.RouteProtocolNetMgmt; pub const PROTO_IP_NETMGMT = NL_ROUTE_PROTOCOL.RouteProtocolNetMgmt; pub const MIB_IPPROTO_ICMP = NL_ROUTE_PROTOCOL.RouteProtocolIcmp; pub const PROTO_IP_ICMP = NL_ROUTE_PROTOCOL.RouteProtocolIcmp; pub const MIB_IPPROTO_EGP = NL_ROUTE_PROTOCOL.RouteProtocolEgp; pub const PROTO_IP_EGP = NL_ROUTE_PROTOCOL.RouteProtocolEgp; pub const MIB_IPPROTO_GGP = NL_ROUTE_PROTOCOL.RouteProtocolGgp; pub const PROTO_IP_GGP = NL_ROUTE_PROTOCOL.RouteProtocolGgp; pub const MIB_IPPROTO_HELLO = NL_ROUTE_PROTOCOL.RouteProtocolHello; pub const PROTO_IP_HELLO = NL_ROUTE_PROTOCOL.RouteProtocolHello; pub const MIB_IPPROTO_RIP = NL_ROUTE_PROTOCOL.RouteProtocolRip; pub const PROTO_IP_RIP = NL_ROUTE_PROTOCOL.RouteProtocolRip; pub const MIB_IPPROTO_IS_IS = NL_ROUTE_PROTOCOL.RouteProtocolIsIs; pub const PROTO_IP_IS_IS = NL_ROUTE_PROTOCOL.RouteProtocolIsIs; pub const MIB_IPPROTO_ES_IS = NL_ROUTE_PROTOCOL.RouteProtocolEsIs; pub const PROTO_IP_ES_IS = NL_ROUTE_PROTOCOL.RouteProtocolEsIs; pub const MIB_IPPROTO_CISCO = NL_ROUTE_PROTOCOL.RouteProtocolCisco; pub const PROTO_IP_CISCO = NL_ROUTE_PROTOCOL.RouteProtocolCisco; pub const MIB_IPPROTO_BBN = NL_ROUTE_PROTOCOL.RouteProtocolBbn; pub const PROTO_IP_BBN = NL_ROUTE_PROTOCOL.RouteProtocolBbn; pub const MIB_IPPROTO_OSPF = NL_ROUTE_PROTOCOL.RouteProtocolOspf; pub const PROTO_IP_OSPF = NL_ROUTE_PROTOCOL.RouteProtocolOspf; pub const MIB_IPPROTO_BGP = NL_ROUTE_PROTOCOL.RouteProtocolBgp; pub const PROTO_IP_BGP = NL_ROUTE_PROTOCOL.RouteProtocolBgp; pub const MIB_IPPROTO_IDPR = NL_ROUTE_PROTOCOL.RouteProtocolIdpr; pub const PROTO_IP_IDPR = NL_ROUTE_PROTOCOL.RouteProtocolIdpr; pub const MIB_IPPROTO_EIGRP = NL_ROUTE_PROTOCOL.RouteProtocolEigrp; pub const PROTO_IP_EIGRP = NL_ROUTE_PROTOCOL.RouteProtocolEigrp; pub const MIB_IPPROTO_DVMRP = NL_ROUTE_PROTOCOL.RouteProtocolDvmrp; pub const PROTO_IP_DVMRP = NL_ROUTE_PROTOCOL.RouteProtocolDvmrp; pub const MIB_IPPROTO_RPL = NL_ROUTE_PROTOCOL.RouteProtocolRpl; pub const PROTO_IP_RPL = NL_ROUTE_PROTOCOL.RouteProtocolRpl; pub const MIB_IPPROTO_DHCP = NL_ROUTE_PROTOCOL.RouteProtocolDhcp; pub const PROTO_IP_DHCP = NL_ROUTE_PROTOCOL.RouteProtocolDhcp; pub const MIB_IPPROTO_NT_AUTOSTATIC = NL_ROUTE_PROTOCOL.MIB_IPPROTO_NT_AUTOSTATIC; pub const PROTO_IP_NT_AUTOSTATIC = NL_ROUTE_PROTOCOL.MIB_IPPROTO_NT_AUTOSTATIC; pub const MIB_IPPROTO_NT_STATIC = NL_ROUTE_PROTOCOL.MIB_IPPROTO_NT_STATIC; pub const PROTO_IP_NT_STATIC = NL_ROUTE_PROTOCOL.MIB_IPPROTO_NT_STATIC; pub const MIB_IPPROTO_NT_STATIC_NON_DOD = NL_ROUTE_PROTOCOL.MIB_IPPROTO_NT_STATIC_NON_DOD; pub const PROTO_IP_NT_STATIC_NON_DOD = NL_ROUTE_PROTOCOL.MIB_IPPROTO_NT_STATIC_NON_DOD; pub const NL_ADDRESS_TYPE = enum(i32) { Unspecified = 0, Unicast = 1, Anycast = 2, Multicast = 3, Broadcast = 4, Invalid = 5, }; pub const NlatUnspecified = NL_ADDRESS_TYPE.Unspecified; pub const NlatUnicast = NL_ADDRESS_TYPE.Unicast; pub const NlatAnycast = NL_ADDRESS_TYPE.Anycast; pub const NlatMulticast = NL_ADDRESS_TYPE.Multicast; pub const NlatBroadcast = NL_ADDRESS_TYPE.Broadcast; pub const NlatInvalid = NL_ADDRESS_TYPE.Invalid; pub const NL_ROUTE_ORIGIN = enum(i32) { Manual = 0, WellKnown = 1, DHCP = 2, RouterAdvertisement = 3, @"6to4" = 4, }; pub const NlroManual = NL_ROUTE_ORIGIN.Manual; pub const NlroWellKnown = NL_ROUTE_ORIGIN.WellKnown; pub const NlroDHCP = NL_ROUTE_ORIGIN.DHCP; pub const NlroRouterAdvertisement = NL_ROUTE_ORIGIN.RouterAdvertisement; pub const Nlro6to4 = NL_ROUTE_ORIGIN.@"6to4"; pub const NL_NEIGHBOR_STATE = enum(i32) { Unreachable = 0, Incomplete = 1, Probe = 2, Delay = 3, Stale = 4, Reachable = 5, Permanent = 6, Maximum = 7, }; pub const NlnsUnreachable = NL_NEIGHBOR_STATE.Unreachable; pub const NlnsIncomplete = NL_NEIGHBOR_STATE.Incomplete; pub const NlnsProbe = NL_NEIGHBOR_STATE.Probe; pub const NlnsDelay = NL_NEIGHBOR_STATE.Delay; pub const NlnsStale = NL_NEIGHBOR_STATE.Stale; pub const NlnsReachable = NL_NEIGHBOR_STATE.Reachable; pub const NlnsPermanent = NL_NEIGHBOR_STATE.Permanent; pub const NlnsMaximum = NL_NEIGHBOR_STATE.Maximum; pub const NL_LINK_LOCAL_ADDRESS_BEHAVIOR = enum(i32) { AlwaysOff = 0, Delayed = 1, AlwaysOn = 2, Unchanged = -1, }; pub const LinkLocalAlwaysOff = NL_LINK_LOCAL_ADDRESS_BEHAVIOR.AlwaysOff; pub const LinkLocalDelayed = NL_LINK_LOCAL_ADDRESS_BEHAVIOR.Delayed; pub const LinkLocalAlwaysOn = NL_LINK_LOCAL_ADDRESS_BEHAVIOR.AlwaysOn; pub const LinkLocalUnchanged = NL_LINK_LOCAL_ADDRESS_BEHAVIOR.Unchanged; pub const NL_INTERFACE_OFFLOAD_ROD = extern struct { _bitfield: u8, }; pub const NL_ROUTER_DISCOVERY_BEHAVIOR = enum(i32) { Disabled = 0, Enabled = 1, Dhcp = 2, Unchanged = -1, }; pub const RouterDiscoveryDisabled = NL_ROUTER_DISCOVERY_BEHAVIOR.Disabled; pub const RouterDiscoveryEnabled = NL_ROUTER_DISCOVERY_BEHAVIOR.Enabled; pub const RouterDiscoveryDhcp = NL_ROUTER_DISCOVERY_BEHAVIOR.Dhcp; pub const RouterDiscoveryUnchanged = NL_ROUTER_DISCOVERY_BEHAVIOR.Unchanged; pub const NL_BANDWIDTH_FLAG = enum(i32) { Disabled = 0, Enabled = 1, Unchanged = -1, }; pub const NlbwDisabled = NL_BANDWIDTH_FLAG.Disabled; pub const NlbwEnabled = NL_BANDWIDTH_FLAG.Enabled; pub const NlbwUnchanged = NL_BANDWIDTH_FLAG.Unchanged; pub const NL_PATH_BANDWIDTH_ROD = extern struct { Bandwidth: u64, Instability: u64, BandwidthPeaked: BOOLEAN, }; pub const NL_NETWORK_CATEGORY = enum(i32) { Public = 0, Private = 1, DomainAuthenticated = 2, Unchanged = -1, // Unknown = -1, this enum value conflicts with Unchanged }; pub const NetworkCategoryPublic = NL_NETWORK_CATEGORY.Public; pub const NetworkCategoryPrivate = NL_NETWORK_CATEGORY.Private; pub const NetworkCategoryDomainAuthenticated = NL_NETWORK_CATEGORY.DomainAuthenticated; pub const NetworkCategoryUnchanged = NL_NETWORK_CATEGORY.Unchanged; pub const NetworkCategoryUnknown = NL_NETWORK_CATEGORY.Unchanged; pub const NL_INTERFACE_NETWORK_CATEGORY_STATE = enum(i32) { CategoryUnknown = 0, Public = 1, Private = 2, DomainAuthenticated = 3, CategoryStateMax = 4, }; pub const NlincCategoryUnknown = NL_INTERFACE_NETWORK_CATEGORY_STATE.CategoryUnknown; pub const NlincPublic = NL_INTERFACE_NETWORK_CATEGORY_STATE.Public; pub const NlincPrivate = NL_INTERFACE_NETWORK_CATEGORY_STATE.Private; pub const NlincDomainAuthenticated = NL_INTERFACE_NETWORK_CATEGORY_STATE.DomainAuthenticated; pub const NlincCategoryStateMax = NL_INTERFACE_NETWORK_CATEGORY_STATE.CategoryStateMax; pub const NL_NETWORK_CONNECTIVITY_LEVEL_HINT = enum(i32) { Unknown = 0, None = 1, LocalAccess = 2, InternetAccess = 3, ConstrainedInternetAccess = 4, Hidden = 5, }; pub const NetworkConnectivityLevelHintUnknown = NL_NETWORK_CONNECTIVITY_LEVEL_HINT.Unknown; pub const NetworkConnectivityLevelHintNone = NL_NETWORK_CONNECTIVITY_LEVEL_HINT.None; pub const NetworkConnectivityLevelHintLocalAccess = NL_NETWORK_CONNECTIVITY_LEVEL_HINT.LocalAccess; pub const NetworkConnectivityLevelHintInternetAccess = NL_NETWORK_CONNECTIVITY_LEVEL_HINT.InternetAccess; pub const NetworkConnectivityLevelHintConstrainedInternetAccess = NL_NETWORK_CONNECTIVITY_LEVEL_HINT.ConstrainedInternetAccess; pub const NetworkConnectivityLevelHintHidden = NL_NETWORK_CONNECTIVITY_LEVEL_HINT.Hidden; pub const NL_NETWORK_CONNECTIVITY_COST_HINT = enum(i32) { Unknown = 0, Unrestricted = 1, Fixed = 2, Variable = 3, }; pub const NetworkConnectivityCostHintUnknown = NL_NETWORK_CONNECTIVITY_COST_HINT.Unknown; pub const NetworkConnectivityCostHintUnrestricted = NL_NETWORK_CONNECTIVITY_COST_HINT.Unrestricted; pub const NetworkConnectivityCostHintFixed = NL_NETWORK_CONNECTIVITY_COST_HINT.Fixed; pub const NetworkConnectivityCostHintVariable = NL_NETWORK_CONNECTIVITY_COST_HINT.Variable; pub const NL_NETWORK_CONNECTIVITY_HINT = extern struct { ConnectivityLevel: NL_NETWORK_CONNECTIVITY_LEVEL_HINT, ConnectivityCost: NL_NETWORK_CONNECTIVITY_COST_HINT, ApproachingDataLimit: BOOLEAN, OverDataLimit: BOOLEAN, Roaming: BOOLEAN, }; pub const NL_BANDWIDTH_INFORMATION = extern struct { Bandwidth: u64, Instability: u64, BandwidthPeaked: BOOLEAN, }; pub const TCPSTATE = enum(i32) { CLOSED = 0, LISTEN = 1, SYN_SENT = 2, SYN_RCVD = 3, ESTABLISHED = 4, FIN_WAIT_1 = 5, FIN_WAIT_2 = 6, CLOSE_WAIT = 7, CLOSING = 8, LAST_ACK = 9, TIME_WAIT = 10, MAX = 11, }; pub const TCPSTATE_CLOSED = TCPSTATE.CLOSED; pub const TCPSTATE_LISTEN = TCPSTATE.LISTEN; pub const TCPSTATE_SYN_SENT = TCPSTATE.SYN_SENT; pub const TCPSTATE_SYN_RCVD = TCPSTATE.SYN_RCVD; pub const TCPSTATE_ESTABLISHED = TCPSTATE.ESTABLISHED; pub const TCPSTATE_FIN_WAIT_1 = TCPSTATE.FIN_WAIT_1; pub const TCPSTATE_FIN_WAIT_2 = TCPSTATE.FIN_WAIT_2; pub const TCPSTATE_CLOSE_WAIT = TCPSTATE.CLOSE_WAIT; pub const TCPSTATE_CLOSING = TCPSTATE.CLOSING; pub const TCPSTATE_LAST_ACK = TCPSTATE.LAST_ACK; pub const TCPSTATE_TIME_WAIT = TCPSTATE.TIME_WAIT; pub const TCPSTATE_MAX = TCPSTATE.MAX; pub const TRANSPORT_SETTING_ID = extern struct { Guid: Guid, }; pub const tcp_keepalive = extern struct { onoff: u32, keepalivetime: u32, keepaliveinterval: u32, }; pub const CONTROL_CHANNEL_TRIGGER_STATUS = enum(i32) { INVALID = 0, SOFTWARE_SLOT_ALLOCATED = 1, HARDWARE_SLOT_ALLOCATED = 2, POLICY_ERROR = 3, SYSTEM_ERROR = 4, TRANSPORT_DISCONNECTED = 5, SERVICE_UNAVAILABLE = 6, }; pub const CONTROL_CHANNEL_TRIGGER_STATUS_INVALID = CONTROL_CHANNEL_TRIGGER_STATUS.INVALID; pub const CONTROL_CHANNEL_TRIGGER_STATUS_SOFTWARE_SLOT_ALLOCATED = CONTROL_CHANNEL_TRIGGER_STATUS.SOFTWARE_SLOT_ALLOCATED; pub const CONTROL_CHANNEL_TRIGGER_STATUS_HARDWARE_SLOT_ALLOCATED = CONTROL_CHANNEL_TRIGGER_STATUS.HARDWARE_SLOT_ALLOCATED; pub const CONTROL_CHANNEL_TRIGGER_STATUS_POLICY_ERROR = CONTROL_CHANNEL_TRIGGER_STATUS.POLICY_ERROR; pub const CONTROL_CHANNEL_TRIGGER_STATUS_SYSTEM_ERROR = CONTROL_CHANNEL_TRIGGER_STATUS.SYSTEM_ERROR; pub const CONTROL_CHANNEL_TRIGGER_STATUS_TRANSPORT_DISCONNECTED = CONTROL_CHANNEL_TRIGGER_STATUS.TRANSPORT_DISCONNECTED; pub const CONTROL_CHANNEL_TRIGGER_STATUS_SERVICE_UNAVAILABLE = CONTROL_CHANNEL_TRIGGER_STATUS.SERVICE_UNAVAILABLE; pub const REAL_TIME_NOTIFICATION_SETTING_INPUT = extern struct { TransportSettingId: TRANSPORT_SETTING_ID, BrokerEventGuid: Guid, }; pub const REAL_TIME_NOTIFICATION_SETTING_INPUT_EX = extern struct { TransportSettingId: TRANSPORT_SETTING_ID, BrokerEventGuid: Guid, Unmark: BOOLEAN, }; pub const REAL_TIME_NOTIFICATION_SETTING_OUTPUT = extern struct { ChannelStatus: CONTROL_CHANNEL_TRIGGER_STATUS, }; pub const ASSOCIATE_NAMERES_CONTEXT_INPUT = extern struct { TransportSettingId: TRANSPORT_SETTING_ID, Handle: u64, }; pub const TIMESTAMPING_CONFIG = extern struct { Flags: u32, TxTimestampsBuffered: u16, }; pub const SOCKET_PRIORITY_HINT = enum(i32) { PriorityHintVeryLow = 0, PriorityHintLow = 1, PriorityHintNormal = 2, MaximumPriorityHintType = 3, }; pub const SocketPriorityHintVeryLow = SOCKET_PRIORITY_HINT.PriorityHintVeryLow; pub const SocketPriorityHintLow = SOCKET_PRIORITY_HINT.PriorityHintLow; pub const SocketPriorityHintNormal = SOCKET_PRIORITY_HINT.PriorityHintNormal; pub const SocketMaximumPriorityHintType = SOCKET_PRIORITY_HINT.MaximumPriorityHintType; pub const PRIORITY_STATUS = extern struct { Sender: SOCKET_PRIORITY_HINT, Receiver: SOCKET_PRIORITY_HINT, }; pub const RCVALL_VALUE = enum(i32) { OFF = 0, ON = 1, SOCKETLEVELONLY = 2, IPLEVEL = 3, }; pub const RCVALL_OFF = RCVALL_VALUE.OFF; pub const RCVALL_ON = RCVALL_VALUE.ON; pub const RCVALL_SOCKETLEVELONLY = RCVALL_VALUE.SOCKETLEVELONLY; pub const RCVALL_IPLEVEL = RCVALL_VALUE.IPLEVEL; pub const RCVALL_IF = extern struct { Mode: RCVALL_VALUE, Interface: u32, }; pub const TCP_INITIAL_RTO_PARAMETERS = extern struct { Rtt: u16, MaxSynRetransmissions: u8, }; pub const TCP_ICW_LEVEL = enum(i32) { DEFAULT = 0, HIGH = 1, VERY_HIGH = 2, AGGRESSIVE = 3, EXPERIMENTAL = 4, COMPAT = 254, MAX = 255, }; pub const TCP_ICW_LEVEL_DEFAULT = TCP_ICW_LEVEL.DEFAULT; pub const TCP_ICW_LEVEL_HIGH = TCP_ICW_LEVEL.HIGH; pub const TCP_ICW_LEVEL_VERY_HIGH = TCP_ICW_LEVEL.VERY_HIGH; pub const TCP_ICW_LEVEL_AGGRESSIVE = TCP_ICW_LEVEL.AGGRESSIVE; pub const TCP_ICW_LEVEL_EXPERIMENTAL = TCP_ICW_LEVEL.EXPERIMENTAL; pub const TCP_ICW_LEVEL_COMPAT = TCP_ICW_LEVEL.COMPAT; pub const TCP_ICW_LEVEL_MAX = TCP_ICW_LEVEL.MAX; pub const TCP_ICW_PARAMETERS = extern struct { Level: TCP_ICW_LEVEL, }; pub const TCP_ACK_FREQUENCY_PARAMETERS = extern struct { TcpDelayedAckFrequency: u8, }; pub const TCP_INFO_v0 = extern struct { State: TCPSTATE, Mss: u32, ConnectionTimeMs: u64, TimestampsEnabled: BOOLEAN, RttUs: u32, MinRttUs: u32, BytesInFlight: u32, Cwnd: u32, SndWnd: u32, RcvWnd: u32, RcvBuf: u32, BytesOut: u64, BytesIn: u64, BytesReordered: u32, BytesRetrans: u32, FastRetrans: u32, DupAcksIn: u32, TimeoutEpisodes: u32, SynRetrans: u8, }; pub const TCP_INFO_v1 = extern struct { State: TCPSTATE, Mss: u32, ConnectionTimeMs: u64, TimestampsEnabled: BOOLEAN, RttUs: u32, MinRttUs: u32, BytesInFlight: u32, Cwnd: u32, SndWnd: u32, RcvWnd: u32, RcvBuf: u32, BytesOut: u64, BytesIn: u64, BytesReordered: u32, BytesRetrans: u32, FastRetrans: u32, DupAcksIn: u32, TimeoutEpisodes: u32, SynRetrans: u8, SndLimTransRwin: u32, SndLimTimeRwin: u32, SndLimBytesRwin: u64, SndLimTransCwnd: u32, SndLimTimeCwnd: u32, SndLimBytesCwnd: u64, SndLimTransSnd: u32, SndLimTimeSnd: u32, SndLimBytesSnd: u64, }; pub const INET_PORT_RANGE = extern struct { StartPort: u16, NumberOfPorts: u16, }; pub const INET_PORT_RESERVATION_TOKEN = extern struct { Token: u64, }; pub const INET_PORT_RESERVATION_INSTANCE = extern struct { Reservation: INET_PORT_RANGE, Token: INET_PORT_RESERVATION_TOKEN, }; pub const INET_PORT_RESERVATION_INFORMATION = extern struct { OwningPid: u32, }; pub const SOCKET_USAGE_TYPE = enum(i32) { T = 1, }; pub const SYSTEM_CRITICAL_SOCKET = SOCKET_USAGE_TYPE.T; pub const SOCKET_SECURITY_PROTOCOL = enum(i32) { DEFAULT = 0, IPSEC = 1, IPSEC2 = 2, INVALID = 3, }; pub const SOCKET_SECURITY_PROTOCOL_DEFAULT = SOCKET_SECURITY_PROTOCOL.DEFAULT; pub const SOCKET_SECURITY_PROTOCOL_IPSEC = SOCKET_SECURITY_PROTOCOL.IPSEC; pub const SOCKET_SECURITY_PROTOCOL_IPSEC2 = SOCKET_SECURITY_PROTOCOL.IPSEC2; pub const SOCKET_SECURITY_PROTOCOL_INVALID = SOCKET_SECURITY_PROTOCOL.INVALID; pub const SOCKET_SECURITY_SETTINGS = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, SecurityFlags: u32, }; pub const SOCKET_SECURITY_SETTINGS_IPSEC = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, SecurityFlags: u32, IpsecFlags: u32, AuthipMMPolicyKey: Guid, AuthipQMPolicyKey: Guid, Reserved: Guid, Reserved2: u64, UserNameStringLen: u32, DomainNameStringLen: u32, PasswordStringLen: u32, AllStrings: [1]u16, }; pub const SOCKET_PEER_TARGET_NAME = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, PeerAddress: SOCKADDR_STORAGE, PeerTargetNameStringLen: u32, AllStrings: [1]u16, }; pub const SOCKET_SECURITY_QUERY_TEMPLATE = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, PeerAddress: SOCKADDR_STORAGE, PeerTokenAccessMask: u32, }; pub const SOCKET_SECURITY_QUERY_TEMPLATE_IPSEC2 = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, PeerAddress: SOCKADDR_STORAGE, PeerTokenAccessMask: u32, Flags: u32, FieldMask: u32, }; pub const SOCKET_SECURITY_QUERY_INFO = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, Flags: u32, PeerApplicationAccessTokenHandle: u64, PeerMachineAccessTokenHandle: u64, }; pub const SOCKET_SECURITY_QUERY_INFO_IPSEC2 = extern struct { SecurityProtocol: SOCKET_SECURITY_PROTOCOL, Flags: u32, PeerApplicationAccessTokenHandle: u64, PeerMachineAccessTokenHandle: u64, MmSaId: u64, QmSaId: u64, NegotiationWinerr: u32, SaLookupContext: Guid, }; pub const RSS_SCALABILITY_INFO = extern struct { RssEnabled: BOOLEAN, }; pub const WSA_COMPATIBILITY_BEHAVIOR_ID = enum(i32) { All = 0, ReceiveBuffering = 1, AutoTuning = 2, }; pub const WsaBehaviorAll = WSA_COMPATIBILITY_BEHAVIOR_ID.All; pub const WsaBehaviorReceiveBuffering = WSA_COMPATIBILITY_BEHAVIOR_ID.ReceiveBuffering; pub const WsaBehaviorAutoTuning = WSA_COMPATIBILITY_BEHAVIOR_ID.AutoTuning; pub const WSA_COMPATIBILITY_MODE = extern struct { BehaviorId: WSA_COMPATIBILITY_BEHAVIOR_ID, TargetOsVersion: u32, }; pub const RIORESULT = extern struct { Status: i32, BytesTransferred: u32, SocketContext: u64, RequestContext: u64, }; pub const RIO_BUF = extern struct { BufferId: ?*RIO_BUFFERID_t, Offset: u32, Length: u32, }; pub const RIO_CMSG_BUFFER = extern struct { TotalLength: u32, }; pub const ATM_ADDRESS = extern struct { AddressType: u32, NumofDigits: u32, Addr: [20]u8, }; pub const ATM_BLLI = extern struct { Layer2Protocol: u32, Layer2UserSpecifiedProtocol: u32, Layer3Protocol: u32, Layer3UserSpecifiedProtocol: u32, Layer3IPI: u32, SnapID: [5]u8, }; pub const ATM_BHLI = extern struct { HighLayerInfoType: u32, HighLayerInfoLength: u32, HighLayerInfo: [8]u8, }; pub const sockaddr_atm = extern struct { satm_family: u16, satm_number: ATM_ADDRESS, satm_blli: ATM_BLLI, satm_bhli: ATM_BHLI, }; pub const Q2931_IE_TYPE = enum(i32) { AALParameters = 0, TrafficDescriptor = 1, BroadbandBearerCapability = 2, BHLI = 3, BLLI = 4, CalledPartyNumber = 5, CalledPartySubaddress = 6, CallingPartyNumber = 7, CallingPartySubaddress = 8, Cause = 9, QOSClass = 10, TransitNetworkSelection = 11, }; pub const IE_AALParameters = Q2931_IE_TYPE.AALParameters; pub const IE_TrafficDescriptor = Q2931_IE_TYPE.TrafficDescriptor; pub const IE_BroadbandBearerCapability = Q2931_IE_TYPE.BroadbandBearerCapability; pub const IE_BHLI = Q2931_IE_TYPE.BHLI; pub const IE_BLLI = Q2931_IE_TYPE.BLLI; pub const IE_CalledPartyNumber = Q2931_IE_TYPE.CalledPartyNumber; pub const IE_CalledPartySubaddress = Q2931_IE_TYPE.CalledPartySubaddress; pub const IE_CallingPartyNumber = Q2931_IE_TYPE.CallingPartyNumber; pub const IE_CallingPartySubaddress = Q2931_IE_TYPE.CallingPartySubaddress; pub const IE_Cause = Q2931_IE_TYPE.Cause; pub const IE_QOSClass = Q2931_IE_TYPE.QOSClass; pub const IE_TransitNetworkSelection = Q2931_IE_TYPE.TransitNetworkSelection; pub const Q2931_IE = extern struct { IEType: Q2931_IE_TYPE, IELength: u32, IE: [1]u8, }; pub const AAL_TYPE = enum(i32) { @"5" = 5, USER = 16, }; pub const AALTYPE_5 = AAL_TYPE.@"5"; pub const AALTYPE_USER = AAL_TYPE.USER; pub const AAL5_PARAMETERS = extern struct { ForwardMaxCPCSSDUSize: u32, BackwardMaxCPCSSDUSize: u32, Mode: u8, SSCSType: u8, }; pub const AALUSER_PARAMETERS = extern struct { UserDefined: u32, }; pub const AAL_PARAMETERS_IE = extern struct { AALType: AAL_TYPE, AALSpecificParameters: extern union { AAL5Parameters: AAL5_PARAMETERS, AALUserParameters: AALUSER_PARAMETERS, }, }; pub const ATM_TD = extern struct { PeakCellRate_CLP0: u32, PeakCellRate_CLP01: u32, SustainableCellRate_CLP0: u32, SustainableCellRate_CLP01: u32, MaxBurstSize_CLP0: u32, MaxBurstSize_CLP01: u32, Tagging: BOOL, }; pub const ATM_TRAFFIC_DESCRIPTOR_IE = extern struct { Forward: ATM_TD, Backward: ATM_TD, BestEffort: BOOL, }; pub const ATM_BROADBAND_BEARER_CAPABILITY_IE = extern struct { BearerClass: u8, TrafficType: u8, TimingRequirements: u8, ClippingSusceptability: u8, UserPlaneConnectionConfig: u8, }; pub const ATM_BLLI_IE = extern struct { Layer2Protocol: u32, Layer2Mode: u8, Layer2WindowSize: u8, Layer2UserSpecifiedProtocol: u32, Layer3Protocol: u32, Layer3Mode: u8, Layer3DefaultPacketSize: u8, Layer3PacketWindowSize: u8, Layer3UserSpecifiedProtocol: u32, Layer3IPI: u32, SnapID: [5]u8, }; pub const ATM_CALLING_PARTY_NUMBER_IE = extern struct { ATM_Number: ATM_ADDRESS, Presentation_Indication: u8, Screening_Indicator: u8, }; pub const ATM_CAUSE_IE = extern struct { Location: u8, Cause: u8, DiagnosticsLength: u8, Diagnostics: [4]u8, }; pub const ATM_QOS_CLASS_IE = extern struct { QOSClassForward: u8, QOSClassBackward: u8, }; pub const ATM_TRANSIT_NETWORK_SELECTION_IE = extern struct { TypeOfNetworkId: u8, NetworkIdPlan: u8, NetworkIdLength: u8, NetworkId: [1]u8, }; pub const ATM_CONNECTION_ID = extern struct { DeviceNumber: u32, VPI: u32, VCI: u32, }; pub const ATM_PVC_PARAMS = extern struct { // WARNING: unable to add field alignment because it's causing a compiler bug PvcConnectionId: ATM_CONNECTION_ID, PvcQos: QOS, }; pub const NAPI_PROVIDER_TYPE = enum(i32) { Application = 1, Service = 2, }; pub const ProviderType_Application = NAPI_PROVIDER_TYPE.Application; pub const ProviderType_Service = NAPI_PROVIDER_TYPE.Service; pub const NAPI_PROVIDER_LEVEL = enum(i32) { None = 0, Secondary = 1, Primary = 2, }; pub const ProviderLevel_None = NAPI_PROVIDER_LEVEL.None; pub const ProviderLevel_Secondary = NAPI_PROVIDER_LEVEL.Secondary; pub const ProviderLevel_Primary = NAPI_PROVIDER_LEVEL.Primary; pub const NAPI_DOMAIN_DESCRIPTION_BLOB = extern struct { AuthLevel: u32, cchDomainName: u32, OffsetNextDomainDescription: u32, OffsetThisDomainName: u32, }; pub const NAPI_PROVIDER_INSTALLATION_BLOB = extern struct { dwVersion: u32, dwProviderType: u32, fSupportsWildCard: u32, cDomains: u32, OffsetFirstDomain: u32, }; pub const TRANSMIT_FILE_BUFFERS = extern struct { Head: ?*anyopaque, HeadLength: u32, Tail: ?*anyopaque, TailLength: u32, }; pub const LPFN_TRANSMITFILE = fn( hSocket: ?SOCKET, hFile: ?HANDLE, nNumberOfBytesToWrite: u32, nNumberOfBytesPerSend: u32, lpOverlapped: ?*OVERLAPPED, lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_ACCEPTEX = fn( sListenSocket: ?SOCKET, sAcceptSocket: ?SOCKET, lpOutputBuffer: ?*anyopaque, dwReceiveDataLength: u32, dwLocalAddressLength: u32, dwRemoteAddressLength: u32, lpdwBytesReceived: ?*u32, lpOverlapped: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_GETACCEPTEXSOCKADDRS = fn( lpOutputBuffer: ?*anyopaque, dwReceiveDataLength: u32, dwLocalAddressLength: u32, dwRemoteAddressLength: u32, LocalSockaddr: ?*?*SOCKADDR, LocalSockaddrLength: ?*i32, RemoteSockaddr: ?*?*SOCKADDR, RemoteSockaddrLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const TRANSMIT_PACKETS_ELEMENT = extern struct { dwElFlags: u32, cLength: u32, Anonymous: extern union { Anonymous: extern struct { nFileOffset: LARGE_INTEGER, hFile: ?HANDLE, }, pBuffer: ?*anyopaque, }, }; pub const LPFN_TRANSMITPACKETS = fn( hSocket: ?SOCKET, lpPacketArray: ?*TRANSMIT_PACKETS_ELEMENT, nElementCount: u32, nSendSize: u32, lpOverlapped: ?*OVERLAPPED, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_CONNECTEX = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, // TODO: what to do with BytesParamIndex 4? lpSendBuffer: ?*anyopaque, dwSendDataLength: u32, lpdwBytesSent: ?*u32, lpOverlapped: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_DISCONNECTEX = fn( s: ?SOCKET, lpOverlapped: ?*OVERLAPPED, dwFlags: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const NLA_BLOB_DATA_TYPE = enum(i32) { RAW_DATA = 0, INTERFACE = 1, @"802_1X_LOCATION" = 2, CONNECTIVITY = 3, ICS = 4, }; pub const NLA_RAW_DATA = NLA_BLOB_DATA_TYPE.RAW_DATA; pub const NLA_INTERFACE = NLA_BLOB_DATA_TYPE.INTERFACE; pub const NLA_802_1X_LOCATION = NLA_BLOB_DATA_TYPE.@"802_1X_LOCATION"; pub const NLA_CONNECTIVITY = NLA_BLOB_DATA_TYPE.CONNECTIVITY; pub const NLA_ICS = NLA_BLOB_DATA_TYPE.ICS; pub const NLA_CONNECTIVITY_TYPE = enum(i32) { AD_HOC = 0, MANAGED = 1, UNMANAGED = 2, UNKNOWN = 3, }; pub const NLA_NETWORK_AD_HOC = NLA_CONNECTIVITY_TYPE.AD_HOC; pub const NLA_NETWORK_MANAGED = NLA_CONNECTIVITY_TYPE.MANAGED; pub const NLA_NETWORK_UNMANAGED = NLA_CONNECTIVITY_TYPE.UNMANAGED; pub const NLA_NETWORK_UNKNOWN = NLA_CONNECTIVITY_TYPE.UNKNOWN; pub const NLA_INTERNET = enum(i32) { UNKNOWN = 0, NO = 1, YES = 2, }; pub const NLA_INTERNET_UNKNOWN = NLA_INTERNET.UNKNOWN; pub const NLA_INTERNET_NO = NLA_INTERNET.NO; pub const NLA_INTERNET_YES = NLA_INTERNET.YES; pub const NLA_BLOB = extern struct { header: extern struct { type: NLA_BLOB_DATA_TYPE, dwSize: u32, nextOffset: u32, }, data: extern union { rawData: [1]CHAR, interfaceData: extern struct { dwType: u32, dwSpeed: u32, adapterName: [1]CHAR, }, locationData: extern struct { information: [1]CHAR, }, connectivity: extern struct { type: NLA_CONNECTIVITY_TYPE, internet: NLA_INTERNET, }, ICS: extern struct { remote: extern struct { speed: u32, type: u32, state: u32, machineName: [256]u16, sharedAdapterName: [256]u16, }, }, }, }; pub const LPFN_WSARECVMSG = fn( s: ?SOCKET, lpMsg: ?*WSAMSG, lpdwNumberOfBytesRecvd: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const WSAPOLLDATA = extern struct { result: i32, fds: u32, timeout: i32, fdArray: [1]WSAPOLLFD, }; pub const WSASENDMSG = extern struct { lpMsg: ?*WSAMSG, dwFlags: u32, lpNumberOfBytesSent: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, }; pub const LPFN_WSASENDMSG = fn( s: ?SOCKET, lpMsg: ?*WSAMSG, dwFlags: u32, lpNumberOfBytesSent: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPFN_WSAPOLL = fn( fdarray: ?*WSAPOLLFD, nfds: u32, timeout: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPFN_RIORECEIVE = fn( SocketQueue: ?*RIO_RQ_t, pData: [*]RIO_BUF, DataBufferCount: u32, Flags: u32, RequestContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_RIORECEIVEEX = fn( SocketQueue: ?*RIO_RQ_t, pData: [*]RIO_BUF, DataBufferCount: u32, pLocalAddress: ?*RIO_BUF, pRemoteAddress: ?*RIO_BUF, pControlContext: ?*RIO_BUF, pFlags: ?*RIO_BUF, Flags: u32, RequestContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPFN_RIOSEND = fn( SocketQueue: ?*RIO_RQ_t, pData: [*]RIO_BUF, DataBufferCount: u32, Flags: u32, RequestContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_RIOSENDEX = fn( SocketQueue: ?*RIO_RQ_t, pData: [*]RIO_BUF, DataBufferCount: u32, pLocalAddress: ?*RIO_BUF, pRemoteAddress: ?*RIO_BUF, pControlContext: ?*RIO_BUF, pFlags: ?*RIO_BUF, Flags: u32, RequestContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_RIOCLOSECOMPLETIONQUEUE = fn( CQ: ?*RIO_CQ_t, ) callconv(@import("std").os.windows.WINAPI) void; pub const RIO_NOTIFICATION_COMPLETION_TYPE = enum(i32) { EVENT_COMPLETION = 1, IOCP_COMPLETION = 2, }; pub const RIO_EVENT_COMPLETION = RIO_NOTIFICATION_COMPLETION_TYPE.EVENT_COMPLETION; pub const RIO_IOCP_COMPLETION = RIO_NOTIFICATION_COMPLETION_TYPE.IOCP_COMPLETION; pub const RIO_NOTIFICATION_COMPLETION = extern struct { Type: RIO_NOTIFICATION_COMPLETION_TYPE, Anonymous: extern union { Event: extern struct { EventHandle: ?HANDLE, NotifyReset: BOOL, }, Iocp: extern struct { IocpHandle: ?HANDLE, CompletionKey: ?*anyopaque, Overlapped: ?*anyopaque, }, }, }; pub const LPFN_RIOCREATECOMPLETIONQUEUE = fn( QueueSize: u32, NotificationCompletion: ?*RIO_NOTIFICATION_COMPLETION, ) callconv(@import("std").os.windows.WINAPI) ?*RIO_CQ_t; pub const LPFN_RIOCREATEREQUESTQUEUE = fn( Socket: ?SOCKET, MaxOutstandingReceive: u32, MaxReceiveDataBuffers: u32, MaxOutstandingSend: u32, MaxSendDataBuffers: u32, ReceiveCQ: ?*RIO_CQ_t, SendCQ: ?*RIO_CQ_t, SocketContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*RIO_RQ_t; pub const LPFN_RIODEQUEUECOMPLETION = fn( CQ: ?*RIO_CQ_t, Array: [*]RIORESULT, ArraySize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPFN_RIODEREGISTERBUFFER = fn( BufferId: ?*RIO_BUFFERID_t, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPFN_RIONOTIFY = fn( CQ: ?*RIO_CQ_t, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPFN_RIOREGISTERBUFFER = fn( DataBuffer: ?[*]u8, DataLength: u32, ) callconv(@import("std").os.windows.WINAPI) ?*RIO_BUFFERID_t; pub const LPFN_RIORESIZECOMPLETIONQUEUE = fn( CQ: ?*RIO_CQ_t, QueueSize: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPFN_RIORESIZEREQUESTQUEUE = fn( RQ: ?*RIO_RQ_t, MaxOutstandingReceive: u32, MaxOutstandingSend: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const RIO_EXTENSION_FUNCTION_TABLE = extern struct { cbSize: u32, RIOReceive: ?LPFN_RIORECEIVE, RIOReceiveEx: ?LPFN_RIORECEIVEEX, RIOSend: ?LPFN_RIOSEND, RIOSendEx: ?LPFN_RIOSENDEX, RIOCloseCompletionQueue: ?LPFN_RIOCLOSECOMPLETIONQUEUE, RIOCreateCompletionQueue: ?LPFN_RIOCREATECOMPLETIONQUEUE, RIOCreateRequestQueue: ?LPFN_RIOCREATEREQUESTQUEUE, RIODequeueCompletion: ?LPFN_RIODEQUEUECOMPLETION, RIODeregisterBuffer: ?LPFN_RIODEREGISTERBUFFER, RIONotify: ?LPFN_RIONOTIFY, RIORegisterBuffer: ?LPFN_RIOREGISTERBUFFER, RIOResizeCompletionQueue: ?LPFN_RIORESIZECOMPLETIONQUEUE, RIOResizeRequestQueue: ?LPFN_RIORESIZEREQUESTQUEUE, }; pub const WSPData = extern struct { wVersion: u16, wHighVersion: u16, szDescription: [256]u16, }; pub const WSATHREADID = extern struct { ThreadHandle: ?HANDLE, Reserved: usize, }; pub const LPBLOCKINGCALLBACK = fn( dwContext: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWSAUSERAPC = fn( dwContext: usize, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPWSPACCEPT = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? addr: ?*SOCKADDR, addrlen: ?*i32, lpfnCondition: ?LPCONDITIONPROC, dwCallbackData: usize, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; pub const LPWSPADDRESSTOSTRING = fn( // TODO: what to do with BytesParamIndex 1? lpsaAddress: ?*SOCKADDR, dwAddressLength: u32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, lpszAddressString: [*:0]u16, lpdwAddressStringLength: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPASYNCSELECT = fn( s: ?SOCKET, hWnd: ?HWND, wMsg: u32, lEvent: i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPBIND = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPCANCELBLOCKINGCALL = fn( lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPCLEANUP = fn( lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPCLOSESOCKET = fn( s: ?SOCKET, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPCONNECT = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, lpCallerData: ?*WSABUF, lpCalleeData: ?*WSABUF, lpSQOS: ?*QOS, lpGQOS: ?*QOS, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPDUPLICATESOCKET = fn( s: ?SOCKET, dwProcessId: u32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPENUMNETWORKEVENTS = fn( s: ?SOCKET, hEventObject: ?HANDLE, lpNetworkEvents: ?*WSANETWORKEVENTS, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPEVENTSELECT = fn( s: ?SOCKET, hEventObject: ?HANDLE, lNetworkEvents: i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPGETOVERLAPPEDRESULT = fn( s: ?SOCKET, lpOverlapped: ?*OVERLAPPED, lpcbTransfer: ?*u32, fWait: BOOL, lpdwFlags: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWSPGETPEERNAME = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*SOCKADDR, namelen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPGETSOCKNAME = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*SOCKADDR, namelen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPGETSOCKOPT = fn( s: ?SOCKET, level: i32, optname: i32, // TODO: what to do with BytesParamIndex 4? optval: ?PSTR, optlen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPGETQOSBYNAME = fn( s: ?SOCKET, lpQOSName: ?*WSABUF, lpQOS: ?*QOS, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWSPIOCTL = fn( s: ?SOCKET, dwIoControlCode: u32, // TODO: what to do with BytesParamIndex 3? lpvInBuffer: ?*anyopaque, cbInBuffer: u32, // TODO: what to do with BytesParamIndex 5? lpvOutBuffer: ?*anyopaque, cbOutBuffer: u32, lpcbBytesReturned: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPJOINLEAF = fn( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, lpCallerData: ?*WSABUF, lpCalleeData: ?*WSABUF, lpSQOS: ?*QOS, lpGQOS: ?*QOS, dwFlags: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; pub const LPWSPLISTEN = fn( s: ?SOCKET, backlog: i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPRECV = fn( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesRecvd: ?*u32, lpFlags: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPRECVDISCONNECT = fn( s: ?SOCKET, lpInboundDisconnectData: ?*WSABUF, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPRECVFROM = fn( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesRecvd: ?*u32, lpFlags: ?*u32, // TODO: what to do with BytesParamIndex 6? lpFrom: ?*SOCKADDR, lpFromlen: ?*i32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSELECT = fn( nfds: i32, readfds: ?*fd_set, writefds: ?*fd_set, exceptfds: ?*fd_set, timeout: ?*const timeval, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSEND = fn( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesSent: ?*u32, dwFlags: u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSENDDISCONNECT = fn( s: ?SOCKET, lpOutboundDisconnectData: ?*WSABUF, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSENDTO = fn( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesSent: ?*u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpTo: ?*const SOCKADDR, iTolen: i32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSETSOCKOPT = fn( s: ?SOCKET, level: i32, optname: i32, // TODO: what to do with BytesParamIndex 4? optval: ?[*:0]const u8, optlen: i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSHUTDOWN = fn( s: ?SOCKET, how: i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSPSOCKET = fn( af: i32, type: i32, protocol: i32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, g: u32, dwFlags: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; pub const LPWSPSTRINGTOADDRESS = fn( AddressString: ?PWSTR, AddressFamily: i32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, // TODO: what to do with BytesParamIndex 4? lpAddress: ?*SOCKADDR, lpAddressLength: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const WSPPROC_TABLE = extern struct { lpWSPAccept: ?LPWSPACCEPT, lpWSPAddressToString: ?LPWSPADDRESSTOSTRING, lpWSPAsyncSelect: ?LPWSPASYNCSELECT, lpWSPBind: ?LPWSPBIND, lpWSPCancelBlockingCall: ?LPWSPCANCELBLOCKINGCALL, lpWSPCleanup: ?LPWSPCLEANUP, lpWSPCloseSocket: ?LPWSPCLOSESOCKET, lpWSPConnect: ?LPWSPCONNECT, lpWSPDuplicateSocket: ?LPWSPDUPLICATESOCKET, lpWSPEnumNetworkEvents: ?LPWSPENUMNETWORKEVENTS, lpWSPEventSelect: ?LPWSPEVENTSELECT, lpWSPGetOverlappedResult: ?LPWSPGETOVERLAPPEDRESULT, lpWSPGetPeerName: ?LPWSPGETPEERNAME, lpWSPGetSockName: ?LPWSPGETSOCKNAME, lpWSPGetSockOpt: ?LPWSPGETSOCKOPT, lpWSPGetQOSByName: ?LPWSPGETQOSBYNAME, lpWSPIoctl: ?LPWSPIOCTL, lpWSPJoinLeaf: ?LPWSPJOINLEAF, lpWSPListen: ?LPWSPLISTEN, lpWSPRecv: ?LPWSPRECV, lpWSPRecvDisconnect: ?LPWSPRECVDISCONNECT, lpWSPRecvFrom: ?LPWSPRECVFROM, lpWSPSelect: ?LPWSPSELECT, lpWSPSend: ?LPWSPSEND, lpWSPSendDisconnect: ?LPWSPSENDDISCONNECT, lpWSPSendTo: ?LPWSPSENDTO, lpWSPSetSockOpt: ?LPWSPSETSOCKOPT, lpWSPShutdown: ?LPWSPSHUTDOWN, lpWSPSocket: ?LPWSPSOCKET, lpWSPStringToAddress: ?LPWSPSTRINGTOADDRESS, }; pub const LPWPUCLOSEEVENT = fn( hEvent: ?HANDLE, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWPUCLOSESOCKETHANDLE = fn( s: ?SOCKET, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUCREATEEVENT = fn( lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; pub const LPWPUCREATESOCKETHANDLE = fn( dwCatalogEntryId: u32, dwContext: usize, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; pub const LPWPUFDISSET = fn( s: ?SOCKET, fdset: ?*fd_set, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUGETPROVIDERPATH = fn( lpProviderId: ?*Guid, lpszProviderDllPath: [*:0]u16, lpProviderDllPathLen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUMODIFYIFSHANDLE = fn( dwCatalogEntryId: u32, ProposedHandle: ?SOCKET, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; pub const LPWPUPOSTMESSAGE = fn( hWnd: ?HWND, Msg: u32, wParam: WPARAM, lParam: LPARAM, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWPUQUERYBLOCKINGCALLBACK = fn( dwCatalogEntryId: u32, lplpfnCallback: ?*?LPBLOCKINGCALLBACK, lpdwContext: ?*usize, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUQUERYSOCKETHANDLECONTEXT = fn( s: ?SOCKET, lpContext: ?*usize, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUQUEUEAPC = fn( lpThreadId: ?*WSATHREADID, lpfnUserApc: ?LPWSAUSERAPC, dwContext: usize, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPURESETEVENT = fn( hEvent: ?HANDLE, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWPUSETEVENT = fn( hEvent: ?HANDLE, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPWPUOPENCURRENTTHREAD = fn( lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUCLOSETHREAD = fn( lpThreadId: ?*WSATHREADID, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWPUCOMPLETEOVERLAPPEDREQUEST = fn( s: ?SOCKET, lpOverlapped: ?*OVERLAPPED, dwError: u32, cbTransferred: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const WSPUPCALLTABLE = extern struct { lpWPUCloseEvent: ?LPWPUCLOSEEVENT, lpWPUCloseSocketHandle: ?LPWPUCLOSESOCKETHANDLE, lpWPUCreateEvent: ?LPWPUCREATEEVENT, lpWPUCreateSocketHandle: ?LPWPUCREATESOCKETHANDLE, lpWPUFDIsSet: ?LPWPUFDISSET, lpWPUGetProviderPath: ?LPWPUGETPROVIDERPATH, lpWPUModifyIFSHandle: ?LPWPUMODIFYIFSHANDLE, lpWPUPostMessage: ?LPWPUPOSTMESSAGE, lpWPUQueryBlockingCallback: ?LPWPUQUERYBLOCKINGCALLBACK, lpWPUQuerySocketHandleContext: ?LPWPUQUERYSOCKETHANDLECONTEXT, lpWPUQueueApc: ?LPWPUQUEUEAPC, lpWPUResetEvent: ?LPWPURESETEVENT, lpWPUSetEvent: ?LPWPUSETEVENT, lpWPUOpenCurrentThread: ?LPWPUOPENCURRENTTHREAD, lpWPUCloseThread: ?LPWPUCLOSETHREAD, }; pub const LPWSPSTARTUP = fn( wVersionRequested: u16, lpWSPData: ?*WSPData, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, UpcallTable: WSPUPCALLTABLE, lpProcTable: ?*WSPPROC_TABLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCENUMPROTOCOLS = fn( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*WSAPROTOCOL_INFOW, lpdwBufferLength: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCDEINSTALLPROVIDER = fn( lpProviderId: ?*Guid, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCINSTALLPROVIDER = fn( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpProtocolInfoList: [*]const WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCGETPROVIDERPATH = fn( lpProviderId: ?*Guid, lpszProviderDllPath: [*:0]u16, lpProviderDllPathLen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCUPDATEPROVIDER = fn( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpProtocolInfoList: [*]const WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const WSC_PROVIDER_INFO_TYPE = enum(i32) { LspCategories = 0, Audit = 1, }; pub const ProviderInfoLspCategories = WSC_PROVIDER_INFO_TYPE.LspCategories; pub const ProviderInfoAudit = WSC_PROVIDER_INFO_TYPE.Audit; pub const WSC_PROVIDER_AUDIT_INFO = extern struct { RecordSize: u32, Reserved: ?*anyopaque, }; pub const LPWSCINSTALLNAMESPACE = fn( lpszIdentifier: ?PWSTR, lpszPathName: ?PWSTR, dwNameSpace: u32, dwVersion: u32, lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCUNINSTALLNAMESPACE = fn( lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCENABLENSPROVIDER = fn( lpProviderId: ?*Guid, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPCLEANUP = fn( lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPLOOKUPSERVICEBEGIN = fn( lpProviderId: ?*Guid, lpqsRestrictions: ?*WSAQUERYSETW, lpServiceClassInfo: ?*WSASERVICECLASSINFOW, dwControlFlags: u32, lphLookup: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPLOOKUPSERVICENEXT = fn( hLookup: ?HANDLE, dwControlFlags: u32, lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 2? lpqsResults: ?*WSAQUERYSETW, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPIOCTL = fn( hLookup: ?HANDLE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 3? lpvInBuffer: ?*anyopaque, cbInBuffer: u32, // TODO: what to do with BytesParamIndex 5? lpvOutBuffer: ?*anyopaque, cbOutBuffer: u32, lpcbBytesReturned: ?*u32, lpCompletion: ?*WSACOMPLETION, lpThreadId: ?*WSATHREADID, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPLOOKUPSERVICEEND = fn( hLookup: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPSETSERVICE = fn( lpProviderId: ?*Guid, lpServiceClassInfo: ?*WSASERVICECLASSINFOW, lpqsRegInfo: ?*WSAQUERYSETW, essOperation: WSAESETSERVICEOP, dwControlFlags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPINSTALLSERVICECLASS = fn( lpProviderId: ?*Guid, lpServiceClassInfo: ?*WSASERVICECLASSINFOW, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPREMOVESERVICECLASS = fn( lpProviderId: ?*Guid, lpServiceClassId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPGETSERVICECLASSINFO = fn( lpProviderId: ?*Guid, lpdwBufSize: ?*u32, lpServiceClassInfo: ?*WSASERVICECLASSINFOW, ) callconv(@import("std").os.windows.WINAPI) i32; pub const NSP_ROUTINE = extern struct { cbSize: u32, dwMajorVersion: u32, dwMinorVersion: u32, NSPCleanup: ?LPNSPCLEANUP, NSPLookupServiceBegin: ?LPNSPLOOKUPSERVICEBEGIN, NSPLookupServiceNext: ?LPNSPLOOKUPSERVICENEXT, NSPLookupServiceEnd: ?LPNSPLOOKUPSERVICEEND, NSPSetService: ?LPNSPSETSERVICE, NSPInstallServiceClass: ?LPNSPINSTALLSERVICECLASS, NSPRemoveServiceClass: ?LPNSPREMOVESERVICECLASS, NSPGetServiceClassInfo: ?LPNSPGETSERVICECLASSINFO, NSPIoctl: ?LPNSPIOCTL, }; pub const LPNSPSTARTUP = fn( lpProviderId: ?*Guid, lpnspRoutines: ?*NSP_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPV2STARTUP = fn( lpProviderId: ?*Guid, ppvClientSessionArg: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPV2CLEANUP = fn( lpProviderId: ?*Guid, pvClientSessionArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPV2LOOKUPSERVICEBEGIN = fn( lpProviderId: ?*Guid, lpqsRestrictions: ?*WSAQUERYSET2W, dwControlFlags: u32, lpvClientSessionArg: ?*anyopaque, lphLookup: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPV2LOOKUPSERVICENEXTEX = fn( hAsyncCall: ?HANDLE, hLookup: ?HANDLE, dwControlFlags: u32, lpdwBufferLength: ?*u32, lpqsResults: ?*WSAQUERYSET2W, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPNSPV2LOOKUPSERVICEEND = fn( hLookup: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPNSPV2SETSERVICEEX = fn( hAsyncCall: ?HANDLE, lpProviderId: ?*Guid, lpqsRegInfo: ?*WSAQUERYSET2W, essOperation: WSAESETSERVICEOP, dwControlFlags: u32, lpvClientSessionArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPNSPV2CLIENTSESSIONRUNDOWN = fn( lpProviderId: ?*Guid, pvClientSessionArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const NSPV2_ROUTINE = extern struct { cbSize: u32, dwMajorVersion: u32, dwMinorVersion: u32, NSPv2Startup: ?LPNSPV2STARTUP, NSPv2Cleanup: ?LPNSPV2CLEANUP, NSPv2LookupServiceBegin: ?LPNSPV2LOOKUPSERVICEBEGIN, NSPv2LookupServiceNextEx: ?LPNSPV2LOOKUPSERVICENEXTEX, NSPv2LookupServiceEnd: ?LPNSPV2LOOKUPSERVICEEND, NSPv2SetServiceEx: ?LPNSPV2SETSERVICEEX, NSPv2ClientSessionRundown: ?LPNSPV2CLIENTSESSIONRUNDOWN, }; pub const NS_INFOA = extern struct { dwNameSpace: u32, dwNameSpaceFlags: u32, lpNameSpace: ?PSTR, }; pub const NS_INFOW = extern struct { dwNameSpace: u32, dwNameSpaceFlags: u32, lpNameSpace: ?PWSTR, }; pub const SERVICE_TYPE_VALUE = extern struct { dwNameSpace: u32, dwValueType: u32, dwValueSize: u32, dwValueNameOffset: u32, dwValueOffset: u32, }; pub const SERVICE_TYPE_VALUE_ABSA = extern struct { dwNameSpace: u32, dwValueType: u32, dwValueSize: u32, lpValueName: ?PSTR, lpValue: ?*anyopaque, }; pub const SERVICE_TYPE_VALUE_ABSW = extern struct { dwNameSpace: u32, dwValueType: u32, dwValueSize: u32, lpValueName: ?PWSTR, lpValue: ?*anyopaque, }; pub const SERVICE_TYPE_INFO = extern struct { dwTypeNameOffset: u32, dwValueCount: u32, Values: [1]SERVICE_TYPE_VALUE, }; pub const SERVICE_TYPE_INFO_ABSA = extern struct { lpTypeName: ?PSTR, dwValueCount: u32, Values: [1]SERVICE_TYPE_VALUE_ABSA, }; pub const SERVICE_TYPE_INFO_ABSW = extern struct { lpTypeName: ?PWSTR, dwValueCount: u32, Values: [1]SERVICE_TYPE_VALUE_ABSW, }; pub const SERVICE_ADDRESS = extern struct { dwAddressType: u32, dwAddressFlags: u32, dwAddressLength: u32, dwPrincipalLength: u32, lpAddress: ?*u8, lpPrincipal: ?*u8, }; pub const SERVICE_ADDRESSES = extern struct { dwAddressCount: u32, Addresses: [1]SERVICE_ADDRESS, }; pub const SERVICE_INFOA = extern struct { lpServiceType: ?*Guid, lpServiceName: ?PSTR, lpComment: ?PSTR, lpLocale: ?PSTR, dwDisplayHint: RESOURCE_DISPLAY_TYPE, dwVersion: u32, dwTime: u32, lpMachineName: ?PSTR, lpServiceAddress: ?*SERVICE_ADDRESSES, ServiceSpecificInfo: BLOB, }; pub const SERVICE_INFOW = extern struct { lpServiceType: ?*Guid, lpServiceName: ?PWSTR, lpComment: ?PWSTR, lpLocale: ?PWSTR, dwDisplayHint: RESOURCE_DISPLAY_TYPE, dwVersion: u32, dwTime: u32, lpMachineName: ?PWSTR, lpServiceAddress: ?*SERVICE_ADDRESSES, ServiceSpecificInfo: BLOB, }; pub const NS_SERVICE_INFOA = extern struct { dwNameSpace: u32, ServiceInfo: SERVICE_INFOA, }; pub const NS_SERVICE_INFOW = extern struct { dwNameSpace: u32, ServiceInfo: SERVICE_INFOW, }; pub const PROTOCOL_INFOA = extern struct { dwServiceFlags: u32, iAddressFamily: i32, iMaxSockAddr: i32, iMinSockAddr: i32, iSocketType: i32, iProtocol: i32, dwMessageSize: u32, lpProtocol: ?PSTR, }; pub const PROTOCOL_INFOW = extern struct { dwServiceFlags: u32, iAddressFamily: i32, iMaxSockAddr: i32, iMinSockAddr: i32, iSocketType: i32, iProtocol: i32, dwMessageSize: u32, lpProtocol: ?PWSTR, }; pub const NETRESOURCE2A = extern struct { dwScope: u32, dwType: u32, dwUsage: u32, dwDisplayType: u32, lpLocalName: ?PSTR, lpRemoteName: ?PSTR, lpComment: ?PSTR, ns_info: NS_INFOA, ServiceType: Guid, dwProtocols: u32, lpiProtocols: ?*i32, }; pub const NETRESOURCE2W = extern struct { dwScope: u32, dwType: u32, dwUsage: u32, dwDisplayType: u32, lpLocalName: ?PWSTR, lpRemoteName: ?PWSTR, lpComment: ?PWSTR, ns_info: NS_INFOA, ServiceType: Guid, dwProtocols: u32, lpiProtocols: ?*i32, }; pub const LPFN_NSPAPI = fn( ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPSERVICE_CALLBACK_PROC = fn( lParam: LPARAM, hAsyncTaskHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) void; pub const SERVICE_ASYNC_INFO = extern struct { lpServiceCallbackProc: ?LPSERVICE_CALLBACK_PROC, lParam: LPARAM, hAsyncTaskHandle: ?HANDLE, }; pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = fn( dwError: u32, dwBytes: u32, lpOverlapped: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPWSCWRITEPROVIDERORDER = fn( lpwdCatalogEntryId: ?*u32, dwNumberOfEntries: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const LPWSCWRITENAMESPACEORDER = fn( lpProviderId: ?*Guid, dwNumberOfEntries: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const sockaddr_un = extern struct { sun_family: u16, sun_path: [108]CHAR, }; pub const sockaddr_ipx = extern struct { sa_family: i16, sa_netnum: [4]CHAR, sa_nodenum: [6]CHAR, sa_socket: u16, }; pub const sockaddr_tp = extern struct { tp_family: u16, tp_addr_type: u16, tp_taddr_len: u16, tp_tsel_len: u16, tp_addr: [64]u8, }; pub const sockaddr_nb = extern struct { snb_family: i16, snb_type: u16, snb_name: [16]CHAR, }; pub const sockaddr_vns = extern struct { sin_family: u16, net_address: [4]u8, subnet_addr: [2]u8, port: [2]u8, hops: u8, filler: [5]u8, }; pub const servent = switch(@import("../zig.zig").arch) { .X64, .Arm64 => extern struct { s_name: ?PSTR, s_aliases: ?*?*i8, s_proto: ?PSTR, s_port: i16, }, .X86 => extern struct { s_name: ?PSTR, s_aliases: ?*?*i8, s_port: i16, s_proto: ?PSTR, }, }; pub const WSAData = switch(@import("../zig.zig").arch) { .X64, .Arm64 => extern struct { wVersion: u16, wHighVersion: u16, iMaxSockets: u16, iMaxUdpDg: u16, lpVendorInfo: ?PSTR, szDescription: [257]CHAR, szSystemStatus: [129]CHAR, }, .X86 => extern struct { wVersion: u16, wHighVersion: u16, szDescription: [257]CHAR, szSystemStatus: [129]CHAR, iMaxSockets: u16, iMaxUdpDg: u16, lpVendorInfo: ?PSTR, }, }; //-------------------------------------------------------------------------------- // Section: Functions (203) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn __WSAFDIsSet( fd: ?SOCKET, param1: ?*fd_set, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn accept( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? addr: ?*SOCKADDR, addrlen: ?*i32, ) callconv(@import("std").os.windows.WINAPI) SOCKET; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn bind( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn closesocket( s: ?SOCKET, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn connect( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn ioctlsocket( s: ?SOCKET, cmd: i32, argp: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getpeername( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*SOCKADDR, namelen: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getsockname( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*SOCKADDR, namelen: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getsockopt( s: ?SOCKET, level: i32, optname: i32, // TODO: what to do with BytesParamIndex 4? optval: ?PSTR, optlen: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn htonl( hostlong: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn htons( hostshort: u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn inet_addr( cp: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn inet_ntoa( in: IN_ADDR, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn listen( s: ?SOCKET, backlog: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn ntohl( netlong: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn ntohs( netshort: u16, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn recv( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? buf: ?PSTR, len: i32, flags: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn recvfrom( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? buf: ?PSTR, len: i32, flags: i32, // TODO: what to do with BytesParamIndex 5? from: ?*SOCKADDR, fromlen: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn select( nfds: i32, readfds: ?*fd_set, writefds: ?*fd_set, exceptfds: ?*fd_set, timeout: ?*const timeval, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn send( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? buf: ?[*:0]const u8, len: i32, flags: SEND_FLAGS, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn sendto( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? buf: ?[*:0]const u8, len: i32, flags: i32, // TODO: what to do with BytesParamIndex 5? to: ?*const SOCKADDR, tolen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn setsockopt( s: ?SOCKET, level: i32, optname: i32, // TODO: what to do with BytesParamIndex 4? optval: ?[*:0]const u8, optlen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn shutdown( s: ?SOCKET, how: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn socket( af: i32, type: i32, protocol: i32, ) callconv(@import("std").os.windows.WINAPI) SOCKET; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn gethostbyaddr( // TODO: what to do with BytesParamIndex 1? addr: ?[*:0]const u8, len: i32, type: i32, ) callconv(@import("std").os.windows.WINAPI) ?*hostent; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn gethostbyname( name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*hostent; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn gethostname( // TODO: what to do with BytesParamIndex 1? name: ?PSTR, namelen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn GetHostNameW( name: [*:0]u16, namelen: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getservbyport( port: i32, proto: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*servent; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getservbyname( name: ?[*:0]const u8, proto: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*servent; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getprotobynumber( number: i32, ) callconv(@import("std").os.windows.WINAPI) ?*protoent; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getprotobyname( name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*protoent; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAStartup( wVersionRequested: u16, lpWSAData: ?*WSAData, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSACleanup( ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASetLastError( iError: i32, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAGetLastError( ) callconv(@import("std").os.windows.WINAPI) WSA_ERROR; pub extern "WS2_32" fn WSAIsBlocking( ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WS2_32" fn WSAUnhookBlockingHook( ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "WS2_32" fn WSASetBlockingHook( lpBlockFunc: ?FARPROC, ) callconv(@import("std").os.windows.WINAPI) ?FARPROC; pub extern "WS2_32" fn WSACancelBlockingCall( ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncGetServByName( hWnd: ?HWND, wMsg: u32, name: ?[*:0]const u8, proto: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 5? buf: ?PSTR, buflen: i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncGetServByPort( hWnd: ?HWND, wMsg: u32, port: i32, proto: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 5? buf: ?PSTR, buflen: i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncGetProtoByName( hWnd: ?HWND, wMsg: u32, name: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 4? buf: ?PSTR, buflen: i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncGetProtoByNumber( hWnd: ?HWND, wMsg: u32, number: i32, // TODO: what to do with BytesParamIndex 4? buf: ?PSTR, buflen: i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncGetHostByName( hWnd: ?HWND, wMsg: u32, name: ?[*:0]const u8, // TODO: what to do with BytesParamIndex 4? buf: ?PSTR, buflen: i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncGetHostByAddr( hWnd: ?HWND, wMsg: u32, // TODO: what to do with BytesParamIndex 3? addr: ?[*:0]const u8, len: i32, type: i32, // TODO: what to do with BytesParamIndex 6? buf: ?PSTR, buflen: i32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSACancelAsyncRequest( hAsyncTaskHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAAsyncSelect( s: ?SOCKET, hWnd: ?HWND, wMsg: u32, lEvent: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAAccept( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? addr: ?*SOCKADDR, addrlen: ?*i32, lpfnCondition: ?LPCONDITIONPROC, dwCallbackData: usize, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSACloseEvent( hEvent: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAConnect( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, lpCallerData: ?*WSABUF, lpCalleeData: ?*WSABUF, lpSQOS: ?*QOS, lpGQOS: ?*QOS, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAConnectByNameW( s: ?SOCKET, nodename: ?PWSTR, servicename: ?PWSTR, LocalAddressLength: ?*u32, // TODO: what to do with BytesParamIndex 3? LocalAddress: ?*SOCKADDR, RemoteAddressLength: ?*u32, // TODO: what to do with BytesParamIndex 5? RemoteAddress: ?*SOCKADDR, timeout: ?*const timeval, Reserved: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAConnectByNameA( s: ?SOCKET, nodename: ?[*:0]const u8, servicename: ?[*:0]const u8, LocalAddressLength: ?*u32, // TODO: what to do with BytesParamIndex 3? LocalAddress: ?*SOCKADDR, RemoteAddressLength: ?*u32, // TODO: what to do with BytesParamIndex 5? RemoteAddress: ?*SOCKADDR, timeout: ?*const timeval, Reserved: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAConnectByList( s: ?SOCKET, SocketAddress: ?*SOCKET_ADDRESS_LIST, LocalAddressLength: ?*u32, // TODO: what to do with BytesParamIndex 2? LocalAddress: ?*SOCKADDR, RemoteAddressLength: ?*u32, // TODO: what to do with BytesParamIndex 4? RemoteAddress: ?*SOCKADDR, timeout: ?*const timeval, Reserved: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSACreateEvent( ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSADuplicateSocketA( s: ?SOCKET, dwProcessId: u32, lpProtocolInfo: ?*WSAPROTOCOL_INFOA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSADuplicateSocketW( s: ?SOCKET, dwProcessId: u32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumNetworkEvents( s: ?SOCKET, hEventObject: ?HANDLE, lpNetworkEvents: ?*WSANETWORKEVENTS, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumProtocolsA( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*WSAPROTOCOL_INFOA, lpdwBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumProtocolsW( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*WSAPROTOCOL_INFOW, lpdwBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEventSelect( s: ?SOCKET, hEventObject: ?HANDLE, lNetworkEvents: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAGetOverlappedResult( s: ?SOCKET, lpOverlapped: ?*OVERLAPPED, lpcbTransfer: ?*u32, fWait: BOOL, lpdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAGetQOSByName( s: ?SOCKET, lpQOSName: ?*WSABUF, lpQOS: ?*QOS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAHtonl( s: ?SOCKET, hostlong: u32, lpnetlong: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAHtons( s: ?SOCKET, hostshort: u16, lpnetshort: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAIoctl( s: ?SOCKET, dwIoControlCode: u32, // TODO: what to do with BytesParamIndex 3? lpvInBuffer: ?*anyopaque, cbInBuffer: u32, // TODO: what to do with BytesParamIndex 5? lpvOutBuffer: ?*anyopaque, cbOutBuffer: u32, lpcbBytesReturned: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAJoinLeaf( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? name: ?*const SOCKADDR, namelen: i32, lpCallerData: ?*WSABUF, lpCalleeData: ?*WSABUF, lpSQOS: ?*QOS, lpGQOS: ?*QOS, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?SOCKET; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSANtohl( s: ?SOCKET, netlong: u32, lphostlong: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSANtohs( s: ?SOCKET, netshort: u16, lphostshort: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSARecv( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesRecvd: ?*u32, lpFlags: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSARecvDisconnect( s: ?SOCKET, lpInboundDisconnectData: ?*WSABUF, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSARecvFrom( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesRecvd: ?*u32, lpFlags: ?*u32, // TODO: what to do with BytesParamIndex 6? lpFrom: ?*SOCKADDR, lpFromlen: ?*i32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAResetEvent( hEvent: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASend( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesSent: ?*u32, dwFlags: u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASendMsg( Handle: ?SOCKET, lpMsg: ?*WSAMSG, dwFlags: u32, lpNumberOfBytesSent: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSASendDisconnect( s: ?SOCKET, lpOutboundDisconnectData: ?*WSABUF, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASendTo( s: ?SOCKET, lpBuffers: [*]WSABUF, dwBufferCount: u32, lpNumberOfBytesSent: ?*u32, dwFlags: u32, // TODO: what to do with BytesParamIndex 6? lpTo: ?*const SOCKADDR, iTolen: i32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASetEvent( hEvent: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASocketA( af: i32, type: i32, protocol: i32, lpProtocolInfo: ?*WSAPROTOCOL_INFOA, g: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) SOCKET; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASocketW( af: i32, type: i32, protocol: i32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, g: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) SOCKET; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAWaitForMultipleEvents( cEvents: u32, lphEvents: [*]const ?HANDLE, fWaitAll: BOOL, dwTimeout: u32, fAlertable: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAAddressToStringA( // TODO: what to do with BytesParamIndex 1? lpsaAddress: ?*SOCKADDR, dwAddressLength: u32, lpProtocolInfo: ?*WSAPROTOCOL_INFOA, lpszAddressString: [*:0]u8, lpdwAddressStringLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAAddressToStringW( // TODO: what to do with BytesParamIndex 1? lpsaAddress: ?*SOCKADDR, dwAddressLength: u32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, lpszAddressString: [*:0]u16, lpdwAddressStringLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAStringToAddressA( AddressString: ?PSTR, AddressFamily: i32, lpProtocolInfo: ?*WSAPROTOCOL_INFOA, // TODO: what to do with BytesParamIndex 4? lpAddress: ?*SOCKADDR, lpAddressLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAStringToAddressW( AddressString: ?PWSTR, AddressFamily: i32, lpProtocolInfo: ?*WSAPROTOCOL_INFOW, // TODO: what to do with BytesParamIndex 4? lpAddress: ?*SOCKADDR, lpAddressLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSALookupServiceBeginA( lpqsRestrictions: ?*WSAQUERYSETA, dwControlFlags: u32, lphLookup: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSALookupServiceBeginW( lpqsRestrictions: ?*WSAQUERYSETW, dwControlFlags: u32, lphLookup: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSALookupServiceNextA( hLookup: ?HANDLE, dwControlFlags: u32, lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 2? lpqsResults: ?*WSAQUERYSETA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSALookupServiceNextW( hLookup: ?HANDLE, dwControlFlags: u32, lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 2? lpqsResults: ?*WSAQUERYSETW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSANSPIoctl( hLookup: ?HANDLE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 3? lpvInBuffer: ?*anyopaque, cbInBuffer: u32, // TODO: what to do with BytesParamIndex 5? lpvOutBuffer: ?*anyopaque, cbOutBuffer: u32, lpcbBytesReturned: ?*u32, lpCompletion: ?*WSACOMPLETION, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSALookupServiceEnd( hLookup: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAInstallServiceClassA( lpServiceClassInfo: ?*WSASERVICECLASSINFOA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAInstallServiceClassW( lpServiceClassInfo: ?*WSASERVICECLASSINFOW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSARemoveServiceClass( lpServiceClassId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAGetServiceClassInfoA( lpProviderId: ?*Guid, lpServiceClassId: ?*Guid, lpdwBufSize: ?*u32, // TODO: what to do with BytesParamIndex 2? lpServiceClassInfo: ?*WSASERVICECLASSINFOA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAGetServiceClassInfoW( lpProviderId: ?*Guid, lpServiceClassId: ?*Guid, lpdwBufSize: ?*u32, // TODO: what to do with BytesParamIndex 2? lpServiceClassInfo: ?*WSASERVICECLASSINFOW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumNameSpaceProvidersA( lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 0? lpnspBuffer: ?*WSANAMESPACE_INFOA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumNameSpaceProvidersW( lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 0? lpnspBuffer: ?*WSANAMESPACE_INFOW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumNameSpaceProvidersExA( lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 0? lpnspBuffer: ?*WSANAMESPACE_INFOEXA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAEnumNameSpaceProvidersExW( lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 0? lpnspBuffer: ?*WSANAMESPACE_INFOEXW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAGetServiceClassNameByClassIdA( lpServiceClassId: ?*Guid, // TODO: what to do with BytesParamIndex 2? lpszServiceClassName: ?PSTR, lpdwBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSAGetServiceClassNameByClassIdW( lpServiceClassId: ?*Guid, // TODO: what to do with BytesParamIndex 2? lpszServiceClassName: ?PWSTR, lpdwBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASetServiceA( lpqsRegInfo: ?*WSAQUERYSETA, essoperation: WSAESETSERVICEOP, dwControlFlags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSASetServiceW( lpqsRegInfo: ?*WSAQUERYSETW, essoperation: WSAESETSERVICEOP, dwControlFlags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAProviderConfigChange( lpNotificationHandle: ?*?HANDLE, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn WSAPoll( fdArray: ?*WSAPOLLFD, fds: u32, timeout: i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "WS2_32" fn ProcessSocketNotifications( completionPort: ?HANDLE, registrationCount: u32, registrationInfos: ?[*]SOCK_NOTIFY_REGISTRATION, timeoutMs: u32, completionCount: u32, completionPortEntries: ?[*]OVERLAPPED_ENTRY, receivedEntryCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv4AddressToStringA( Addr: ?*const IN_ADDR, S: *[16]u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "ntdll" fn RtlIpv4AddressToStringExA( Address: ?*const IN_ADDR, Port: u16, AddressString: [*:0]u8, AddressStringLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv4AddressToStringW( Addr: ?*const IN_ADDR, S: *[16]u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv4AddressToStringExW( Address: ?*const IN_ADDR, Port: u16, AddressString: [*:0]u16, AddressStringLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv4StringToAddressA( S: ?[*:0]const u8, Strict: BOOLEAN, Terminator: ?*?PSTR, Addr: ?*IN_ADDR, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "ntdll" fn RtlIpv4StringToAddressExA( AddressString: ?[*:0]const u8, Strict: BOOLEAN, Address: ?*IN_ADDR, Port: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv4StringToAddressW( S: ?[*:0]const u16, Strict: BOOLEAN, Terminator: ?*?PWSTR, Addr: ?*IN_ADDR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv4StringToAddressExW( AddressString: ?[*:0]const u16, Strict: BOOLEAN, Address: ?*IN_ADDR, Port: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv6AddressToStringA( Addr: ?*const IN6_ADDR, S: *[46]u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "ntdll" fn RtlIpv6AddressToStringExA( Address: ?*const IN6_ADDR, ScopeId: u32, Port: u16, AddressString: [*:0]u8, AddressStringLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv6AddressToStringW( Addr: ?*const IN6_ADDR, S: *[46]u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv6AddressToStringExW( Address: ?*const IN6_ADDR, ScopeId: u32, Port: u16, AddressString: [*:0]u16, AddressStringLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv6StringToAddressA( S: ?[*:0]const u8, Terminator: ?*?PSTR, Addr: ?*IN6_ADDR, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "ntdll" fn RtlIpv6StringToAddressExA( AddressString: ?[*:0]const u8, Address: ?*IN6_ADDR, ScopeId: ?*u32, Port: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv6StringToAddressW( S: ?[*:0]const u16, Terminator: ?*?PWSTR, Addr: ?*IN6_ADDR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "ntdll" fn RtlIpv6StringToAddressExW( AddressString: ?[*:0]const u16, Address: ?*IN6_ADDR, ScopeId: ?*u32, Port: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.1' pub extern "ntdll" fn RtlEthernetAddressToStringA( Addr: ?*const DL_EUI48, S: *[18]u8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; // TODO: this type is limited to platform 'windows6.1' pub extern "ntdll" fn RtlEthernetAddressToStringW( Addr: ?*const DL_EUI48, S: *[18]u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows6.1' pub extern "ntdll" fn RtlEthernetStringToAddressA( S: ?[*:0]const u8, Terminator: ?*?PSTR, Addr: ?*DL_EUI48, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.1' pub extern "ntdll" fn RtlEthernetStringToAddressW( S: ?[*:0]const u16, Terminator: ?*?PWSTR, Addr: ?*DL_EUI48, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn WSARecvEx( s: ?SOCKET, // TODO: what to do with BytesParamIndex 2? buf: ?PSTR, len: i32, flags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "MSWSOCK" fn TransmitFile( hSocket: ?SOCKET, hFile: ?HANDLE, nNumberOfBytesToWrite: u32, nNumberOfBytesPerSend: u32, lpOverlapped: ?*OVERLAPPED, lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "MSWSOCK" fn AcceptEx( sListenSocket: ?SOCKET, sAcceptSocket: ?SOCKET, lpOutputBuffer: ?*anyopaque, dwReceiveDataLength: u32, dwLocalAddressLength: u32, dwRemoteAddressLength: u32, lpdwBytesReceived: ?*u32, lpOverlapped: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "MSWSOCK" fn GetAcceptExSockaddrs( lpOutputBuffer: ?*anyopaque, dwReceiveDataLength: u32, dwLocalAddressLength: u32, dwRemoteAddressLength: u32, LocalSockaddr: ?*?*SOCKADDR, LocalSockaddrLength: ?*i32, RemoteSockaddr: ?*?*SOCKADDR, RemoteSockaddrLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCEnumProtocols( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*WSAPROTOCOL_INFOW, lpdwBufferLength: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCEnumProtocols32( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*WSAPROTOCOL_INFOW, lpdwBufferLength: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCDeinstallProvider( lpProviderId: ?*Guid, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCDeinstallProvider32( lpProviderId: ?*Guid, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCInstallProvider( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpProtocolInfoList: [*]const WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows5.1.2600' pub extern "WS2_32" fn WSCInstallProvider64_32( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpProtocolInfoList: [*]const WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCGetProviderPath( lpProviderId: ?*Guid, lpszProviderDllPath: [*:0]u16, lpProviderDllPathLen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCGetProviderPath32( lpProviderId: ?*Guid, lpszProviderDllPath: [*:0]u16, lpProviderDllPathLen: ?*i32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "WS2_32" fn WSCUpdateProvider( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpProtocolInfoList: [*]const WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCUpdateProvider32( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpProtocolInfoList: [*]const WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCSetProviderInfo( lpProviderId: ?*Guid, InfoType: WSC_PROVIDER_INFO_TYPE, // TODO: what to do with BytesParamIndex 3? Info: ?*u8, InfoSize: usize, Flags: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCGetProviderInfo( lpProviderId: ?*Guid, InfoType: WSC_PROVIDER_INFO_TYPE, // TODO: what to do with BytesParamIndex 3? Info: ?*u8, InfoSize: ?*usize, Flags: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCSetProviderInfo32( lpProviderId: ?*Guid, InfoType: WSC_PROVIDER_INFO_TYPE, // TODO: what to do with BytesParamIndex 3? Info: ?*u8, InfoSize: usize, Flags: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCGetProviderInfo32( lpProviderId: ?*Guid, InfoType: WSC_PROVIDER_INFO_TYPE, // TODO: what to do with BytesParamIndex 3? Info: ?*u8, InfoSize: ?*usize, Flags: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCSetApplicationCategory( Path: [*:0]const u16, PathLength: u32, Extra: ?[*:0]const u16, ExtraLength: u32, PermittedLspCategories: u32, pPrevPermLspCat: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCGetApplicationCategory( Path: [*:0]const u16, PathLength: u32, Extra: ?[*:0]const u16, ExtraLength: u32, pPermittedLspCategories: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WPUCompleteOverlappedRequest( s: ?SOCKET, lpOverlapped: ?*OVERLAPPED, dwError: u32, cbTransferred: u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCEnumNameSpaceProviders32( lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 0? lpnspBuffer: ?*WSANAMESPACE_INFOW, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCEnumNameSpaceProvidersEx32( lpdwBufferLength: ?*u32, // TODO: what to do with BytesParamIndex 0? lpnspBuffer: ?*WSANAMESPACE_INFOEXW, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCInstallNameSpace( lpszIdentifier: ?PWSTR, lpszPathName: ?PWSTR, dwNameSpace: u32, dwVersion: u32, lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCInstallNameSpace32( lpszIdentifier: ?PWSTR, lpszPathName: ?PWSTR, dwNameSpace: u32, dwVersion: u32, lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCUnInstallNameSpace( lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCInstallNameSpaceEx( lpszIdentifier: ?PWSTR, lpszPathName: ?PWSTR, dwNameSpace: u32, dwVersion: u32, lpProviderId: ?*Guid, lpProviderSpecific: ?*BLOB, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCInstallNameSpaceEx32( lpszIdentifier: ?PWSTR, lpszPathName: ?PWSTR, dwNameSpace: u32, dwVersion: u32, lpProviderId: ?*Guid, lpProviderSpecific: ?*BLOB, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCUnInstallNameSpace32( lpProviderId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCEnableNSProvider( lpProviderId: ?*Guid, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCEnableNSProvider32( lpProviderId: ?*Guid, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCInstallProviderAndChains64_32( lpProviderId: ?*Guid, lpszProviderDllPath: ?[*:0]const u16, lpszProviderDllPath32: ?[*:0]const u16, lpszLspName: ?[*:0]const u16, dwServiceFlags: u32, lpProtocolInfoList: [*]WSAPROTOCOL_INFOW, dwNumberOfEntries: u32, lpdwCatalogEntryId: ?*u32, lpErrno: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSAAdvertiseProvider( puuidProviderId: ?*const Guid, pNSPv2Routine: ?*const NSPV2_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSAUnadvertiseProvider( puuidProviderId: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSAProviderCompleteAsyncCall( hAsyncCall: ?HANDLE, iRetCode: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn EnumProtocolsA( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*anyopaque, lpdwBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn EnumProtocolsW( lpiProtocols: ?*i32, // TODO: what to do with BytesParamIndex 2? lpProtocolBuffer: ?*anyopaque, lpdwBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetAddressByNameA( dwNameSpace: u32, lpServiceType: ?*Guid, lpServiceName: ?PSTR, lpiProtocols: ?*i32, dwResolution: u32, lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO, // TODO: what to do with BytesParamIndex 7? lpCsaddrBuffer: ?*anyopaque, lpdwBufferLength: ?*u32, lpAliasBuffer: ?[*:0]u8, lpdwAliasBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetAddressByNameW( dwNameSpace: u32, lpServiceType: ?*Guid, lpServiceName: ?PWSTR, lpiProtocols: ?*i32, dwResolution: u32, lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO, // TODO: what to do with BytesParamIndex 7? lpCsaddrBuffer: ?*anyopaque, lpdwBufferLength: ?*u32, lpAliasBuffer: ?[*:0]u16, lpdwAliasBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetTypeByNameA( lpServiceName: ?PSTR, lpServiceType: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetTypeByNameW( lpServiceName: ?PWSTR, lpServiceType: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetNameByTypeA( lpServiceType: ?*Guid, // TODO: what to do with BytesParamIndex 2? lpServiceName: ?PSTR, dwNameLength: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetNameByTypeW( lpServiceType: ?*Guid, // TODO: what to do with BytesParamIndex 2? lpServiceName: ?PWSTR, dwNameLength: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn SetServiceA( dwNameSpace: u32, dwOperation: SET_SERVICE_OPERATION, dwFlags: u32, lpServiceInfo: ?*SERVICE_INFOA, lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO, lpdwStatusFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn SetServiceW( dwNameSpace: u32, dwOperation: SET_SERVICE_OPERATION, dwFlags: u32, lpServiceInfo: ?*SERVICE_INFOW, lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO, lpdwStatusFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetServiceA( dwNameSpace: u32, lpGuid: ?*Guid, lpServiceName: ?PSTR, dwProperties: u32, // TODO: what to do with BytesParamIndex 5? lpBuffer: ?*anyopaque, lpdwBufferSize: ?*u32, lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "MSWSOCK" fn GetServiceW( dwNameSpace: u32, lpGuid: ?*Guid, lpServiceName: ?PWSTR, dwProperties: u32, // TODO: what to do with BytesParamIndex 5? lpBuffer: ?*anyopaque, lpdwBufferSize: ?*u32, lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getaddrinfo( pNodeName: ?[*:0]const u8, pServiceName: ?[*:0]const u8, pHints: ?*const ADDRINFOA, ppResult: ?*?*ADDRINFOA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn GetAddrInfoW( pNodeName: ?[*:0]const u16, pServiceName: ?[*:0]const u16, pHints: ?*const addrinfoW, ppResult: ?*?*addrinfoW, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn GetAddrInfoExA( pName: ?[*:0]const u8, pServiceName: ?[*:0]const u8, dwNameSpace: u32, lpNspId: ?*Guid, hints: ?*const addrinfoexA, ppResult: ?*?*addrinfoexA, timeout: ?*timeval, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE, lpNameHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn GetAddrInfoExW( pName: ?[*:0]const u16, pServiceName: ?[*:0]const u16, dwNameSpace: u32, lpNspId: ?*Guid, hints: ?*const addrinfoexW, ppResult: ?*?*addrinfoexW, timeout: ?*timeval, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE, lpHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn GetAddrInfoExCancel( lpHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn GetAddrInfoExOverlappedResult( lpOverlapped: ?*OVERLAPPED, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn SetAddrInfoExA( pName: ?[*:0]const u8, pServiceName: ?[*:0]const u8, pAddresses: ?*SOCKET_ADDRESS, dwAddressCount: u32, lpBlob: ?*BLOB, dwFlags: u32, dwNameSpace: u32, lpNspId: ?*Guid, timeout: ?*timeval, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE, lpNameHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn SetAddrInfoExW( pName: ?[*:0]const u16, pServiceName: ?[*:0]const u16, pAddresses: ?*SOCKET_ADDRESS, dwAddressCount: u32, lpBlob: ?*BLOB, dwFlags: u32, dwNameSpace: u32, lpNspId: ?*Guid, timeout: ?*timeval, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE, lpNameHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn freeaddrinfo( pAddrInfo: ?*ADDRINFOA, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn FreeAddrInfoW( pAddrInfo: ?*addrinfoW, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn FreeAddrInfoEx( pAddrInfoEx: ?*addrinfoexA, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn FreeAddrInfoExW( pAddrInfoEx: ?*addrinfoexW, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn getnameinfo( // TODO: what to do with BytesParamIndex 1? pSockaddr: ?*const SOCKADDR, SockaddrLength: i32, pNodeBuffer: ?[*]u8, NodeBufferSize: u32, pServiceBuffer: ?[*]u8, ServiceBufferSize: u32, Flags: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn GetNameInfoW( // TODO: what to do with BytesParamIndex 1? pSockaddr: ?*const SOCKADDR, SockaddrLength: i32, pNodeBuffer: ?[*]u16, NodeBufferSize: u32, pServiceBuffer: ?[*]u16, ServiceBufferSize: u32, Flags: i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn inet_pton( Family: i32, pszAddrString: ?[*:0]const u8, pAddrBuf: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn InetPtonW( Family: i32, pszAddrString: ?[*:0]const u16, pAddrBuf: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn inet_ntop( Family: i32, pAddr: ?*const anyopaque, pStringBuf: [*:0]u8, StringBufSize: usize, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; // TODO: this type is limited to platform 'windows8.1' pub extern "WS2_32" fn InetNtopW( Family: i32, pAddr: ?*const anyopaque, pStringBuf: [*:0]u16, StringBufSize: usize, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "fwpuclnt" fn WSASetSocketSecurity( Socket: ?SOCKET, // TODO: what to do with BytesParamIndex 2? SecuritySettings: ?*const SOCKET_SECURITY_SETTINGS, SecuritySettingsLen: u32, Overlapped: ?*OVERLAPPED, CompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "fwpuclnt" fn WSAQuerySocketSecurity( Socket: ?SOCKET, // TODO: what to do with BytesParamIndex 2? SecurityQueryTemplate: ?*const SOCKET_SECURITY_QUERY_TEMPLATE, SecurityQueryTemplateLen: u32, // TODO: what to do with BytesParamIndex 4? SecurityQueryInfo: ?*SOCKET_SECURITY_QUERY_INFO, SecurityQueryInfoLen: ?*u32, Overlapped: ?*OVERLAPPED, CompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "fwpuclnt" fn WSASetSocketPeerTargetName( Socket: ?SOCKET, // TODO: what to do with BytesParamIndex 2? PeerTargetName: ?*const SOCKET_PEER_TARGET_NAME, PeerTargetNameLen: u32, Overlapped: ?*OVERLAPPED, CompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "fwpuclnt" fn WSADeleteSocketPeerTargetName( Socket: ?SOCKET, // TODO: what to do with BytesParamIndex 2? PeerAddr: ?*const SOCKADDR, PeerAddrLen: u32, Overlapped: ?*OVERLAPPED, CompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "fwpuclnt" fn WSAImpersonateSocketPeer( Socket: ?SOCKET, // TODO: what to do with BytesParamIndex 2? PeerAddr: ?*const SOCKADDR, PeerAddrLen: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "fwpuclnt" fn WSARevertImpersonation( ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.0' pub extern "Windows.Networking" fn SetSocketMediaStreamingMode( value: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCWriteProviderOrder( lpwdCatalogEntryId: ?*u32, dwNumberOfEntries: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCWriteProviderOrder32( lpwdCatalogEntryId: ?*u32, dwNumberOfEntries: u32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; // TODO: this type is limited to platform 'windows5.0' pub extern "WS2_32" fn WSCWriteNameSpaceOrder( lpProviderId: ?*Guid, dwNumberOfEntries: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub usingnamespace switch (@import("../zig.zig").arch) { .X64, .Arm64 => struct { // TODO: this type is limited to platform 'windows6.0.6000' pub extern "WS2_32" fn WSCWriteNameSpaceOrder32( lpProviderId: ?*Guid, dwNumberOfEntries: u32, ) callconv(@import("std").os.windows.WINAPI) i32; }, else => struct { } }; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (48) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const addrinfoex = thismodule.addrinfoexA; pub const addrinfoex2 = thismodule.addrinfoex2A; pub const WSAPROTOCOL_INFO = thismodule.WSAPROTOCOL_INFOA; pub const WSAQUERYSET = thismodule.WSAQUERYSETA; pub const WSAQUERYSET2 = thismodule.WSAQUERYSET2A; pub const WSANSCLASSINFO = thismodule.WSANSCLASSINFOA; pub const WSASERVICECLASSINFO = thismodule.WSASERVICECLASSINFOA; pub const WSANAMESPACE_INFO = thismodule.WSANAMESPACE_INFOA; pub const WSANAMESPACE_INFOEX = thismodule.WSANAMESPACE_INFOEXA; pub const NS_INFO = thismodule.NS_INFOA; pub const SERVICE_TYPE_VALUE_ABS = thismodule.SERVICE_TYPE_VALUE_ABSA; pub const SERVICE_TYPE_INFO_ABS = thismodule.SERVICE_TYPE_INFO_ABSA; pub const SERVICE_INFO = thismodule.SERVICE_INFOA; pub const NS_SERVICE_INFO = thismodule.NS_SERVICE_INFOA; pub const PROTOCOL_INFO = thismodule.PROTOCOL_INFOA; pub const NETRESOURCE2 = thismodule.NETRESOURCE2A; pub const WSAConnectByName = thismodule.WSAConnectByNameA; pub const WSADuplicateSocket = thismodule.WSADuplicateSocketA; pub const WSAEnumProtocols = thismodule.WSAEnumProtocolsA; pub const WSASocket = thismodule.WSASocketA; pub const WSAAddressToString = thismodule.WSAAddressToStringA; pub const WSAStringToAddress = thismodule.WSAStringToAddressA; pub const WSALookupServiceBegin = thismodule.WSALookupServiceBeginA; pub const WSALookupServiceNext = thismodule.WSALookupServiceNextA; pub const WSAInstallServiceClass = thismodule.WSAInstallServiceClassA; pub const WSAGetServiceClassInfo = thismodule.WSAGetServiceClassInfoA; pub const WSAEnumNameSpaceProviders = thismodule.WSAEnumNameSpaceProvidersA; pub const WSAEnumNameSpaceProvidersEx = thismodule.WSAEnumNameSpaceProvidersExA; pub const WSAGetServiceClassNameByClassId = thismodule.WSAGetServiceClassNameByClassIdA; pub const WSASetService = thismodule.WSASetServiceA; pub const RtlIpv4AddressToString = thismodule.RtlIpv4AddressToStringA; pub const RtlIpv4AddressToStringEx = thismodule.RtlIpv4AddressToStringExA; pub const RtlIpv4StringToAddress = thismodule.RtlIpv4StringToAddressA; pub const RtlIpv4StringToAddressEx = thismodule.RtlIpv4StringToAddressExA; pub const RtlIpv6AddressToString = thismodule.RtlIpv6AddressToStringA; pub const RtlIpv6AddressToStringEx = thismodule.RtlIpv6AddressToStringExA; pub const RtlIpv6StringToAddress = thismodule.RtlIpv6StringToAddressA; pub const RtlIpv6StringToAddressEx = thismodule.RtlIpv6StringToAddressExA; pub const RtlEthernetAddressToString = thismodule.RtlEthernetAddressToStringA; pub const RtlEthernetStringToAddress = thismodule.RtlEthernetStringToAddressA; pub const EnumProtocols = thismodule.EnumProtocolsA; pub const GetAddressByName = thismodule.GetAddressByNameA; pub const GetTypeByName = thismodule.GetTypeByNameA; pub const GetNameByType = thismodule.GetNameByTypeA; pub const SetService = thismodule.SetServiceA; pub const GetService = thismodule.GetServiceA; pub const GetAddrInfoEx = thismodule.GetAddrInfoExA; pub const SetAddrInfoEx = thismodule.SetAddrInfoExA; }, .wide => struct { pub const addrinfoex = thismodule.addrinfoexW; pub const addrinfoex2 = thismodule.addrinfoex2W; pub const WSAPROTOCOL_INFO = thismodule.WSAPROTOCOL_INFOW; pub const WSAQUERYSET = thismodule.WSAQUERYSETW; pub const WSAQUERYSET2 = thismodule.WSAQUERYSET2W; pub const WSANSCLASSINFO = thismodule.WSANSCLASSINFOW; pub const WSASERVICECLASSINFO = thismodule.WSASERVICECLASSINFOW; pub const WSANAMESPACE_INFO = thismodule.WSANAMESPACE_INFOW; pub const WSANAMESPACE_INFOEX = thismodule.WSANAMESPACE_INFOEXW; pub const NS_INFO = thismodule.NS_INFOW; pub const SERVICE_TYPE_VALUE_ABS = thismodule.SERVICE_TYPE_VALUE_ABSW; pub const SERVICE_TYPE_INFO_ABS = thismodule.SERVICE_TYPE_INFO_ABSW; pub const SERVICE_INFO = thismodule.SERVICE_INFOW; pub const NS_SERVICE_INFO = thismodule.NS_SERVICE_INFOW; pub const PROTOCOL_INFO = thismodule.PROTOCOL_INFOW; pub const NETRESOURCE2 = thismodule.NETRESOURCE2W; pub const WSAConnectByName = thismodule.WSAConnectByNameW; pub const WSADuplicateSocket = thismodule.WSADuplicateSocketW; pub const WSAEnumProtocols = thismodule.WSAEnumProtocolsW; pub const WSASocket = thismodule.WSASocketW; pub const WSAAddressToString = thismodule.WSAAddressToStringW; pub const WSAStringToAddress = thismodule.WSAStringToAddressW; pub const WSALookupServiceBegin = thismodule.WSALookupServiceBeginW; pub const WSALookupServiceNext = thismodule.WSALookupServiceNextW; pub const WSAInstallServiceClass = thismodule.WSAInstallServiceClassW; pub const WSAGetServiceClassInfo = thismodule.WSAGetServiceClassInfoW; pub const WSAEnumNameSpaceProviders = thismodule.WSAEnumNameSpaceProvidersW; pub const WSAEnumNameSpaceProvidersEx = thismodule.WSAEnumNameSpaceProvidersExW; pub const WSAGetServiceClassNameByClassId = thismodule.WSAGetServiceClassNameByClassIdW; pub const WSASetService = thismodule.WSASetServiceW; pub const RtlIpv4AddressToString = thismodule.RtlIpv4AddressToStringW; pub const RtlIpv4AddressToStringEx = thismodule.RtlIpv4AddressToStringExW; pub const RtlIpv4StringToAddress = thismodule.RtlIpv4StringToAddressW; pub const RtlIpv4StringToAddressEx = thismodule.RtlIpv4StringToAddressExW; pub const RtlIpv6AddressToString = thismodule.RtlIpv6AddressToStringW; pub const RtlIpv6AddressToStringEx = thismodule.RtlIpv6AddressToStringExW; pub const RtlIpv6StringToAddress = thismodule.RtlIpv6StringToAddressW; pub const RtlIpv6StringToAddressEx = thismodule.RtlIpv6StringToAddressExW; pub const RtlEthernetAddressToString = thismodule.RtlEthernetAddressToStringW; pub const RtlEthernetStringToAddress = thismodule.RtlEthernetStringToAddressW; pub const EnumProtocols = thismodule.EnumProtocolsW; pub const GetAddressByName = thismodule.GetAddressByNameW; pub const GetTypeByName = thismodule.GetTypeByNameW; pub const GetNameByType = thismodule.GetNameByTypeW; pub const SetService = thismodule.SetServiceW; pub const GetService = thismodule.GetServiceW; pub const GetAddrInfoEx = thismodule.GetAddrInfoExW; pub const SetAddrInfoEx = thismodule.SetAddrInfoExW; }, .unspecified => if (@import("builtin").is_test) struct { pub const addrinfoex = *opaque{}; pub const addrinfoex2 = *opaque{}; pub const WSAPROTOCOL_INFO = *opaque{}; pub const WSAQUERYSET = *opaque{}; pub const WSAQUERYSET2 = *opaque{}; pub const WSANSCLASSINFO = *opaque{}; pub const WSASERVICECLASSINFO = *opaque{}; pub const WSANAMESPACE_INFO = *opaque{}; pub const WSANAMESPACE_INFOEX = *opaque{}; pub const NS_INFO = *opaque{}; pub const SERVICE_TYPE_VALUE_ABS = *opaque{}; pub const SERVICE_TYPE_INFO_ABS = *opaque{}; pub const SERVICE_INFO = *opaque{}; pub const NS_SERVICE_INFO = *opaque{}; pub const PROTOCOL_INFO = *opaque{}; pub const NETRESOURCE2 = *opaque{}; pub const WSAConnectByName = *opaque{}; pub const WSADuplicateSocket = *opaque{}; pub const WSAEnumProtocols = *opaque{}; pub const WSASocket = *opaque{}; pub const WSAAddressToString = *opaque{}; pub const WSAStringToAddress = *opaque{}; pub const WSALookupServiceBegin = *opaque{}; pub const WSALookupServiceNext = *opaque{}; pub const WSAInstallServiceClass = *opaque{}; pub const WSAGetServiceClassInfo = *opaque{}; pub const WSAEnumNameSpaceProviders = *opaque{}; pub const WSAEnumNameSpaceProvidersEx = *opaque{}; pub const WSAGetServiceClassNameByClassId = *opaque{}; pub const WSASetService = *opaque{}; pub const RtlIpv4AddressToString = *opaque{}; pub const RtlIpv4AddressToStringEx = *opaque{}; pub const RtlIpv4StringToAddress = *opaque{}; pub const RtlIpv4StringToAddressEx = *opaque{}; pub const RtlIpv6AddressToString = *opaque{}; pub const RtlIpv6AddressToStringEx = *opaque{}; pub const RtlIpv6StringToAddress = *opaque{}; pub const RtlIpv6StringToAddressEx = *opaque{}; pub const RtlEthernetAddressToString = *opaque{}; pub const RtlEthernetStringToAddress = *opaque{}; pub const EnumProtocols = *opaque{}; pub const GetAddressByName = *opaque{}; pub const GetTypeByName = *opaque{}; pub const GetNameByType = *opaque{}; pub const SetService = *opaque{}; pub const GetService = *opaque{}; pub const GetAddrInfoEx = *opaque{}; pub const SetAddrInfoEx = *opaque{}; } else struct { pub const addrinfoex = @compileError("'addrinfoex' requires that UNICODE be set to true or false in the root module"); pub const addrinfoex2 = @compileError("'addrinfoex2' requires that UNICODE be set to true or false in the root module"); pub const WSAPROTOCOL_INFO = @compileError("'WSAPROTOCOL_INFO' requires that UNICODE be set to true or false in the root module"); pub const WSAQUERYSET = @compileError("'WSAQUERYSET' requires that UNICODE be set to true or false in the root module"); pub const WSAQUERYSET2 = @compileError("'WSAQUERYSET2' requires that UNICODE be set to true or false in the root module"); pub const WSANSCLASSINFO = @compileError("'WSANSCLASSINFO' requires that UNICODE be set to true or false in the root module"); pub const WSASERVICECLASSINFO = @compileError("'WSASERVICECLASSINFO' requires that UNICODE be set to true or false in the root module"); pub const WSANAMESPACE_INFO = @compileError("'WSANAMESPACE_INFO' requires that UNICODE be set to true or false in the root module"); pub const WSANAMESPACE_INFOEX = @compileError("'WSANAMESPACE_INFOEX' requires that UNICODE be set to true or false in the root module"); pub const NS_INFO = @compileError("'NS_INFO' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_TYPE_VALUE_ABS = @compileError("'SERVICE_TYPE_VALUE_ABS' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_TYPE_INFO_ABS = @compileError("'SERVICE_TYPE_INFO_ABS' requires that UNICODE be set to true or false in the root module"); pub const SERVICE_INFO = @compileError("'SERVICE_INFO' requires that UNICODE be set to true or false in the root module"); pub const NS_SERVICE_INFO = @compileError("'NS_SERVICE_INFO' requires that UNICODE be set to true or false in the root module"); pub const PROTOCOL_INFO = @compileError("'PROTOCOL_INFO' requires that UNICODE be set to true or false in the root module"); pub const NETRESOURCE2 = @compileError("'NETRESOURCE2' requires that UNICODE be set to true or false in the root module"); pub const WSAConnectByName = @compileError("'WSAConnectByName' requires that UNICODE be set to true or false in the root module"); pub const WSADuplicateSocket = @compileError("'WSADuplicateSocket' requires that UNICODE be set to true or false in the root module"); pub const WSAEnumProtocols = @compileError("'WSAEnumProtocols' requires that UNICODE be set to true or false in the root module"); pub const WSASocket = @compileError("'WSASocket' requires that UNICODE be set to true or false in the root module"); pub const WSAAddressToString = @compileError("'WSAAddressToString' requires that UNICODE be set to true or false in the root module"); pub const WSAStringToAddress = @compileError("'WSAStringToAddress' requires that UNICODE be set to true or false in the root module"); pub const WSALookupServiceBegin = @compileError("'WSALookupServiceBegin' requires that UNICODE be set to true or false in the root module"); pub const WSALookupServiceNext = @compileError("'WSALookupServiceNext' requires that UNICODE be set to true or false in the root module"); pub const WSAInstallServiceClass = @compileError("'WSAInstallServiceClass' requires that UNICODE be set to true or false in the root module"); pub const WSAGetServiceClassInfo = @compileError("'WSAGetServiceClassInfo' requires that UNICODE be set to true or false in the root module"); pub const WSAEnumNameSpaceProviders = @compileError("'WSAEnumNameSpaceProviders' requires that UNICODE be set to true or false in the root module"); pub const WSAEnumNameSpaceProvidersEx = @compileError("'WSAEnumNameSpaceProvidersEx' requires that UNICODE be set to true or false in the root module"); pub const WSAGetServiceClassNameByClassId = @compileError("'WSAGetServiceClassNameByClassId' requires that UNICODE be set to true or false in the root module"); pub const WSASetService = @compileError("'WSASetService' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv4AddressToString = @compileError("'RtlIpv4AddressToString' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv4AddressToStringEx = @compileError("'RtlIpv4AddressToStringEx' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv4StringToAddress = @compileError("'RtlIpv4StringToAddress' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv4StringToAddressEx = @compileError("'RtlIpv4StringToAddressEx' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv6AddressToString = @compileError("'RtlIpv6AddressToString' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv6AddressToStringEx = @compileError("'RtlIpv6AddressToStringEx' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv6StringToAddress = @compileError("'RtlIpv6StringToAddress' requires that UNICODE be set to true or false in the root module"); pub const RtlIpv6StringToAddressEx = @compileError("'RtlIpv6StringToAddressEx' requires that UNICODE be set to true or false in the root module"); pub const RtlEthernetAddressToString = @compileError("'RtlEthernetAddressToString' requires that UNICODE be set to true or false in the root module"); pub const RtlEthernetStringToAddress = @compileError("'RtlEthernetStringToAddress' requires that UNICODE be set to true or false in the root module"); pub const EnumProtocols = @compileError("'EnumProtocols' requires that UNICODE be set to true or false in the root module"); pub const GetAddressByName = @compileError("'GetAddressByName' requires that UNICODE be set to true or false in the root module"); pub const GetTypeByName = @compileError("'GetTypeByName' requires that UNICODE be set to true or false in the root module"); pub const GetNameByType = @compileError("'GetNameByType' requires that UNICODE be set to true or false in the root module"); pub const SetService = @compileError("'SetService' requires that UNICODE be set to true or false in the root module"); pub const GetService = @compileError("'GetService' requires that UNICODE be set to true or false in the root module"); pub const GetAddrInfoEx = @compileError("'GetAddrInfoEx' requires that UNICODE be set to true or false in the root module"); pub const SetAddrInfoEx = @compileError("'SetAddrInfoEx' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (19) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BLOB = @import("../system/com.zig").BLOB; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const CHAR = @import("../foundation.zig").CHAR; const DL_EUI48 = @import("../network_management/windows_filtering_platform.zig").DL_EUI48; const FARPROC = @import("../foundation.zig").FARPROC; const HANDLE = @import("../foundation.zig").HANDLE; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const LPARAM = @import("../foundation.zig").LPARAM; const OVERLAPPED = @import("../system/io.zig").OVERLAPPED; const OVERLAPPED_ENTRY = @import("../system/io.zig").OVERLAPPED_ENTRY; const PROCESSOR_NUMBER = @import("../system/kernel.zig").PROCESSOR_NUMBER; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const QOS = @import("../network_management/qo_s.zig").QOS; 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(), "LPCONDITIONPROC")) { _ = LPCONDITIONPROC; } if (@hasDecl(@This(), "LPWSAOVERLAPPED_COMPLETION_ROUTINE")) { _ = LPWSAOVERLAPPED_COMPLETION_ROUTINE; } if (@hasDecl(@This(), "LPFN_TRANSMITFILE")) { _ = LPFN_TRANSMITFILE; } if (@hasDecl(@This(), "LPFN_ACCEPTEX")) { _ = LPFN_ACCEPTEX; } if (@hasDecl(@This(), "LPFN_GETACCEPTEXSOCKADDRS")) { _ = LPFN_GETACCEPTEXSOCKADDRS; } if (@hasDecl(@This(), "LPFN_TRANSMITPACKETS")) { _ = LPFN_TRANSMITPACKETS; } if (@hasDecl(@This(), "LPFN_CONNECTEX")) { _ = LPFN_CONNECTEX; } if (@hasDecl(@This(), "LPFN_DISCONNECTEX")) { _ = LPFN_DISCONNECTEX; } if (@hasDecl(@This(), "LPFN_WSARECVMSG")) { _ = LPFN_WSARECVMSG; } if (@hasDecl(@This(), "LPFN_WSASENDMSG")) { _ = LPFN_WSASENDMSG; } if (@hasDecl(@This(), "LPFN_WSAPOLL")) { _ = LPFN_WSAPOLL; } if (@hasDecl(@This(), "LPFN_RIORECEIVE")) { _ = LPFN_RIORECEIVE; } if (@hasDecl(@This(), "LPFN_RIORECEIVEEX")) { _ = LPFN_RIORECEIVEEX; } if (@hasDecl(@This(), "LPFN_RIOSEND")) { _ = LPFN_RIOSEND; } if (@hasDecl(@This(), "LPFN_RIOSENDEX")) { _ = LPFN_RIOSENDEX; } if (@hasDecl(@This(), "LPFN_RIOCLOSECOMPLETIONQUEUE")) { _ = LPFN_RIOCLOSECOMPLETIONQUEUE; } if (@hasDecl(@This(), "LPFN_RIOCREATECOMPLETIONQUEUE")) { _ = LPFN_RIOCREATECOMPLETIONQUEUE; } if (@hasDecl(@This(), "LPFN_RIOCREATEREQUESTQUEUE")) { _ = LPFN_RIOCREATEREQUESTQUEUE; } if (@hasDecl(@This(), "LPFN_RIODEQUEUECOMPLETION")) { _ = LPFN_RIODEQUEUECOMPLETION; } if (@hasDecl(@This(), "LPFN_RIODEREGISTERBUFFER")) { _ = LPFN_RIODEREGISTERBUFFER; } if (@hasDecl(@This(), "LPFN_RIONOTIFY")) { _ = LPFN_RIONOTIFY; } if (@hasDecl(@This(), "LPFN_RIOREGISTERBUFFER")) { _ = LPFN_RIOREGISTERBUFFER; } if (@hasDecl(@This(), "LPFN_RIORESIZECOMPLETIONQUEUE")) { _ = LPFN_RIORESIZECOMPLETIONQUEUE; } if (@hasDecl(@This(), "LPFN_RIORESIZEREQUESTQUEUE")) { _ = LPFN_RIORESIZEREQUESTQUEUE; } if (@hasDecl(@This(), "LPBLOCKINGCALLBACK")) { _ = LPBLOCKINGCALLBACK; } if (@hasDecl(@This(), "LPWSAUSERAPC")) { _ = LPWSAUSERAPC; } if (@hasDecl(@This(), "LPWSPACCEPT")) { _ = LPWSPACCEPT; } if (@hasDecl(@This(), "LPWSPADDRESSTOSTRING")) { _ = LPWSPADDRESSTOSTRING; } if (@hasDecl(@This(), "LPWSPASYNCSELECT")) { _ = LPWSPASYNCSELECT; } if (@hasDecl(@This(), "LPWSPBIND")) { _ = LPWSPBIND; } if (@hasDecl(@This(), "LPWSPCANCELBLOCKINGCALL")) { _ = LPWSPCANCELBLOCKINGCALL; } if (@hasDecl(@This(), "LPWSPCLEANUP")) { _ = LPWSPCLEANUP; } if (@hasDecl(@This(), "LPWSPCLOSESOCKET")) { _ = LPWSPCLOSESOCKET; } if (@hasDecl(@This(), "LPWSPCONNECT")) { _ = LPWSPCONNECT; } if (@hasDecl(@This(), "LPWSPDUPLICATESOCKET")) { _ = LPWSPDUPLICATESOCKET; } if (@hasDecl(@This(), "LPWSPENUMNETWORKEVENTS")) { _ = LPWSPENUMNETWORKEVENTS; } if (@hasDecl(@This(), "LPWSPEVENTSELECT")) { _ = LPWSPEVENTSELECT; } if (@hasDecl(@This(), "LPWSPGETOVERLAPPEDRESULT")) { _ = LPWSPGETOVERLAPPEDRESULT; } if (@hasDecl(@This(), "LPWSPGETPEERNAME")) { _ = LPWSPGETPEERNAME; } if (@hasDecl(@This(), "LPWSPGETSOCKNAME")) { _ = LPWSPGETSOCKNAME; } if (@hasDecl(@This(), "LPWSPGETSOCKOPT")) { _ = LPWSPGETSOCKOPT; } if (@hasDecl(@This(), "LPWSPGETQOSBYNAME")) { _ = LPWSPGETQOSBYNAME; } if (@hasDecl(@This(), "LPWSPIOCTL")) { _ = LPWSPIOCTL; } if (@hasDecl(@This(), "LPWSPJOINLEAF")) { _ = LPWSPJOINLEAF; } if (@hasDecl(@This(), "LPWSPLISTEN")) { _ = LPWSPLISTEN; } if (@hasDecl(@This(), "LPWSPRECV")) { _ = LPWSPRECV; } if (@hasDecl(@This(), "LPWSPRECVDISCONNECT")) { _ = LPWSPRECVDISCONNECT; } if (@hasDecl(@This(), "LPWSPRECVFROM")) { _ = LPWSPRECVFROM; } if (@hasDecl(@This(), "LPWSPSELECT")) { _ = LPWSPSELECT; } if (@hasDecl(@This(), "LPWSPSEND")) { _ = LPWSPSEND; } if (@hasDecl(@This(), "LPWSPSENDDISCONNECT")) { _ = LPWSPSENDDISCONNECT; } if (@hasDecl(@This(), "LPWSPSENDTO")) { _ = LPWSPSENDTO; } if (@hasDecl(@This(), "LPWSPSETSOCKOPT")) { _ = LPWSPSETSOCKOPT; } if (@hasDecl(@This(), "LPWSPSHUTDOWN")) { _ = LPWSPSHUTDOWN; } if (@hasDecl(@This(), "LPWSPSOCKET")) { _ = LPWSPSOCKET; } if (@hasDecl(@This(), "LPWSPSTRINGTOADDRESS")) { _ = LPWSPSTRINGTOADDRESS; } if (@hasDecl(@This(), "LPWPUCLOSEEVENT")) { _ = LPWPUCLOSEEVENT; } if (@hasDecl(@This(), "LPWPUCLOSESOCKETHANDLE")) { _ = LPWPUCLOSESOCKETHANDLE; } if (@hasDecl(@This(), "LPWPUCREATEEVENT")) { _ = LPWPUCREATEEVENT; } if (@hasDecl(@This(), "LPWPUCREATESOCKETHANDLE")) { _ = LPWPUCREATESOCKETHANDLE; } if (@hasDecl(@This(), "LPWPUFDISSET")) { _ = LPWPUFDISSET; } if (@hasDecl(@This(), "LPWPUGETPROVIDERPATH")) { _ = LPWPUGETPROVIDERPATH; } if (@hasDecl(@This(), "LPWPUMODIFYIFSHANDLE")) { _ = LPWPUMODIFYIFSHANDLE; } if (@hasDecl(@This(), "LPWPUPOSTMESSAGE")) { _ = LPWPUPOSTMESSAGE; } if (@hasDecl(@This(), "LPWPUQUERYBLOCKINGCALLBACK")) { _ = LPWPUQUERYBLOCKINGCALLBACK; } if (@hasDecl(@This(), "LPWPUQUERYSOCKETHANDLECONTEXT")) { _ = LPWPUQUERYSOCKETHANDLECONTEXT; } if (@hasDecl(@This(), "LPWPUQUEUEAPC")) { _ = LPWPUQUEUEAPC; } if (@hasDecl(@This(), "LPWPURESETEVENT")) { _ = LPWPURESETEVENT; } if (@hasDecl(@This(), "LPWPUSETEVENT")) { _ = LPWPUSETEVENT; } if (@hasDecl(@This(), "LPWPUOPENCURRENTTHREAD")) { _ = LPWPUOPENCURRENTTHREAD; } if (@hasDecl(@This(), "LPWPUCLOSETHREAD")) { _ = LPWPUCLOSETHREAD; } if (@hasDecl(@This(), "LPWPUCOMPLETEOVERLAPPEDREQUEST")) { _ = LPWPUCOMPLETEOVERLAPPEDREQUEST; } if (@hasDecl(@This(), "LPWSPSTARTUP")) { _ = LPWSPSTARTUP; } if (@hasDecl(@This(), "LPWSCENUMPROTOCOLS")) { _ = LPWSCENUMPROTOCOLS; } if (@hasDecl(@This(), "LPWSCDEINSTALLPROVIDER")) { _ = LPWSCDEINSTALLPROVIDER; } if (@hasDecl(@This(), "LPWSCINSTALLPROVIDER")) { _ = LPWSCINSTALLPROVIDER; } if (@hasDecl(@This(), "LPWSCGETPROVIDERPATH")) { _ = LPWSCGETPROVIDERPATH; } if (@hasDecl(@This(), "LPWSCUPDATEPROVIDER")) { _ = LPWSCUPDATEPROVIDER; } if (@hasDecl(@This(), "LPWSCINSTALLNAMESPACE")) { _ = LPWSCINSTALLNAMESPACE; } if (@hasDecl(@This(), "LPWSCUNINSTALLNAMESPACE")) { _ = LPWSCUNINSTALLNAMESPACE; } if (@hasDecl(@This(), "LPWSCENABLENSPROVIDER")) { _ = LPWSCENABLENSPROVIDER; } if (@hasDecl(@This(), "LPNSPCLEANUP")) { _ = LPNSPCLEANUP; } if (@hasDecl(@This(), "LPNSPLOOKUPSERVICEBEGIN")) { _ = LPNSPLOOKUPSERVICEBEGIN; } if (@hasDecl(@This(), "LPNSPLOOKUPSERVICENEXT")) { _ = LPNSPLOOKUPSERVICENEXT; } if (@hasDecl(@This(), "LPNSPIOCTL")) { _ = LPNSPIOCTL; } if (@hasDecl(@This(), "LPNSPLOOKUPSERVICEEND")) { _ = LPNSPLOOKUPSERVICEEND; } if (@hasDecl(@This(), "LPNSPSETSERVICE")) { _ = LPNSPSETSERVICE; } if (@hasDecl(@This(), "LPNSPINSTALLSERVICECLASS")) { _ = LPNSPINSTALLSERVICECLASS; } if (@hasDecl(@This(), "LPNSPREMOVESERVICECLASS")) { _ = LPNSPREMOVESERVICECLASS; } if (@hasDecl(@This(), "LPNSPGETSERVICECLASSINFO")) { _ = LPNSPGETSERVICECLASSINFO; } if (@hasDecl(@This(), "LPNSPSTARTUP")) { _ = LPNSPSTARTUP; } if (@hasDecl(@This(), "LPNSPV2STARTUP")) { _ = LPNSPV2STARTUP; } if (@hasDecl(@This(), "LPNSPV2CLEANUP")) { _ = LPNSPV2CLEANUP; } if (@hasDecl(@This(), "LPNSPV2LOOKUPSERVICEBEGIN")) { _ = LPNSPV2LOOKUPSERVICEBEGIN; } if (@hasDecl(@This(), "LPNSPV2LOOKUPSERVICENEXTEX")) { _ = LPNSPV2LOOKUPSERVICENEXTEX; } if (@hasDecl(@This(), "LPNSPV2LOOKUPSERVICEEND")) { _ = LPNSPV2LOOKUPSERVICEEND; } if (@hasDecl(@This(), "LPNSPV2SETSERVICEEX")) { _ = LPNSPV2SETSERVICEEX; } if (@hasDecl(@This(), "LPNSPV2CLIENTSESSIONRUNDOWN")) { _ = LPNSPV2CLIENTSESSIONRUNDOWN; } if (@hasDecl(@This(), "LPFN_NSPAPI")) { _ = LPFN_NSPAPI; } if (@hasDecl(@This(), "LPSERVICE_CALLBACK_PROC")) { _ = LPSERVICE_CALLBACK_PROC; } if (@hasDecl(@This(), "LPLOOKUPSERVICE_COMPLETION_ROUTINE")) { _ = LPLOOKUPSERVICE_COMPLETION_ROUTINE; } if (@hasDecl(@This(), "LPWSCWRITEPROVIDERORDER")) { _ = LPWSCWRITEPROVIDERORDER; } if (@hasDecl(@This(), "LPWSCWRITENAMESPACEORDER")) { _ = LPWSCWRITENAMESPACEORDER; } @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/networking/win_sock.zig
pub const CLUSTER_VERSION_FLAG_MIXED_MODE = @as(u32, 1); pub const CLUSTER_VERSION_UNKNOWN = @as(u32, 4294967295); pub const NT4_MAJOR_VERSION = @as(u32, 1); pub const NT4SP4_MAJOR_VERSION = @as(u32, 2); pub const NT5_MAJOR_VERSION = @as(u32, 3); pub const NT51_MAJOR_VERSION = @as(u32, 4); pub const NT6_MAJOR_VERSION = @as(u32, 5); pub const NT7_MAJOR_VERSION = @as(u32, 6); pub const NT8_MAJOR_VERSION = @as(u32, 7); pub const NT9_MAJOR_VERSION = @as(u32, 8); pub const NT10_MAJOR_VERSION = @as(u32, 9); pub const NT11_MAJOR_VERSION = @as(u32, 10); pub const NT12_MAJOR_VERSION = @as(u32, 11); pub const NT13_MAJOR_VERSION = @as(u32, 12); pub const WS2016_TP4_UPGRADE_VERSION = @as(u32, 6); pub const WS2016_TP5_UPGRADE_VERSION = @as(u32, 7); pub const WS2016_RTM_UPGRADE_VERSION = @as(u32, 8); pub const RS3_UPGRADE_VERSION = @as(u32, 1); pub const RS4_UPGRADE_VERSION = @as(u32, 2); pub const RS5_UPGRADE_VERSION = @as(u32, 3); pub const NINETEEN_H1_UPGRADE_VERSION = @as(u32, 1); pub const NINETEEN_H2_UPGRADE_VERSION = @as(u32, 2); pub const MN_UPGRADE_VERSION = @as(u32, 3); pub const FE_UPGRADE_VERSION = @as(u32, 4); pub const CA_UPGRADE_VERSION = @as(u32, 1); pub const HCI_UPGRADE_BIT = @as(u32, 32768); pub const CLUSAPI_VERSION_SERVER2008 = @as(u32, 1536); pub const CLUSAPI_VERSION_SERVER2008R2 = @as(u32, 1792); pub const CLUSAPI_VERSION_WINDOWS8 = @as(u32, 1793); pub const CLUSAPI_VERSION_WINDOWSBLUE = @as(u32, 1794); pub const CLUSAPI_VERSION_WINTHRESHOLD = @as(u32, 1795); pub const CLUSAPI_VERSION_RS3 = @as(u32, 2560); pub const CLUSAPI_VERSION = @as(u32, 2560); pub const CREATE_CLUSTER_VERSION = @as(u32, 1536); pub const CREATE_CLUSTER_MAJOR_VERSION_MASK = @as(u32, 4294967040); pub const MAX_CLUSTERNAME_LENGTH = @as(u32, 63); pub const CLUSTER_INSTALLED = @as(u32, 1); pub const CLUSTER_CONFIGURED = @as(u32, 2); pub const CLUSTER_RUNNING = @as(u32, 16); pub const CLUS_HYBRID_QUORUM = @as(u32, 1024); pub const CLUS_NODE_MAJORITY_QUORUM = @as(u32, 0); pub const CLUSCTL_RESOURCE_STATE_CHANGE_REASON_VERSION_1 = @as(u32, 1); pub const CLUSREG_DATABASE_SYNC_WRITE_TO_ALL_NODES = @as(u32, 1); pub const CLUSREG_DATABASE_ISOLATE_READ = @as(u32, 2); pub const CLUSTER_ENUM_ITEM_VERSION_1 = @as(u32, 1); pub const CLUSTER_ENUM_ITEM_VERSION = @as(u32, 1); pub const CLUSTER_CREATE_GROUP_INFO_VERSION_1 = @as(u32, 1); pub const CLUSTER_CREATE_GROUP_INFO_VERSION = @as(u32, 1); pub const GROUPSET_READY_SETTING_DELAY = @as(u32, 1); pub const GROUPSET_READY_SETTING_ONLINE = @as(u32, 2); pub const GROUPSET_READY_SETTING_OS_HEARTBEAT = @as(u32, 3); pub const GROUPSET_READY_SETTING_APPLICATION_READY = @as(u32, 4); pub const CLUS_GRP_MOVE_ALLOWED = @as(u32, 0); pub const CLUS_GRP_MOVE_LOCKED = @as(u32, 1); pub const CLUSAPI_READ_ACCESS = @as(i32, 1); pub const CLUSAPI_CHANGE_ACCESS = @as(i32, 2); pub const CLUSAPI_NO_ACCESS = @as(i32, 4); pub const CLUSTER_SET_ACCESS_TYPE_ALLOWED = @as(u32, 0); pub const CLUSTER_SET_ACCESS_TYPE_DENIED = @as(u32, 1); pub const CLUSTER_DELETE_ACCESS_CONTROL_ENTRY = @as(u32, 2); pub const CLUSGROUPSET_STATUS_GROUPS_PENDING = @as(u64, 1); pub const CLUSGROUPSET_STATUS_GROUPS_ONLINE = @as(u64, 2); pub const CLUSGROUPSET_STATUS_OS_HEARTBEAT = @as(u64, 4); pub const CLUSGROUPSET_STATUS_APPLICATION_READY = @as(u64, 8); pub const CLUSTER_AVAILABILITY_SET_CONFIG_V1 = @as(u32, 1); pub const CLUSTER_GROUP_ENUM_ITEM_VERSION_1 = @as(u32, 1); pub const CLUSTER_GROUP_ENUM_ITEM_VERSION = @as(u32, 1); pub const CLUSTER_RESOURCE_ENUM_ITEM_VERSION_1 = @as(u32, 1); pub const CLUSTER_RESOURCE_ENUM_ITEM_VERSION = @as(u32, 1); pub const CLUSAPI_NODE_PAUSE_REMAIN_ON_PAUSED_NODE_ON_MOVE_ERROR = @as(u32, 1); pub const CLUSAPI_NODE_AVOID_PLACEMENT = @as(u32, 2); pub const CLUSAPI_NODE_PAUSE_RETRY_DRAIN_ON_FAILURE = @as(u32, 4); pub const CLUSGRP_STATUS_LOCKED_MODE = @as(u64, 1); pub const CLUSGRP_STATUS_PREEMPTED = @as(u64, 2); pub const CLUSGRP_STATUS_WAITING_IN_QUEUE_FOR_MOVE = @as(u64, 4); pub const CLUSGRP_STATUS_PHYSICAL_RESOURCES_LACKING = @as(u64, 8); pub const CLUSGRP_STATUS_WAITING_TO_START = @as(u64, 16); pub const CLUSGRP_STATUS_EMBEDDED_FAILURE = @as(u64, 32); pub const CLUSGRP_STATUS_OFFLINE_DUE_TO_ANTIAFFINITY_CONFLICT = @as(u64, 64); pub const CLUSGRP_STATUS_NETWORK_FAILURE = @as(u64, 128); pub const CLUSGRP_STATUS_UNMONITORED = @as(u64, 256); pub const CLUSGRP_STATUS_OS_HEARTBEAT = @as(u64, 512); pub const CLUSGRP_STATUS_APPLICATION_READY = @as(u64, 1024); pub const CLUSGRP_STATUS_OFFLINE_NOT_LOCAL_DISK_OWNER = @as(u64, 2048); pub const CLUSGRP_STATUS_WAITING_FOR_DEPENDENCIES = @as(u64, 4096); pub const CLUSRES_STATUS_LOCKED_MODE = @as(u64, 1); pub const CLUSRES_STATUS_EMBEDDED_FAILURE = @as(u64, 2); pub const CLUSRES_STATUS_FAILED_DUE_TO_INSUFFICIENT_CPU = @as(u64, 4); pub const CLUSRES_STATUS_FAILED_DUE_TO_INSUFFICIENT_MEMORY = @as(u64, 8); pub const CLUSRES_STATUS_FAILED_DUE_TO_INSUFFICIENT_GENERIC_RESOURCES = @as(u64, 16); pub const CLUSRES_STATUS_NETWORK_FAILURE = @as(u64, 32); pub const CLUSRES_STATUS_UNMONITORED = @as(u64, 64); pub const CLUSRES_STATUS_OS_HEARTBEAT = @as(u64, 128); pub const CLUSRES_STATUS_APPLICATION_READY = @as(u64, 256); pub const CLUSRES_STATUS_OFFLINE_NOT_LOCAL_DISK_OWNER = @as(u64, 512); pub const CLUSAPI_GROUP_ONLINE_IGNORE_RESOURCE_STATUS = @as(u32, 1); pub const CLUSAPI_GROUP_ONLINE_SYNCHRONOUS = @as(u32, 2); pub const CLUSAPI_GROUP_ONLINE_BEST_POSSIBLE_NODE = @as(u32, 4); pub const CLUSAPI_GROUP_ONLINE_IGNORE_AFFINITY_RULE = @as(u32, 8); pub const CLUSAPI_GROUP_OFFLINE_IGNORE_RESOURCE_STATUS = @as(u32, 1); pub const CLUSAPI_RESOURCE_ONLINE_IGNORE_RESOURCE_STATUS = @as(u32, 1); pub const CLUSAPI_RESOURCE_ONLINE_DO_NOT_UPDATE_PERSISTENT_STATE = @as(u32, 2); pub const CLUSAPI_RESOURCE_ONLINE_NECESSARY_FOR_QUORUM = @as(u32, 4); pub const CLUSAPI_RESOURCE_ONLINE_BEST_POSSIBLE_NODE = @as(u32, 8); pub const CLUSAPI_RESOURCE_ONLINE_IGNORE_AFFINITY_RULE = @as(u32, 32); pub const CLUSAPI_RESOURCE_OFFLINE_IGNORE_RESOURCE_STATUS = @as(u32, 1); pub const CLUSAPI_RESOURCE_OFFLINE_FORCE_WITH_TERMINATION = @as(u32, 2); pub const CLUSAPI_RESOURCE_OFFLINE_DO_NOT_UPDATE_PERSISTENT_STATE = @as(u32, 4); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_NONE = @as(u32, 0); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_UNKNOWN = @as(u32, 1); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_MOVING = @as(u32, 2); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_USER_REQUESTED = @as(u32, 4); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_BEING_DELETED = @as(u32, 8); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_BEING_RESTARTED = @as(u32, 16); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_PREEMPTED = @as(u32, 32); pub const CLUSAPI_RESOURCE_OFFLINE_REASON_SHUTTING_DOWN = @as(u32, 64); pub const CLUSAPI_GROUP_MOVE_IGNORE_RESOURCE_STATUS = @as(u32, 1); pub const CLUSAPI_GROUP_MOVE_RETURN_TO_SOURCE_NODE_ON_ERROR = @as(u32, 2); pub const CLUSAPI_GROUP_MOVE_QUEUE_ENABLED = @as(u32, 4); pub const CLUSAPI_GROUP_MOVE_HIGH_PRIORITY_START = @as(u32, 8); pub const CLUSAPI_GROUP_MOVE_FAILBACK = @as(u32, 16); pub const CLUSAPI_GROUP_MOVE_IGNORE_AFFINITY_RULE = @as(u32, 32); pub const CLUSAPI_CHANGE_RESOURCE_GROUP_FORCE_MOVE_TO_CSV = @as(u64, 1); pub const CLUSAPI_VALID_CHANGE_RESOURCE_GROUP_FLAGS = @as(u64, 1); pub const GROUP_FAILURE_INFO_VERSION_1 = @as(u32, 1); pub const RESOURCE_FAILURE_INFO_VERSION_1 = @as(u32, 1); pub const CLUS_ACCESS_ANY = @as(u32, 0); pub const CLUS_ACCESS_READ = @as(u32, 1); pub const CLUS_ACCESS_WRITE = @as(u32, 2); pub const CLUS_NO_MODIFY = @as(u32, 0); pub const CLUS_MODIFY = @as(u32, 1); pub const CLUS_NOT_GLOBAL = @as(u32, 0); pub const CLUS_GLOBAL = @as(u32, 1); pub const CLUSCTL_ACCESS_SHIFT = @as(u32, 0); pub const CLUSCTL_FUNCTION_SHIFT = @as(u32, 2); pub const CLCTL_INTERNAL_SHIFT = @as(u32, 20); pub const CLCTL_USER_SHIFT = @as(u32, 21); pub const CLCTL_MODIFY_SHIFT = @as(u32, 22); pub const CLCTL_GLOBAL_SHIFT = @as(u32, 23); pub const CLUSCTL_OBJECT_SHIFT = @as(u32, 24); pub const CLUSCTL_CONTROL_CODE_MASK = @as(u32, 4194303); pub const CLUSCTL_OBJECT_MASK = @as(u32, 255); pub const CLUSCTL_ACCESS_MODE_MASK = @as(u32, 3); pub const CLCTL_CLUSTER_BASE = @as(u32, 0); pub const BitLockerEnabled = @as(i32, 1); pub const BitLockerDecrypted = @as(i32, 4); pub const BitlockerEncrypted = @as(i32, 8); pub const BitLockerDecrypting = @as(i32, 16); pub const BitlockerEncrypting = @as(i32, 32); pub const BitLockerPaused = @as(i32, 64); pub const BitLockerStopped = @as(i32, 128); pub const RedirectedIOReasonUserRequest = @as(u64, 1); pub const RedirectedIOReasonUnsafeFileSystemFilter = @as(u64, 2); pub const RedirectedIOReasonUnsafeVolumeFilter = @as(u64, 4); pub const RedirectedIOReasonFileSystemTiering = @as(u64, 8); pub const RedirectedIOReasonBitLockerInitializing = @as(u64, 16); pub const RedirectedIOReasonReFs = @as(u64, 32); pub const RedirectedIOReasonMax = @as(u64, 9223372036854775808); pub const VolumeRedirectedIOReasonNoDiskConnectivity = @as(u64, 1); pub const VolumeRedirectedIOReasonStorageSpaceNotAttached = @as(u64, 2); pub const VolumeRedirectedIOReasonVolumeReplicationEnabled = @as(u64, 4); pub const VolumeRedirectedIOReasonMax = @as(u64, 9223372036854775808); pub const MAX_OBJECTID = @as(u32, 64); pub const MAX_CO_PASSWORD_LENGTH = @as(u32, 16); pub const GUID_PRESENT = @as(u32, 1); pub const CREATEDC_PRESENT = @as(u32, 2); pub const MAX_CO_PASSWORD_LENGTHEX = @as(u32, 127); pub const MAX_CO_PASSWORD_STORAGEEX = @as(u32, 128); pub const MAX_CREATINGDC_LENGTH = @as(u32, 256); pub const DNS_LENGTH = @as(u32, 64); pub const MAINTENANCE_MODE_V2_SIG = @as(u32, 2881155087); pub const NNLEN = @as(u32, 80); pub const SR_REPLICATED_PARTITION_DISALLOW_MULTINODE_IO = @as(u32, 1); pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_FLAG_ADD_VOLUME_INFO = @as(u32, 1); pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_FLAG_FILTER_BY_POOL = @as(u32, 2); pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_FLAG_INCLUDE_NON_SHARED_DISKS = @as(u32, 4); pub const CLRES_VERSION_V1_00 = @as(u32, 256); pub const CLRES_VERSION_V2_00 = @as(u32, 512); pub const CLRES_VERSION_V3_00 = @as(u32, 768); pub const CLRES_VERSION_V4_00 = @as(u32, 1024); pub const CLUSCTL_GET_OPERATION_CONTEXT_PARAMS_VERSION_1 = @as(u32, 1); pub const CLUSRESDLL_STATUS_OFFLINE_BUSY = @as(u32, 1); pub const CLUSRESDLL_STATUS_OFFLINE_SOURCE_THROTTLED = @as(u32, 2); pub const CLUSRESDLL_STATUS_OFFLINE_DESTINATION_THROTTLED = @as(u32, 4); pub const CLUSRESDLL_STATUS_OFFLINE_DESTINATION_REJECTED = @as(u32, 8); pub const CLUSRESDLL_STATUS_INSUFFICIENT_MEMORY = @as(u32, 16); pub const CLUSRESDLL_STATUS_INSUFFICIENT_PROCESSOR = @as(u32, 32); pub const CLUSRESDLL_STATUS_INSUFFICIENT_OTHER_RESOURCES = @as(u32, 64); pub const CLUSRESDLL_STATUS_INVALID_PARAMETERS = @as(u32, 128); pub const CLUSRESDLL_STATUS_NETWORK_NOT_AVAILABLE = @as(u32, 256); pub const CLUSRESDLL_STATUS_DO_NOT_COLLECT_WER_REPORT = @as(u32, 1073741824); pub const CLUSRESDLL_STATUS_DUMP_NOW = @as(u32, 2147483648); pub const CLUS_RESDLL_OPEN_RECOVER_MONITOR_STATE = @as(u32, 1); pub const CLUS_RESDLL_ONLINE_RECOVER_MONITOR_STATE = @as(u32, 1); pub const CLUS_RESDLL_ONLINE_IGNORE_RESOURCE_STATUS = @as(u32, 2); pub const CLUS_RESDLL_ONLINE_RETURN_TO_SOURCE_NODE_ON_ERROR = @as(u32, 4); pub const CLUS_RESDLL_ONLINE_RESTORE_ONLINE_STATE = @as(u32, 8); pub const CLUS_RESDLL_ONLINE_IGNORE_NETWORK_CONNECTIVITY = @as(u32, 16); pub const CLUS_RESDLL_OFFLINE_IGNORE_RESOURCE_STATUS = @as(u32, 1); pub const CLUS_RESDLL_OFFLINE_RETURN_TO_SOURCE_NODE_ON_ERROR = @as(u32, 2); pub const CLUS_RESDLL_OFFLINE_QUEUE_ENABLED = @as(u32, 4); pub const CLUS_RESDLL_OFFLINE_RETURNING_TO_SOURCE_NODE_BECAUSE_OF_ERROR = @as(u32, 8); pub const CLUS_RESDLL_OFFLINE_DUE_TO_EMBEDDED_FAILURE = @as(u32, 16); pub const CLUS_RESDLL_OFFLINE_IGNORE_NETWORK_CONNECTIVITY = @as(u32, 32); pub const CLUS_RESDLL_OFFLINE_DO_NOT_UPDATE_PERSISTENT_STATE = @as(u32, 64); pub const CLUS_RESDLL_OPEN_DONT_DELETE_TEMP_DISK = @as(u32, 2); pub const RESTYPE_MONITOR_SHUTTING_DOWN_NODE_STOP = @as(u32, 1); pub const RESTYPE_MONITOR_SHUTTING_DOWN_CLUSSVC_CRASH = @as(u32, 2); pub const RESUTIL_PROPITEM_READ_ONLY = @as(u32, 1); pub const RESUTIL_PROPITEM_REQUIRED = @as(u32, 2); pub const RESUTIL_PROPITEM_SIGNED = @as(u32, 4); pub const RESUTIL_PROPITEM_IN_MEMORY = @as(u32, 8); pub const LOCKED_MODE_FLAGS_DONT_REMOVE_FROM_MOVE_QUEUE = @as(u32, 1); pub const CLUSTER_HEALTH_FAULT_ARGS = @as(u32, 7); pub const CLUSTER_HEALTH_FAULT_ID = @as(u32, 0); pub const CLUSTER_HEALTH_FAULT_ERRORTYPE = @as(u32, 1); pub const CLUSTER_HEALTH_FAULT_ERRORCODE = @as(u32, 2); pub const CLUSTER_HEALTH_FAULT_DESCRIPTION = @as(u32, 3); pub const CLUSTER_HEALTH_FAULT_PROVIDER = @as(u32, 4); pub const CLUSTER_HEALTH_FAULT_FLAGS = @as(u32, 5); pub const CLUSTER_HEALTH_FAULT_RESERVED = @as(u32, 6); pub const CLUS_CREATE_CRYPT_CONTAINER_NOT_FOUND = @as(u32, 1); pub const SET_APPINSTANCE_CSV_FLAGS_VALID_ONLY_IF_CSV_COORDINATOR = @as(u32, 1); //-------------------------------------------------------------------------------- // Section: Types (689) //-------------------------------------------------------------------------------- pub const _HCLUSTER = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNODE = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HRESOURCE = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HGROUP = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNETWORK = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNETINTERFACE = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HCHANGE = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HCLUSENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HGROUPENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HRESENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNETWORKENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNODEENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNETINTERFACEENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HRESTYPEENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HREGBATCH = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HREGBATCHPORT = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HREGBATCHNOTIFICATION = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HREGREADBATCH = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HREGREADBATCHREPLY = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HNODEENUMEX = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HCLUSENUMEX = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HGROUPENUMEX = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HRESENUMEX = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HGROUPSET = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const _HGROUPSETENUM = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const CLUSTER_QUORUM_TYPE = enum(i32) { OperationalQuorum = 0, ModifyQuorum = 1, }; pub const OperationalQuorum = CLUSTER_QUORUM_TYPE.OperationalQuorum; pub const ModifyQuorum = CLUSTER_QUORUM_TYPE.ModifyQuorum; pub const CLUSTERVERSIONINFO_NT4 = extern struct { dwVersionInfoSize: u32, MajorVersion: u16, MinorVersion: u16, BuildNumber: u16, szVendorId: [64]u16, szCSDVersion: [64]u16, }; pub const CLUSTERVERSIONINFO = extern struct { dwVersionInfoSize: u32, MajorVersion: u16, MinorVersion: u16, BuildNumber: u16, szVendorId: [64]u16, szCSDVersion: [64]u16, dwClusterHighestVersion: u32, dwClusterLowestVersion: u32, dwFlags: u32, dwReserved: u32, }; pub const CLUS_STARTING_PARAMS = extern struct { dwSize: u32, bForm: BOOL, bFirst: BOOL, }; pub const NODE_CLUSTER_STATE = enum(i32) { NotInstalled = 0, NotConfigured = 1, NotRunning = 3, Running = 19, }; pub const ClusterStateNotInstalled = NODE_CLUSTER_STATE.NotInstalled; pub const ClusterStateNotConfigured = NODE_CLUSTER_STATE.NotConfigured; pub const ClusterStateNotRunning = NODE_CLUSTER_STATE.NotRunning; pub const ClusterStateRunning = NODE_CLUSTER_STATE.Running; pub const CLUSTER_RESOURCE_STATE_CHANGE_REASON = enum(i32) { Unknown = 0, Move = 1, Failover = 2, FailedMove = 3, Shutdown = 4, Rundown = 5, }; pub const eResourceStateChangeReasonUnknown = CLUSTER_RESOURCE_STATE_CHANGE_REASON.Unknown; pub const eResourceStateChangeReasonMove = CLUSTER_RESOURCE_STATE_CHANGE_REASON.Move; pub const eResourceStateChangeReasonFailover = CLUSTER_RESOURCE_STATE_CHANGE_REASON.Failover; pub const eResourceStateChangeReasonFailedMove = CLUSTER_RESOURCE_STATE_CHANGE_REASON.FailedMove; pub const eResourceStateChangeReasonShutdown = CLUSTER_RESOURCE_STATE_CHANGE_REASON.Shutdown; pub const eResourceStateChangeReasonRundown = CLUSTER_RESOURCE_STATE_CHANGE_REASON.Rundown; pub const CLUSTER_REG_COMMAND = enum(i32) { COMMAND_NONE = 0, SET_VALUE = 1, CREATE_KEY = 2, DELETE_KEY = 3, DELETE_VALUE = 4, SET_KEY_SECURITY = 5, VALUE_DELETED = 6, READ_KEY = 7, READ_VALUE = 8, READ_ERROR = 9, CONTROL_COMMAND = 10, CONDITION_EXISTS = 11, CONDITION_NOT_EXISTS = 12, CONDITION_IS_EQUAL = 13, CONDITION_IS_NOT_EQUAL = 14, CONDITION_IS_GREATER_THAN = 15, CONDITION_IS_LESS_THAN = 16, CONDITION_KEY_EXISTS = 17, CONDITION_KEY_NOT_EXISTS = 18, LAST_COMMAND = 19, }; pub const CLUSREG_COMMAND_NONE = CLUSTER_REG_COMMAND.COMMAND_NONE; pub const CLUSREG_SET_VALUE = CLUSTER_REG_COMMAND.SET_VALUE; pub const CLUSREG_CREATE_KEY = CLUSTER_REG_COMMAND.CREATE_KEY; pub const CLUSREG_DELETE_KEY = CLUSTER_REG_COMMAND.DELETE_KEY; pub const CLUSREG_DELETE_VALUE = CLUSTER_REG_COMMAND.DELETE_VALUE; pub const CLUSREG_SET_KEY_SECURITY = CLUSTER_REG_COMMAND.SET_KEY_SECURITY; pub const CLUSREG_VALUE_DELETED = CLUSTER_REG_COMMAND.VALUE_DELETED; pub const CLUSREG_READ_KEY = CLUSTER_REG_COMMAND.READ_KEY; pub const CLUSREG_READ_VALUE = CLUSTER_REG_COMMAND.READ_VALUE; pub const CLUSREG_READ_ERROR = CLUSTER_REG_COMMAND.READ_ERROR; pub const CLUSREG_CONTROL_COMMAND = CLUSTER_REG_COMMAND.CONTROL_COMMAND; pub const CLUSREG_CONDITION_EXISTS = CLUSTER_REG_COMMAND.CONDITION_EXISTS; pub const CLUSREG_CONDITION_NOT_EXISTS = CLUSTER_REG_COMMAND.CONDITION_NOT_EXISTS; pub const CLUSREG_CONDITION_IS_EQUAL = CLUSTER_REG_COMMAND.CONDITION_IS_EQUAL; pub const CLUSREG_CONDITION_IS_NOT_EQUAL = CLUSTER_REG_COMMAND.CONDITION_IS_NOT_EQUAL; pub const CLUSREG_CONDITION_IS_GREATER_THAN = CLUSTER_REG_COMMAND.CONDITION_IS_GREATER_THAN; pub const CLUSREG_CONDITION_IS_LESS_THAN = CLUSTER_REG_COMMAND.CONDITION_IS_LESS_THAN; pub const CLUSREG_CONDITION_KEY_EXISTS = CLUSTER_REG_COMMAND.CONDITION_KEY_EXISTS; pub const CLUSREG_CONDITION_KEY_NOT_EXISTS = CLUSTER_REG_COMMAND.CONDITION_KEY_NOT_EXISTS; pub const CLUSREG_LAST_COMMAND = CLUSTER_REG_COMMAND.LAST_COMMAND; pub const CLUSCTL_RESOURCE_STATE_CHANGE_REASON_STRUCT = extern struct { dwSize: u32, dwVersion: u32, eReason: CLUSTER_RESOURCE_STATE_CHANGE_REASON, }; pub const CLUSTER_BATCH_COMMAND = extern struct { Command: CLUSTER_REG_COMMAND, dwOptions: u32, wzName: ?[*:0]const u16, lpData: ?*const u8, cbData: u32, }; pub const CLUSTER_READ_BATCH_COMMAND = extern struct { Command: CLUSTER_REG_COMMAND, dwOptions: u32, wzSubkeyName: ?[*:0]const u16, wzValueName: ?[*:0]const u16, lpData: ?*const u8, cbData: u32, }; pub const CLUSTER_ENUM_ITEM = extern struct { dwVersion: u32, dwType: u32, cbId: u32, lpszId: ?PWSTR, cbName: u32, lpszName: ?PWSTR, }; pub const CLUSGROUP_TYPE = enum(i32) { CoreCluster = 1, AvailableStorage = 2, Temporary = 3, SharedVolume = 4, StoragePool = 5, FileServer = 100, PrintServer = 101, DhcpServer = 102, Dtc = 103, Msmq = 104, Wins = 105, StandAloneDfs = 106, GenericApplication = 107, GenericService = 108, GenericScript = 109, IScsiNameService = 110, VirtualMachine = 111, TsSessionBroker = 112, IScsiTarget = 113, ScaleoutFileServer = 114, VMReplicaBroker = 115, TaskScheduler = 116, ClusterUpdateAgent = 117, ScaleoutCluster = 118, StorageReplica = 119, VMReplicaCoordinator = 120, CrossClusterOrchestrator = 121, InfrastructureFileServer = 122, CoreSddc = 123, Unknown = 9999, }; pub const ClusGroupTypeCoreCluster = CLUSGROUP_TYPE.CoreCluster; pub const ClusGroupTypeAvailableStorage = CLUSGROUP_TYPE.AvailableStorage; pub const ClusGroupTypeTemporary = CLUSGROUP_TYPE.Temporary; pub const ClusGroupTypeSharedVolume = CLUSGROUP_TYPE.SharedVolume; pub const ClusGroupTypeStoragePool = CLUSGROUP_TYPE.StoragePool; pub const ClusGroupTypeFileServer = CLUSGROUP_TYPE.FileServer; pub const ClusGroupTypePrintServer = CLUSGROUP_TYPE.PrintServer; pub const ClusGroupTypeDhcpServer = CLUSGROUP_TYPE.DhcpServer; pub const ClusGroupTypeDtc = CLUSGROUP_TYPE.Dtc; pub const ClusGroupTypeMsmq = CLUSGROUP_TYPE.Msmq; pub const ClusGroupTypeWins = CLUSGROUP_TYPE.Wins; pub const ClusGroupTypeStandAloneDfs = CLUSGROUP_TYPE.StandAloneDfs; pub const ClusGroupTypeGenericApplication = CLUSGROUP_TYPE.GenericApplication; pub const ClusGroupTypeGenericService = CLUSGROUP_TYPE.GenericService; pub const ClusGroupTypeGenericScript = CLUSGROUP_TYPE.GenericScript; pub const ClusGroupTypeIScsiNameService = CLUSGROUP_TYPE.IScsiNameService; pub const ClusGroupTypeVirtualMachine = CLUSGROUP_TYPE.VirtualMachine; pub const ClusGroupTypeTsSessionBroker = CLUSGROUP_TYPE.TsSessionBroker; pub const ClusGroupTypeIScsiTarget = CLUSGROUP_TYPE.IScsiTarget; pub const ClusGroupTypeScaleoutFileServer = CLUSGROUP_TYPE.ScaleoutFileServer; pub const ClusGroupTypeVMReplicaBroker = CLUSGROUP_TYPE.VMReplicaBroker; pub const ClusGroupTypeTaskScheduler = CLUSGROUP_TYPE.TaskScheduler; pub const ClusGroupTypeClusterUpdateAgent = CLUSGROUP_TYPE.ClusterUpdateAgent; pub const ClusGroupTypeScaleoutCluster = CLUSGROUP_TYPE.ScaleoutCluster; pub const ClusGroupTypeStorageReplica = CLUSGROUP_TYPE.StorageReplica; pub const ClusGroupTypeVMReplicaCoordinator = CLUSGROUP_TYPE.VMReplicaCoordinator; pub const ClusGroupTypeCrossClusterOrchestrator = CLUSGROUP_TYPE.CrossClusterOrchestrator; pub const ClusGroupTypeInfrastructureFileServer = CLUSGROUP_TYPE.InfrastructureFileServer; pub const ClusGroupTypeCoreSddc = CLUSGROUP_TYPE.CoreSddc; pub const ClusGroupTypeUnknown = CLUSGROUP_TYPE.Unknown; pub const CLUSTER_CREATE_GROUP_INFO = extern struct { dwVersion: u32, groupType: CLUSGROUP_TYPE, }; pub const CLUSTER_MGMT_POINT_TYPE = enum(i32) { NONE = 0, CNO = 1, DNS_ONLY = 2, CNO_ONLY = 3, }; pub const CLUSTER_MGMT_POINT_TYPE_NONE = CLUSTER_MGMT_POINT_TYPE.NONE; pub const CLUSTER_MGMT_POINT_TYPE_CNO = CLUSTER_MGMT_POINT_TYPE.CNO; pub const CLUSTER_MGMT_POINT_TYPE_DNS_ONLY = CLUSTER_MGMT_POINT_TYPE.DNS_ONLY; pub const CLUSTER_MGMT_POINT_TYPE_CNO_ONLY = CLUSTER_MGMT_POINT_TYPE.CNO_ONLY; pub const CLUSTER_MGMT_POINT_RESTYPE = enum(i32) { AUTO = 0, SNN = 1, DNN = 2, }; pub const CLUSTER_MGMT_POINT_RESTYPE_AUTO = CLUSTER_MGMT_POINT_RESTYPE.AUTO; pub const CLUSTER_MGMT_POINT_RESTYPE_SNN = CLUSTER_MGMT_POINT_RESTYPE.SNN; pub const CLUSTER_MGMT_POINT_RESTYPE_DNN = CLUSTER_MGMT_POINT_RESTYPE.DNN; pub const CLUSTER_CLOUD_TYPE = enum(i32) { NONE = 0, AZURE = 1, MIXED = 128, UNKNOWN = -1, }; pub const CLUSTER_CLOUD_TYPE_NONE = CLUSTER_CLOUD_TYPE.NONE; pub const CLUSTER_CLOUD_TYPE_AZURE = CLUSTER_CLOUD_TYPE.AZURE; pub const CLUSTER_CLOUD_TYPE_MIXED = CLUSTER_CLOUD_TYPE.MIXED; pub const CLUSTER_CLOUD_TYPE_UNKNOWN = CLUSTER_CLOUD_TYPE.UNKNOWN; pub const CLUS_GROUP_START_SETTING = enum(i32) { START_ALWAYS = 0, DO_NOT_START = 1, START_ALLOWED = 2, }; pub const CLUS_GROUP_START_ALWAYS = CLUS_GROUP_START_SETTING.START_ALWAYS; pub const CLUS_GROUP_DO_NOT_START = CLUS_GROUP_START_SETTING.DO_NOT_START; pub const CLUS_GROUP_START_ALLOWED = CLUS_GROUP_START_SETTING.START_ALLOWED; pub const CLUS_AFFINITY_RULE_TYPE = enum(i32) { NONE = 0, SAME_FAULT_DOMAIN = 1, SAME_NODE = 2, DIFFERENT_FAULT_DOMAIN = 3, DIFFERENT_NODE = 4, // MIN = 0, this enum value conflicts with NONE // MAX = 4, this enum value conflicts with DIFFERENT_NODE }; pub const CLUS_AFFINITY_RULE_NONE = CLUS_AFFINITY_RULE_TYPE.NONE; pub const CLUS_AFFINITY_RULE_SAME_FAULT_DOMAIN = CLUS_AFFINITY_RULE_TYPE.SAME_FAULT_DOMAIN; pub const CLUS_AFFINITY_RULE_SAME_NODE = CLUS_AFFINITY_RULE_TYPE.SAME_NODE; pub const CLUS_AFFINITY_RULE_DIFFERENT_FAULT_DOMAIN = CLUS_AFFINITY_RULE_TYPE.DIFFERENT_FAULT_DOMAIN; pub const CLUS_AFFINITY_RULE_DIFFERENT_NODE = CLUS_AFFINITY_RULE_TYPE.DIFFERENT_NODE; pub const CLUS_AFFINITY_RULE_MIN = CLUS_AFFINITY_RULE_TYPE.NONE; pub const CLUS_AFFINITY_RULE_MAX = CLUS_AFFINITY_RULE_TYPE.DIFFERENT_NODE; pub const CLUSTER_QUORUM_VALUE = enum(i32) { MAINTAINED = 0, LOST = 1, }; pub const CLUSTER_QUORUM_MAINTAINED = CLUSTER_QUORUM_VALUE.MAINTAINED; pub const CLUSTER_QUORUM_LOST = CLUSTER_QUORUM_VALUE.LOST; pub const CLUSTER_VALIDATE_PATH = extern struct { szPath: [1]u16, }; pub const CLUSTER_VALIDATE_DIRECTORY = extern struct { szPath: [1]u16, }; pub const CLUSTER_VALIDATE_NETNAME = extern struct { szNetworkName: [1]u16, }; pub const CLUSTER_VALIDATE_CSV_FILENAME = extern struct { szFileName: [1]u16, }; pub const CLUSTER_SET_PASSWORD_STATUS = extern struct { NodeId: u32, SetAttempted: BOOLEAN, ReturnStatus: u32, }; pub const CLUSTER_IP_ENTRY = extern struct { lpszIpAddress: ?[*:0]const u16, dwPrefixLength: u32, }; pub const CREATE_CLUSTER_CONFIG = extern struct { dwVersion: u32, lpszClusterName: ?[*:0]const u16, cNodes: u32, ppszNodeNames: ?*?PWSTR, cIpEntries: u32, pIpEntries: ?*CLUSTER_IP_ENTRY, fEmptyCluster: BOOLEAN, managementPointType: CLUSTER_MGMT_POINT_TYPE, managementPointResType: CLUSTER_MGMT_POINT_RESTYPE, }; pub const CREATE_CLUSTER_NAME_ACCOUNT = extern struct { dwVersion: u32, lpszClusterName: ?[*:0]const u16, dwFlags: u32, pszUserName: ?[*:0]const u16, pszPassword: ?[*:0]const u16, pszDomain: ?[*:0]const u16, managementPointType: CLUSTER_MGMT_POINT_TYPE, managementPointResType: CLUSTER_MGMT_POINT_RESTYPE, bUpgradeVCOs: BOOLEAN, }; pub const PCLUSAPI_GET_NODE_CLUSTER_STATE = fn( lpszNodeName: ?[*:0]const u16, pdwClusterState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_OPEN_CLUSTER = fn( lpszClusterName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_OPEN_CLUSTER_EX = fn( lpszClusterName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_CLOSE_CLUSTER = fn( hCluster: ?*_HCLUSTER, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_SetClusterName = fn( hCluster: ?*_HCLUSTER, lpszNewClusterName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_INFORMATION = fn( hCluster: ?*_HCLUSTER, lpszClusterName: [*:0]u16, lpcchClusterName: ?*u32, lpClusterInfo: ?*CLUSTERVERSIONINFO, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_QUORUM_RESOURCE = fn( hCluster: ?*_HCLUSTER, lpszResourceName: [*:0]u16, lpcchResourceName: ?*u32, lpszDeviceName: [*:0]u16, lpcchDeviceName: ?*u32, lpdwMaxQuorumLogSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_CLUSTER_QUORUM_RESOURCE = fn( hResource: ?*_HRESOURCE, lpszDeviceName: ?[*:0]const u16, dwMaxQuoLogSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_BACKUP_CLUSTER_DATABASE = fn( hCluster: ?*_HCLUSTER, lpszPathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_RESTORE_CLUSTER_DATABASE = fn( lpszPathName: ?[*:0]const u16, bForce: BOOL, lpszQuorumDriveLetter: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_CLUSTER_NETWORK_PRIORITY_ORDER = fn( hCluster: ?*_HCLUSTER, NetworkCount: u32, NetworkList: [*]?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_CLUSTER_SERVICE_ACCOUNT_PASSWORD = fn( lpszClusterName: ?[*:0]const u16, lpszNewPassword: ?[*:0]const u16, dwFlags: u32, // TODO: what to do with BytesParamIndex 4? lpReturnStatusBuffer: ?*CLUSTER_SET_PASSWORD_STATUS, lpcbReturnStatusBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_CONTROL = fn( hCluster: ?*_HCLUSTER, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_UPGRADE_PHASE = enum(i32) { Initialize = 1, ValidatingUpgrade = 2, UpgradingComponents = 3, InstallingNewComponents = 4, UpgradeComplete = 5, }; pub const ClusterUpgradePhaseInitialize = CLUSTER_UPGRADE_PHASE.Initialize; pub const ClusterUpgradePhaseValidatingUpgrade = CLUSTER_UPGRADE_PHASE.ValidatingUpgrade; pub const ClusterUpgradePhaseUpgradingComponents = CLUSTER_UPGRADE_PHASE.UpgradingComponents; pub const ClusterUpgradePhaseInstallingNewComponents = CLUSTER_UPGRADE_PHASE.InstallingNewComponents; pub const ClusterUpgradePhaseUpgradeComplete = CLUSTER_UPGRADE_PHASE.UpgradeComplete; pub const PCLUSTER_UPGRADE_PROGRESS_CALLBACK = fn( pvCallbackArg: ?*anyopaque, eUpgradePhase: CLUSTER_UPGRADE_PHASE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_CLUSTER_UPGRADE = fn( hCluster: ?*_HCLUSTER, perform: BOOL, pfnProgressCallback: ?PCLUSTER_UPGRADE_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_CHANGE = enum(i32) { NODE_STATE = 1, NODE_DELETED = 2, NODE_ADDED = 4, NODE_PROPERTY = 8, REGISTRY_NAME = 16, REGISTRY_ATTRIBUTES = 32, REGISTRY_VALUE = 64, REGISTRY_SUBTREE = 128, RESOURCE_STATE = 256, RESOURCE_DELETED = 512, RESOURCE_ADDED = 1024, RESOURCE_PROPERTY = 2048, GROUP_STATE = 4096, GROUP_DELETED = 8192, GROUP_ADDED = 16384, GROUP_PROPERTY = 32768, RESOURCE_TYPE_DELETED = 65536, RESOURCE_TYPE_ADDED = 131072, RESOURCE_TYPE_PROPERTY = 262144, CLUSTER_RECONNECT = 524288, NETWORK_STATE = 1048576, NETWORK_DELETED = 2097152, NETWORK_ADDED = 4194304, NETWORK_PROPERTY = 8388608, NETINTERFACE_STATE = 16777216, NETINTERFACE_DELETED = 33554432, NETINTERFACE_ADDED = 67108864, NETINTERFACE_PROPERTY = 134217728, QUORUM_STATE = 268435456, CLUSTER_STATE = 536870912, CLUSTER_PROPERTY = 1073741824, HANDLE_CLOSE = -2147483648, ALL = -1, }; pub const CLUSTER_CHANGE_NODE_STATE = CLUSTER_CHANGE.NODE_STATE; pub const CLUSTER_CHANGE_NODE_DELETED = CLUSTER_CHANGE.NODE_DELETED; pub const CLUSTER_CHANGE_NODE_ADDED = CLUSTER_CHANGE.NODE_ADDED; pub const CLUSTER_CHANGE_NODE_PROPERTY = CLUSTER_CHANGE.NODE_PROPERTY; pub const CLUSTER_CHANGE_REGISTRY_NAME = CLUSTER_CHANGE.REGISTRY_NAME; pub const CLUSTER_CHANGE_REGISTRY_ATTRIBUTES = CLUSTER_CHANGE.REGISTRY_ATTRIBUTES; pub const CLUSTER_CHANGE_REGISTRY_VALUE = CLUSTER_CHANGE.REGISTRY_VALUE; pub const CLUSTER_CHANGE_REGISTRY_SUBTREE = CLUSTER_CHANGE.REGISTRY_SUBTREE; pub const CLUSTER_CHANGE_RESOURCE_STATE = CLUSTER_CHANGE.RESOURCE_STATE; pub const CLUSTER_CHANGE_RESOURCE_DELETED = CLUSTER_CHANGE.RESOURCE_DELETED; pub const CLUSTER_CHANGE_RESOURCE_ADDED = CLUSTER_CHANGE.RESOURCE_ADDED; pub const CLUSTER_CHANGE_RESOURCE_PROPERTY = CLUSTER_CHANGE.RESOURCE_PROPERTY; pub const CLUSTER_CHANGE_GROUP_STATE = CLUSTER_CHANGE.GROUP_STATE; pub const CLUSTER_CHANGE_GROUP_DELETED = CLUSTER_CHANGE.GROUP_DELETED; pub const CLUSTER_CHANGE_GROUP_ADDED = CLUSTER_CHANGE.GROUP_ADDED; pub const CLUSTER_CHANGE_GROUP_PROPERTY = CLUSTER_CHANGE.GROUP_PROPERTY; pub const CLUSTER_CHANGE_RESOURCE_TYPE_DELETED = CLUSTER_CHANGE.RESOURCE_TYPE_DELETED; pub const CLUSTER_CHANGE_RESOURCE_TYPE_ADDED = CLUSTER_CHANGE.RESOURCE_TYPE_ADDED; pub const CLUSTER_CHANGE_RESOURCE_TYPE_PROPERTY = CLUSTER_CHANGE.RESOURCE_TYPE_PROPERTY; pub const CLUSTER_CHANGE_CLUSTER_RECONNECT = CLUSTER_CHANGE.CLUSTER_RECONNECT; pub const CLUSTER_CHANGE_NETWORK_STATE = CLUSTER_CHANGE.NETWORK_STATE; pub const CLUSTER_CHANGE_NETWORK_DELETED = CLUSTER_CHANGE.NETWORK_DELETED; pub const CLUSTER_CHANGE_NETWORK_ADDED = CLUSTER_CHANGE.NETWORK_ADDED; pub const CLUSTER_CHANGE_NETWORK_PROPERTY = CLUSTER_CHANGE.NETWORK_PROPERTY; pub const CLUSTER_CHANGE_NETINTERFACE_STATE = CLUSTER_CHANGE.NETINTERFACE_STATE; pub const CLUSTER_CHANGE_NETINTERFACE_DELETED = CLUSTER_CHANGE.NETINTERFACE_DELETED; pub const CLUSTER_CHANGE_NETINTERFACE_ADDED = CLUSTER_CHANGE.NETINTERFACE_ADDED; pub const CLUSTER_CHANGE_NETINTERFACE_PROPERTY = CLUSTER_CHANGE.NETINTERFACE_PROPERTY; pub const CLUSTER_CHANGE_QUORUM_STATE = CLUSTER_CHANGE.QUORUM_STATE; pub const CLUSTER_CHANGE_CLUSTER_STATE = CLUSTER_CHANGE.CLUSTER_STATE; pub const CLUSTER_CHANGE_CLUSTER_PROPERTY = CLUSTER_CHANGE.CLUSTER_PROPERTY; pub const CLUSTER_CHANGE_HANDLE_CLOSE = CLUSTER_CHANGE.HANDLE_CLOSE; pub const CLUSTER_CHANGE_ALL = CLUSTER_CHANGE.ALL; pub const CLUSTER_NOTIFICATIONS_VERSION = enum(i32) { @"1" = 1, @"2" = 2, }; pub const CLUSTER_NOTIFICATIONS_V1 = CLUSTER_NOTIFICATIONS_VERSION.@"1"; pub const CLUSTER_NOTIFICATIONS_V2 = CLUSTER_NOTIFICATIONS_VERSION.@"2"; pub const CLUSTER_CHANGE_CLUSTER_V2 = enum(i32) { RECONNECT_V2 = 1, STATE_V2 = 2, GROUP_ADDED_V2 = 4, HANDLE_CLOSE_V2 = 8, NETWORK_ADDED_V2 = 16, NODE_ADDED_V2 = 32, RESOURCE_TYPE_ADDED_V2 = 64, COMMON_PROPERTY_V2 = 128, PRIVATE_PROPERTY_V2 = 256, LOST_NOTIFICATIONS_V2 = 512, RENAME_V2 = 1024, MEMBERSHIP_V2 = 2048, UPGRADED_V2 = 4096, ALL_V2 = 8191, }; pub const CLUSTER_CHANGE_CLUSTER_RECONNECT_V2 = CLUSTER_CHANGE_CLUSTER_V2.RECONNECT_V2; pub const CLUSTER_CHANGE_CLUSTER_STATE_V2 = CLUSTER_CHANGE_CLUSTER_V2.STATE_V2; pub const CLUSTER_CHANGE_CLUSTER_GROUP_ADDED_V2 = CLUSTER_CHANGE_CLUSTER_V2.GROUP_ADDED_V2; pub const CLUSTER_CHANGE_CLUSTER_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_CLUSTER_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_CLUSTER_NETWORK_ADDED_V2 = CLUSTER_CHANGE_CLUSTER_V2.NETWORK_ADDED_V2; pub const CLUSTER_CHANGE_CLUSTER_NODE_ADDED_V2 = CLUSTER_CHANGE_CLUSTER_V2.NODE_ADDED_V2; pub const CLUSTER_CHANGE_CLUSTER_RESOURCE_TYPE_ADDED_V2 = CLUSTER_CHANGE_CLUSTER_V2.RESOURCE_TYPE_ADDED_V2; pub const CLUSTER_CHANGE_CLUSTER_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_CLUSTER_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_CLUSTER_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_CLUSTER_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_CLUSTER_LOST_NOTIFICATIONS_V2 = CLUSTER_CHANGE_CLUSTER_V2.LOST_NOTIFICATIONS_V2; pub const CLUSTER_CHANGE_CLUSTER_RENAME_V2 = CLUSTER_CHANGE_CLUSTER_V2.RENAME_V2; pub const CLUSTER_CHANGE_CLUSTER_MEMBERSHIP_V2 = CLUSTER_CHANGE_CLUSTER_V2.MEMBERSHIP_V2; pub const CLUSTER_CHANGE_CLUSTER_UPGRADED_V2 = CLUSTER_CHANGE_CLUSTER_V2.UPGRADED_V2; pub const CLUSTER_CHANGE_CLUSTER_ALL_V2 = CLUSTER_CHANGE_CLUSTER_V2.ALL_V2; pub const CLUSTER_CHANGE_GROUP_V2 = enum(i32) { DELETED_V2 = 1, COMMON_PROPERTY_V2 = 2, PRIVATE_PROPERTY_V2 = 4, STATE_V2 = 8, OWNER_NODE_V2 = 16, PREFERRED_OWNERS_V2 = 32, RESOURCE_ADDED_V2 = 64, RESOURCE_GAINED_V2 = 128, RESOURCE_LOST_V2 = 256, HANDLE_CLOSE_V2 = 512, ALL_V2 = 1023, }; pub const CLUSTER_CHANGE_GROUP_DELETED_V2 = CLUSTER_CHANGE_GROUP_V2.DELETED_V2; pub const CLUSTER_CHANGE_GROUP_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_GROUP_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_GROUP_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_GROUP_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_GROUP_STATE_V2 = CLUSTER_CHANGE_GROUP_V2.STATE_V2; pub const CLUSTER_CHANGE_GROUP_OWNER_NODE_V2 = CLUSTER_CHANGE_GROUP_V2.OWNER_NODE_V2; pub const CLUSTER_CHANGE_GROUP_PREFERRED_OWNERS_V2 = CLUSTER_CHANGE_GROUP_V2.PREFERRED_OWNERS_V2; pub const CLUSTER_CHANGE_GROUP_RESOURCE_ADDED_V2 = CLUSTER_CHANGE_GROUP_V2.RESOURCE_ADDED_V2; pub const CLUSTER_CHANGE_GROUP_RESOURCE_GAINED_V2 = CLUSTER_CHANGE_GROUP_V2.RESOURCE_GAINED_V2; pub const CLUSTER_CHANGE_GROUP_RESOURCE_LOST_V2 = CLUSTER_CHANGE_GROUP_V2.RESOURCE_LOST_V2; pub const CLUSTER_CHANGE_GROUP_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_GROUP_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_GROUP_ALL_V2 = CLUSTER_CHANGE_GROUP_V2.ALL_V2; pub const CLUSTER_CHANGE_GROUPSET_V2 = enum(i32) { DELETED_v2 = 1, COMMON_PROPERTY_V2 = 2, PRIVATE_PROPERTY_V2 = 4, STATE_V2 = 8, GROUP_ADDED = 16, GROUP_REMOVED = 32, DEPENDENCIES_V2 = 64, DEPENDENTS_V2 = 128, HANDLE_CLOSE_v2 = 256, ALL_V2 = 511, }; pub const CLUSTER_CHANGE_GROUPSET_DELETED_v2 = CLUSTER_CHANGE_GROUPSET_V2.DELETED_v2; pub const CLUSTER_CHANGE_GROUPSET_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_GROUPSET_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_GROUPSET_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_GROUPSET_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_GROUPSET_STATE_V2 = CLUSTER_CHANGE_GROUPSET_V2.STATE_V2; pub const CLUSTER_CHANGE_GROUPSET_GROUP_ADDED = CLUSTER_CHANGE_GROUPSET_V2.GROUP_ADDED; pub const CLUSTER_CHANGE_GROUPSET_GROUP_REMOVED = CLUSTER_CHANGE_GROUPSET_V2.GROUP_REMOVED; pub const CLUSTER_CHANGE_GROUPSET_DEPENDENCIES_V2 = CLUSTER_CHANGE_GROUPSET_V2.DEPENDENCIES_V2; pub const CLUSTER_CHANGE_GROUPSET_DEPENDENTS_V2 = CLUSTER_CHANGE_GROUPSET_V2.DEPENDENTS_V2; pub const CLUSTER_CHANGE_GROUPSET_HANDLE_CLOSE_v2 = CLUSTER_CHANGE_GROUPSET_V2.HANDLE_CLOSE_v2; pub const CLUSTER_CHANGE_GROUPSET_ALL_V2 = CLUSTER_CHANGE_GROUPSET_V2.ALL_V2; pub const CLUSTER_CHANGE_RESOURCE_V2 = enum(i32) { COMMON_PROPERTY_V2 = 1, PRIVATE_PROPERTY_V2 = 2, STATE_V2 = 4, OWNER_GROUP_V2 = 8, DEPENDENCIES_V2 = 16, DEPENDENTS_V2 = 32, POSSIBLE_OWNERS_V2 = 64, DELETED_V2 = 128, DLL_UPGRADED_V2 = 256, HANDLE_CLOSE_V2 = 512, TERMINAL_STATE_V2 = 1024, ALL_V2 = 2047, }; pub const CLUSTER_CHANGE_RESOURCE_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_RESOURCE_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_RESOURCE_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_RESOURCE_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_RESOURCE_STATE_V2 = CLUSTER_CHANGE_RESOURCE_V2.STATE_V2; pub const CLUSTER_CHANGE_RESOURCE_OWNER_GROUP_V2 = CLUSTER_CHANGE_RESOURCE_V2.OWNER_GROUP_V2; pub const CLUSTER_CHANGE_RESOURCE_DEPENDENCIES_V2 = CLUSTER_CHANGE_RESOURCE_V2.DEPENDENCIES_V2; pub const CLUSTER_CHANGE_RESOURCE_DEPENDENTS_V2 = CLUSTER_CHANGE_RESOURCE_V2.DEPENDENTS_V2; pub const CLUSTER_CHANGE_RESOURCE_POSSIBLE_OWNERS_V2 = CLUSTER_CHANGE_RESOURCE_V2.POSSIBLE_OWNERS_V2; pub const CLUSTER_CHANGE_RESOURCE_DELETED_V2 = CLUSTER_CHANGE_RESOURCE_V2.DELETED_V2; pub const CLUSTER_CHANGE_RESOURCE_DLL_UPGRADED_V2 = CLUSTER_CHANGE_RESOURCE_V2.DLL_UPGRADED_V2; pub const CLUSTER_CHANGE_RESOURCE_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_RESOURCE_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_RESOURCE_TERMINAL_STATE_V2 = CLUSTER_CHANGE_RESOURCE_V2.TERMINAL_STATE_V2; pub const CLUSTER_CHANGE_RESOURCE_ALL_V2 = CLUSTER_CHANGE_RESOURCE_V2.ALL_V2; pub const CLUSTER_CHANGE_RESOURCE_TYPE_V2 = enum(i32) { CHANGE_RESOURCE_TYPE_DELETED_V2 = 1, CHANGE_RESOURCE_TYPE_COMMON_PROPERTY_V2 = 2, CHANGE_RESOURCE_TYPE_PRIVATE_PROPERTY_V2 = 4, CHANGE_RESOURCE_TYPE_POSSIBLE_OWNERS_V2 = 8, CHANGE_RESOURCE_TYPE_DLL_UPGRADED_V2 = 16, RESOURCE_TYPE_SPECIFIC_V2 = 32, CHANGE_RESOURCE_TYPE_ALL_V2 = 63, }; pub const CLUSTER_CHANGE_RESOURCE_TYPE_DELETED_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.CHANGE_RESOURCE_TYPE_DELETED_V2; pub const CLUSTER_CHANGE_RESOURCE_TYPE_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.CHANGE_RESOURCE_TYPE_COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_RESOURCE_TYPE_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.CHANGE_RESOURCE_TYPE_PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_RESOURCE_TYPE_POSSIBLE_OWNERS_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.CHANGE_RESOURCE_TYPE_POSSIBLE_OWNERS_V2; pub const CLUSTER_CHANGE_RESOURCE_TYPE_DLL_UPGRADED_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.CHANGE_RESOURCE_TYPE_DLL_UPGRADED_V2; pub const CLUSTER_RESOURCE_TYPE_SPECIFIC_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.RESOURCE_TYPE_SPECIFIC_V2; pub const CLUSTER_CHANGE_RESOURCE_TYPE_ALL_V2 = CLUSTER_CHANGE_RESOURCE_TYPE_V2.CHANGE_RESOURCE_TYPE_ALL_V2; pub const CLUSTER_CHANGE_NETINTERFACE_V2 = enum(i32) { DELETED_V2 = 1, COMMON_PROPERTY_V2 = 2, PRIVATE_PROPERTY_V2 = 4, STATE_V2 = 8, HANDLE_CLOSE_V2 = 16, ALL_V2 = 31, }; pub const CLUSTER_CHANGE_NETINTERFACE_DELETED_V2 = CLUSTER_CHANGE_NETINTERFACE_V2.DELETED_V2; pub const CLUSTER_CHANGE_NETINTERFACE_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_NETINTERFACE_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_NETINTERFACE_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_NETINTERFACE_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_NETINTERFACE_STATE_V2 = CLUSTER_CHANGE_NETINTERFACE_V2.STATE_V2; pub const CLUSTER_CHANGE_NETINTERFACE_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_NETINTERFACE_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_NETINTERFACE_ALL_V2 = CLUSTER_CHANGE_NETINTERFACE_V2.ALL_V2; pub const CLUSTER_CHANGE_NETWORK_V2 = enum(i32) { DELETED_V2 = 1, COMMON_PROPERTY_V2 = 2, PRIVATE_PROPERTY_V2 = 4, STATE_V2 = 8, HANDLE_CLOSE_V2 = 16, ALL_V2 = 31, }; pub const CLUSTER_CHANGE_NETWORK_DELETED_V2 = CLUSTER_CHANGE_NETWORK_V2.DELETED_V2; pub const CLUSTER_CHANGE_NETWORK_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_NETWORK_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_NETWORK_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_NETWORK_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_NETWORK_STATE_V2 = CLUSTER_CHANGE_NETWORK_V2.STATE_V2; pub const CLUSTER_CHANGE_NETWORK_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_NETWORK_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_NETWORK_ALL_V2 = CLUSTER_CHANGE_NETWORK_V2.ALL_V2; pub const CLUSTER_CHANGE_NODE_V2 = enum(i32) { NETINTERFACE_ADDED_V2 = 1, DELETED_V2 = 2, COMMON_PROPERTY_V2 = 4, PRIVATE_PROPERTY_V2 = 8, STATE_V2 = 16, GROUP_GAINED_V2 = 32, GROUP_LOST_V2 = 64, HANDLE_CLOSE_V2 = 128, ALL_V2 = 255, }; pub const CLUSTER_CHANGE_NODE_NETINTERFACE_ADDED_V2 = CLUSTER_CHANGE_NODE_V2.NETINTERFACE_ADDED_V2; pub const CLUSTER_CHANGE_NODE_DELETED_V2 = CLUSTER_CHANGE_NODE_V2.DELETED_V2; pub const CLUSTER_CHANGE_NODE_COMMON_PROPERTY_V2 = CLUSTER_CHANGE_NODE_V2.COMMON_PROPERTY_V2; pub const CLUSTER_CHANGE_NODE_PRIVATE_PROPERTY_V2 = CLUSTER_CHANGE_NODE_V2.PRIVATE_PROPERTY_V2; pub const CLUSTER_CHANGE_NODE_STATE_V2 = CLUSTER_CHANGE_NODE_V2.STATE_V2; pub const CLUSTER_CHANGE_NODE_GROUP_GAINED_V2 = CLUSTER_CHANGE_NODE_V2.GROUP_GAINED_V2; pub const CLUSTER_CHANGE_NODE_GROUP_LOST_V2 = CLUSTER_CHANGE_NODE_V2.GROUP_LOST_V2; pub const CLUSTER_CHANGE_NODE_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_NODE_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_NODE_ALL_V2 = CLUSTER_CHANGE_NODE_V2.ALL_V2; pub const CLUSTER_CHANGE_REGISTRY_V2 = enum(i32) { ATTRIBUTES_V2 = 1, NAME_V2 = 2, SUBTREE_V2 = 4, VALUE_V2 = 8, HANDLE_CLOSE_V2 = 16, ALL_V2 = 31, }; pub const CLUSTER_CHANGE_REGISTRY_ATTRIBUTES_V2 = CLUSTER_CHANGE_REGISTRY_V2.ATTRIBUTES_V2; pub const CLUSTER_CHANGE_REGISTRY_NAME_V2 = CLUSTER_CHANGE_REGISTRY_V2.NAME_V2; pub const CLUSTER_CHANGE_REGISTRY_SUBTREE_V2 = CLUSTER_CHANGE_REGISTRY_V2.SUBTREE_V2; pub const CLUSTER_CHANGE_REGISTRY_VALUE_V2 = CLUSTER_CHANGE_REGISTRY_V2.VALUE_V2; pub const CLUSTER_CHANGE_REGISTRY_HANDLE_CLOSE_V2 = CLUSTER_CHANGE_REGISTRY_V2.HANDLE_CLOSE_V2; pub const CLUSTER_CHANGE_REGISTRY_ALL_V2 = CLUSTER_CHANGE_REGISTRY_V2.ALL_V2; pub const CLUSTER_CHANGE_QUORUM_V2 = enum(i32) { STATE_V2 = 1, // ALL_V2 = 1, this enum value conflicts with STATE_V2 }; pub const CLUSTER_CHANGE_QUORUM_STATE_V2 = CLUSTER_CHANGE_QUORUM_V2.STATE_V2; pub const CLUSTER_CHANGE_QUORUM_ALL_V2 = CLUSTER_CHANGE_QUORUM_V2.STATE_V2; pub const CLUSTER_CHANGE_SHARED_VOLUME_V2 = enum(i32) { STATE_V2 = 1, ADDED_V2 = 2, REMOVED_V2 = 4, ALL_V2 = 7, }; pub const CLUSTER_CHANGE_SHARED_VOLUME_STATE_V2 = CLUSTER_CHANGE_SHARED_VOLUME_V2.STATE_V2; pub const CLUSTER_CHANGE_SHARED_VOLUME_ADDED_V2 = CLUSTER_CHANGE_SHARED_VOLUME_V2.ADDED_V2; pub const CLUSTER_CHANGE_SHARED_VOLUME_REMOVED_V2 = CLUSTER_CHANGE_SHARED_VOLUME_V2.REMOVED_V2; pub const CLUSTER_CHANGE_SHARED_VOLUME_ALL_V2 = CLUSTER_CHANGE_SHARED_VOLUME_V2.ALL_V2; pub const CLUSTER_CHANGE_SPACEPORT_V2 = enum(i32) { @"2" = 1, }; pub const CLUSTER_CHANGE_SPACEPORT_CUSTOM_PNP_V2 = CLUSTER_CHANGE_SPACEPORT_V2.@"2"; pub const CLUSTER_CHANGE_NODE_UPGRADE_PHASE_V2 = enum(i32) { NODE_PREPARE = 1, NODE_COMMIT = 2, NODE_POSTCOMMIT = 4, ALL = 7, }; pub const CLUSTER_CHANGE_UPGRADE_NODE_PREPARE = CLUSTER_CHANGE_NODE_UPGRADE_PHASE_V2.NODE_PREPARE; pub const CLUSTER_CHANGE_UPGRADE_NODE_COMMIT = CLUSTER_CHANGE_NODE_UPGRADE_PHASE_V2.NODE_COMMIT; pub const CLUSTER_CHANGE_UPGRADE_NODE_POSTCOMMIT = CLUSTER_CHANGE_NODE_UPGRADE_PHASE_V2.NODE_POSTCOMMIT; pub const CLUSTER_CHANGE_UPGRADE_ALL = CLUSTER_CHANGE_NODE_UPGRADE_PHASE_V2.ALL; pub const CLUSTER_OBJECT_TYPE = enum(i32) { NONE = 0, CLUSTER = 1, GROUP = 2, RESOURCE = 3, RESOURCE_TYPE = 4, NETWORK_INTERFACE = 5, NETWORK = 6, NODE = 7, REGISTRY = 8, QUORUM = 9, SHARED_VOLUME = 10, GROUPSET = 13, AFFINITYRULE = 16, }; pub const CLUSTER_OBJECT_TYPE_NONE = CLUSTER_OBJECT_TYPE.NONE; pub const CLUSTER_OBJECT_TYPE_CLUSTER = CLUSTER_OBJECT_TYPE.CLUSTER; pub const CLUSTER_OBJECT_TYPE_GROUP = CLUSTER_OBJECT_TYPE.GROUP; pub const CLUSTER_OBJECT_TYPE_RESOURCE = CLUSTER_OBJECT_TYPE.RESOURCE; pub const CLUSTER_OBJECT_TYPE_RESOURCE_TYPE = CLUSTER_OBJECT_TYPE.RESOURCE_TYPE; pub const CLUSTER_OBJECT_TYPE_NETWORK_INTERFACE = CLUSTER_OBJECT_TYPE.NETWORK_INTERFACE; pub const CLUSTER_OBJECT_TYPE_NETWORK = CLUSTER_OBJECT_TYPE.NETWORK; pub const CLUSTER_OBJECT_TYPE_NODE = CLUSTER_OBJECT_TYPE.NODE; pub const CLUSTER_OBJECT_TYPE_REGISTRY = CLUSTER_OBJECT_TYPE.REGISTRY; pub const CLUSTER_OBJECT_TYPE_QUORUM = CLUSTER_OBJECT_TYPE.QUORUM; pub const CLUSTER_OBJECT_TYPE_SHARED_VOLUME = CLUSTER_OBJECT_TYPE.SHARED_VOLUME; pub const CLUSTER_OBJECT_TYPE_GROUPSET = CLUSTER_OBJECT_TYPE.GROUPSET; pub const CLUSTER_OBJECT_TYPE_AFFINITYRULE = CLUSTER_OBJECT_TYPE.AFFINITYRULE; pub const CLUSTERSET_OBJECT_TYPE = enum(i32) { NONE = 0, MEMBER = 1, WORKLOAD = 2, DATABASE = 3, }; pub const CLUSTERSET_OBJECT_TYPE_NONE = CLUSTERSET_OBJECT_TYPE.NONE; pub const CLUSTERSET_OBJECT_TYPE_MEMBER = CLUSTERSET_OBJECT_TYPE.MEMBER; pub const CLUSTERSET_OBJECT_TYPE_WORKLOAD = CLUSTERSET_OBJECT_TYPE.WORKLOAD; pub const CLUSTERSET_OBJECT_TYPE_DATABASE = CLUSTERSET_OBJECT_TYPE.DATABASE; pub const NOTIFY_FILTER_AND_TYPE = extern struct { dwObjectType: u32, FilterFlags: i64, }; pub const CLUSTER_MEMBERSHIP_INFO = extern struct { HasQuorum: BOOL, UpnodesSize: u32, Upnodes: [1]u8, }; pub const PCLUSAPI_CREATE_CLUSTER_NOTIFY_PORT_V2 = fn( hChange: ?*_HCHANGE, hCluster: ?*_HCLUSTER, Filters: ?*NOTIFY_FILTER_AND_TYPE, dwFilterCount: u32, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) ?*_HCHANGE; pub const PCLUSAPI_REGISTER_CLUSTER_NOTIFY_V2 = fn( hChange: ?*_HCHANGE, Filter: NOTIFY_FILTER_AND_TYPE, hObject: ?HANDLE, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_NOTIFY_EVENT_HANDLE_V2 = fn( hChange: ?*_HCHANGE, lphTargetEvent: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_NOTIFY_V2 = fn( hChange: ?*_HCHANGE, lpdwNotifyKey: ?*usize, pFilterAndType: ?*NOTIFY_FILTER_AND_TYPE, buffer: ?*u8, lpcchBufferSize: ?*u32, lpszObjectId: ?PWSTR, lpcchObjectId: ?*u32, lpszParentId: ?PWSTR, lpcchParentId: ?*u32, lpszName: ?PWSTR, lpcchName: ?*u32, lpszType: ?PWSTR, lpcchType: ?*u32, dwMilliseconds: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CREATE_CLUSTER_NOTIFY_PORT = fn( hChange: ?*_HCHANGE, hCluster: ?*_HCLUSTER, dwFilter: u32, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) ?*_HCHANGE; pub const PCLUSAPI_REGISTER_CLUSTER_NOTIFY = fn( hChange: ?*_HCHANGE, dwFilterType: u32, hObject: ?HANDLE, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_NOTIFY = fn( hChange: ?*_HCHANGE, lpdwNotifyKey: ?*usize, lpdwFilterType: ?*u32, lpszName: ?[*:0]u16, lpcchName: ?*u32, dwMilliseconds: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLOSE_CLUSTER_NOTIFY_PORT = fn( hChange: ?*_HCHANGE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CLUSTER_ENUM = enum(i32) { NODE = 1, RESTYPE = 2, RESOURCE = 4, GROUP = 8, NETWORK = 16, NETINTERFACE = 32, SHARED_VOLUME_GROUP = 536870912, SHARED_VOLUME_RESOURCE = 1073741824, INTERNAL_NETWORK = -2147483648, ALL = 63, }; pub const CLUSTER_ENUM_NODE = CLUSTER_ENUM.NODE; pub const CLUSTER_ENUM_RESTYPE = CLUSTER_ENUM.RESTYPE; pub const CLUSTER_ENUM_RESOURCE = CLUSTER_ENUM.RESOURCE; pub const CLUSTER_ENUM_GROUP = CLUSTER_ENUM.GROUP; pub const CLUSTER_ENUM_NETWORK = CLUSTER_ENUM.NETWORK; pub const CLUSTER_ENUM_NETINTERFACE = CLUSTER_ENUM.NETINTERFACE; pub const CLUSTER_ENUM_SHARED_VOLUME_GROUP = CLUSTER_ENUM.SHARED_VOLUME_GROUP; pub const CLUSTER_ENUM_SHARED_VOLUME_RESOURCE = CLUSTER_ENUM.SHARED_VOLUME_RESOURCE; pub const CLUSTER_ENUM_INTERNAL_NETWORK = CLUSTER_ENUM.INTERNAL_NETWORK; pub const CLUSTER_ENUM_ALL = CLUSTER_ENUM.ALL; pub const PCLUSAPI_CLUSTER_OPEN_ENUM = fn( hCluster: ?*_HCLUSTER, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSENUM; pub const PCLUSAPI_CLUSTER_GET_ENUM_COUNT = fn( hEnum: ?*_HCLUSENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_ENUM = fn( hEnum: ?*_HCLUSENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_CLOSE_ENUM = fn( hEnum: ?*_HCLUSENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_OPEN_ENUM_EX = fn( hCluster: ?*_HCLUSTER, dwType: u32, pOptions: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSENUMEX; pub const PCLUSAPI_CLUSTER_GET_ENUM_COUNT_EX = fn( hClusterEnum: ?*_HCLUSENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_ENUM_EX = fn( hClusterEnum: ?*_HCLUSENUMEX, dwIndex: u32, pItem: ?*CLUSTER_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_CLOSE_ENUM_EX = fn( hClusterEnum: ?*_HCLUSENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CREATE_CLUSTER_GROUP_GROUPSET = fn( hCluster: ?*_HCLUSTER, lpszGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSET; pub const PCLUSAPI_OPEN_CLUSTER_GROUP_GROUPSET = fn( hCluster: ?*_HCLUSTER, lpszGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSET; pub const PCLUSAPI_CLOSE_CLUSTER_GROUP_GROUPSET = fn( hGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_DELETE_CLUSTER_GROUP_GROUPSET = fn( hGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_ADD_GROUP_TO_GROUP_GROUPSET = fn( hGroupSet: ?*_HGROUPSET, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_REMOVE_GROUP_FROM_GROUP_GROUPSET = fn( hGroupSet: ?*_HGROUPSET, hGroupName: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_GROUPSET_CONTROL = fn( hGroupSet: ?*_HGROUPSET, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_CLUSTER_GROUP_DEPENDENCY = fn( hDependentGroup: ?*_HGROUP, hProviderGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_GROUP_DEPENDENCY_EXPRESSION = fn( hGroupSet: ?*_HGROUP, lpszDependencyExpression: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CLUSTER_GROUP_DEPENDENCY = fn( hGroup: ?*_HGROUP, hDependsOn: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_CLUSTER_GROUP_GROUPSET_DEPENDENCY = fn( hDependentGroupSet: ?*_HGROUPSET, hProviderGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_CLUSTER_GROUP_GROUPSET_DEPENDENCY_EXPRESSION = fn( hGroupSet: ?*_HGROUPSET, lpszDependencyExpression: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CLUSTER_GROUP_GROUPSET_DEPENDENCY = fn( hGroupSet: ?*_HGROUPSET, hDependsOn: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_CLUSTER_GROUP_TO_GROUP_GROUPSET_DEPENDENCY = fn( hDependentGroup: ?*_HGROUP, hProviderGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CLUSTER_GROUP_TO_GROUP_GROUPSET_DEPENDENCY = fn( hGroup: ?*_HGROUP, hDependsOn: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_FROM_GROUP_GROUPSET = fn( hGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_ADD_CROSS_CLUSTER_GROUPSET_DEPENDENCY = fn( hDependentGroupSet: ?*_HGROUPSET, lpRemoteClusterName: ?[*:0]const u16, lpRemoteGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CROSS_CLUSTER_GROUPSET_DEPENDENCY = fn( hDependentGroupSet: ?*_HGROUPSET, lpRemoteClusterName: ?[*:0]const u16, lpRemoteGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_AVAILABILITY_SET_CONFIG = extern struct { dwVersion: u32, dwUpdateDomains: u32, dwFaultDomains: u32, bReserveSpareNode: BOOL, }; pub const PCLUSAPI_CREATE_CLUSTER_AVAILABILITY_SET = fn( hCluster: ?*_HCLUSTER, lpAvailabilitySetName: ?[*:0]const u16, pAvailabilitySetConfig: ?*CLUSTER_AVAILABILITY_SET_CONFIG, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSET; pub const PCLUSAPI_CLUSTER_CREATE_AFFINITY_RULE = fn( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, ruleType: CLUS_AFFINITY_RULE_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_REMOVE_AFFINITY_RULE = fn( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_ADD_GROUP_TO_AFFINITY_RULE = fn( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_REMOVE_GROUP_FROM_AFFINITY_RULE = fn( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_AFFINITY_RULE_CONTROL = fn( hCluster: ?*_HCLUSTER, affinityRuleName: ?[*:0]const u16, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 5? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 7? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_NODE_ENUM = enum(i32) { NETINTERFACES = 1, GROUPS = 2, PREFERRED_GROUPS = 4, ALL = 3, }; pub const CLUSTER_NODE_ENUM_NETINTERFACES = CLUSTER_NODE_ENUM.NETINTERFACES; pub const CLUSTER_NODE_ENUM_GROUPS = CLUSTER_NODE_ENUM.GROUPS; pub const CLUSTER_NODE_ENUM_PREFERRED_GROUPS = CLUSTER_NODE_ENUM.PREFERRED_GROUPS; pub const CLUSTER_NODE_ENUM_ALL = CLUSTER_NODE_ENUM.ALL; pub const CLUSTER_NODE_STATE = enum(i32) { StateUnknown = -1, Up = 0, Down = 1, Paused = 2, Joining = 3, }; pub const ClusterNodeStateUnknown = CLUSTER_NODE_STATE.StateUnknown; pub const ClusterNodeUp = CLUSTER_NODE_STATE.Up; pub const ClusterNodeDown = CLUSTER_NODE_STATE.Down; pub const ClusterNodePaused = CLUSTER_NODE_STATE.Paused; pub const ClusterNodeJoining = CLUSTER_NODE_STATE.Joining; pub const CLUSTER_STORAGENODE_STATE = enum(i32) { StateUnknown = 0, Up = 1, Down = 2, Paused = 3, Starting = 4, Stopping = 5, }; pub const ClusterStorageNodeStateUnknown = CLUSTER_STORAGENODE_STATE.StateUnknown; pub const ClusterStorageNodeUp = CLUSTER_STORAGENODE_STATE.Up; pub const ClusterStorageNodeDown = CLUSTER_STORAGENODE_STATE.Down; pub const ClusterStorageNodePaused = CLUSTER_STORAGENODE_STATE.Paused; pub const ClusterStorageNodeStarting = CLUSTER_STORAGENODE_STATE.Starting; pub const ClusterStorageNodeStopping = CLUSTER_STORAGENODE_STATE.Stopping; pub const CLUSTER_NODE_DRAIN_STATUS = enum(i32) { NodeDrainStatusNotInitiated = 0, NodeDrainStatusInProgress = 1, NodeDrainStatusCompleted = 2, NodeDrainStatusFailed = 3, ClusterNodeDrainStatusCount = 4, }; pub const NodeDrainStatusNotInitiated = CLUSTER_NODE_DRAIN_STATUS.NodeDrainStatusNotInitiated; pub const NodeDrainStatusInProgress = CLUSTER_NODE_DRAIN_STATUS.NodeDrainStatusInProgress; pub const NodeDrainStatusCompleted = CLUSTER_NODE_DRAIN_STATUS.NodeDrainStatusCompleted; pub const NodeDrainStatusFailed = CLUSTER_NODE_DRAIN_STATUS.NodeDrainStatusFailed; pub const ClusterNodeDrainStatusCount = CLUSTER_NODE_DRAIN_STATUS.ClusterNodeDrainStatusCount; pub const CLUSTER_NODE_STATUS = enum(i32) { Normal = 0, Isolated = 1, Quarantined = 2, DrainInProgress = 4, DrainCompleted = 8, DrainFailed = 16, AvoidPlacement = 32, Max = 51, }; pub const NodeStatusNormal = CLUSTER_NODE_STATUS.Normal; pub const NodeStatusIsolated = CLUSTER_NODE_STATUS.Isolated; pub const NodeStatusQuarantined = CLUSTER_NODE_STATUS.Quarantined; pub const NodeStatusDrainInProgress = CLUSTER_NODE_STATUS.DrainInProgress; pub const NodeStatusDrainCompleted = CLUSTER_NODE_STATUS.DrainCompleted; pub const NodeStatusDrainFailed = CLUSTER_NODE_STATUS.DrainFailed; pub const NodeStatusAvoidPlacement = CLUSTER_NODE_STATUS.AvoidPlacement; pub const NodeStatusMax = CLUSTER_NODE_STATUS.Max; pub const PCLUSAPI_OPEN_CLUSTER_NODE = fn( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub const PCLUSAPI_OPEN_CLUSTER_NODE_EX = fn( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub const PCLUSAPI_OPEN_NODE_BY_ID = fn( hCluster: ?*_HCLUSTER, nodeId: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub const PCLUSAPI_CLOSE_CLUSTER_NODE = fn( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_GET_CLUSTER_NODE_STATE = fn( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_NODE_STATE; pub const PCLUSAPI_GET_CLUSTER_NODE_ID = fn( hNode: ?*_HNODE, lpszNodeId: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_FROM_NODE = fn( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_PAUSE_CLUSTER_NODE = fn( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_RESUME_CLUSTER_NODE = fn( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_EVICT_CLUSTER_NODE = fn( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_OPEN_ENUM = fn( hNode: ?*_HNODE, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODEENUM; pub const PCLUSAPI_CLUSTER_NODE_OPEN_ENUM_EX = fn( hNode: ?*_HNODE, dwType: u32, pOptions: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODEENUMEX; pub const PCLUSAPI_CLUSTER_NODE_GET_ENUM_COUNT_EX = fn( hNodeEnum: ?*_HNODEENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_ENUM_EX = fn( hNodeEnum: ?*_HNODEENUMEX, dwIndex: u32, pItem: ?*CLUSTER_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_CLOSE_ENUM_EX = fn( hNodeEnum: ?*_HNODEENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_GET_ENUM_COUNT = fn( hNodeEnum: ?*_HNODEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_CLOSE_ENUM = fn( hNodeEnum: ?*_HNODEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_ENUM = fn( hNodeEnum: ?*_HNODEENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_EVICT_CLUSTER_NODE_EX = fn( hNode: ?*_HNODE, dwTimeOut: u32, phrCleanupStatus: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_RESOURCE_TYPE_KEY = fn( hCluster: ?*_HCLUSTER, lpszTypeName: ?[*:0]const u16, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const CLUSTER_GROUP_ENUM = enum(i32) { CONTAINS = 1, NODES = 2, ALL = 3, }; pub const CLUSTER_GROUP_ENUM_CONTAINS = CLUSTER_GROUP_ENUM.CONTAINS; pub const CLUSTER_GROUP_ENUM_NODES = CLUSTER_GROUP_ENUM.NODES; pub const CLUSTER_GROUP_ENUM_ALL = CLUSTER_GROUP_ENUM.ALL; pub const CLUSTER_GROUP_STATE = enum(i32) { StateUnknown = -1, Online = 0, Offline = 1, Failed = 2, PartialOnline = 3, Pending = 4, }; pub const ClusterGroupStateUnknown = CLUSTER_GROUP_STATE.StateUnknown; pub const ClusterGroupOnline = CLUSTER_GROUP_STATE.Online; pub const ClusterGroupOffline = CLUSTER_GROUP_STATE.Offline; pub const ClusterGroupFailed = CLUSTER_GROUP_STATE.Failed; pub const ClusterGroupPartialOnline = CLUSTER_GROUP_STATE.PartialOnline; pub const ClusterGroupPending = CLUSTER_GROUP_STATE.Pending; pub const CLUSTER_GROUP_PRIORITY = enum(i32) { Disabled = 0, Low = 1000, Medium = 2000, High = 3000, }; pub const PriorityDisabled = CLUSTER_GROUP_PRIORITY.Disabled; pub const PriorityLow = CLUSTER_GROUP_PRIORITY.Low; pub const PriorityMedium = CLUSTER_GROUP_PRIORITY.Medium; pub const PriorityHigh = CLUSTER_GROUP_PRIORITY.High; pub const CLUSTER_GROUP_AUTOFAILBACK_TYPE = enum(i32) { PreventFailback = 0, AllowFailback = 1, FailbackTypeCount = 2, }; pub const ClusterGroupPreventFailback = CLUSTER_GROUP_AUTOFAILBACK_TYPE.PreventFailback; pub const ClusterGroupAllowFailback = CLUSTER_GROUP_AUTOFAILBACK_TYPE.AllowFailback; pub const ClusterGroupFailbackTypeCount = CLUSTER_GROUP_AUTOFAILBACK_TYPE.FailbackTypeCount; pub const CLUSTER_GROUP_ENUM_ITEM = extern struct { dwVersion: u32, cbId: u32, lpszId: ?PWSTR, cbName: u32, lpszName: ?PWSTR, state: CLUSTER_GROUP_STATE, cbOwnerNode: u32, lpszOwnerNode: ?PWSTR, dwFlags: u32, cbProperties: u32, pProperties: ?*anyopaque, cbRoProperties: u32, pRoProperties: ?*anyopaque, }; pub const CLUSTER_RESOURCE_ENUM_ITEM = extern struct { dwVersion: u32, cbId: u32, lpszId: ?PWSTR, cbName: u32, lpszName: ?PWSTR, cbOwnerGroupName: u32, lpszOwnerGroupName: ?PWSTR, cbOwnerGroupId: u32, lpszOwnerGroupId: ?PWSTR, cbProperties: u32, pProperties: ?*anyopaque, cbRoProperties: u32, pRoProperties: ?*anyopaque, }; pub const PCLUSAPI_CREATE_CLUSTER_GROUP = fn( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; pub const PCLUSAPI_OPEN_CLUSTER_GROUP = fn( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; pub const PCLUSAPI_OPEN_CLUSTER_GROUP_EX = fn( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; pub const PCLUSAPI_PAUSE_CLUSTER_NODE_EX = fn( hNode: ?*_HNODE, bDrainNode: BOOL, dwPauseFlags: u32, hNodeDrainTarget: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_NODE_RESUME_FAILBACK_TYPE = enum(i32) { DoNotFailbackGroups = 0, FailbackGroupsImmediately = 1, FailbackGroupsPerPolicy = 2, ClusterNodeResumeFailbackTypeCount = 3, }; pub const DoNotFailbackGroups = CLUSTER_NODE_RESUME_FAILBACK_TYPE.DoNotFailbackGroups; pub const FailbackGroupsImmediately = CLUSTER_NODE_RESUME_FAILBACK_TYPE.FailbackGroupsImmediately; pub const FailbackGroupsPerPolicy = CLUSTER_NODE_RESUME_FAILBACK_TYPE.FailbackGroupsPerPolicy; pub const ClusterNodeResumeFailbackTypeCount = CLUSTER_NODE_RESUME_FAILBACK_TYPE.ClusterNodeResumeFailbackTypeCount; pub const PCLUSAPI_RESUME_CLUSTER_NODE_EX = fn( hNode: ?*_HNODE, eResumeFailbackType: CLUSTER_NODE_RESUME_FAILBACK_TYPE, dwResumeFlagsReserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CREATE_CLUSTER_GROUPEX = fn( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, pGroupInfo: ?*CLUSTER_CREATE_GROUP_INFO, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; pub const PCLUSAPI_CLUSTER_GROUP_OPEN_ENUM_EX = fn( hCluster: ?*_HCLUSTER, // TODO: what to do with BytesParamIndex 2? lpszProperties: ?[*:0]const u16, cbProperties: u32, // TODO: what to do with BytesParamIndex 4? lpszRoProperties: ?[*:0]const u16, cbRoProperties: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPENUMEX; pub const PCLUSAPI_CLUSTER_GROUP_GET_ENUM_COUNT_EX = fn( hGroupEnumEx: ?*_HGROUPENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_ENUM_EX = fn( hGroupEnumEx: ?*_HGROUPENUMEX, dwIndex: u32, pItem: ?*CLUSTER_GROUP_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_CLOSE_ENUM_EX = fn( hGroupEnumEx: ?*_HGROUPENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_OPEN_ENUM_EX = fn( hCluster: ?*_HCLUSTER, // TODO: what to do with BytesParamIndex 2? lpszProperties: ?[*:0]const u16, cbProperties: u32, // TODO: what to do with BytesParamIndex 4? lpszRoProperties: ?[*:0]const u16, cbRoProperties: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESENUMEX; pub const PCLUSAPI_CLUSTER_RESOURCE_GET_ENUM_COUNT_EX = fn( hResourceEnumEx: ?*_HRESENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_ENUM_EX = fn( hResourceEnumEx: ?*_HRESENUMEX, dwIndex: u32, pItem: ?*CLUSTER_RESOURCE_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_CLOSE_ENUM_EX = fn( hResourceEnumEx: ?*_HRESENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_RESTART_CLUSTER_RESOURCE = fn( hResource: ?*_HRESOURCE, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLOSE_CLUSTER_GROUP = fn( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_GET_CLUSTER_FROM_GROUP = fn( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_GET_CLUSTER_GROUP_STATE = fn( hGroup: ?*_HGROUP, lpszNodeName: ?[*:0]u16, lpcchNodeName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_GROUP_STATE; pub const PCLUSAPI_SET_CLUSTER_GROUP_NAME = fn( hGroup: ?*_HGROUP, lpszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_CLUSTER_GROUP_NODE_LIST = fn( hGroup: ?*_HGROUP, NodeCount: u32, NodeList: ?[*]?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ONLINE_CLUSTER_GROUP = fn( hGroup: ?*_HGROUP, hDestinationNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_MOVE_CLUSTER_GROUP = fn( hGroup: ?*_HGROUP, hDestinationNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_OFFLINE_CLUSTER_GROUP = fn( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_DELETE_CLUSTER_GROUP = fn( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_DESTROY_CLUSTER_GROUP = fn( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_OPEN_ENUM = fn( hGroup: ?*_HGROUP, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPENUM; pub const PCLUSAPI_CLUSTER_GROUP_GET_ENUM_COUNT = fn( hGroupEnum: ?*_HGROUPENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_ENUM = fn( hGroupEnum: ?*_HGROUPENUM, dwIndex: u32, lpdwType: ?*u32, lpszResourceName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_CLOSE_ENUM = fn( hGroupEnum: ?*_HGROUPENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_RESOURCE_STATE = enum(i32) { StateUnknown = -1, Inherited = 0, Initializing = 1, Online = 2, Offline = 3, Failed = 4, Pending = 128, OnlinePending = 129, OfflinePending = 130, }; pub const ClusterResourceStateUnknown = CLUSTER_RESOURCE_STATE.StateUnknown; pub const ClusterResourceInherited = CLUSTER_RESOURCE_STATE.Inherited; pub const ClusterResourceInitializing = CLUSTER_RESOURCE_STATE.Initializing; pub const ClusterResourceOnline = CLUSTER_RESOURCE_STATE.Online; pub const ClusterResourceOffline = CLUSTER_RESOURCE_STATE.Offline; pub const ClusterResourceFailed = CLUSTER_RESOURCE_STATE.Failed; pub const ClusterResourcePending = CLUSTER_RESOURCE_STATE.Pending; pub const ClusterResourceOnlinePending = CLUSTER_RESOURCE_STATE.OnlinePending; pub const ClusterResourceOfflinePending = CLUSTER_RESOURCE_STATE.OfflinePending; pub const CLUSTER_RESOURCE_RESTART_ACTION = enum(i32) { DontRestart = 0, RestartNoNotify = 1, RestartNotify = 2, RestartActionCount = 3, }; pub const ClusterResourceDontRestart = CLUSTER_RESOURCE_RESTART_ACTION.DontRestart; pub const ClusterResourceRestartNoNotify = CLUSTER_RESOURCE_RESTART_ACTION.RestartNoNotify; pub const ClusterResourceRestartNotify = CLUSTER_RESOURCE_RESTART_ACTION.RestartNotify; pub const ClusterResourceRestartActionCount = CLUSTER_RESOURCE_RESTART_ACTION.RestartActionCount; pub const CLUSTER_RESOURCE_EMBEDDED_FAILURE_ACTION = enum(i32) { None = 0, LogOnly = 1, Recover = 2, }; pub const ClusterResourceEmbeddedFailureActionNone = CLUSTER_RESOURCE_EMBEDDED_FAILURE_ACTION.None; pub const ClusterResourceEmbeddedFailureActionLogOnly = CLUSTER_RESOURCE_EMBEDDED_FAILURE_ACTION.LogOnly; pub const ClusterResourceEmbeddedFailureActionRecover = CLUSTER_RESOURCE_EMBEDDED_FAILURE_ACTION.Recover; pub const CLUSTER_RESOURCE_CREATE_FLAGS = enum(i32) { DEFAULT_MONITOR = 0, SEPARATE_MONITOR = 1, // VALID_FLAGS = 1, this enum value conflicts with SEPARATE_MONITOR }; pub const CLUSTER_RESOURCE_DEFAULT_MONITOR = CLUSTER_RESOURCE_CREATE_FLAGS.DEFAULT_MONITOR; pub const CLUSTER_RESOURCE_SEPARATE_MONITOR = CLUSTER_RESOURCE_CREATE_FLAGS.SEPARATE_MONITOR; pub const CLUSTER_RESOURCE_VALID_FLAGS = CLUSTER_RESOURCE_CREATE_FLAGS.SEPARATE_MONITOR; pub const CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE = enum(i32) { SnapshotStateUnknown = 0, PrepareForHWSnapshot = 1, HWSnapshotCompleted = 2, PrepareForFreeze = 3, }; pub const ClusterSharedVolumeSnapshotStateUnknown = CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE.SnapshotStateUnknown; pub const ClusterSharedVolumePrepareForHWSnapshot = CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE.PrepareForHWSnapshot; pub const ClusterSharedVolumeHWSnapshotCompleted = CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE.HWSnapshotCompleted; pub const ClusterSharedVolumePrepareForFreeze = CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE.PrepareForFreeze; pub const PCLUSAPI_CREATE_CLUSTER_RESOURCE = fn( hGroup: ?*_HGROUP, lpszResourceName: ?[*:0]const u16, lpszResourceType: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PCLUSAPI_OPEN_CLUSTER_RESOURCE = fn( hCluster: ?*_HCLUSTER, lpszResourceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PCLUSAPI_OPEN_CLUSTER_RESOURCE_EX = fn( hCluster: ?*_HCLUSTER, lpszResourceName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PCLUSAPI_CLOSE_CLUSTER_RESOURCE = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_GET_CLUSTER_FROM_RESOURCE = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_DELETE_CLUSTER_RESOURCE = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_RESOURCE_STATE = fn( hResource: ?*_HRESOURCE, lpszNodeName: ?[*:0]u16, lpcchNodeName: ?*u32, lpszGroupName: ?[*:0]u16, lpcchGroupName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_RESOURCE_STATE; pub const PCLUSAPI_SET_CLUSTER_RESOURCE_NAME = fn( hResource: ?*_HRESOURCE, lpszResourceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_FAIL_CLUSTER_RESOURCE = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ONLINE_CLUSTER_RESOURCE = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_OFFLINE_CLUSTER_RESOURCE = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CHANGE_CLUSTER_RESOURCE_GROUP = fn( hResource: ?*_HRESOURCE, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CHANGE_CLUSTER_RESOURCE_GROUP_EX = fn( hResource: ?*_HRESOURCE, hGroup: ?*_HGROUP, Flags: u64, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_CLUSTER_RESOURCE_NODE = fn( hResource: ?*_HRESOURCE, hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CLUSTER_RESOURCE_NODE = fn( hResource: ?*_HRESOURCE, hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_CLUSTER_RESOURCE_DEPENDENCY = fn( hResource: ?*_HRESOURCE, hDependsOn: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CLUSTER_RESOURCE_DEPENDENCY = fn( hResource: ?*_HRESOURCE, hDependsOn: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SET_CLUSTER_RESOURCE_DEPENDENCY_EXPRESSION = fn( hResource: ?*_HRESOURCE, lpszDependencyExpression: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_RESOURCE_DEPENDENCY_EXPRESSION = fn( hResource: ?*_HRESOURCE, lpszDependencyExpression: ?[*:0]u16, lpcchDependencyExpression: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_RESOURCE_TO_CLUSTER_SHARED_VOLUMES = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_RESOURCE_FROM_CLUSTER_SHARED_VOLUMES = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_IS_FILE_ON_CLUSTER_SHARED_VOLUME = fn( lpszPathName: ?[*:0]const u16, pbFileIsOnSharedVolume: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_SHARED_VOLUME_SET_SNAPSHOT_STATE = fn( guidSnapshotSet: Guid, lpszVolumeName: ?[*:0]const u16, state: CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CAN_RESOURCE_BE_DEPENDENT = fn( hResource: ?*_HRESOURCE, hResourceDependent: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_CLUSTER_RESOURCE_CONTROL = fn( hResource: ?*_HRESOURCE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_TYPE_CONTROL = fn( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 5? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 7? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_GROUP_CONTROL = fn( hGroup: ?*_HGROUP, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NODE_CONTROL = fn( hNode: ?*_HNODE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_RESOURCE_NETWORK_NAME = fn( hResource: ?*_HRESOURCE, lpBuffer: [*:0]u16, nSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const CLUSTER_PROPERTY_TYPE = enum(i32) { UNKNOWN = -1, ENDMARK = 0, LIST_VALUE = 1, RESCLASS = 2, RESERVED1 = 3, NAME = 4, SIGNATURE = 5, SCSI_ADDRESS = 6, DISK_NUMBER = 7, PARTITION_INFO = 8, FTSET_INFO = 9, DISK_SERIALNUMBER = 10, DISK_GUID = 11, DISK_SIZE = 12, PARTITION_INFO_EX = 13, PARTITION_INFO_EX2 = 14, STORAGE_DEVICE_ID_DESCRIPTOR = 15, USER = 32768, }; pub const CLUSPROP_TYPE_UNKNOWN = CLUSTER_PROPERTY_TYPE.UNKNOWN; pub const CLUSPROP_TYPE_ENDMARK = CLUSTER_PROPERTY_TYPE.ENDMARK; pub const CLUSPROP_TYPE_LIST_VALUE = CLUSTER_PROPERTY_TYPE.LIST_VALUE; pub const CLUSPROP_TYPE_RESCLASS = CLUSTER_PROPERTY_TYPE.RESCLASS; pub const CLUSPROP_TYPE_RESERVED1 = CLUSTER_PROPERTY_TYPE.RESERVED1; pub const CLUSPROP_TYPE_NAME = CLUSTER_PROPERTY_TYPE.NAME; pub const CLUSPROP_TYPE_SIGNATURE = CLUSTER_PROPERTY_TYPE.SIGNATURE; pub const CLUSPROP_TYPE_SCSI_ADDRESS = CLUSTER_PROPERTY_TYPE.SCSI_ADDRESS; pub const CLUSPROP_TYPE_DISK_NUMBER = CLUSTER_PROPERTY_TYPE.DISK_NUMBER; pub const CLUSPROP_TYPE_PARTITION_INFO = CLUSTER_PROPERTY_TYPE.PARTITION_INFO; pub const CLUSPROP_TYPE_FTSET_INFO = CLUSTER_PROPERTY_TYPE.FTSET_INFO; pub const CLUSPROP_TYPE_DISK_SERIALNUMBER = CLUSTER_PROPERTY_TYPE.DISK_SERIALNUMBER; pub const CLUSPROP_TYPE_DISK_GUID = CLUSTER_PROPERTY_TYPE.DISK_GUID; pub const CLUSPROP_TYPE_DISK_SIZE = CLUSTER_PROPERTY_TYPE.DISK_SIZE; pub const CLUSPROP_TYPE_PARTITION_INFO_EX = CLUSTER_PROPERTY_TYPE.PARTITION_INFO_EX; pub const CLUSPROP_TYPE_PARTITION_INFO_EX2 = CLUSTER_PROPERTY_TYPE.PARTITION_INFO_EX2; pub const CLUSPROP_TYPE_STORAGE_DEVICE_ID_DESCRIPTOR = CLUSTER_PROPERTY_TYPE.STORAGE_DEVICE_ID_DESCRIPTOR; pub const CLUSPROP_TYPE_USER = CLUSTER_PROPERTY_TYPE.USER; pub const CLUSTER_PROPERTY_FORMAT = enum(i32) { UNKNOWN = 0, BINARY = 1, DWORD = 2, SZ = 3, EXPAND_SZ = 4, MULTI_SZ = 5, ULARGE_INTEGER = 6, LONG = 7, EXPANDED_SZ = 8, SECURITY_DESCRIPTOR = 9, LARGE_INTEGER = 10, WORD = 11, FILETIME = 12, VALUE_LIST = 13, PROPERTY_LIST = 14, USER = 32768, }; pub const CLUSPROP_FORMAT_UNKNOWN = CLUSTER_PROPERTY_FORMAT.UNKNOWN; pub const CLUSPROP_FORMAT_BINARY = CLUSTER_PROPERTY_FORMAT.BINARY; pub const CLUSPROP_FORMAT_DWORD = CLUSTER_PROPERTY_FORMAT.DWORD; pub const CLUSPROP_FORMAT_SZ = CLUSTER_PROPERTY_FORMAT.SZ; pub const CLUSPROP_FORMAT_EXPAND_SZ = CLUSTER_PROPERTY_FORMAT.EXPAND_SZ; pub const CLUSPROP_FORMAT_MULTI_SZ = CLUSTER_PROPERTY_FORMAT.MULTI_SZ; pub const CLUSPROP_FORMAT_ULARGE_INTEGER = CLUSTER_PROPERTY_FORMAT.ULARGE_INTEGER; pub const CLUSPROP_FORMAT_LONG = CLUSTER_PROPERTY_FORMAT.LONG; pub const CLUSPROP_FORMAT_EXPANDED_SZ = CLUSTER_PROPERTY_FORMAT.EXPANDED_SZ; pub const CLUSPROP_FORMAT_SECURITY_DESCRIPTOR = CLUSTER_PROPERTY_FORMAT.SECURITY_DESCRIPTOR; pub const CLUSPROP_FORMAT_LARGE_INTEGER = CLUSTER_PROPERTY_FORMAT.LARGE_INTEGER; pub const CLUSPROP_FORMAT_WORD = CLUSTER_PROPERTY_FORMAT.WORD; pub const CLUSPROP_FORMAT_FILETIME = CLUSTER_PROPERTY_FORMAT.FILETIME; pub const CLUSPROP_FORMAT_VALUE_LIST = CLUSTER_PROPERTY_FORMAT.VALUE_LIST; pub const CLUSPROP_FORMAT_PROPERTY_LIST = CLUSTER_PROPERTY_FORMAT.PROPERTY_LIST; pub const CLUSPROP_FORMAT_USER = CLUSTER_PROPERTY_FORMAT.USER; pub const CLUSTER_PROPERTY_SYNTAX = enum(u32) { ENDMARK = 0, NAME = 262147, RESCLASS = 131074, LIST_VALUE_SZ = 65539, LIST_VALUE_EXPAND_SZ = 65540, LIST_VALUE_DWORD = 65538, LIST_VALUE_BINARY = 65537, LIST_VALUE_MULTI_SZ = 65541, LIST_VALUE_LONG = 65543, LIST_VALUE_EXPANDED_SZ = 65544, LIST_VALUE_SECURITY_DESCRIPTOR = 65545, LIST_VALUE_LARGE_INTEGER = 65546, LIST_VALUE_ULARGE_INTEGER = 65542, LIST_VALUE_WORD = 65547, LIST_VALUE_PROPERTY_LIST = 65550, LIST_VALUE_FILETIME = 65548, DISK_SIGNATURE = 327682, SCSI_ADDRESS = 393218, DISK_NUMBER = 458754, PARTITION_INFO = 524289, FTSET_INFO = 589825, DISK_SERIALNUMBER = 655363, DISK_GUID = 720899, DISK_SIZE = 786438, PARTITION_INFO_EX = 851969, PARTITION_INFO_EX2 = 917505, STORAGE_DEVICE_ID_DESCRIPTOR = 983041, }; pub const CLUSPROP_SYNTAX_ENDMARK = CLUSTER_PROPERTY_SYNTAX.ENDMARK; pub const CLUSPROP_SYNTAX_NAME = CLUSTER_PROPERTY_SYNTAX.NAME; pub const CLUSPROP_SYNTAX_RESCLASS = CLUSTER_PROPERTY_SYNTAX.RESCLASS; pub const CLUSPROP_SYNTAX_LIST_VALUE_SZ = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_SZ; pub const CLUSPROP_SYNTAX_LIST_VALUE_EXPAND_SZ = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_EXPAND_SZ; pub const CLUSPROP_SYNTAX_LIST_VALUE_DWORD = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_DWORD; pub const CLUSPROP_SYNTAX_LIST_VALUE_BINARY = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_BINARY; pub const CLUSPROP_SYNTAX_LIST_VALUE_MULTI_SZ = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_MULTI_SZ; pub const CLUSPROP_SYNTAX_LIST_VALUE_LONG = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_LONG; pub const CLUSPROP_SYNTAX_LIST_VALUE_EXPANDED_SZ = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_EXPANDED_SZ; pub const CLUSPROP_SYNTAX_LIST_VALUE_SECURITY_DESCRIPTOR = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_SECURITY_DESCRIPTOR; pub const CLUSPROP_SYNTAX_LIST_VALUE_LARGE_INTEGER = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_LARGE_INTEGER; pub const CLUSPROP_SYNTAX_LIST_VALUE_ULARGE_INTEGER = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_ULARGE_INTEGER; pub const CLUSPROP_SYNTAX_LIST_VALUE_WORD = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_WORD; pub const CLUSPROP_SYNTAX_LIST_VALUE_PROPERTY_LIST = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_PROPERTY_LIST; pub const CLUSPROP_SYNTAX_LIST_VALUE_FILETIME = CLUSTER_PROPERTY_SYNTAX.LIST_VALUE_FILETIME; pub const CLUSPROP_SYNTAX_DISK_SIGNATURE = CLUSTER_PROPERTY_SYNTAX.DISK_SIGNATURE; pub const CLUSPROP_SYNTAX_SCSI_ADDRESS = CLUSTER_PROPERTY_SYNTAX.SCSI_ADDRESS; pub const CLUSPROP_SYNTAX_DISK_NUMBER = CLUSTER_PROPERTY_SYNTAX.DISK_NUMBER; pub const CLUSPROP_SYNTAX_PARTITION_INFO = CLUSTER_PROPERTY_SYNTAX.PARTITION_INFO; pub const CLUSPROP_SYNTAX_FTSET_INFO = CLUSTER_PROPERTY_SYNTAX.FTSET_INFO; pub const CLUSPROP_SYNTAX_DISK_SERIALNUMBER = CLUSTER_PROPERTY_SYNTAX.DISK_SERIALNUMBER; pub const CLUSPROP_SYNTAX_DISK_GUID = CLUSTER_PROPERTY_SYNTAX.DISK_GUID; pub const CLUSPROP_SYNTAX_DISK_SIZE = CLUSTER_PROPERTY_SYNTAX.DISK_SIZE; pub const CLUSPROP_SYNTAX_PARTITION_INFO_EX = CLUSTER_PROPERTY_SYNTAX.PARTITION_INFO_EX; pub const CLUSPROP_SYNTAX_PARTITION_INFO_EX2 = CLUSTER_PROPERTY_SYNTAX.PARTITION_INFO_EX2; pub const CLUSPROP_SYNTAX_STORAGE_DEVICE_ID_DESCRIPTOR = CLUSTER_PROPERTY_SYNTAX.STORAGE_DEVICE_ID_DESCRIPTOR; pub const GROUP_FAILURE_INFO = extern struct { dwFailoverAttemptsRemaining: u32, dwFailoverPeriodRemaining: u32, }; pub const GROUP_FAILURE_INFO_BUFFER = extern struct { dwVersion: u32, Info: GROUP_FAILURE_INFO, }; pub const RESOURCE_FAILURE_INFO = extern struct { dwRestartAttemptsRemaining: u32, dwRestartPeriodRemaining: u32, }; pub const RESOURCE_FAILURE_INFO_BUFFER = extern struct { dwVersion: u32, Info: RESOURCE_FAILURE_INFO, }; pub const RESOURCE_TERMINAL_FAILURE_INFO_BUFFER = extern struct { isTerminalFailure: BOOL, restartPeriodRemaining: u32, }; pub const CLUSTER_CONTROL_OBJECT = enum(i32) { INVALID = 0, RESOURCE = 1, RESOURCE_TYPE = 2, GROUP = 3, NODE = 4, NETWORK = 5, NETINTERFACE = 6, CLUSTER = 7, GROUPSET = 8, AFFINITYRULE = 9, USER = 128, }; pub const CLUS_OBJECT_INVALID = CLUSTER_CONTROL_OBJECT.INVALID; pub const CLUS_OBJECT_RESOURCE = CLUSTER_CONTROL_OBJECT.RESOURCE; pub const CLUS_OBJECT_RESOURCE_TYPE = CLUSTER_CONTROL_OBJECT.RESOURCE_TYPE; pub const CLUS_OBJECT_GROUP = CLUSTER_CONTROL_OBJECT.GROUP; pub const CLUS_OBJECT_NODE = CLUSTER_CONTROL_OBJECT.NODE; pub const CLUS_OBJECT_NETWORK = CLUSTER_CONTROL_OBJECT.NETWORK; pub const CLUS_OBJECT_NETINTERFACE = CLUSTER_CONTROL_OBJECT.NETINTERFACE; pub const CLUS_OBJECT_CLUSTER = CLUSTER_CONTROL_OBJECT.CLUSTER; pub const CLUS_OBJECT_GROUPSET = CLUSTER_CONTROL_OBJECT.GROUPSET; pub const CLUS_OBJECT_AFFINITYRULE = CLUSTER_CONTROL_OBJECT.AFFINITYRULE; pub const CLUS_OBJECT_USER = CLUSTER_CONTROL_OBJECT.USER; pub const CLCTL_CODES = enum(i32) { LCTL_UNKNOWN = 0, LCTL_GET_CHARACTERISTICS = 5, LCTL_GET_FLAGS = 9, LCTL_GET_CLASS_INFO = 13, LCTL_GET_REQUIRED_DEPENDENCIES = 17, LCTL_GET_ARB_TIMEOUT = 21, LCTL_GET_FAILURE_INFO = 25, LCTL_GET_NAME = 41, LCTL_GET_RESOURCE_TYPE = 45, LCTL_GET_NODE = 49, LCTL_GET_NETWORK = 53, LCTL_GET_ID = 57, LCTL_GET_FQDN = 61, LCTL_GET_CLUSTER_SERVICE_ACCOUNT_NAME = 65, LCTL_CHECK_VOTER_EVICT = 69, LCTL_CHECK_VOTER_DOWN = 73, LCTL_SHUTDOWN = 77, LCTL_ENUM_COMMON_PROPERTIES = 81, LCTL_GET_RO_COMMON_PROPERTIES = 85, LCTL_GET_COMMON_PROPERTIES = 89, LCTL_SET_COMMON_PROPERTIES = 4194398, LCTL_VALIDATE_COMMON_PROPERTIES = 97, LCTL_GET_COMMON_PROPERTY_FMTS = 101, LCTL_GET_COMMON_RESOURCE_PROPERTY_FMTS = 105, LCTL_ENUM_PRIVATE_PROPERTIES = 121, LCTL_GET_RO_PRIVATE_PROPERTIES = 125, LCTL_GET_PRIVATE_PROPERTIES = 129, LCTL_SET_PRIVATE_PROPERTIES = 4194438, LCTL_VALIDATE_PRIVATE_PROPERTIES = 137, LCTL_GET_PRIVATE_PROPERTY_FMTS = 141, LCTL_GET_PRIVATE_RESOURCE_PROPERTY_FMTS = 145, LCTL_ADD_REGISTRY_CHECKPOINT = 4194466, LCTL_DELETE_REGISTRY_CHECKPOINT = 4194470, LCTL_GET_REGISTRY_CHECKPOINTS = 169, LCTL_ADD_CRYPTO_CHECKPOINT = 4194478, LCTL_DELETE_CRYPTO_CHECKPOINT = 4194482, LCTL_GET_CRYPTO_CHECKPOINTS = 181, LCTL_RESOURCE_UPGRADE_DLL = 4194490, LCTL_ADD_REGISTRY_CHECKPOINT_64BIT = 4194494, LCTL_ADD_REGISTRY_CHECKPOINT_32BIT = 4194498, LCTL_GET_LOADBAL_PROCESS_LIST = 201, LCTL_SET_ACCOUNT_ACCESS = 4194546, LCTL_GET_NETWORK_NAME = 361, LCTL_NETNAME_GET_VIRTUAL_SERVER_TOKEN = 365, LCTL_NETNAME_REGISTER_DNS_RECORDS = 370, LCTL_GET_DNS_NAME = 373, LCTL_NETNAME_SET_PWD_INFO = 378, LCTL_NETNAME_DELETE_CO = 382, LCTL_NETNAME_VALIDATE_VCO = 385, LCTL_NETNAME_RESET_VCO = 389, LCTL_NETNAME_REPAIR_VCO = 397, LCTL_STORAGE_GET_DISK_INFO = 401, LCTL_STORAGE_GET_AVAILABLE_DISKS = 405, LCTL_STORAGE_IS_PATH_VALID = 409, LCTL_STORAGE_SYNC_CLUSDISK_DB = 4194718, LCTL_STORAGE_GET_DISK_NUMBER_INFO = 417, LCTL_QUERY_DELETE = 441, LCTL_IPADDRESS_RENEW_LEASE = 4194750, LCTL_IPADDRESS_RELEASE_LEASE = 4194754, LCTL_QUERY_MAINTENANCE_MODE = 481, LCTL_SET_MAINTENANCE_MODE = 4194790, LCTL_STORAGE_SET_DRIVELETTER = 4194794, LCTL_STORAGE_GET_DRIVELETTERS = 493, LCTL_STORAGE_GET_DISK_INFO_EX = 497, LCTL_STORAGE_GET_AVAILABLE_DISKS_EX = 501, LCTL_STORAGE_GET_DISK_INFO_EX2 = 505, LCTL_STORAGE_GET_CLUSPORT_DISK_COUNT = 509, LCTL_STORAGE_REMAP_DRIVELETTER = 513, LCTL_STORAGE_GET_DISKID = 517, LCTL_STORAGE_IS_CLUSTERABLE = 521, LCTL_STORAGE_REMOVE_VM_OWNERSHIP = 4194830, LCTL_STORAGE_GET_MOUNTPOINTS = 529, LCTL_STORAGE_GET_DIRTY = 537, LCTL_STORAGE_GET_SHARED_VOLUME_INFO = 549, LCTL_STORAGE_IS_CSV_FILE = 553, LCTL_STORAGE_GET_RESOURCEID = 557, LCTL_VALIDATE_PATH = 561, LCTL_VALIDATE_NETNAME = 565, LCTL_VALIDATE_DIRECTORY = 569, LCTL_BATCH_BLOCK_KEY = 574, LCTL_BATCH_UNBLOCK_KEY = 577, LCTL_FILESERVER_SHARE_ADD = 4194886, LCTL_FILESERVER_SHARE_DEL = 4194890, LCTL_FILESERVER_SHARE_MODIFY = 4194894, LCTL_FILESERVER_SHARE_REPORT = 593, LCTL_NETNAME_GET_OU_FOR_VCO = 4194926, LCTL_ENABLE_SHARED_VOLUME_DIRECTIO = 4194954, LCTL_DISABLE_SHARED_VOLUME_DIRECTIO = 4194958, LCTL_GET_SHARED_VOLUME_ID = 657, LCTL_SET_CSV_MAINTENANCE_MODE = 4194966, LCTL_SET_SHARED_VOLUME_BACKUP_MODE = 4194970, LCTL_STORAGE_GET_SHARED_VOLUME_PARTITION_NAMES = 669, LCTL_STORAGE_GET_SHARED_VOLUME_STATES = 4194978, LCTL_STORAGE_IS_SHARED_VOLUME = 677, LCTL_GET_CLUSDB_TIMESTAMP = 681, LCTL_RW_MODIFY_NOOP = 4194990, LCTL_IS_QUORUM_BLOCKED = 689, LCTL_POOL_GET_DRIVE_INFO = 693, LCTL_GET_GUM_LOCK_OWNER = 697, LCTL_GET_STUCK_NODES = 701, LCTL_INJECT_GEM_FAULT = 705, LCTL_INTRODUCE_GEM_REPAIR_DELAY = 709, LCTL_SEND_DUMMY_GEM_MESSAGES = 713, LCTL_BLOCK_GEM_SEND_RECV = 717, LCTL_GET_GEMID_VECTOR = 721, LCTL_ADD_CRYPTO_CHECKPOINT_EX = 4195030, LCTL_GROUP_GET_LAST_MOVE_TIME = 729, LCTL_SET_STORAGE_CONFIGURATION = 4195042, LCTL_GET_STORAGE_CONFIGURATION = 741, LCTL_GET_STORAGE_CONFIG_ATTRIBUTES = 745, LCTL_REMOVE_NODE = 4195054, LCTL_IS_FEATURE_INSTALLED = 753, LCTL_IS_S2D_FEATURE_SUPPORTED = 757, LCTL_STORAGE_GET_PHYSICAL_DISK_INFO = 761, LCTL_STORAGE_GET_CLUSBFLT_PATHS = 765, LCTL_STORAGE_GET_CLUSBFLT_PATHINFO = 769, LCTL_CLEAR_NODE_CONNECTION_INFO = 4195078, LCTL_SET_DNS_DOMAIN = 4195082, TCTL_GET_ROUTESTATUS_BASIC = 781, TCTL_GET_ROUTESTATUS_EXTENDED = 785, TCTL_GET_FAULT_DOMAIN_STATE = 789, LCTL_NETNAME_SET_PWD_INFOEX = 794, LCTL_STORAGE_GET_AVAILABLE_DISKS_EX2_INT = 8161, LCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS = 8417, LCTL_CLOUD_WITNESS_RESOURCE_UPDATE_TOKEN = 4<PASSWORD>, LCTL_RESOURCE_PREPARE_UPGRADE = 4202730, LCTL_RESOURCE_UPGRADE_COMPLETED = 4202734, LCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS_WITH_KEY = 8433, LCTL_CLOUD_WITNESS_RESOURCE_UPDATE_KEY = 4202742, LCTL_REPLICATION_ADD_REPLICATION_GROUP = 8514, LCTL_REPLICATION_GET_LOG_INFO = 8517, LCTL_REPLICATION_GET_ELIGIBLE_LOGDISKS = 8521, LCTL_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS = 8525, LCTL_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS = 8529, LCTL_REPLICATION_GET_REPLICATED_DISKS = 8533, LCTL_REPLICATION_GET_REPLICA_VOLUMES = 8537, LCTL_REPLICATION_GET_LOG_VOLUME = 8541, LCTL_REPLICATION_GET_RESOURCE_GROUP = 8545, LCTL_REPLICATION_GET_REPLICATED_PARTITION_INFO = 8549, LCTL_GET_STATE_CHANGE_TIME = 11613, LCTL_SET_CLUSTER_S2D_ENABLED = 4205922, LCTL_SET_CLUSTER_S2D_CACHE_METADATA_RESERVE_BYTES = 4205934, LCTL_GROUPSET_GET_GROUPS = 11633, LCTL_GROUPSET_GET_PROVIDER_GROUPS = 11637, LCTL_GROUPSET_GET_PROVIDER_GROUPSETS = 11641, LCTL_GROUP_GET_PROVIDER_GROUPS = 11645, LCTL_GROUP_GET_PROVIDER_GROUPSETS = 11649, LCTL_GROUP_SET_CCF_FROM_MASTER = 4205958, LCTL_GET_INFRASTRUCTURE_SOFS_BUFFER = 11657, LCTL_SET_INFRASTRUCTURE_SOFS_BUFFER = 4205966, LCTL_NOTIFY_INFRASTRUCTURE_SOFS_CHANGED = 4205970, LCTL_SCALEOUT_COMMAND = 4205974, LCTL_SCALEOUT_CONTROL = 4205978, LCTL_SCALEOUT_GET_CLUSTERS = 4205981, LCTL_RELOAD_AUTOLOGGER_CONFIG = 11730, LCTL_STORAGE_RENAME_SHARED_VOLUME = 11734, LCTL_STORAGE_RENAME_SHARED_VOLUME_GUID = 11738, LCTL_ENUM_AFFINITY_RULE_NAMES = 11741, LCTL_GET_NODES_IN_FD = 11745, LCTL_FORCE_DB_FLUSH = 4206054, LCTL_DELETE = 5242886, LCTL_INSTALL_NODE = 5242890, LCTL_EVICT_NODE = 5242894, LCTL_ADD_DEPENDENCY = 5242898, LCTL_REMOVE_DEPENDENCY = 5242902, LCTL_ADD_OWNER = 5242906, LCTL_REMOVE_OWNER = 5242910, LCTL_SET_NAME = 5242918, LCTL_CLUSTER_NAME_CHANGED = 5242922, LCTL_CLUSTER_VERSION_CHANGED = 5242926, LCTL_FIXUP_ON_UPGRADE = 5242930, LCTL_STARTING_PHASE1 = 5242934, LCTL_STARTING_PHASE2 = 5242938, LCTL_HOLD_IO = 5242942, LCTL_RESUME_IO = 5242946, LCTL_FORCE_QUORUM = 5242950, LCTL_INITIALIZE = 5242954, LCTL_STATE_CHANGE_REASON = 5242958, LCTL_PROVIDER_STATE_CHANGE = 5242962, LCTL_LEAVING_GROUP = 5242966, LCTL_JOINING_GROUP = 5242970, LCTL_FSWITNESS_GET_EPOCH_INFO = 1048669, LCTL_FSWITNESS_SET_EPOCH_INFO = 5242978, LCTL_FSWITNESS_RELEASE_LOCK = 5242982, LCTL_NETNAME_CREDS_NOTIFYCAM = 5242986, LCTL_NOTIFY_QUORUM_STATUS = 5243006, LCTL_NOTIFY_MONITOR_SHUTTING_DOWN = 1048705, LCTL_UNDELETE = 5243014, LCTL_GET_OPERATION_CONTEXT = 1057001, LCTL_NOTIFY_OWNER_CHANGE = 5251362, LCTL_VALIDATE_CHANGE_GROUP = 1057061, LCTL_CHECK_DRAIN_VETO = 1057069, LCTL_NOTIFY_DRAIN_COMPLETE = 1057073, }; pub const CLCTL_UNKNOWN = CLCTL_CODES.LCTL_UNKNOWN; pub const CLCTL_GET_CHARACTERISTICS = CLCTL_CODES.LCTL_GET_CHARACTERISTICS; pub const CLCTL_GET_FLAGS = CLCTL_CODES.LCTL_GET_FLAGS; pub const CLCTL_GET_CLASS_INFO = CLCTL_CODES.LCTL_GET_CLASS_INFO; pub const CLCTL_GET_REQUIRED_DEPENDENCIES = CLCTL_CODES.LCTL_GET_REQUIRED_DEPENDENCIES; pub const CLCTL_GET_ARB_TIMEOUT = CLCTL_CODES.LCTL_GET_ARB_TIMEOUT; pub const CLCTL_GET_FAILURE_INFO = CLCTL_CODES.LCTL_GET_FAILURE_INFO; pub const CLCTL_GET_NAME = CLCTL_CODES.LCTL_GET_NAME; pub const CLCTL_GET_RESOURCE_TYPE = CLCTL_CODES.LCTL_GET_RESOURCE_TYPE; pub const CLCTL_GET_NODE = CLCTL_CODES.LCTL_GET_NODE; pub const CLCTL_GET_NETWORK = CLCTL_CODES.LCTL_GET_NETWORK; pub const CLCTL_GET_ID = CLCTL_CODES.LCTL_GET_ID; pub const CLCTL_GET_FQDN = CLCTL_CODES.LCTL_GET_FQDN; pub const CLCTL_GET_CLUSTER_SERVICE_ACCOUNT_NAME = CLCTL_CODES.LCTL_GET_CLUSTER_SERVICE_ACCOUNT_NAME; pub const CLCTL_CHECK_VOTER_EVICT = CLCTL_CODES.LCTL_CHECK_VOTER_EVICT; pub const CLCTL_CHECK_VOTER_DOWN = CLCTL_CODES.LCTL_CHECK_VOTER_DOWN; pub const CLCTL_SHUTDOWN = CLCTL_CODES.LCTL_SHUTDOWN; pub const CLCTL_ENUM_COMMON_PROPERTIES = CLCTL_CODES.LCTL_ENUM_COMMON_PROPERTIES; pub const CLCTL_GET_RO_COMMON_PROPERTIES = CLCTL_CODES.LCTL_GET_RO_COMMON_PROPERTIES; pub const CLCTL_GET_COMMON_PROPERTIES = CLCTL_CODES.LCTL_GET_COMMON_PROPERTIES; pub const CLCTL_SET_COMMON_PROPERTIES = CLCTL_CODES.LCTL_SET_COMMON_PROPERTIES; pub const CLCTL_VALIDATE_COMMON_PROPERTIES = CLCTL_CODES.LCTL_VALIDATE_COMMON_PROPERTIES; pub const CLCTL_GET_COMMON_PROPERTY_FMTS = CLCTL_CODES.LCTL_GET_COMMON_PROPERTY_FMTS; pub const CLCTL_GET_COMMON_RESOURCE_PROPERTY_FMTS = CLCTL_CODES.LCTL_GET_COMMON_RESOURCE_PROPERTY_FMTS; pub const CLCTL_ENUM_PRIVATE_PROPERTIES = CLCTL_CODES.LCTL_ENUM_PRIVATE_PROPERTIES; pub const CLCTL_GET_RO_PRIVATE_PROPERTIES = CLCTL_CODES.LCTL_GET_RO_PRIVATE_PROPERTIES; pub const CLCTL_GET_PRIVATE_PROPERTIES = CLCTL_CODES.LCTL_GET_PRIVATE_PROPERTIES; pub const CLCTL_SET_PRIVATE_PROPERTIES = CLCTL_CODES.LCTL_SET_PRIVATE_PROPERTIES; pub const CLCTL_VALIDATE_PRIVATE_PROPERTIES = CLCTL_CODES.LCTL_VALIDATE_PRIVATE_PROPERTIES; pub const CLCTL_GET_PRIVATE_PROPERTY_FMTS = CLCTL_CODES.LCTL_GET_PRIVATE_PROPERTY_FMTS; pub const CLCTL_GET_PRIVATE_RESOURCE_PROPERTY_FMTS = CLCTL_CODES.LCTL_GET_PRIVATE_RESOURCE_PROPERTY_FMTS; pub const CLCTL_ADD_REGISTRY_CHECKPOINT = CLCTL_CODES.LCTL_ADD_REGISTRY_CHECKPOINT; pub const CLCTL_DELETE_REGISTRY_CHECKPOINT = CLCTL_CODES.LCTL_DELETE_REGISTRY_CHECKPOINT; pub const CLCTL_GET_REGISTRY_CHECKPOINTS = CLCTL_CODES.LCTL_GET_REGISTRY_CHECKPOINTS; pub const CLCTL_ADD_CRYPTO_CHECKPOINT = CLCTL_CODES.LCTL_ADD_CRYPTO_CHECKPOINT; pub const CLCTL_DELETE_CRYPTO_CHECKPOINT = CLCTL_CODES.LCTL_DELETE_CRYPTO_CHECKPOINT; pub const CLCTL_GET_CRYPTO_CHECKPOINTS = CLCTL_CODES.LCTL_GET_CRYPTO_CHECKPOINTS; pub const CLCTL_RESOURCE_UPGRADE_DLL = CLCTL_CODES.LCTL_RESOURCE_UPGRADE_DLL; pub const CLCTL_ADD_REGISTRY_CHECKPOINT_64BIT = CLCTL_CODES.LCTL_ADD_REGISTRY_CHECKPOINT_64BIT; pub const CLCTL_ADD_REGISTRY_CHECKPOINT_32BIT = CLCTL_CODES.LCTL_ADD_REGISTRY_CHECKPOINT_32BIT; pub const CLCTL_GET_LOADBAL_PROCESS_LIST = CLCTL_CODES.LCTL_GET_LOADBAL_PROCESS_LIST; pub const CLCTL_SET_ACCOUNT_ACCESS = CLCTL_CODES.LCTL_SET_ACCOUNT_ACCESS; pub const CLCTL_GET_NETWORK_NAME = CLCTL_CODES.LCTL_GET_NETWORK_NAME; pub const CLCTL_NETNAME_GET_VIRTUAL_SERVER_TOKEN = CLCTL_CODES.LCTL_NETNAME_GET_VIRTUAL_SERVER_TOKEN; pub const CLCTL_NETNAME_REGISTER_DNS_RECORDS = CLCTL_CODES.LCTL_NETNAME_REGISTER_DNS_RECORDS; pub const CLCTL_GET_DNS_NAME = CLCTL_CODES.LCTL_GET_DNS_NAME; pub const CLCTL_NETNAME_SET_PWD_INFO = CLCTL_CODES.LCTL_NETNAME_SET_PWD_INFO; pub const CLCTL_NETNAME_DELETE_CO = CLCTL_CODES.LCTL_NETNAME_DELETE_CO; pub const CLCTL_NETNAME_VALIDATE_VCO = CLCTL_CODES.LCTL_NETNAME_VALIDATE_VCO; pub const CLCTL_NETNAME_RESET_VCO = CLCTL_CODES.LCTL_NETNAME_RESET_VCO; pub const CLCTL_NETNAME_REPAIR_VCO = CLCTL_CODES.LCTL_NETNAME_REPAIR_VCO; pub const CLCTL_STORAGE_GET_DISK_INFO = CLCTL_CODES.LCTL_STORAGE_GET_DISK_INFO; pub const CLCTL_STORAGE_GET_AVAILABLE_DISKS = CLCTL_CODES.LCTL_STORAGE_GET_AVAILABLE_DISKS; pub const CLCTL_STORAGE_IS_PATH_VALID = CLCTL_CODES.LCTL_STORAGE_IS_PATH_VALID; pub const CLCTL_STORAGE_SYNC_CLUSDISK_DB = CLCTL_CODES.LCTL_STORAGE_SYNC_CLUSDISK_DB; pub const CLCTL_STORAGE_GET_DISK_NUMBER_INFO = CLCTL_CODES.LCTL_STORAGE_GET_DISK_NUMBER_INFO; pub const CLCTL_QUERY_DELETE = CLCTL_CODES.LCTL_QUERY_DELETE; pub const CLCTL_IPADDRESS_RENEW_LEASE = CLCTL_CODES.LCTL_IPADDRESS_RENEW_LEASE; pub const CLCTL_IPADDRESS_RELEASE_LEASE = CLCTL_CODES.LCTL_IPADDRESS_RELEASE_LEASE; pub const CLCTL_QUERY_MAINTENANCE_MODE = CLCTL_CODES.LCTL_QUERY_MAINTENANCE_MODE; pub const CLCTL_SET_MAINTENANCE_MODE = CLCTL_CODES.LCTL_SET_MAINTENANCE_MODE; pub const CLCTL_STORAGE_SET_DRIVELETTER = CLCTL_CODES.LCTL_STORAGE_SET_DRIVELETTER; pub const CLCTL_STORAGE_GET_DRIVELETTERS = CLCTL_CODES.LCTL_STORAGE_GET_DRIVELETTERS; pub const CLCTL_STORAGE_GET_DISK_INFO_EX = CLCTL_CODES.LCTL_STORAGE_GET_DISK_INFO_EX; pub const CLCTL_STORAGE_GET_AVAILABLE_DISKS_EX = CLCTL_CODES.LCTL_STORAGE_GET_AVAILABLE_DISKS_EX; pub const CLCTL_STORAGE_GET_DISK_INFO_EX2 = CLCTL_CODES.LCTL_STORAGE_GET_DISK_INFO_EX2; pub const CLCTL_STORAGE_GET_CLUSPORT_DISK_COUNT = CLCTL_CODES.LCTL_STORAGE_GET_CLUSPORT_DISK_COUNT; pub const CLCTL_STORAGE_REMAP_DRIVELETTER = CLCTL_CODES.LCTL_STORAGE_REMAP_DRIVELETTER; pub const CLCTL_STORAGE_GET_DISKID = CLCTL_CODES.LCTL_STORAGE_GET_DISKID; pub const CLCTL_STORAGE_IS_CLUSTERABLE = CLCTL_CODES.LCTL_STORAGE_IS_CLUSTERABLE; pub const CLCTL_STORAGE_REMOVE_VM_OWNERSHIP = CLCTL_CODES.LCTL_STORAGE_REMOVE_VM_OWNERSHIP; pub const CLCTL_STORAGE_GET_MOUNTPOINTS = CLCTL_CODES.LCTL_STORAGE_GET_MOUNTPOINTS; pub const CLCTL_STORAGE_GET_DIRTY = CLCTL_CODES.LCTL_STORAGE_GET_DIRTY; pub const CLCTL_STORAGE_GET_SHARED_VOLUME_INFO = CLCTL_CODES.LCTL_STORAGE_GET_SHARED_VOLUME_INFO; pub const CLCTL_STORAGE_IS_CSV_FILE = CLCTL_CODES.LCTL_STORAGE_IS_CSV_FILE; pub const CLCTL_STORAGE_GET_RESOURCEID = CLCTL_CODES.LCTL_STORAGE_GET_RESOURCEID; pub const CLCTL_VALIDATE_PATH = CLCTL_CODES.LCTL_VALIDATE_PATH; pub const CLCTL_VALIDATE_NETNAME = CLCTL_CODES.LCTL_VALIDATE_NETNAME; pub const CLCTL_VALIDATE_DIRECTORY = CLCTL_CODES.LCTL_VALIDATE_DIRECTORY; pub const CLCTL_BATCH_BLOCK_KEY = CLCTL_CODES.LCTL_BATCH_BLOCK_KEY; pub const CLCTL_BATCH_UNBLOCK_KEY = CLCTL_CODES.LCTL_BATCH_UNBLOCK_KEY; pub const CLCTL_FILESERVER_SHARE_ADD = CLCTL_CODES.LCTL_FILESERVER_SHARE_ADD; pub const CLCTL_FILESERVER_SHARE_DEL = CLCTL_CODES.LCTL_FILESERVER_SHARE_DEL; pub const CLCTL_FILESERVER_SHARE_MODIFY = CLCTL_CODES.LCTL_FILESERVER_SHARE_MODIFY; pub const CLCTL_FILESERVER_SHARE_REPORT = CLCTL_CODES.LCTL_FILESERVER_SHARE_REPORT; pub const CLCTL_NETNAME_GET_OU_FOR_VCO = CLCTL_CODES.LCTL_NETNAME_GET_OU_FOR_VCO; pub const CLCTL_ENABLE_SHARED_VOLUME_DIRECTIO = CLCTL_CODES.LCTL_ENABLE_SHARED_VOLUME_DIRECTIO; pub const CLCTL_DISABLE_SHARED_VOLUME_DIRECTIO = CLCTL_CODES.LCTL_DISABLE_SHARED_VOLUME_DIRECTIO; pub const CLCTL_GET_SHARED_VOLUME_ID = CLCTL_CODES.LCTL_GET_SHARED_VOLUME_ID; pub const CLCTL_SET_CSV_MAINTENANCE_MODE = CLCTL_CODES.LCTL_SET_CSV_MAINTENANCE_MODE; pub const CLCTL_SET_SHARED_VOLUME_BACKUP_MODE = CLCTL_CODES.LCTL_SET_SHARED_VOLUME_BACKUP_MODE; pub const CLCTL_STORAGE_GET_SHARED_VOLUME_PARTITION_NAMES = CLCTL_CODES.LCTL_STORAGE_GET_SHARED_VOLUME_PARTITION_NAMES; pub const CLCTL_STORAGE_GET_SHARED_VOLUME_STATES = CLCTL_CODES.LCTL_STORAGE_GET_SHARED_VOLUME_STATES; pub const CLCTL_STORAGE_IS_SHARED_VOLUME = CLCTL_CODES.LCTL_STORAGE_IS_SHARED_VOLUME; pub const CLCTL_GET_CLUSDB_TIMESTAMP = CLCTL_CODES.LCTL_GET_CLUSDB_TIMESTAMP; pub const CLCTL_RW_MODIFY_NOOP = CLCTL_CODES.LCTL_RW_MODIFY_NOOP; pub const CLCTL_IS_QUORUM_BLOCKED = CLCTL_CODES.LCTL_IS_QUORUM_BLOCKED; pub const CLCTL_POOL_GET_DRIVE_INFO = CLCTL_CODES.LCTL_POOL_GET_DRIVE_INFO; pub const CLCTL_GET_GUM_LOCK_OWNER = CLCTL_CODES.LCTL_GET_GUM_LOCK_OWNER; pub const CLCTL_GET_STUCK_NODES = CLCTL_CODES.LCTL_GET_STUCK_NODES; pub const CLCTL_INJECT_GEM_FAULT = CLCTL_CODES.LCTL_INJECT_GEM_FAULT; pub const CLCTL_INTRODUCE_GEM_REPAIR_DELAY = CLCTL_CODES.LCTL_INTRODUCE_GEM_REPAIR_DELAY; pub const CLCTL_SEND_DUMMY_GEM_MESSAGES = CLCTL_CODES.LCTL_SEND_DUMMY_GEM_MESSAGES; pub const CLCTL_BLOCK_GEM_SEND_RECV = CLCTL_CODES.LCTL_BLOCK_GEM_SEND_RECV; pub const CLCTL_GET_GEMID_VECTOR = CLCTL_CODES.LCTL_GET_GEMID_VECTOR; pub const CLCTL_ADD_CRYPTO_CHECKPOINT_EX = CLCTL_CODES.LCTL_ADD_CRYPTO_CHECKPOINT_EX; pub const CLCTL_GROUP_GET_LAST_MOVE_TIME = CLCTL_CODES.LCTL_GROUP_GET_LAST_MOVE_TIME; pub const CLCTL_SET_STORAGE_CONFIGURATION = CLCTL_CODES.LCTL_SET_STORAGE_CONFIGURATION; pub const CLCTL_GET_STORAGE_CONFIGURATION = CLCTL_CODES.LCTL_GET_STORAGE_CONFIGURATION; pub const CLCTL_GET_STORAGE_CONFIG_ATTRIBUTES = CLCTL_CODES.LCTL_GET_STORAGE_CONFIG_ATTRIBUTES; pub const CLCTL_REMOVE_NODE = CLCTL_CODES.LCTL_REMOVE_NODE; pub const CLCTL_IS_FEATURE_INSTALLED = CLCTL_CODES.LCTL_IS_FEATURE_INSTALLED; pub const CLCTL_IS_S2D_FEATURE_SUPPORTED = CLCTL_CODES.LCTL_IS_S2D_FEATURE_SUPPORTED; pub const CLCTL_STORAGE_GET_PHYSICAL_DISK_INFO = CLCTL_CODES.LCTL_STORAGE_GET_PHYSICAL_DISK_INFO; pub const CLCTL_STORAGE_GET_CLUSBFLT_PATHS = CLCTL_CODES.LCTL_STORAGE_GET_CLUSBFLT_PATHS; pub const CLCTL_STORAGE_GET_CLUSBFLT_PATHINFO = CLCTL_CODES.LCTL_STORAGE_GET_CLUSBFLT_PATHINFO; pub const CLCTL_CLEAR_NODE_CONNECTION_INFO = CLCTL_CODES.LCTL_CLEAR_NODE_CONNECTION_INFO; pub const CLCTL_SET_DNS_DOMAIN = CLCTL_CODES.LCTL_SET_DNS_DOMAIN; pub const CTCTL_GET_ROUTESTATUS_BASIC = CLCTL_CODES.TCTL_GET_ROUTESTATUS_BASIC; pub const CTCTL_GET_ROUTESTATUS_EXTENDED = CLCTL_CODES.TCTL_GET_ROUTESTATUS_EXTENDED; pub const CTCTL_GET_FAULT_DOMAIN_STATE = CLCTL_CODES.TCTL_GET_FAULT_DOMAIN_STATE; pub const CLCTL_NETNAME_SET_PWD_INFOEX = CLCTL_CODES.LCTL_NETNAME_SET_PWD_INFOEX; pub const CLCTL_STORAGE_GET_AVAILABLE_DISKS_EX2_INT = CLCTL_CODES.LCTL_STORAGE_GET_AVAILABLE_DISKS_EX2_INT; pub const CLCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS = CLCTL_CODES.LCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS; pub const CLCTL_CLOUD_WITNESS_RESOURCE_UPDATE_TOKEN = CLCTL_CODES.LCTL_CLOUD_WITNESS_RESOURCE_UPDATE_TOKEN; pub const CLCTL_RESOURCE_PREPARE_UPGRADE = CLCTL_CODES.LCTL_RESOURCE_PREPARE_UPGRADE; pub const CLCTL_RESOURCE_UPGRADE_COMPLETED = CLCTL_CODES.LCTL_RESOURCE_UPGRADE_COMPLETED; pub const CLCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS_WITH_KEY = CLCTL_CODES.LCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS_WITH_KEY; pub const CLCTL_CLOUD_WITNESS_RESOURCE_UPDATE_KEY = CLCTL_CODES.LCTL_CLOUD_WITNESS_RESOURCE_UPDATE_KEY; pub const CLCTL_REPLICATION_ADD_REPLICATION_GROUP = CLCTL_CODES.LCTL_REPLICATION_ADD_REPLICATION_GROUP; pub const CLCTL_REPLICATION_GET_LOG_INFO = CLCTL_CODES.LCTL_REPLICATION_GET_LOG_INFO; pub const CLCTL_REPLICATION_GET_ELIGIBLE_LOGDISKS = CLCTL_CODES.LCTL_REPLICATION_GET_ELIGIBLE_LOGDISKS; pub const CLCTL_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS = CLCTL_CODES.LCTL_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS; pub const CLCTL_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS = CLCTL_CODES.LCTL_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS; pub const CLCTL_REPLICATION_GET_REPLICATED_DISKS = CLCTL_CODES.LCTL_REPLICATION_GET_REPLICATED_DISKS; pub const CLCTL_REPLICATION_GET_REPLICA_VOLUMES = CLCTL_CODES.LCTL_REPLICATION_GET_REPLICA_VOLUMES; pub const CLCTL_REPLICATION_GET_LOG_VOLUME = CLCTL_CODES.LCTL_REPLICATION_GET_LOG_VOLUME; pub const CLCTL_REPLICATION_GET_RESOURCE_GROUP = CLCTL_CODES.LCTL_REPLICATION_GET_RESOURCE_GROUP; pub const CLCTL_REPLICATION_GET_REPLICATED_PARTITION_INFO = CLCTL_CODES.LCTL_REPLICATION_GET_REPLICATED_PARTITION_INFO; pub const CLCTL_GET_STATE_CHANGE_TIME = CLCTL_CODES.LCTL_GET_STATE_CHANGE_TIME; pub const CLCTL_SET_CLUSTER_S2D_ENABLED = CLCTL_CODES.LCTL_SET_CLUSTER_S2D_ENABLED; pub const CLCTL_SET_CLUSTER_S2D_CACHE_METADATA_RESERVE_BYTES = CLCTL_CODES.LCTL_SET_CLUSTER_S2D_CACHE_METADATA_RESERVE_BYTES; pub const CLCTL_GROUPSET_GET_GROUPS = CLCTL_CODES.LCTL_GROUPSET_GET_GROUPS; pub const CLCTL_GROUPSET_GET_PROVIDER_GROUPS = CLCTL_CODES.LCTL_GROUPSET_GET_PROVIDER_GROUPS; pub const CLCTL_GROUPSET_GET_PROVIDER_GROUPSETS = CLCTL_CODES.LCTL_GROUPSET_GET_PROVIDER_GROUPSETS; pub const CLCTL_GROUP_GET_PROVIDER_GROUPS = CLCTL_CODES.LCTL_GROUP_GET_PROVIDER_GROUPS; pub const CLCTL_GROUP_GET_PROVIDER_GROUPSETS = CLCTL_CODES.LCTL_GROUP_GET_PROVIDER_GROUPSETS; pub const CLCTL_GROUP_SET_CCF_FROM_MASTER = CLCTL_CODES.LCTL_GROUP_SET_CCF_FROM_MASTER; pub const CLCTL_GET_INFRASTRUCTURE_SOFS_BUFFER = CLCTL_CODES.LCTL_GET_INFRASTRUCTURE_SOFS_BUFFER; pub const CLCTL_SET_INFRASTRUCTURE_SOFS_BUFFER = CLCTL_CODES.LCTL_SET_INFRASTRUCTURE_SOFS_BUFFER; pub const CLCTL_NOTIFY_INFRASTRUCTURE_SOFS_CHANGED = CLCTL_CODES.LCTL_NOTIFY_INFRASTRUCTURE_SOFS_CHANGED; pub const CLCTL_SCALEOUT_COMMAND = CLCTL_CODES.LCTL_SCALEOUT_COMMAND; pub const CLCTL_SCALEOUT_CONTROL = CLCTL_CODES.LCTL_SCALEOUT_CONTROL; pub const CLCTL_SCALEOUT_GET_CLUSTERS = CLCTL_CODES.LCTL_SCALEOUT_GET_CLUSTERS; pub const CLCTL_RELOAD_AUTOLOGGER_CONFIG = CLCTL_CODES.LCTL_RELOAD_AUTOLOGGER_CONFIG; pub const CLCTL_STORAGE_RENAME_SHARED_VOLUME = CLCTL_CODES.LCTL_STORAGE_RENAME_SHARED_VOLUME; pub const CLCTL_STORAGE_RENAME_SHARED_VOLUME_GUID = CLCTL_CODES.LCTL_STORAGE_RENAME_SHARED_VOLUME_GUID; pub const CLCTL_ENUM_AFFINITY_RULE_NAMES = CLCTL_CODES.LCTL_ENUM_AFFINITY_RULE_NAMES; pub const CLCTL_GET_NODES_IN_FD = CLCTL_CODES.LCTL_GET_NODES_IN_FD; pub const CLCTL_FORCE_DB_FLUSH = CLCTL_CODES.LCTL_FORCE_DB_FLUSH; pub const CLCTL_DELETE = CLCTL_CODES.LCTL_DELETE; pub const CLCTL_INSTALL_NODE = CLCTL_CODES.LCTL_INSTALL_NODE; pub const CLCTL_EVICT_NODE = CLCTL_CODES.LCTL_EVICT_NODE; pub const CLCTL_ADD_DEPENDENCY = CLCTL_CODES.LCTL_ADD_DEPENDENCY; pub const CLCTL_REMOVE_DEPENDENCY = CLCTL_CODES.LCTL_REMOVE_DEPENDENCY; pub const CLCTL_ADD_OWNER = CLCTL_CODES.LCTL_ADD_OWNER; pub const CLCTL_REMOVE_OWNER = CLCTL_CODES.LCTL_REMOVE_OWNER; pub const CLCTL_SET_NAME = CLCTL_CODES.LCTL_SET_NAME; pub const CLCTL_CLUSTER_NAME_CHANGED = CLCTL_CODES.LCTL_CLUSTER_NAME_CHANGED; pub const CLCTL_CLUSTER_VERSION_CHANGED = CLCTL_CODES.LCTL_CLUSTER_VERSION_CHANGED; pub const CLCTL_FIXUP_ON_UPGRADE = CLCTL_CODES.LCTL_FIXUP_ON_UPGRADE; pub const CLCTL_STARTING_PHASE1 = CLCTL_CODES.LCTL_STARTING_PHASE1; pub const CLCTL_STARTING_PHASE2 = CLCTL_CODES.LCTL_STARTING_PHASE2; pub const CLCTL_HOLD_IO = CLCTL_CODES.LCTL_HOLD_IO; pub const CLCTL_RESUME_IO = CLCTL_CODES.LCTL_RESUME_IO; pub const CLCTL_FORCE_QUORUM = CLCTL_CODES.LCTL_FORCE_QUORUM; pub const CLCTL_INITIALIZE = CLCTL_CODES.LCTL_INITIALIZE; pub const CLCTL_STATE_CHANGE_REASON = CLCTL_CODES.LCTL_STATE_CHANGE_REASON; pub const CLCTL_PROVIDER_STATE_CHANGE = CLCTL_CODES.LCTL_PROVIDER_STATE_CHANGE; pub const CLCTL_LEAVING_GROUP = CLCTL_CODES.LCTL_LEAVING_GROUP; pub const CLCTL_JOINING_GROUP = CLCTL_CODES.LCTL_JOINING_GROUP; pub const CLCTL_FSWITNESS_GET_EPOCH_INFO = CLCTL_CODES.LCTL_FSWITNESS_GET_EPOCH_INFO; pub const CLCTL_FSWITNESS_SET_EPOCH_INFO = CLCTL_CODES.LCTL_FSWITNESS_SET_EPOCH_INFO; pub const CLCTL_FSWITNESS_RELEASE_LOCK = CLCTL_CODES.LCTL_FSWITNESS_RELEASE_LOCK; pub const CLCTL_NETNAME_CREDS_NOTIFYCAM = CLCTL_CODES.LCTL_NETNAME_CREDS_NOTIFYCAM; pub const CLCTL_NOTIFY_QUORUM_STATUS = CLCTL_CODES.LCTL_NOTIFY_QUORUM_STATUS; pub const CLCTL_NOTIFY_MONITOR_SHUTTING_DOWN = CLCTL_CODES.LCTL_NOTIFY_MONITOR_SHUTTING_DOWN; pub const CLCTL_UNDELETE = CLCTL_CODES.LCTL_UNDELETE; pub const CLCTL_GET_OPERATION_CONTEXT = CLCTL_CODES.LCTL_GET_OPERATION_CONTEXT; pub const CLCTL_NOTIFY_OWNER_CHANGE = CLCTL_CODES.LCTL_NOTIFY_OWNER_CHANGE; pub const CLCTL_VALIDATE_CHANGE_GROUP = CLCTL_CODES.LCTL_VALIDATE_CHANGE_GROUP; pub const CLCTL_CHECK_DRAIN_VETO = CLCTL_CODES.LCTL_CHECK_DRAIN_VETO; pub const CLCTL_NOTIFY_DRAIN_COMPLETE = CLCTL_CODES.LCTL_NOTIFY_DRAIN_COMPLETE; pub const CLUSCTL_RESOURCE_CODES = enum(i32) { RESOURCE_UNKNOWN = 16777216, RESOURCE_GET_CHARACTERISTICS = 16777221, RESOURCE_GET_FLAGS = 16777225, RESOURCE_GET_CLASS_INFO = 16777229, RESOURCE_GET_REQUIRED_DEPENDENCIES = 16777233, RESOURCE_GET_NAME = 16777257, RESOURCE_GET_ID = 16777273, RESOURCE_GET_RESOURCE_TYPE = 16777261, RESOURCE_ENUM_COMMON_PROPERTIES = 16777297, RESOURCE_GET_RO_COMMON_PROPERTIES = 16777301, RESOURCE_GET_COMMON_PROPERTIES = 16777305, RESOURCE_SET_COMMON_PROPERTIES = 20971614, RESOURCE_VALIDATE_COMMON_PROPERTIES = 16777313, RESOURCE_GET_COMMON_PROPERTY_FMTS = 16777317, RESOURCE_ENUM_PRIVATE_PROPERTIES = 16777337, RESOURCE_GET_RO_PRIVATE_PROPERTIES = 16777341, RESOURCE_GET_PRIVATE_PROPERTIES = 16777345, RESOURCE_SET_PRIVATE_PROPERTIES = 20971654, RESOURCE_VALIDATE_PRIVATE_PROPERTIES = 16777353, RESOURCE_GET_PRIVATE_PROPERTY_FMTS = 16777357, RESOURCE_ADD_REGISTRY_CHECKPOINT = 20971682, RESOURCE_DELETE_REGISTRY_CHECKPOINT = 20971686, RESOURCE_GET_REGISTRY_CHECKPOINTS = 16777385, RESOURCE_ADD_CRYPTO_CHECKPOINT = 20971694, RESOURCE_DELETE_CRYPTO_CHECKPOINT = 20971698, RESOURCE_ADD_CRYPTO_CHECKPOINT_EX = 20972246, RESOURCE_GET_CRYPTO_CHECKPOINTS = 16777397, RESOURCE_GET_LOADBAL_PROCESS_LIST = 16777417, RESOURCE_GET_NETWORK_NAME = 16777577, RESOURCE_NETNAME_GET_VIRTUAL_SERVER_TOKEN = 16777581, RESOURCE_NETNAME_SET_PWD_INFO = 16777594, RESOURCE_NETNAME_SET_PWD_INFOEX = 16778010, RESOURCE_NETNAME_DELETE_CO = 16777598, RESOURCE_NETNAME_VALIDATE_VCO = 16777601, RESOURCE_NETNAME_RESET_VCO = 16777605, RESOURCE_NETNAME_REPAIR_VCO = 16777613, RESOURCE_NETNAME_REGISTER_DNS_RECORDS = 16777586, RESOURCE_GET_DNS_NAME = 16777589, RESOURCE_STORAGE_GET_DISK_INFO = 16777617, RESOURCE_STORAGE_GET_DISK_NUMBER_INFO = 16777633, RESOURCE_STORAGE_IS_PATH_VALID = 16777625, RESOURCE_QUERY_DELETE = 16777657, RESOURCE_UPGRADE_DLL = 20971706, RESOURCE_IPADDRESS_RENEW_LEASE = 20971966, RESOURCE_IPADDRESS_RELEASE_LEASE = 20971970, RESOURCE_ADD_REGISTRY_CHECKPOINT_64BIT = 20971710, RESOURCE_ADD_REGISTRY_CHECKPOINT_32BIT = 20971714, RESOURCE_QUERY_MAINTENANCE_MODE = 16777697, RESOURCE_SET_MAINTENANCE_MODE = 20972006, RESOURCE_STORAGE_SET_DRIVELETTER = 20972010, RESOURCE_STORAGE_GET_DISK_INFO_EX = 16777713, RESOURCE_STORAGE_GET_DISK_INFO_EX2 = 16777721, RESOURCE_STORAGE_GET_MOUNTPOINTS = 16777745, RESOURCE_STORAGE_GET_DIRTY = 16777753, RESOURCE_STORAGE_GET_SHARED_VOLUME_INFO = 16777765, RESOURCE_SET_CSV_MAINTENANCE_MODE = 20972182, RESOURCE_ENABLE_SHARED_VOLUME_DIRECTIO = 20972170, RESOURCE_DISABLE_SHARED_VOLUME_DIRECTIO = 20972174, RESOURCE_SET_SHARED_VOLUME_BACKUP_MODE = 20972186, RESOURCE_STORAGE_GET_SHARED_VOLUME_PARTITION_NAMES = 16777885, RESOURCE_GET_FAILURE_INFO = 16777241, RESOURCE_STORAGE_GET_DISKID = 16777733, RESOURCE_STORAGE_GET_SHARED_VOLUME_STATES = 20972194, RESOURCE_STORAGE_IS_SHARED_VOLUME = 16777893, RESOURCE_IS_QUORUM_BLOCKED = 16777905, RESOURCE_POOL_GET_DRIVE_INFO = 16777909, // RESOURCE_RLUA_GET_VIRTUAL_SERVER_TOKEN = <PASSWORD>, this enum value conflicts with RESOURCE_NETNAME_GET_VIRTUAL_SERVER_TOKEN // RESOURCE_RLUA_SET_PWD_INFO = <PASSWORD>, this enum value conflicts with RESOURCE_NETNAME_SET_PWD_INFO // RESOURCE_RLUA_SET_PWD_INFOEX = 16778010, this enum value conflicts with RESOURCE_NETNAME_SET_PWD_INFOEX RESOURCE_DELETE = 22020102, RESOURCE_UNDELETE = 22020230, RESOURCE_INSTALL_NODE = 22020106, RESOURCE_EVICT_NODE = 22020110, RESOURCE_ADD_DEPENDENCY = 22020114, RESOURCE_REMOVE_DEPENDENCY = 22020118, RESOURCE_ADD_OWNER = 22020122, RESOURCE_REMOVE_OWNER = 22020126, RESOURCE_SET_NAME = 22020134, RESOURCE_CLUSTER_NAME_CHANGED = 22020138, RESOURCE_CLUSTER_VERSION_CHANGED = 22020142, RESOURCE_FORCE_QUORUM = 22020166, RESOURCE_INITIALIZE = 22020170, RESOURCE_STATE_CHANGE_REASON = 22020174, RESOURCE_PROVIDER_STATE_CHANGE = 22020178, RESOURCE_LEAVING_GROUP = 22020182, RESOURCE_JOINING_GROUP = 22020186, RESOURCE_FSWITNESS_GET_EPOCH_INFO = 17825885, RESOURCE_FSWITNESS_SET_EPOCH_INFO = 22020194, RESOURCE_FSWITNESS_RELEASE_LOCK = 22020198, RESOURCE_NETNAME_CREDS_NOTIFYCAM = 22020202, RESOURCE_GET_OPERATION_CONTEXT = 17834217, RESOURCE_RW_MODIFY_NOOP = 20972206, RESOURCE_NOTIFY_QUORUM_STATUS = 22020222, RESOURCE_NOTIFY_OWNER_CHANGE = 22028578, RESOURCE_VALIDATE_CHANGE_GROUP = 17834277, RESOURCE_STORAGE_RENAME_SHARED_VOLUME = 16788950, RESOURCE_STORAGE_RENAME_SHARED_VOLUME_GUID = 16788954, CLOUD_WITNESS_RESOURCE_UPDATE_TOKEN = 20979942, CLOUD_WITNESS_RESOURCE_UPDATE_KEY = 20979958, RESOURCE_PREPARE_UPGRADE = 20979946, RESOURCE_UPGRADE_COMPLETED = 20979950, RESOURCE_GET_STATE_CHANGE_TIME = 16788829, RESOURCE_GET_INFRASTRUCTURE_SOFS_BUFFER = 16788873, RESOURCE_SET_INFRASTRUCTURE_SOFS_BUFFER = 20983182, RESOURCE_SCALEOUT_COMMAND = 20983190, RESOURCE_SCALEOUT_CONTROL = 20983194, RESOURCE_SCALEOUT_GET_CLUSTERS = 20983197, RESOURCE_CHECK_DRAIN_VETO = 17834285, RESOURCE_NOTIFY_DRAIN_COMPLETE = 17834289, RESOURCE_GET_NODES_IN_FD = 16788961, }; pub const CLUSCTL_RESOURCE_UNKNOWN = CLUSCTL_RESOURCE_CODES.RESOURCE_UNKNOWN; pub const CLUSCTL_RESOURCE_GET_CHARACTERISTICS = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_CHARACTERISTICS; pub const CLUSCTL_RESOURCE_GET_FLAGS = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_FLAGS; pub const CLUSCTL_RESOURCE_GET_CLASS_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_CLASS_INFO; pub const CLUSCTL_RESOURCE_GET_REQUIRED_DEPENDENCIES = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_REQUIRED_DEPENDENCIES; pub const CLUSCTL_RESOURCE_GET_NAME = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_NAME; pub const CLUSCTL_RESOURCE_GET_ID = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_ID; pub const CLUSCTL_RESOURCE_GET_RESOURCE_TYPE = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_RESOURCE_TYPE; pub const CLUSCTL_RESOURCE_ENUM_COMMON_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_ENUM_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_GET_RO_COMMON_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_GET_COMMON_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_SET_COMMON_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_VALIDATE_COMMON_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_GET_COMMON_PROPERTY_FMTS = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_RESOURCE_ENUM_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_CODES.RESOURCE_VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_REGISTRY_CHECKPOINT; pub const CLUSCTL_RESOURCE_DELETE_REGISTRY_CHECKPOINT = CLUSCTL_RESOURCE_CODES.RESOURCE_DELETE_REGISTRY_CHECKPOINT; pub const CLUSCTL_RESOURCE_GET_REGISTRY_CHECKPOINTS = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_REGISTRY_CHECKPOINTS; pub const CLUSCTL_RESOURCE_ADD_CRYPTO_CHECKPOINT = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_CRYPTO_CHECKPOINT; pub const CLUSCTL_RESOURCE_DELETE_CRYPTO_CHECKPOINT = CLUSCTL_RESOURCE_CODES.RESOURCE_DELETE_CRYPTO_CHECKPOINT; pub const CLUSCTL_RESOURCE_ADD_CRYPTO_CHECKPOINT_EX = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_CRYPTO_CHECKPOINT_EX; pub const CLUSCTL_RESOURCE_GET_CRYPTO_CHECKPOINTS = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_CRYPTO_CHECKPOINTS; pub const CLUSCTL_RESOURCE_GET_LOADBAL_PROCESS_LIST = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_LOADBAL_PROCESS_LIST; pub const CLUSCTL_RESOURCE_GET_NETWORK_NAME = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_NETWORK_NAME; pub const CLUSCTL_RESOURCE_NETNAME_GET_VIRTUAL_SERVER_TOKEN = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_GET_VIRTUAL_SERVER_TOKEN; pub const CLUSCTL_RESOURCE_NETNAME_SET_PWD_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_SET_PWD_INFO; pub const CLUSCTL_RESOURCE_NETNAME_SET_PWD_INFOEX = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_SET_PWD_INFOEX; pub const CLUSCTL_RESOURCE_NETNAME_DELETE_CO = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_DELETE_CO; pub const CLUSCTL_RESOURCE_NETNAME_VALIDATE_VCO = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_VALIDATE_VCO; pub const CLUSCTL_RESOURCE_NETNAME_RESET_VCO = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_RESET_VCO; pub const CLUSCTL_RESOURCE_NETNAME_REPAIR_VCO = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_REPAIR_VCO; pub const CLUSCTL_RESOURCE_NETNAME_REGISTER_DNS_RECORDS = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_REGISTER_DNS_RECORDS; pub const CLUSCTL_RESOURCE_GET_DNS_NAME = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_DNS_NAME; pub const CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_DISK_INFO; pub const CLUSCTL_RESOURCE_STORAGE_GET_DISK_NUMBER_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_DISK_NUMBER_INFO; pub const CLUSCTL_RESOURCE_STORAGE_IS_PATH_VALID = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_IS_PATH_VALID; pub const CLUSCTL_RESOURCE_QUERY_DELETE = CLUSCTL_RESOURCE_CODES.RESOURCE_QUERY_DELETE; pub const CLUSCTL_RESOURCE_UPGRADE_DLL = CLUSCTL_RESOURCE_CODES.RESOURCE_UPGRADE_DLL; pub const CLUSCTL_RESOURCE_IPADDRESS_RENEW_LEASE = CLUSCTL_RESOURCE_CODES.RESOURCE_IPADDRESS_RENEW_LEASE; pub const CLUSCTL_RESOURCE_IPADDRESS_RELEASE_LEASE = CLUSCTL_RESOURCE_CODES.RESOURCE_IPADDRESS_RELEASE_LEASE; pub const CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT_64BIT = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_REGISTRY_CHECKPOINT_64BIT; pub const CLUSCTL_RESOURCE_ADD_REGISTRY_CHECKPOINT_32BIT = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_REGISTRY_CHECKPOINT_32BIT; pub const CLUSCTL_RESOURCE_QUERY_MAINTENANCE_MODE = CLUSCTL_RESOURCE_CODES.RESOURCE_QUERY_MAINTENANCE_MODE; pub const CLUSCTL_RESOURCE_SET_MAINTENANCE_MODE = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_MAINTENANCE_MODE; pub const CLUSCTL_RESOURCE_STORAGE_SET_DRIVELETTER = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_SET_DRIVELETTER; pub const CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO_EX = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_DISK_INFO_EX; pub const CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO_EX2 = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_DISK_INFO_EX2; pub const CLUSCTL_RESOURCE_STORAGE_GET_MOUNTPOINTS = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_MOUNTPOINTS; pub const CLUSCTL_RESOURCE_STORAGE_GET_DIRTY = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_DIRTY; pub const CLUSCTL_RESOURCE_STORAGE_GET_SHARED_VOLUME_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_SHARED_VOLUME_INFO; pub const CLUSCTL_RESOURCE_SET_CSV_MAINTENANCE_MODE = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_CSV_MAINTENANCE_MODE; pub const CLUSCTL_RESOURCE_ENABLE_SHARED_VOLUME_DIRECTIO = CLUSCTL_RESOURCE_CODES.RESOURCE_ENABLE_SHARED_VOLUME_DIRECTIO; pub const CLUSCTL_RESOURCE_DISABLE_SHARED_VOLUME_DIRECTIO = CLUSCTL_RESOURCE_CODES.RESOURCE_DISABLE_SHARED_VOLUME_DIRECTIO; pub const CLUSCTL_RESOURCE_SET_SHARED_VOLUME_BACKUP_MODE = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_SHARED_VOLUME_BACKUP_MODE; pub const CLUSCTL_RESOURCE_STORAGE_GET_SHARED_VOLUME_PARTITION_NAMES = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_SHARED_VOLUME_PARTITION_NAMES; pub const CLUSCTL_RESOURCE_GET_FAILURE_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_FAILURE_INFO; pub const CLUSCTL_RESOURCE_STORAGE_GET_DISKID = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_DISKID; pub const CLUSCTL_RESOURCE_STORAGE_GET_SHARED_VOLUME_STATES = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_GET_SHARED_VOLUME_STATES; pub const CLUSCTL_RESOURCE_STORAGE_IS_SHARED_VOLUME = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_IS_SHARED_VOLUME; pub const CLUSCTL_RESOURCE_IS_QUORUM_BLOCKED = CLUSCTL_RESOURCE_CODES.RESOURCE_IS_QUORUM_BLOCKED; pub const CLUSCTL_RESOURCE_POOL_GET_DRIVE_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_POOL_GET_DRIVE_INFO; pub const CLUSCTL_RESOURCE_RLUA_GET_VIRTUAL_SERVER_TOKEN = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_GET_VIRTUAL_SERVER_TOKEN; pub const CLUSCTL_RESOURCE_RLUA_SET_PWD_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_SET_PWD_INFO; pub const CLUSCTL_RESOURCE_RLUA_SET_PWD_INFOEX = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_SET_PWD_INFOEX; pub const CLUSCTL_RESOURCE_DELETE = CLUSCTL_RESOURCE_CODES.RESOURCE_DELETE; pub const CLUSCTL_RESOURCE_UNDELETE = CLUSCTL_RESOURCE_CODES.RESOURCE_UNDELETE; pub const CLUSCTL_RESOURCE_INSTALL_NODE = CLUSCTL_RESOURCE_CODES.RESOURCE_INSTALL_NODE; pub const CLUSCTL_RESOURCE_EVICT_NODE = CLUSCTL_RESOURCE_CODES.RESOURCE_EVICT_NODE; pub const CLUSCTL_RESOURCE_ADD_DEPENDENCY = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_DEPENDENCY; pub const CLUSCTL_RESOURCE_REMOVE_DEPENDENCY = CLUSCTL_RESOURCE_CODES.RESOURCE_REMOVE_DEPENDENCY; pub const CLUSCTL_RESOURCE_ADD_OWNER = CLUSCTL_RESOURCE_CODES.RESOURCE_ADD_OWNER; pub const CLUSCTL_RESOURCE_REMOVE_OWNER = CLUSCTL_RESOURCE_CODES.RESOURCE_REMOVE_OWNER; pub const CLUSCTL_RESOURCE_SET_NAME = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_NAME; pub const CLUSCTL_RESOURCE_CLUSTER_NAME_CHANGED = CLUSCTL_RESOURCE_CODES.RESOURCE_CLUSTER_NAME_CHANGED; pub const CLUSCTL_RESOURCE_CLUSTER_VERSION_CHANGED = CLUSCTL_RESOURCE_CODES.RESOURCE_CLUSTER_VERSION_CHANGED; pub const CLUSCTL_RESOURCE_FORCE_QUORUM = CLUSCTL_RESOURCE_CODES.RESOURCE_FORCE_QUORUM; pub const CLUSCTL_RESOURCE_INITIALIZE = CLUSCTL_RESOURCE_CODES.RESOURCE_INITIALIZE; pub const CLUSCTL_RESOURCE_STATE_CHANGE_REASON = CLUSCTL_RESOURCE_CODES.RESOURCE_STATE_CHANGE_REASON; pub const CLUSCTL_RESOURCE_PROVIDER_STATE_CHANGE = CLUSCTL_RESOURCE_CODES.RESOURCE_PROVIDER_STATE_CHANGE; pub const CLUSCTL_RESOURCE_LEAVING_GROUP = CLUSCTL_RESOURCE_CODES.RESOURCE_LEAVING_GROUP; pub const CLUSCTL_RESOURCE_JOINING_GROUP = CLUSCTL_RESOURCE_CODES.RESOURCE_JOINING_GROUP; pub const CLUSCTL_RESOURCE_FSWITNESS_GET_EPOCH_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_FSWITNESS_GET_EPOCH_INFO; pub const CLUSCTL_RESOURCE_FSWITNESS_SET_EPOCH_INFO = CLUSCTL_RESOURCE_CODES.RESOURCE_FSWITNESS_SET_EPOCH_INFO; pub const CLUSCTL_RESOURCE_FSWITNESS_RELEASE_LOCK = CLUSCTL_RESOURCE_CODES.RESOURCE_FSWITNESS_RELEASE_LOCK; pub const CLUSCTL_RESOURCE_NETNAME_CREDS_NOTIFYCAM = CLUSCTL_RESOURCE_CODES.RESOURCE_NETNAME_CREDS_NOTIFYCAM; pub const CLUSCTL_RESOURCE_GET_OPERATION_CONTEXT = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_OPERATION_CONTEXT; pub const CLUSCTL_RESOURCE_RW_MODIFY_NOOP = CLUSCTL_RESOURCE_CODES.RESOURCE_RW_MODIFY_NOOP; pub const CLUSCTL_RESOURCE_NOTIFY_QUORUM_STATUS = CLUSCTL_RESOURCE_CODES.RESOURCE_NOTIFY_QUORUM_STATUS; pub const CLUSCTL_RESOURCE_NOTIFY_OWNER_CHANGE = CLUSCTL_RESOURCE_CODES.RESOURCE_NOTIFY_OWNER_CHANGE; pub const CLUSCTL_RESOURCE_VALIDATE_CHANGE_GROUP = CLUSCTL_RESOURCE_CODES.RESOURCE_VALIDATE_CHANGE_GROUP; pub const CLUSCTL_RESOURCE_STORAGE_RENAME_SHARED_VOLUME = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_RENAME_SHARED_VOLUME; pub const CLUSCTL_RESOURCE_STORAGE_RENAME_SHARED_VOLUME_GUID = CLUSCTL_RESOURCE_CODES.RESOURCE_STORAGE_RENAME_SHARED_VOLUME_GUID; pub const CLUSCTL_CLOUD_WITNESS_RESOURCE_UPDATE_TOKEN = CLUSCTL_RESOURCE_CODES.CLOUD_WITNESS_RESOURCE_UPDATE_TOKEN; pub const CLUSCTL_CLOUD_WITNESS_RESOURCE_UPDATE_KEY = CLUSCTL_RESOURCE_CODES.CLOUD_WITNESS_RESOURCE_UPDATE_KEY; pub const CLUSCTL_RESOURCE_PREPARE_UPGRADE = CLUSCTL_RESOURCE_CODES.RESOURCE_PREPARE_UPGRADE; pub const CLUSCTL_RESOURCE_UPGRADE_COMPLETED = CLUSCTL_RESOURCE_CODES.RESOURCE_UPGRADE_COMPLETED; pub const CLUSCTL_RESOURCE_GET_STATE_CHANGE_TIME = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_STATE_CHANGE_TIME; pub const CLUSCTL_RESOURCE_GET_INFRASTRUCTURE_SOFS_BUFFER = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_INFRASTRUCTURE_SOFS_BUFFER; pub const CLUSCTL_RESOURCE_SET_INFRASTRUCTURE_SOFS_BUFFER = CLUSCTL_RESOURCE_CODES.RESOURCE_SET_INFRASTRUCTURE_SOFS_BUFFER; pub const CLUSCTL_RESOURCE_SCALEOUT_COMMAND = CLUSCTL_RESOURCE_CODES.RESOURCE_SCALEOUT_COMMAND; pub const CLUSCTL_RESOURCE_SCALEOUT_CONTROL = CLUSCTL_RESOURCE_CODES.RESOURCE_SCALEOUT_CONTROL; pub const CLUSCTL_RESOURCE_SCALEOUT_GET_CLUSTERS = CLUSCTL_RESOURCE_CODES.RESOURCE_SCALEOUT_GET_CLUSTERS; pub const CLUSCTL_RESOURCE_CHECK_DRAIN_VETO = CLUSCTL_RESOURCE_CODES.RESOURCE_CHECK_DRAIN_VETO; pub const CLUSCTL_RESOURCE_NOTIFY_DRAIN_COMPLETE = CLUSCTL_RESOURCE_CODES.RESOURCE_NOTIFY_DRAIN_COMPLETE; pub const CLUSCTL_RESOURCE_GET_NODES_IN_FD = CLUSCTL_RESOURCE_CODES.RESOURCE_GET_NODES_IN_FD; pub const CLUSCTL_RESOURCE_TYPE_CODES = enum(i32) { RESOURCE_TYPE_UNKNOWN = 33554432, RESOURCE_TYPE_GET_CHARACTERISTICS = 33554437, RESOURCE_TYPE_GET_FLAGS = 33554441, RESOURCE_TYPE_GET_CLASS_INFO = 33554445, RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES = 33554449, RESOURCE_TYPE_GET_ARB_TIMEOUT = 33554453, RESOURCE_TYPE_ENUM_COMMON_PROPERTIES = 33554513, RESOURCE_TYPE_GET_RO_COMMON_PROPERTIES = 33554517, RESOURCE_TYPE_GET_COMMON_PROPERTIES = 33554521, RESOURCE_TYPE_VALIDATE_COMMON_PROPERTIES = 33554529, RESOURCE_TYPE_SET_COMMON_PROPERTIES = 37748830, RESOURCE_TYPE_GET_COMMON_PROPERTY_FMTS = 33554533, RESOURCE_TYPE_GET_COMMON_RESOURCE_PROPERTY_FMTS = 33554537, RESOURCE_TYPE_ENUM_PRIVATE_PROPERTIES = 33554553, RESOURCE_TYPE_GET_RO_PRIVATE_PROPERTIES = 33554557, RESOURCE_TYPE_GET_PRIVATE_PROPERTIES = 33554561, RESOURCE_TYPE_SET_PRIVATE_PROPERTIES = 37748870, RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES = 33554569, RESOURCE_TYPE_GET_PRIVATE_PROPERTY_FMTS = 33554573, RESOURCE_TYPE_GET_PRIVATE_RESOURCE_PROPERTY_FMTS = 33554577, RESOURCE_TYPE_GET_REGISTRY_CHECKPOINTS = 33554601, RESOURCE_TYPE_GET_CRYPTO_CHECKPOINTS = 33554613, RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS = 33554837, RESOURCE_TYPE_STORAGE_SYNC_CLUSDISK_DB = 37749150, RESOURCE_TYPE_NETNAME_VALIDATE_NETNAME = 33554997, RESOURCE_TYPE_NETNAME_GET_OU_FOR_VCO = 37749358, RESOURCE_TYPE_GEN_APP_VALIDATE_PATH = 33554993, RESOURCE_TYPE_GEN_APP_VALIDATE_DIRECTORY = 33555001, // RESOURCE_TYPE_GEN_SCRIPT_VALIDATE_PATH = 33554993, this enum value conflicts with RESOURCE_TYPE_GEN_APP_VALIDATE_PATH RESOURCE_TYPE_QUERY_DELETE = 33554873, RESOURCE_TYPE_STORAGE_GET_DRIVELETTERS = 33554925, RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX = 33554933, RESOURCE_TYPE_STORAGE_REMAP_DRIVELETTER = 33554945, RESOURCE_TYPE_STORAGE_GET_DISKID = 33554949, RESOURCE_TYPE_STORAGE_GET_RESOURCEID = 33554989, RESOURCE_TYPE_STORAGE_IS_CLUSTERABLE = 33554953, RESOURCE_TYPE_STORAGE_REMOVE_VM_OWNERSHIP = 37749262, RESOURCE_TYPE_STORAGE_IS_CSV_FILE = 16777769, // RESOURCE_TYPE_WITNESS_VALIDATE_PATH = 33554993, this enum value conflicts with RESOURCE_TYPE_GEN_APP_VALIDATE_PATH RESOURCE_TYPE_INSTALL_NODE = 38797322, RESOURCE_TYPE_EVICT_NODE = 38797326, RESOURCE_TYPE_CLUSTER_VERSION_CHANGED = 38797358, RESOURCE_TYPE_FIXUP_ON_UPGRADE = 38797362, RESOURCE_TYPE_STARTING_PHASE1 = 38797366, RESOURCE_TYPE_STARTING_PHASE2 = 38797370, RESOURCE_TYPE_HOLD_IO = 38797374, RESOURCE_TYPE_RESUME_IO = 38797378, RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_INT = 33562593, RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_LOGDISKS = 33562953, RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS = 33562957, RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS = 33562961, RESOURCE_TYPE_REPLICATION_GET_REPLICATED_DISKS = 33562965, RESOURCE_TYPE_REPLICATION_GET_REPLICA_VOLUMES = 33562969, RESOURCE_TYPE_REPLICATION_GET_LOG_VOLUME = 33562973, RESOURCE_TYPE_REPLICATION_GET_RESOURCE_GROUP = 33562977, RESOURCE_TYPE_REPLICATION_GET_REPLICATED_PARTITION_INFO = 33562981, RESOURCE_TYPE_REPLICATION_GET_LOG_INFO = 33562949, RESOURCE_TYPE_REPLICATION_ADD_REPLICATION_GROUP = 33562946, CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS = 33562849, CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS_WITH_KEY = 33562865, RESOURCE_TYPE_PREPARE_UPGRADE = 37757162, RESOURCE_TYPE_UPGRADE_COMPLETED = 37757166, RESOURCE_TYPE_NOTIFY_MONITOR_SHUTTING_DOWN = 34603137, RESOURCE_TYPE_CHECK_DRAIN_VETO = 34611501, RESOURCE_TYPE_NOTIFY_DRAIN_COMPLETE = 34611505, }; pub const CLUSCTL_RESOURCE_TYPE_UNKNOWN = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_UNKNOWN; pub const CLUSCTL_RESOURCE_TYPE_GET_CHARACTERISTICS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_CHARACTERISTICS; pub const CLUSCTL_RESOURCE_TYPE_GET_FLAGS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_FLAGS; pub const CLUSCTL_RESOURCE_TYPE_GET_CLASS_INFO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_CLASS_INFO; pub const CLUSCTL_RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_REQUIRED_DEPENDENCIES; pub const CLUSCTL_RESOURCE_TYPE_GET_ARB_TIMEOUT = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_ARB_TIMEOUT; pub const CLUSCTL_RESOURCE_TYPE_ENUM_COMMON_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_ENUM_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_GET_RO_COMMON_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_GET_COMMON_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_VALIDATE_COMMON_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_SET_COMMON_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_SET_COMMON_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_GET_COMMON_PROPERTY_FMTS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_RESOURCE_TYPE_GET_COMMON_RESOURCE_PROPERTY_FMTS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_COMMON_RESOURCE_PROPERTY_FMTS; pub const CLUSCTL_RESOURCE_TYPE_ENUM_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_SET_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_RESOURCE_PROPERTY_FMTS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_PRIVATE_RESOURCE_PROPERTY_FMTS; pub const CLUSCTL_RESOURCE_TYPE_GET_REGISTRY_CHECKPOINTS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_REGISTRY_CHECKPOINTS; pub const CLUSCTL_RESOURCE_TYPE_GET_CRYPTO_CHECKPOINTS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GET_CRYPTO_CHECKPOINTS; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_SYNC_CLUSDISK_DB = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_SYNC_CLUSDISK_DB; pub const CLUSCTL_RESOURCE_TYPE_NETNAME_VALIDATE_NETNAME = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_NETNAME_VALIDATE_NETNAME; pub const CLUSCTL_RESOURCE_TYPE_NETNAME_GET_OU_FOR_VCO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_NETNAME_GET_OU_FOR_VCO; pub const CLUSCTL_RESOURCE_TYPE_GEN_APP_VALIDATE_PATH = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GEN_APP_VALIDATE_PATH; pub const CLUSCTL_RESOURCE_TYPE_GEN_APP_VALIDATE_DIRECTORY = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GEN_APP_VALIDATE_DIRECTORY; pub const CLUSCTL_RESOURCE_TYPE_GEN_SCRIPT_VALIDATE_PATH = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GEN_APP_VALIDATE_PATH; pub const CLUSCTL_RESOURCE_TYPE_QUERY_DELETE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_QUERY_DELETE; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_DRIVELETTERS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_GET_DRIVELETTERS; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_REMAP_DRIVELETTER = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_REMAP_DRIVELETTER; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_DISKID = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_GET_DISKID; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_RESOURCEID = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_GET_RESOURCEID; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_IS_CLUSTERABLE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_IS_CLUSTERABLE; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_REMOVE_VM_OWNERSHIP = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_REMOVE_VM_OWNERSHIP; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_IS_CSV_FILE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_IS_CSV_FILE; pub const CLUSCTL_RESOURCE_TYPE_WITNESS_VALIDATE_PATH = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_GEN_APP_VALIDATE_PATH; pub const CLUSCTL_RESOURCE_TYPE_INSTALL_NODE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_INSTALL_NODE; pub const CLUSCTL_RESOURCE_TYPE_EVICT_NODE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_EVICT_NODE; pub const CLUSCTL_RESOURCE_TYPE_CLUSTER_VERSION_CHANGED = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_CLUSTER_VERSION_CHANGED; pub const CLUSCTL_RESOURCE_TYPE_FIXUP_ON_UPGRADE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_FIXUP_ON_UPGRADE; pub const CLUSCTL_RESOURCE_TYPE_STARTING_PHASE1 = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STARTING_PHASE1; pub const CLUSCTL_RESOURCE_TYPE_STARTING_PHASE2 = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STARTING_PHASE2; pub const CLUSCTL_RESOURCE_TYPE_HOLD_IO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_HOLD_IO; pub const CLUSCTL_RESOURCE_TYPE_RESUME_IO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_RESUME_IO; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_INT = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_INT; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_LOGDISKS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_LOGDISKS; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_TARGET_DATADISKS; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_ELIGIBLE_SOURCE_DATADISKS; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICATED_DISKS = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_REPLICATED_DISKS; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICA_VOLUMES = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_REPLICA_VOLUMES; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_LOG_VOLUME = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_LOG_VOLUME; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_RESOURCE_GROUP = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_RESOURCE_GROUP; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_REPLICATED_PARTITION_INFO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_REPLICATED_PARTITION_INFO; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_GET_LOG_INFO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_GET_LOG_INFO; pub const CLUSCTL_RESOURCE_TYPE_REPLICATION_ADD_REPLICATION_GROUP = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_REPLICATION_ADD_REPLICATION_GROUP; pub const CLUSCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS = CLUSCTL_RESOURCE_TYPE_CODES.CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS; pub const CLUSCTL_CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS_WITH_KEY = CLUSCTL_RESOURCE_TYPE_CODES.CLOUD_WITNESS_RESOURCE_TYPE_VALIDATE_CREDENTIALS_WITH_KEY; pub const CLUSCTL_RESOURCE_TYPE_PREPARE_UPGRADE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_PREPARE_UPGRADE; pub const CLUSCTL_RESOURCE_TYPE_UPGRADE_COMPLETED = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_UPGRADE_COMPLETED; pub const CLUSCTL_RESOURCE_TYPE_NOTIFY_MONITOR_SHUTTING_DOWN = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_NOTIFY_MONITOR_SHUTTING_DOWN; pub const CLUSCTL_RESOURCE_TYPE_CHECK_DRAIN_VETO = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_CHECK_DRAIN_VETO; pub const CLUSCTL_RESOURCE_TYPE_NOTIFY_DRAIN_COMPLETE = CLUSCTL_RESOURCE_TYPE_CODES.RESOURCE_TYPE_NOTIFY_DRAIN_COMPLETE; pub const CLUSCTL_GROUP_CODES = enum(i32) { UNKNOWN = 50331648, GET_CHARACTERISTICS = 50331653, GET_FLAGS = 50331657, GET_NAME = 50331689, GET_ID = 50331705, ENUM_COMMON_PROPERTIES = 50331729, GET_RO_COMMON_PROPERTIES = 50331733, GET_COMMON_PROPERTIES = 50331737, SET_COMMON_PROPERTIES = 54526046, VALIDATE_COMMON_PROPERTIES = 50331745, ENUM_PRIVATE_PROPERTIES = 50331769, GET_RO_PRIVATE_PROPERTIES = 50331773, GET_PRIVATE_PROPERTIES = 50331777, SET_PRIVATE_PROPERTIES = 54526086, VALIDATE_PRIVATE_PROPERTIES = 50331785, QUERY_DELETE = 50332089, GET_COMMON_PROPERTY_FMTS = 50331749, GET_PRIVATE_PROPERTY_FMTS = 50331789, GET_FAILURE_INFO = 50331673, GET_LAST_MOVE_TIME = 50332377, SET_CCF_FROM_MASTER = 54537606, }; pub const CLUSCTL_GROUP_UNKNOWN = CLUSCTL_GROUP_CODES.UNKNOWN; pub const CLUSCTL_GROUP_GET_CHARACTERISTICS = CLUSCTL_GROUP_CODES.GET_CHARACTERISTICS; pub const CLUSCTL_GROUP_GET_FLAGS = CLUSCTL_GROUP_CODES.GET_FLAGS; pub const CLUSCTL_GROUP_GET_NAME = CLUSCTL_GROUP_CODES.GET_NAME; pub const CLUSCTL_GROUP_GET_ID = CLUSCTL_GROUP_CODES.GET_ID; pub const CLUSCTL_GROUP_ENUM_COMMON_PROPERTIES = CLUSCTL_GROUP_CODES.ENUM_COMMON_PROPERTIES; pub const CLUSCTL_GROUP_GET_RO_COMMON_PROPERTIES = CLUSCTL_GROUP_CODES.GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_GROUP_GET_COMMON_PROPERTIES = CLUSCTL_GROUP_CODES.GET_COMMON_PROPERTIES; pub const CLUSCTL_GROUP_SET_COMMON_PROPERTIES = CLUSCTL_GROUP_CODES.SET_COMMON_PROPERTIES; pub const CLUSCTL_GROUP_VALIDATE_COMMON_PROPERTIES = CLUSCTL_GROUP_CODES.VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_GROUP_ENUM_PRIVATE_PROPERTIES = CLUSCTL_GROUP_CODES.ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_GROUP_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_GROUP_CODES.GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES = CLUSCTL_GROUP_CODES.GET_PRIVATE_PROPERTIES; pub const CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES = CLUSCTL_GROUP_CODES.SET_PRIVATE_PROPERTIES; pub const CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_GROUP_CODES.VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_GROUP_QUERY_DELETE = CLUSCTL_GROUP_CODES.QUERY_DELETE; pub const CLUSCTL_GROUP_GET_COMMON_PROPERTY_FMTS = CLUSCTL_GROUP_CODES.GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_GROUP_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_GROUP_CODES.GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_GROUP_GET_FAILURE_INFO = CLUSCTL_GROUP_CODES.GET_FAILURE_INFO; pub const CLUSCTL_GROUP_GET_LAST_MOVE_TIME = CLUSCTL_GROUP_CODES.GET_LAST_MOVE_TIME; pub const CLUSCTL_GROUP_SET_CCF_FROM_MASTER = CLUSCTL_GROUP_CODES.SET_CCF_FROM_MASTER; pub const CLUSCTL_NODE_CODES = enum(i32) { UNKNOWN = 67108864, GET_CHARACTERISTICS = 67108869, GET_FLAGS = 67108873, GET_NAME = 67108905, GET_ID = 67108921, ENUM_COMMON_PROPERTIES = 67108945, GET_RO_COMMON_PROPERTIES = 67108949, GET_COMMON_PROPERTIES = 67108953, SET_COMMON_PROPERTIES = 71303262, VALIDATE_COMMON_PROPERTIES = 67108961, ENUM_PRIVATE_PROPERTIES = 67108985, GET_RO_PRIVATE_PROPERTIES = 67108989, GET_PRIVATE_PROPERTIES = 67108993, SET_PRIVATE_PROPERTIES = 71303302, VALIDATE_PRIVATE_PROPERTIES = 67109001, GET_COMMON_PROPERTY_FMTS = 67108965, GET_PRIVATE_PROPERTY_FMTS = 67109005, GET_CLUSTER_SERVICE_ACCOUNT_NAME = 67108929, GET_STUCK_NODES = 67109565, INJECT_GEM_FAULT = 67109569, INTRODUCE_GEM_REPAIR_DELAY = 67109573, SEND_DUMMY_GEM_MESSAGES = 67109577, BLOCK_GEM_SEND_RECV = 67109581, GET_GEMID_VECTOR = 67109585, }; pub const CLUSCTL_NODE_UNKNOWN = CLUSCTL_NODE_CODES.UNKNOWN; pub const CLUSCTL_NODE_GET_CHARACTERISTICS = CLUSCTL_NODE_CODES.GET_CHARACTERISTICS; pub const CLUSCTL_NODE_GET_FLAGS = CLUSCTL_NODE_CODES.GET_FLAGS; pub const CLUSCTL_NODE_GET_NAME = CLUSCTL_NODE_CODES.GET_NAME; pub const CLUSCTL_NODE_GET_ID = CLUSCTL_NODE_CODES.GET_ID; pub const CLUSCTL_NODE_ENUM_COMMON_PROPERTIES = CLUSCTL_NODE_CODES.ENUM_COMMON_PROPERTIES; pub const CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES = CLUSCTL_NODE_CODES.GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_NODE_GET_COMMON_PROPERTIES = CLUSCTL_NODE_CODES.GET_COMMON_PROPERTIES; pub const CLUSCTL_NODE_SET_COMMON_PROPERTIES = CLUSCTL_NODE_CODES.SET_COMMON_PROPERTIES; pub const CLUSCTL_NODE_VALIDATE_COMMON_PROPERTIES = CLUSCTL_NODE_CODES.VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_NODE_ENUM_PRIVATE_PROPERTIES = CLUSCTL_NODE_CODES.ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_NODE_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_NODE_CODES.GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_NODE_GET_PRIVATE_PROPERTIES = CLUSCTL_NODE_CODES.GET_PRIVATE_PROPERTIES; pub const CLUSCTL_NODE_SET_PRIVATE_PROPERTIES = CLUSCTL_NODE_CODES.SET_PRIVATE_PROPERTIES; pub const CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_NODE_CODES.VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_NODE_GET_COMMON_PROPERTY_FMTS = CLUSCTL_NODE_CODES.GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_NODE_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_NODE_CODES.GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_NODE_GET_CLUSTER_SERVICE_ACCOUNT_NAME = CLUSCTL_NODE_CODES.GET_CLUSTER_SERVICE_ACCOUNT_NAME; pub const CLUSCTL_NODE_GET_STUCK_NODES = CLUSCTL_NODE_CODES.GET_STUCK_NODES; pub const CLUSCTL_NODE_INJECT_GEM_FAULT = CLUSCTL_NODE_CODES.INJECT_GEM_FAULT; pub const CLUSCTL_NODE_INTRODUCE_GEM_REPAIR_DELAY = CLUSCTL_NODE_CODES.INTRODUCE_GEM_REPAIR_DELAY; pub const CLUSCTL_NODE_SEND_DUMMY_GEM_MESSAGES = CLUSCTL_NODE_CODES.SEND_DUMMY_GEM_MESSAGES; pub const CLUSCTL_NODE_BLOCK_GEM_SEND_RECV = CLUSCTL_NODE_CODES.BLOCK_GEM_SEND_RECV; pub const CLUSCTL_NODE_GET_GEMID_VECTOR = CLUSCTL_NODE_CODES.GET_GEMID_VECTOR; pub const CLUSCTL_NETWORK_CODES = enum(i32) { UNKNOWN = 83886080, GET_CHARACTERISTICS = 83886085, GET_FLAGS = 83886089, GET_NAME = 83886121, GET_ID = 83886137, ENUM_COMMON_PROPERTIES = 83886161, GET_RO_COMMON_PROPERTIES = 83886165, GET_COMMON_PROPERTIES = 83886169, SET_COMMON_PROPERTIES = 88080478, VALIDATE_COMMON_PROPERTIES = 83886177, ENUM_PRIVATE_PROPERTIES = 83886201, GET_RO_PRIVATE_PROPERTIES = 83886205, GET_PRIVATE_PROPERTIES = 83886209, SET_PRIVATE_PROPERTIES = 88080518, VALIDATE_PRIVATE_PROPERTIES = 83886217, GET_COMMON_PROPERTY_FMTS = 83886181, GET_PRIVATE_PROPERTY_FMTS = 83886221, }; pub const CLUSCTL_NETWORK_UNKNOWN = CLUSCTL_NETWORK_CODES.UNKNOWN; pub const CLUSCTL_NETWORK_GET_CHARACTERISTICS = CLUSCTL_NETWORK_CODES.GET_CHARACTERISTICS; pub const CLUSCTL_NETWORK_GET_FLAGS = CLUSCTL_NETWORK_CODES.GET_FLAGS; pub const CLUSCTL_NETWORK_GET_NAME = CLUSCTL_NETWORK_CODES.GET_NAME; pub const CLUSCTL_NETWORK_GET_ID = CLUSCTL_NETWORK_CODES.GET_ID; pub const CLUSCTL_NETWORK_ENUM_COMMON_PROPERTIES = CLUSCTL_NETWORK_CODES.ENUM_COMMON_PROPERTIES; pub const CLUSCTL_NETWORK_GET_RO_COMMON_PROPERTIES = CLUSCTL_NETWORK_CODES.GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_NETWORK_GET_COMMON_PROPERTIES = CLUSCTL_NETWORK_CODES.GET_COMMON_PROPERTIES; pub const CLUSCTL_NETWORK_SET_COMMON_PROPERTIES = CLUSCTL_NETWORK_CODES.SET_COMMON_PROPERTIES; pub const CLUSCTL_NETWORK_VALIDATE_COMMON_PROPERTIES = CLUSCTL_NETWORK_CODES.VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_NETWORK_ENUM_PRIVATE_PROPERTIES = CLUSCTL_NETWORK_CODES.ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_NETWORK_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_NETWORK_CODES.GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES = CLUSCTL_NETWORK_CODES.GET_PRIVATE_PROPERTIES; pub const CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES = CLUSCTL_NETWORK_CODES.SET_PRIVATE_PROPERTIES; pub const CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_NETWORK_CODES.VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_NETWORK_GET_COMMON_PROPERTY_FMTS = CLUSCTL_NETWORK_CODES.GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_NETWORK_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_NETWORK_CODES.GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_NETINTERFACE_CODES = enum(i32) { UNKNOWN = 100663296, GET_CHARACTERISTICS = 100663301, GET_FLAGS = 100663305, GET_NAME = 100663337, GET_ID = 100663353, GET_NODE = 100663345, GET_NETWORK = 100663349, ENUM_COMMON_PROPERTIES = 100663377, GET_RO_COMMON_PROPERTIES = 100663381, GET_COMMON_PROPERTIES = 100663385, SET_COMMON_PROPERTIES = 104857694, VALIDATE_COMMON_PROPERTIES = 100663393, ENUM_PRIVATE_PROPERTIES = 100663417, GET_RO_PRIVATE_PROPERTIES = 100663421, GET_PRIVATE_PROPERTIES = 100663425, SET_PRIVATE_PROPERTIES = 104857734, VALIDATE_PRIVATE_PROPERTIES = 100663433, GET_COMMON_PROPERTY_FMTS = 100663397, GET_PRIVATE_PROPERTY_FMTS = 100663437, }; pub const CLUSCTL_NETINTERFACE_UNKNOWN = CLUSCTL_NETINTERFACE_CODES.UNKNOWN; pub const CLUSCTL_NETINTERFACE_GET_CHARACTERISTICS = CLUSCTL_NETINTERFACE_CODES.GET_CHARACTERISTICS; pub const CLUSCTL_NETINTERFACE_GET_FLAGS = CLUSCTL_NETINTERFACE_CODES.GET_FLAGS; pub const CLUSCTL_NETINTERFACE_GET_NAME = CLUSCTL_NETINTERFACE_CODES.GET_NAME; pub const CLUSCTL_NETINTERFACE_GET_ID = CLUSCTL_NETINTERFACE_CODES.GET_ID; pub const CLUSCTL_NETINTERFACE_GET_NODE = CLUSCTL_NETINTERFACE_CODES.GET_NODE; pub const CLUSCTL_NETINTERFACE_GET_NETWORK = CLUSCTL_NETINTERFACE_CODES.GET_NETWORK; pub const CLUSCTL_NETINTERFACE_ENUM_COMMON_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.ENUM_COMMON_PROPERTIES; pub const CLUSCTL_NETINTERFACE_GET_RO_COMMON_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_NETINTERFACE_GET_COMMON_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.GET_COMMON_PROPERTIES; pub const CLUSCTL_NETINTERFACE_SET_COMMON_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.SET_COMMON_PROPERTIES; pub const CLUSCTL_NETINTERFACE_VALIDATE_COMMON_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_NETINTERFACE_ENUM_PRIVATE_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_NETINTERFACE_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.GET_PRIVATE_PROPERTIES; pub const CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.SET_PRIVATE_PROPERTIES; pub const CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_NETINTERFACE_CODES.VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_NETINTERFACE_GET_COMMON_PROPERTY_FMTS = CLUSCTL_NETINTERFACE_CODES.GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_NETINTERFACE_CODES.GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_CLUSTER_CODES = enum(i32) { UNKNOWN = 117440512, GET_FQDN = 117440573, SET_STORAGE_CONFIGURATION = 121635554, GET_STORAGE_CONFIGURATION = 117441253, GET_STORAGE_CONFIG_ATTRIBUTES = 117441257, ENUM_COMMON_PROPERTIES = 117440593, GET_RO_COMMON_PROPERTIES = 117440597, GET_COMMON_PROPERTIES = 117440601, SET_COMMON_PROPERTIES = 121634910, VALIDATE_COMMON_PROPERTIES = 117440609, ENUM_PRIVATE_PROPERTIES = 117440633, GET_RO_PRIVATE_PROPERTIES = 117440637, GET_PRIVATE_PROPERTIES = 117440641, SET_PRIVATE_PROPERTIES = 121634950, VALIDATE_PRIVATE_PROPERTIES = 117440649, GET_COMMON_PROPERTY_FMTS = 117440613, GET_PRIVATE_PROPERTY_FMTS = 117440653, CHECK_VOTER_EVICT = 117440581, CHECK_VOTER_DOWN = 117440585, SHUTDOWN = 117440589, BATCH_BLOCK_KEY = 117441086, BATCH_UNBLOCK_KEY = 117441089, GET_SHARED_VOLUME_ID = 117441169, GET_CLUSDB_TIMESTAMP = 117441193, GET_GUM_LOCK_OWNER = 117441209, REMOVE_NODE = 121635566, SET_ACCOUNT_ACCESS = 121635058, CLEAR_NODE_CONNECTION_INFO = 121635590, SET_DNS_DOMAIN = 121635594, SET_CLUSTER_S2D_ENABLED = 121646434, SET_CLUSTER_S2D_CACHE_METADATA_RESERVE_BYTES = 121646446, STORAGE_RENAME_SHARED_VOLUME = 117452246, STORAGE_RENAME_SHARED_VOLUME_GUID = 117452250, RELOAD_AUTOLOGGER_CONFIG = 117452242, ENUM_AFFINITY_RULE_NAMES = 117452253, GET_NODES_IN_FD = 117452257, FORCE_FLUSH_DB = 121646566, GET_CLMUSR_TOKEN = <PASSWORD>, }; pub const CLUSCTL_CLUSTER_UNKNOWN = CLUSCTL_CLUSTER_CODES.UNKNOWN; pub const CLUSCTL_CLUSTER_GET_FQDN = CLUSCTL_CLUSTER_CODES.GET_FQDN; pub const CLUSCTL_CLUSTER_SET_STORAGE_CONFIGURATION = CLUSCTL_CLUSTER_CODES.SET_STORAGE_CONFIGURATION; pub const CLUSCTL_CLUSTER_GET_STORAGE_CONFIGURATION = CLUSCTL_CLUSTER_CODES.GET_STORAGE_CONFIGURATION; pub const CLUSCTL_CLUSTER_GET_STORAGE_CONFIG_ATTRIBUTES = CLUSCTL_CLUSTER_CODES.GET_STORAGE_CONFIG_ATTRIBUTES; pub const CLUSCTL_CLUSTER_ENUM_COMMON_PROPERTIES = CLUSCTL_CLUSTER_CODES.ENUM_COMMON_PROPERTIES; pub const CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES = CLUSCTL_CLUSTER_CODES.GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_CLUSTER_GET_COMMON_PROPERTIES = CLUSCTL_CLUSTER_CODES.GET_COMMON_PROPERTIES; pub const CLUSCTL_CLUSTER_SET_COMMON_PROPERTIES = CLUSCTL_CLUSTER_CODES.SET_COMMON_PROPERTIES; pub const CLUSCTL_CLUSTER_VALIDATE_COMMON_PROPERTIES = CLUSCTL_CLUSTER_CODES.VALIDATE_COMMON_PROPERTIES; pub const CLUSCTL_CLUSTER_ENUM_PRIVATE_PROPERTIES = CLUSCTL_CLUSTER_CODES.ENUM_PRIVATE_PROPERTIES; pub const CLUSCTL_CLUSTER_GET_RO_PRIVATE_PROPERTIES = CLUSCTL_CLUSTER_CODES.GET_RO_PRIVATE_PROPERTIES; pub const CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES = CLUSCTL_CLUSTER_CODES.GET_PRIVATE_PROPERTIES; pub const CLUSCTL_CLUSTER_SET_PRIVATE_PROPERTIES = CLUSCTL_CLUSTER_CODES.SET_PRIVATE_PROPERTIES; pub const CLUSCTL_CLUSTER_VALIDATE_PRIVATE_PROPERTIES = CLUSCTL_CLUSTER_CODES.VALIDATE_PRIVATE_PROPERTIES; pub const CLUSCTL_CLUSTER_GET_COMMON_PROPERTY_FMTS = CLUSCTL_CLUSTER_CODES.GET_COMMON_PROPERTY_FMTS; pub const CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTY_FMTS = CLUSCTL_CLUSTER_CODES.GET_PRIVATE_PROPERTY_FMTS; pub const CLUSCTL_CLUSTER_CHECK_VOTER_EVICT = CLUSCTL_CLUSTER_CODES.CHECK_VOTER_EVICT; pub const CLUSCTL_CLUSTER_CHECK_VOTER_DOWN = CLUSCTL_CLUSTER_CODES.CHECK_VOTER_DOWN; pub const CLUSCTL_CLUSTER_SHUTDOWN = CLUSCTL_CLUSTER_CODES.SHUTDOWN; pub const CLUSCTL_CLUSTER_BATCH_BLOCK_KEY = CLUSCTL_CLUSTER_CODES.BATCH_BLOCK_KEY; pub const CLUSCTL_CLUSTER_BATCH_UNBLOCK_KEY = CLUSCTL_CLUSTER_CODES.BATCH_UNBLOCK_KEY; pub const CLUSCTL_CLUSTER_GET_SHARED_VOLUME_ID = CLUSCTL_CLUSTER_CODES.GET_SHARED_VOLUME_ID; pub const CLUSCTL_CLUSTER_GET_CLUSDB_TIMESTAMP = CLUSCTL_CLUSTER_CODES.GET_CLUSDB_TIMESTAMP; pub const CLUSCTL_CLUSTER_GET_GUM_LOCK_OWNER = CLUSCTL_CLUSTER_CODES.GET_GUM_LOCK_OWNER; pub const CLUSCTL_CLUSTER_REMOVE_NODE = CLUSCTL_CLUSTER_CODES.REMOVE_NODE; pub const CLUSCTL_CLUSTER_SET_ACCOUNT_ACCESS = CLUSCTL_CLUSTER_CODES.SET_ACCOUNT_ACCESS; pub const CLUSCTL_CLUSTER_CLEAR_NODE_CONNECTION_INFO = CLUSCTL_CLUSTER_CODES.CLEAR_NODE_CONNECTION_INFO; pub const CLUSCTL_CLUSTER_SET_DNS_DOMAIN = CLUSCTL_CLUSTER_CODES.SET_DNS_DOMAIN; pub const CLUSCTL_CLUSTER_SET_CLUSTER_S2D_ENABLED = CLUSCTL_CLUSTER_CODES.SET_CLUSTER_S2D_ENABLED; pub const CLUSCTL_CLUSTER_SET_CLUSTER_S2D_CACHE_METADATA_RESERVE_BYTES = CLUSCTL_CLUSTER_CODES.SET_CLUSTER_S2D_CACHE_METADATA_RESERVE_BYTES; pub const CLUSCTL_CLUSTER_STORAGE_RENAME_SHARED_VOLUME = CLUSCTL_CLUSTER_CODES.STORAGE_RENAME_SHARED_VOLUME; pub const CLUSCTL_CLUSTER_STORAGE_RENAME_SHARED_VOLUME_GUID = CLUSCTL_CLUSTER_CODES.STORAGE_RENAME_SHARED_VOLUME_GUID; pub const CLUSCTL_CLUSTER_RELOAD_AUTOLOGGER_CONFIG = CLUSCTL_CLUSTER_CODES.RELOAD_AUTOLOGGER_CONFIG; pub const CLUSCTL_CLUSTER_ENUM_AFFINITY_RULE_NAMES = CLUSCTL_CLUSTER_CODES.ENUM_AFFINITY_RULE_NAMES; pub const CLUSCTL_CLUSTER_GET_NODES_IN_FD = CLUSCTL_CLUSTER_CODES.GET_NODES_IN_FD; pub const CLUSCTL_CLUSTER_FORCE_FLUSH_DB = CLUSCTL_CLUSTER_CODES.FORCE_FLUSH_DB; pub const CLUSCTL_CLUSTER_GET_CLMUSR_TOKEN = CLUSCTL_CLUSTER_CODES.GET_CLMUSR_TOKEN; pub const CLUSCTL_GROUPSET_CODES = enum(i32) { SET_GET_COMMON_PROPERTIES = 134217817, SET_GET_RO_COMMON_PROPERTIES = 134217813, SET_SET_COMMON_PROPERTIES = 138412126, SET_GET_GROUPS = 134229361, SET_GET_PROVIDER_GROUPS = 134229365, SET_GET_PROVIDER_GROUPSETS = 134229369, _GET_PROVIDER_GROUPS = 134229373, _GET_PROVIDER_GROUPSETS = 134229377, SET_GET_ID = 134217785, }; pub const CLUSCTL_GROUPSET_GET_COMMON_PROPERTIES = CLUSCTL_GROUPSET_CODES.SET_GET_COMMON_PROPERTIES; pub const CLUSCTL_GROUPSET_GET_RO_COMMON_PROPERTIES = CLUSCTL_GROUPSET_CODES.SET_GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_GROUPSET_SET_COMMON_PROPERTIES = CLUSCTL_GROUPSET_CODES.SET_SET_COMMON_PROPERTIES; pub const CLUSCTL_GROUPSET_GET_GROUPS = CLUSCTL_GROUPSET_CODES.SET_GET_GROUPS; pub const CLUSCTL_GROUPSET_GET_PROVIDER_GROUPS = CLUSCTL_GROUPSET_CODES.SET_GET_PROVIDER_GROUPS; pub const CLUSCTL_GROUPSET_GET_PROVIDER_GROUPSETS = CLUSCTL_GROUPSET_CODES.SET_GET_PROVIDER_GROUPSETS; pub const CLUSCTL_GROUP_GET_PROVIDER_GROUPS = CLUSCTL_GROUPSET_CODES._GET_PROVIDER_GROUPS; pub const CLUSCTL_GROUP_GET_PROVIDER_GROUPSETS = CLUSCTL_GROUPSET_CODES._GET_PROVIDER_GROUPSETS; pub const CLUSCTL_GROUPSET_GET_ID = CLUSCTL_GROUPSET_CODES.SET_GET_ID; pub const CLUSCTL_AFFINITYRULE_CODES = enum(i32) { GET_COMMON_PROPERTIES = 150995033, GET_RO_COMMON_PROPERTIES = 150995029, SET_COMMON_PROPERTIES = 155189342, GET_ID = 150995001, GET_GROUPNAMES = 151006577, }; pub const CLUSCTL_AFFINITYRULE_GET_COMMON_PROPERTIES = CLUSCTL_AFFINITYRULE_CODES.GET_COMMON_PROPERTIES; pub const CLUSCTL_AFFINITYRULE_GET_RO_COMMON_PROPERTIES = CLUSCTL_AFFINITYRULE_CODES.GET_RO_COMMON_PROPERTIES; pub const CLUSCTL_AFFINITYRULE_SET_COMMON_PROPERTIES = CLUSCTL_AFFINITYRULE_CODES.SET_COMMON_PROPERTIES; pub const CLUSCTL_AFFINITYRULE_GET_ID = CLUSCTL_AFFINITYRULE_CODES.GET_ID; pub const CLUSCTL_AFFINITYRULE_GET_GROUPNAMES = CLUSCTL_AFFINITYRULE_CODES.GET_GROUPNAMES; pub const CLUSTER_RESOURCE_CLASS = enum(i32) { UNKNOWN = 0, STORAGE = 1, NETWORK = 2, USER = 32768, }; pub const CLUS_RESCLASS_UNKNOWN = CLUSTER_RESOURCE_CLASS.UNKNOWN; pub const CLUS_RESCLASS_STORAGE = CLUSTER_RESOURCE_CLASS.STORAGE; pub const CLUS_RESCLASS_NETWORK = CLUSTER_RESOURCE_CLASS.NETWORK; pub const CLUS_RESCLASS_USER = CLUSTER_RESOURCE_CLASS.USER; pub const CLUS_RESSUBCLASS = enum(i32) { D = -2147483648, }; pub const CLUS_RESSUBCLASS_SHARED = CLUS_RESSUBCLASS.D; pub const CLUS_RESSUBCLASS_STORAGE = enum(i32) { SHARED_BUS = -2147483648, DISK = 1073741824, REPLICATION = 268435456, }; pub const CLUS_RESSUBCLASS_STORAGE_SHARED_BUS = CLUS_RESSUBCLASS_STORAGE.SHARED_BUS; pub const CLUS_RESSUBCLASS_STORAGE_DISK = CLUS_RESSUBCLASS_STORAGE.DISK; pub const CLUS_RESSUBCLASS_STORAGE_REPLICATION = CLUS_RESSUBCLASS_STORAGE.REPLICATION; pub const CLUS_RESSUBCLASS_NETWORK = enum(i32) { L = -2147483648, }; pub const CLUS_RESSUBCLASS_NETWORK_INTERNET_PROTOCOL = CLUS_RESSUBCLASS_NETWORK.L; pub const CLUS_CHARACTERISTICS = enum(i32) { UNKNOWN = 0, QUORUM = 1, DELETE_REQUIRES_ALL_NODES = 2, LOCAL_QUORUM = 4, LOCAL_QUORUM_DEBUG = 8, REQUIRES_STATE_CHANGE_REASON = 16, BROADCAST_DELETE = 32, SINGLE_CLUSTER_INSTANCE = 64, SINGLE_GROUP_INSTANCE = 128, COEXIST_IN_SHARED_VOLUME_GROUP = 256, PLACEMENT_DATA = 512, MONITOR_DETACH = 1024, MONITOR_REATTACH = 2048, OPERATION_CONTEXT = 4096, CLONES = 8192, NOT_PREEMPTABLE = 16384, NOTIFY_NEW_OWNER = 32768, SUPPORTS_UNMONITORED_STATE = 65536, INFRASTRUCTURE = 131072, VETO_DRAIN = 262144, DRAIN_LOCAL_OFFLINE = 524288, }; pub const CLUS_CHAR_UNKNOWN = CLUS_CHARACTERISTICS.UNKNOWN; pub const CLUS_CHAR_QUORUM = CLUS_CHARACTERISTICS.QUORUM; pub const CLUS_CHAR_DELETE_REQUIRES_ALL_NODES = CLUS_CHARACTERISTICS.DELETE_REQUIRES_ALL_NODES; pub const CLUS_CHAR_LOCAL_QUORUM = CLUS_CHARACTERISTICS.LOCAL_QUORUM; pub const CLUS_CHAR_LOCAL_QUORUM_DEBUG = CLUS_CHARACTERISTICS.LOCAL_QUORUM_DEBUG; pub const CLUS_CHAR_REQUIRES_STATE_CHANGE_REASON = CLUS_CHARACTERISTICS.REQUIRES_STATE_CHANGE_REASON; pub const CLUS_CHAR_BROADCAST_DELETE = CLUS_CHARACTERISTICS.BROADCAST_DELETE; pub const CLUS_CHAR_SINGLE_CLUSTER_INSTANCE = CLUS_CHARACTERISTICS.SINGLE_CLUSTER_INSTANCE; pub const CLUS_CHAR_SINGLE_GROUP_INSTANCE = CLUS_CHARACTERISTICS.SINGLE_GROUP_INSTANCE; pub const CLUS_CHAR_COEXIST_IN_SHARED_VOLUME_GROUP = CLUS_CHARACTERISTICS.COEXIST_IN_SHARED_VOLUME_GROUP; pub const CLUS_CHAR_PLACEMENT_DATA = CLUS_CHARACTERISTICS.PLACEMENT_DATA; pub const CLUS_CHAR_MONITOR_DETACH = CLUS_CHARACTERISTICS.MONITOR_DETACH; pub const CLUS_CHAR_MONITOR_REATTACH = CLUS_CHARACTERISTICS.MONITOR_REATTACH; pub const CLUS_CHAR_OPERATION_CONTEXT = CLUS_CHARACTERISTICS.OPERATION_CONTEXT; pub const CLUS_CHAR_CLONES = CLUS_CHARACTERISTICS.CLONES; pub const CLUS_CHAR_NOT_PREEMPTABLE = CLUS_CHARACTERISTICS.NOT_PREEMPTABLE; pub const CLUS_CHAR_NOTIFY_NEW_OWNER = CLUS_CHARACTERISTICS.NOTIFY_NEW_OWNER; pub const CLUS_CHAR_SUPPORTS_UNMONITORED_STATE = CLUS_CHARACTERISTICS.SUPPORTS_UNMONITORED_STATE; pub const CLUS_CHAR_INFRASTRUCTURE = CLUS_CHARACTERISTICS.INFRASTRUCTURE; pub const CLUS_CHAR_VETO_DRAIN = CLUS_CHARACTERISTICS.VETO_DRAIN; pub const CLUS_CHAR_DRAIN_LOCAL_OFFLINE = CLUS_CHARACTERISTICS.DRAIN_LOCAL_OFFLINE; pub const CLUS_FLAGS = enum(i32) { E = 1, }; pub const CLUS_FLAG_CORE = CLUS_FLAGS.E; pub const CLUSPROP_SYNTAX = extern union { dw: u32, Anonymous: extern struct { wFormat: u16, wType: u16, }, }; pub const CLUSPROP_VALUE = extern struct { Syntax: CLUSPROP_SYNTAX, cbLength: u32, }; pub const CLUSPROP_BINARY = extern struct { __AnonymousBase_clusapi_L5129_C41: CLUSPROP_VALUE, rgb: [1]u8, }; pub const CLUSPROP_WORD = extern struct { __AnonymousBase_clusapi_L5139_C39: CLUSPROP_VALUE, w: u16, }; pub const CLUSPROP_DWORD = extern struct { __AnonymousBase_clusapi_L5149_C40: CLUSPROP_VALUE, dw: u32, }; pub const CLUSPROP_LONG = extern struct { __AnonymousBase_clusapi_L5159_C39: CLUSPROP_VALUE, l: i32, }; pub const CLUSPROP_SZ = extern struct { __AnonymousBase_clusapi_L5169_C37: CLUSPROP_VALUE, sz: [1]u16, }; pub const CLUSPROP_ULARGE_INTEGER = extern struct { __AnonymousBase_clusapi_L5186_C14: CLUSPROP_VALUE, li: ULARGE_INTEGER, }; pub const CLUSPROP_LARGE_INTEGER = extern struct { __AnonymousBase_clusapi_L5199_C14: CLUSPROP_VALUE, li: LARGE_INTEGER, }; pub const CLUSPROP_SECURITY_DESCRIPTOR = extern struct { __AnonymousBase_clusapi_L5211_C54: CLUSPROP_VALUE, Anonymous: extern union { sd: SECURITY_DESCRIPTOR_RELATIVE, rgbSecurityDescriptor: [1]u8, }, }; pub const CLUSPROP_FILETIME = extern struct { __AnonymousBase_clusapi_L5225_C14: CLUSPROP_VALUE, ft: FILETIME, }; pub const CLUS_RESOURCE_CLASS_INFO = extern struct { Anonymous: extern union { Anonymous: extern struct { Anonymous: extern union { dw: u32, rc: CLUSTER_RESOURCE_CLASS, }, SubClass: u32, }, li: ULARGE_INTEGER, }, }; pub const CLUSPROP_RESOURCE_CLASS = extern struct { __AnonymousBase_clusapi_L5250_C14: CLUSPROP_VALUE, rc: CLUSTER_RESOURCE_CLASS, }; pub const CLUSPROP_RESOURCE_CLASS_INFO = extern struct { __AnonymousBase_clusapi_L5261_C14: CLUSPROP_VALUE, __AnonymousBase_clusapi_L5262_C14: CLUS_RESOURCE_CLASS_INFO, }; pub const CLUSPROP_REQUIRED_DEPENDENCY = extern union { Value: CLUSPROP_VALUE, ResClass: CLUSPROP_RESOURCE_CLASS, ResTypeName: CLUSPROP_SZ, }; pub const CLUSPROP_PIFLAGS = enum(i32) { STICKY = 1, REMOVABLE = 2, USABLE = 4, DEFAULT_QUORUM = 8, USABLE_FOR_CSV = 16, ENCRYPTION_ENABLED = 32, RAW = 64, UNKNOWN = -2147483648, }; pub const CLUSPROP_PIFLAG_STICKY = CLUSPROP_PIFLAGS.STICKY; pub const CLUSPROP_PIFLAG_REMOVABLE = CLUSPROP_PIFLAGS.REMOVABLE; pub const CLUSPROP_PIFLAG_USABLE = CLUSPROP_PIFLAGS.USABLE; pub const CLUSPROP_PIFLAG_DEFAULT_QUORUM = CLUSPROP_PIFLAGS.DEFAULT_QUORUM; pub const CLUSPROP_PIFLAG_USABLE_FOR_CSV = CLUSPROP_PIFLAGS.USABLE_FOR_CSV; pub const CLUSPROP_PIFLAG_ENCRYPTION_ENABLED = CLUSPROP_PIFLAGS.ENCRYPTION_ENABLED; pub const CLUSPROP_PIFLAG_RAW = CLUSPROP_PIFLAGS.RAW; pub const CLUSPROP_PIFLAG_UNKNOWN = CLUSPROP_PIFLAGS.UNKNOWN; pub const CLUS_FORCE_QUORUM_INFO = extern struct { dwSize: u32, dwNodeBitMask: u32, dwMaxNumberofNodes: u32, multiszNodeList: [1]u16, }; pub const CLUS_PARTITION_INFO = extern struct { dwFlags: u32, szDeviceName: [260]u16, szVolumeLabel: [260]u16, dwSerialNumber: u32, rgdwMaximumComponentLength: u32, dwFileSystemFlags: u32, szFileSystem: [32]u16, }; pub const CLUS_PARTITION_INFO_EX = extern struct { dwFlags: u32, szDeviceName: [260]u16, szVolumeLabel: [260]u16, dwSerialNumber: u32, rgdwMaximumComponentLength: u32, dwFileSystemFlags: u32, szFileSystem: [32]u16, TotalSizeInBytes: ULARGE_INTEGER, FreeSizeInBytes: ULARGE_INTEGER, DeviceNumber: u32, PartitionNumber: u32, VolumeGuid: Guid, }; pub const CLUS_PARTITION_INFO_EX2 = extern struct { GptPartitionId: Guid, szPartitionName: [260]u16, EncryptionFlags: u32, }; pub const CLUSTER_CSV_VOLUME_FAULT_STATE = enum(i32) { NoFaults = 0, NoDirectIO = 1, NoAccess = 2, InMaintenance = 4, Dismounted = 8, }; pub const VolumeStateNoFaults = CLUSTER_CSV_VOLUME_FAULT_STATE.NoFaults; pub const VolumeStateNoDirectIO = CLUSTER_CSV_VOLUME_FAULT_STATE.NoDirectIO; pub const VolumeStateNoAccess = CLUSTER_CSV_VOLUME_FAULT_STATE.NoAccess; pub const VolumeStateInMaintenance = CLUSTER_CSV_VOLUME_FAULT_STATE.InMaintenance; pub const VolumeStateDismounted = CLUSTER_CSV_VOLUME_FAULT_STATE.Dismounted; pub const CLUSTER_SHARED_VOLUME_BACKUP_STATE = enum(i32) { None = 0, InProgress = 1, }; pub const VolumeBackupNone = CLUSTER_SHARED_VOLUME_BACKUP_STATE.None; pub const VolumeBackupInProgress = CLUSTER_SHARED_VOLUME_BACKUP_STATE.InProgress; pub const CLUS_CSV_VOLUME_INFO = extern struct { VolumeOffset: ULARGE_INTEGER, PartitionNumber: u32, FaultState: CLUSTER_CSV_VOLUME_FAULT_STATE, BackupState: CLUSTER_SHARED_VOLUME_BACKUP_STATE, szVolumeFriendlyName: [260]u16, szVolumeName: [50]u16, }; pub const CLUS_CSV_VOLUME_NAME = extern struct { VolumeOffset: LARGE_INTEGER, szVolumeName: [260]u16, szRootPath: [263]u16, }; pub const CLUSTER_SHARED_VOLUME_STATE = enum(i32) { Unavailable = 0, Paused = 1, Active = 2, ActiveRedirected = 3, ActiveVolumeRedirected = 4, }; pub const SharedVolumeStateUnavailable = CLUSTER_SHARED_VOLUME_STATE.Unavailable; pub const SharedVolumeStatePaused = CLUSTER_SHARED_VOLUME_STATE.Paused; pub const SharedVolumeStateActive = CLUSTER_SHARED_VOLUME_STATE.Active; pub const SharedVolumeStateActiveRedirected = CLUSTER_SHARED_VOLUME_STATE.ActiveRedirected; pub const SharedVolumeStateActiveVolumeRedirected = CLUSTER_SHARED_VOLUME_STATE.ActiveVolumeRedirected; pub const CLUSTER_SHARED_VOLUME_STATE_INFO = extern struct { szVolumeName: [260]u16, szNodeName: [260]u16, VolumeState: CLUSTER_SHARED_VOLUME_STATE, }; pub const CLUSTER_SHARED_VOLUME_STATE_INFO_EX = extern struct { szVolumeName: [260]u16, szNodeName: [260]u16, VolumeState: CLUSTER_SHARED_VOLUME_STATE, szVolumeFriendlyName: [260]u16, RedirectedIOReason: u64, VolumeRedirectedIOReason: u64, }; pub const CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE = enum(i32) { None = 0, VolumeOffset = 1, VolumeId = 2, VolumeName = 3, VolumeGuid = 4, }; pub const ClusterSharedVolumeRenameInputTypeNone = CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE.None; pub const ClusterSharedVolumeRenameInputTypeVolumeOffset = CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE.VolumeOffset; pub const ClusterSharedVolumeRenameInputTypeVolumeId = CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE.VolumeId; pub const ClusterSharedVolumeRenameInputTypeVolumeName = CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE.VolumeName; pub const ClusterSharedVolumeRenameInputTypeVolumeGuid = CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE.VolumeGuid; pub const CLUSTER_SHARED_VOLUME_RENAME_INPUT_VOLUME = extern struct { InputType: CLUSTER_SHARED_VOLUME_RENAME_INPUT_TYPE, Anonymous: extern union { VolumeOffset: u64, VolumeId: [260]u16, VolumeName: [260]u16, VolumeGuid: [50]u16, }, }; pub const CLUSTER_SHARED_VOLUME_RENAME_INPUT_NAME = extern struct { NewVolumeName: [260]u16, }; pub const CLUSTER_SHARED_VOLUME_RENAME_INPUT_GUID_NAME = extern struct { NewVolumeName: [260]u16, NewVolumeGuid: [50]u16, }; pub const CLUSTER_SHARED_VOLUME_RENAME_INPUT = extern struct { __AnonymousBase_clusapi_L5464_C14: CLUSTER_SHARED_VOLUME_RENAME_INPUT_VOLUME, __AnonymousBase_clusapi_L5465_C14: CLUSTER_SHARED_VOLUME_RENAME_INPUT_NAME, }; pub const CLUSTER_SHARED_VOLUME_RENAME_GUID_INPUT = extern struct { __AnonymousBase_clusapi_L5475_C14: CLUSTER_SHARED_VOLUME_RENAME_INPUT_VOLUME, __AnonymousBase_clusapi_L5476_C14: CLUSTER_SHARED_VOLUME_RENAME_INPUT_GUID_NAME, }; pub const CLUS_CHKDSK_INFO = extern struct { PartitionNumber: u32, ChkdskState: u32, FileIdCount: u32, FileIdList: [1]u64, }; pub const CLUS_DISK_NUMBER_INFO = extern struct { DiskNumber: u32, BytesPerSector: u32, }; pub const CLUS_SHARED_VOLUME_BACKUP_MODE = extern struct { BackupState: CLUSTER_SHARED_VOLUME_BACKUP_STATE, DelayTimerInSecs: u32, VolumeName: [260]u16, }; pub const CLUSPROP_PARTITION_INFO = extern struct { __AnonymousBase_clusapi_L5507_C14: CLUSPROP_VALUE, __AnonymousBase_clusapi_L5508_C14: CLUS_PARTITION_INFO, }; pub const CLUSPROP_PARTITION_INFO_EX = extern struct { __AnonymousBase_clusapi_L5519_C14: CLUSPROP_VALUE, __AnonymousBase_clusapi_L5520_C14: CLUS_PARTITION_INFO_EX, }; pub const CLUSPROP_PARTITION_INFO_EX2 = extern struct { __AnonymousBase_clusapi_L5533_C14: CLUSPROP_PARTITION_INFO_EX, __AnonymousBase_clusapi_L5534_C14: CLUS_PARTITION_INFO_EX2, }; pub const CLUS_FTSET_INFO = extern struct { dwRootSignature: u32, dwFtType: u32, }; pub const CLUSPROP_FTSET_INFO = extern struct { __AnonymousBase_clusapi_L5555_C14: CLUSPROP_VALUE, __AnonymousBase_clusapi_L5556_C14: CLUS_FTSET_INFO, }; pub const CLUS_SCSI_ADDRESS = extern struct { Anonymous: extern union { Anonymous: extern struct { PortNumber: u8, PathId: u8, TargetId: u8, Lun: u8, }, dw: u32, }, }; pub const CLUSPROP_SCSI_ADDRESS = extern struct { __AnonymousBase_clusapi_L5583_C14: CLUSPROP_VALUE, __AnonymousBase_clusapi_L5584_C14: CLUS_SCSI_ADDRESS, }; pub const CLUS_NETNAME_VS_TOKEN_INFO = extern struct { ProcessID: u32, DesiredAccess: u32, InheritHandle: BOOL, }; pub const CLUS_NETNAME_PWD_INFO = extern struct { Flags: u32, Password: [16]u16, CreatingDC: [258]u16, ObjectGuid: [64]u16, }; pub const CLUS_NETNAME_PWD_INFOEX = extern struct { Flags: u32, Password: [128]<PASSWORD>, CreatingDC: [258]u16, ObjectGuid: [64]u16, }; pub const CLUS_DNN_LEADER_STATUS = extern struct { IsOnline: BOOL, IsFileServerPresent: BOOL, }; pub const CLUS_DNN_SODAFS_CLONE_STATUS = extern struct { NodeId: u32, Status: CLUSTER_RESOURCE_STATE, }; pub const CLUS_NETNAME_IP_INFO_ENTRY = extern struct { NodeId: u32, AddressSize: u32, Address: [1]u8, }; pub const CLUS_NETNAME_IP_INFO_FOR_MULTICHANNEL = extern struct { szName: [64]u16, NumEntries: u32, IpInfo: [1]CLUS_NETNAME_IP_INFO_ENTRY, }; pub const CLUS_MAINTENANCE_MODE_INFO = extern struct { InMaintenance: BOOL, }; pub const CLUS_CSV_MAINTENANCE_MODE_INFO = extern struct { InMaintenance: BOOL, VolumeName: [260]u16, }; pub const MAINTENANCE_MODE_TYPE_ENUM = enum(i32) { DisableIsAliveCheck = 1, OfflineResource = 2, UnclusterResource = 3, }; pub const MaintenanceModeTypeDisableIsAliveCheck = MAINTENANCE_MODE_TYPE_ENUM.DisableIsAliveCheck; pub const MaintenanceModeTypeOfflineResource = MAINTENANCE_MODE_TYPE_ENUM.OfflineResource; pub const MaintenanceModeTypeUnclusterResource = MAINTENANCE_MODE_TYPE_ENUM.UnclusterResource; pub const CLUS_MAINTENANCE_MODE_INFOEX = extern struct { InMaintenance: BOOL, MaintainenceModeType: MAINTENANCE_MODE_TYPE_ENUM, InternalState: CLUSTER_RESOURCE_STATE, Signature: u32, }; pub const CLUS_SET_MAINTENANCE_MODE_INPUT = extern struct { InMaintenance: BOOL, ExtraParameterSize: u32, ExtraParameter: [1]u8, }; pub const CLUS_STORAGE_SET_DRIVELETTER = extern struct { PartitionNumber: u32, DriveLetterMask: u32, }; pub const CLUS_STORAGE_GET_AVAILABLE_DRIVELETTERS = extern struct { AvailDrivelettersMask: u32, }; pub const CLUS_STORAGE_REMAP_DRIVELETTER = extern struct { CurrentDriveLetterMask: u32, TargetDriveLetterMask: u32, }; pub const CLUS_PROVIDER_STATE_CHANGE_INFO = extern struct { dwSize: u32, resourceState: CLUSTER_RESOURCE_STATE, szProviderId: [1]u16, }; pub const CLUS_CREATE_INFRASTRUCTURE_FILESERVER_INPUT = extern struct { FileServerName: [16]u16, }; pub const CLUS_CREATE_INFRASTRUCTURE_FILESERVER_OUTPUT = extern struct { FileServerName: [260]u16, }; pub const CLUSPROP_LIST = extern struct { nPropertyCount: u32, PropertyName: CLUSPROP_SZ, }; pub const CLUSPROP_IPADDR_ENABLENETBIOS = enum(i32) { DISABLED = 0, ENABLED = 1, TRACK_NIC = 2, }; pub const CLUSPROP_IPADDR_ENABLENETBIOS_DISABLED = CLUSPROP_IPADDR_ENABLENETBIOS.DISABLED; pub const CLUSPROP_IPADDR_ENABLENETBIOS_ENABLED = CLUSPROP_IPADDR_ENABLENETBIOS.ENABLED; pub const CLUSPROP_IPADDR_ENABLENETBIOS_TRACK_NIC = CLUSPROP_IPADDR_ENABLENETBIOS.TRACK_NIC; pub const FILESHARE_CHANGE_ENUM = enum(i32) { NONE = 0, ADD = 1, DEL = 2, MODIFY = 3, }; pub const FILESHARE_CHANGE_NONE = FILESHARE_CHANGE_ENUM.NONE; pub const FILESHARE_CHANGE_ADD = FILESHARE_CHANGE_ENUM.ADD; pub const FILESHARE_CHANGE_DEL = FILESHARE_CHANGE_ENUM.DEL; pub const FILESHARE_CHANGE_MODIFY = FILESHARE_CHANGE_ENUM.MODIFY; pub const FILESHARE_CHANGE = extern struct { Change: FILESHARE_CHANGE_ENUM, ShareName: [84]u16, }; pub const FILESHARE_CHANGE_LIST = extern struct { NumEntries: u32, ChangeEntry: [1]FILESHARE_CHANGE, }; pub const CLUSCTL_GROUP_GET_LAST_MOVE_TIME_OUTPUT = extern struct { GetTickCount64: u64, GetSystemTime: SYSTEMTIME, NodeId: u32, }; pub const CLUSPROP_BUFFER_HELPER = extern union { pb: ?*u8, pw: ?*u16, pdw: ?*u32, pl: ?*i32, psz: ?PWSTR, pList: ?*CLUSPROP_LIST, pSyntax: ?*CLUSPROP_SYNTAX, pName: ?*CLUSPROP_SZ, pValue: ?*CLUSPROP_VALUE, pBinaryValue: ?*CLUSPROP_BINARY, pWordValue: ?*CLUSPROP_WORD, pDwordValue: ?*CLUSPROP_DWORD, pLongValue: ?*CLUSPROP_LONG, pULargeIntegerValue: ?*CLUSPROP_ULARGE_INTEGER, pLargeIntegerValue: ?*CLUSPROP_LARGE_INTEGER, pStringValue: ?*CLUSPROP_SZ, pMultiSzValue: ?*CLUSPROP_SZ, pSecurityDescriptor: ?*CLUSPROP_SECURITY_DESCRIPTOR, pResourceClassValue: ?*CLUSPROP_RESOURCE_CLASS, pResourceClassInfoValue: ?*CLUSPROP_RESOURCE_CLASS_INFO, pDiskSignatureValue: ?*CLUSPROP_DWORD, pScsiAddressValue: ?*CLUSPROP_SCSI_ADDRESS, pDiskNumberValue: ?*CLUSPROP_DWORD, pPartitionInfoValue: ?*CLUSPROP_PARTITION_INFO, pRequiredDependencyValue: ?*CLUSPROP_REQUIRED_DEPENDENCY, pPartitionInfoValueEx: ?*CLUSPROP_PARTITION_INFO_EX, pPartitionInfoValueEx2: ?*CLUSPROP_PARTITION_INFO_EX2, pFileTimeValue: ?*CLUSPROP_FILETIME, }; pub const CLUSTER_RESOURCE_ENUM = enum(i32) { DEPENDS = 1, PROVIDES = 2, NODES = 4, ALL = 7, }; pub const CLUSTER_RESOURCE_ENUM_DEPENDS = CLUSTER_RESOURCE_ENUM.DEPENDS; pub const CLUSTER_RESOURCE_ENUM_PROVIDES = CLUSTER_RESOURCE_ENUM.PROVIDES; pub const CLUSTER_RESOURCE_ENUM_NODES = CLUSTER_RESOURCE_ENUM.NODES; pub const CLUSTER_RESOURCE_ENUM_ALL = CLUSTER_RESOURCE_ENUM.ALL; pub const CLUSTER_RESOURCE_TYPE_ENUM = enum(i32) { NODES = 1, RESOURCES = 2, ALL = 3, }; pub const CLUSTER_RESOURCE_TYPE_ENUM_NODES = CLUSTER_RESOURCE_TYPE_ENUM.NODES; pub const CLUSTER_RESOURCE_TYPE_ENUM_RESOURCES = CLUSTER_RESOURCE_TYPE_ENUM.RESOURCES; pub const CLUSTER_RESOURCE_TYPE_ENUM_ALL = CLUSTER_RESOURCE_TYPE_ENUM.ALL; pub const PCLUSAPI_CLUSTER_RESOURCE_OPEN_ENUM = fn( hResource: ?*_HRESOURCE, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESENUM; pub const PCLUSAPI_CLUSTER_RESOURCE_GET_ENUM_COUNT = fn( hResEnum: ?*_HRESENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_ENUM = fn( hResEnum: ?*_HRESENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_CLOSE_ENUM = fn( hResEnum: ?*_HRESENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CREATE_CLUSTER_RESOURCE_TYPE = fn( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, lpszDisplayName: ?[*:0]const u16, lpszResourceTypeDll: ?[*:0]const u16, dwLooksAlivePollInterval: u32, dwIsAlivePollInterval: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_DELETE_CLUSTER_RESOURCE_TYPE = fn( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_TYPE_OPEN_ENUM = fn( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESTYPEENUM; pub const PCLUSAPI_CLUSTER_RESOURCE_TYPE_GET_ENUM_COUNT = fn( hResTypeEnum: ?*_HRESTYPEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_TYPE_ENUM = fn( hResTypeEnum: ?*_HRESTYPEENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_RESOURCE_TYPE_CLOSE_ENUM = fn( hResTypeEnum: ?*_HRESTYPEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_NETWORK_ENUM = enum(i32) { NETINTERFACES = 1, // ALL = 1, this enum value conflicts with NETINTERFACES }; pub const CLUSTER_NETWORK_ENUM_NETINTERFACES = CLUSTER_NETWORK_ENUM.NETINTERFACES; pub const CLUSTER_NETWORK_ENUM_ALL = CLUSTER_NETWORK_ENUM.NETINTERFACES; pub const CLUSTER_NETWORK_STATE = enum(i32) { StateUnknown = -1, Unavailable = 0, Down = 1, Partitioned = 2, Up = 3, }; pub const ClusterNetworkStateUnknown = CLUSTER_NETWORK_STATE.StateUnknown; pub const ClusterNetworkUnavailable = CLUSTER_NETWORK_STATE.Unavailable; pub const ClusterNetworkDown = CLUSTER_NETWORK_STATE.Down; pub const ClusterNetworkPartitioned = CLUSTER_NETWORK_STATE.Partitioned; pub const ClusterNetworkUp = CLUSTER_NETWORK_STATE.Up; pub const CLUSTER_NETWORK_ROLE = enum(i32) { None = 0, InternalUse = 1, ClientAccess = 2, InternalAndClient = 3, }; pub const ClusterNetworkRoleNone = CLUSTER_NETWORK_ROLE.None; pub const ClusterNetworkRoleInternalUse = CLUSTER_NETWORK_ROLE.InternalUse; pub const ClusterNetworkRoleClientAccess = CLUSTER_NETWORK_ROLE.ClientAccess; pub const ClusterNetworkRoleInternalAndClient = CLUSTER_NETWORK_ROLE.InternalAndClient; pub const PCLUSAPI_OPEN_CLUSTER_NETWORK = fn( hCluster: ?*_HCLUSTER, lpszNetworkName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORK; pub const PCLUSAPI_OPEN_CLUSTER_NETWORK_EX = fn( hCluster: ?*_HCLUSTER, lpszNetworkName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORK; pub const PCLUSAPI_CLOSE_CLUSTER_NETWORK = fn( hNetwork: ?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_GET_CLUSTER_FROM_NETWORK = fn( hNetwork: ?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_CLUSTER_NETWORK_OPEN_ENUM = fn( hNetwork: ?*_HNETWORK, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORKENUM; pub const PCLUSAPI_CLUSTER_NETWORK_GET_ENUM_COUNT = fn( hNetworkEnum: ?*_HNETWORKENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NETWORK_ENUM = fn( hNetworkEnum: ?*_HNETWORKENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NETWORK_CLOSE_ENUM = fn( hNetworkEnum: ?*_HNETWORKENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_NETWORK_STATE = fn( hNetwork: ?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_NETWORK_STATE; pub const PCLUSAPI_SET_CLUSTER_NETWORK_NAME = fn( hNetwork: ?*_HNETWORK, lpszName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_NETWORK_ID = fn( hNetwork: ?*_HNETWORK, lpszNetworkId: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_NETWORK_CONTROL = fn( hNetwork: ?*_HNETWORK, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_NETINTERFACE_STATE = enum(i32) { StateUnknown = -1, Unavailable = 0, Failed = 1, Unreachable = 2, Up = 3, }; pub const ClusterNetInterfaceStateUnknown = CLUSTER_NETINTERFACE_STATE.StateUnknown; pub const ClusterNetInterfaceUnavailable = CLUSTER_NETINTERFACE_STATE.Unavailable; pub const ClusterNetInterfaceFailed = CLUSTER_NETINTERFACE_STATE.Failed; pub const ClusterNetInterfaceUnreachable = CLUSTER_NETINTERFACE_STATE.Unreachable; pub const ClusterNetInterfaceUp = CLUSTER_NETINTERFACE_STATE.Up; pub const PCLUSAPI_OPEN_CLUSTER_NET_INTERFACE = fn( hCluster: ?*_HCLUSTER, lpszInterfaceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETINTERFACE; pub const PCLUSAPI_OPEN_CLUSTER_NETINTERFACE_EX = fn( hCluster: ?*_HCLUSTER, lpszNetInterfaceName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETINTERFACE; pub const PCLUSAPI_GET_CLUSTER_NET_INTERFACE = fn( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, lpszNetworkName: ?[*:0]const u16, lpszInterfaceName: ?[*:0]u16, lpcchInterfaceName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLOSE_CLUSTER_NET_INTERFACE = fn( hNetInterface: ?*_HNETINTERFACE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_GET_CLUSTER_FROM_NET_INTERFACE = fn( hNetInterface: ?*_HNETINTERFACE, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_GET_CLUSTER_NET_INTERFACE_STATE = fn( hNetInterface: ?*_HNETINTERFACE, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_NETINTERFACE_STATE; pub const PCLUSAPI_CLUSTER_NET_INTERFACE_CONTROL = fn( hNetInterface: ?*_HNETINTERFACE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_GET_CLUSTER_KEY = fn( hCluster: ?*_HCLUSTER, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const PCLUSAPI_GET_CLUSTER_GROUP_KEY = fn( hGroup: ?*_HGROUP, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const PCLUSAPI_GET_CLUSTER_RESOURCE_KEY = fn( hResource: ?*_HRESOURCE, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const PCLUSAPI_GET_CLUSTER_NODE_KEY = fn( hNode: ?*_HNODE, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const PCLUSAPI_GET_CLUSTER_NETWORK_KEY = fn( hNetwork: ?*_HNETWORK, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const PCLUSAPI_GET_CLUSTER_NET_INTERFACE_KEY = fn( hNetInterface: ?*_HNETINTERFACE, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; pub const PCLUSAPI_CLUSTER_REG_CREATE_KEY = fn( hKey: ?HKEY, lpszSubKey: ?[*:0]const u16, dwOptions: u32, samDesired: u32, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES, phkResult: ?*?HKEY, lpdwDisposition: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_OPEN_KEY = fn( hKey: ?HKEY, lpszSubKey: ?[*:0]const u16, samDesired: u32, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_DELETE_KEY = fn( hKey: ?HKEY, lpszSubKey: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_CLOSE_KEY = fn( hKey: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_ENUM_KEY = fn( hKey: ?HKEY, dwIndex: u32, lpszName: [*:0]u16, lpcchName: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_SET_VALUE = fn( hKey: ?HKEY, lpszValueName: ?[*:0]const u16, dwType: u32, lpData: ?*const u8, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_REG_DELETE_VALUE = fn( hKey: ?HKEY, lpszValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_REG_QUERY_VALUE = fn( hKey: ?HKEY, lpszValueName: ?[*:0]const u16, lpdwValueType: ?*u32, // TODO: what to do with BytesParamIndex 4? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_ENUM_VALUE = fn( hKey: ?HKEY, dwIndex: u32, lpszValueName: [*:0]u16, lpcchValueName: ?*u32, lpdwType: ?*u32, // TODO: what to do with BytesParamIndex 6? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUSTER_REG_QUERY_INFO_KEY = fn( hKey: ?HKEY, lpcSubKeys: ?*u32, lpcbMaxSubKeyLen: ?*u32, lpcValues: ?*u32, lpcbMaxValueNameLen: ?*u32, lpcbMaxValueLen: ?*u32, lpcbSecurityDescriptor: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_GET_KEY_SECURITY = fn( hKey: ?HKEY, RequestedInformation: u32, // TODO: what to do with BytesParamIndex 3? pSecurityDescriptor: ?*SECURITY_DESCRIPTOR, lpcbSecurityDescriptor: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_SET_KEY_SECURITY = fn( hKey: ?HKEY, SecurityInformation: u32, pSecurityDescriptor: ?*SECURITY_DESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_SYNC_DATABASE = fn( hCluster: ?*_HCLUSTER, flags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSAPI_CLUSTER_REG_CREATE_BATCH = fn( hKey: ?HKEY, pHREGBATCH: ?*?*_HREGBATCH, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_BATCH_ADD_COMMAND = fn( hRegBatch: ?*_HREGBATCH, dwCommand: CLUSTER_REG_COMMAND, wzName: ?PWSTR, dwOptions: u32, // TODO: what to do with BytesParamIndex 5? lpData: ?*const anyopaque, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CLOSE_BATCH = fn( hRegBatch: ?*_HREGBATCH, bCommit: BOOL, failedCommandNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_BATCH_READ_COMMAND = fn( hBatchNotification: ?*_HREGBATCHNOTIFICATION, pBatchCommand: ?*CLUSTER_BATCH_COMMAND, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_BATCH_CLOSE_NOTIFICATION = fn( hBatchNotification: ?*_HREGBATCHNOTIFICATION, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CREATE_BATCH_NOTIFY_PORT = fn( hKey: ?HKEY, phBatchNotifyPort: ?*?*_HREGBATCHPORT, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CLOSE_BATCH_NOTIFY_PORT = fn( hBatchNotifyPort: ?*_HREGBATCHPORT, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_GET_BATCH_NOTIFICATION = fn( hBatchNotify: ?*_HREGBATCHPORT, phBatchNotification: ?*?*_HREGBATCHNOTIFICATION, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CREATE_READ_BATCH = fn( hKey: ?HKEY, phRegReadBatch: ?*?*_HREGREADBATCH, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_READ_BATCH_ADD_COMMAND = fn( hRegReadBatch: ?*_HREGREADBATCH, wzSubkeyName: ?[*:0]const u16, wzValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CLOSE_READ_BATCH = fn( hRegReadBatch: ?*_HREGREADBATCH, phRegReadBatchReply: ?*?*_HREGREADBATCHREPLY, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CLOSE_READ_BATCH_EX = fn( hRegReadBatch: ?*_HREGREADBATCH, flags: u32, phRegReadBatchReply: ?*?*_HREGREADBATCHREPLY, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_READ_BATCH_REPLY_NEXT_COMMAND = fn( hRegReadBatchReply: ?*_HREGREADBATCHREPLY, pBatchCommand: ?*CLUSTER_READ_BATCH_COMMAND, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_REG_CLOSE_READ_BATCH_REPLY = fn( hRegReadBatchReply: ?*_HREGREADBATCHREPLY, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PCLUSTER_SET_ACCOUNT_ACCESS = fn( hCluster: ?*_HCLUSTER, szAccountSID: ?[*:0]const u16, dwAccess: u32, dwControlType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_SETUP_PHASE = enum(i32) { Initialize = 1, ValidateNodeState = 100, ValidateNetft = 102, ValidateClusDisk = 103, ConfigureClusSvc = 104, StartingClusSvc = 105, QueryClusterNameAccount = 106, ValidateClusterNameAccount = 107, CreateClusterAccount = 108, ConfigureClusterAccount = 109, FormingCluster = 200, AddClusterProperties = 201, CreateResourceTypes = 202, CreateGroups = 203, CreateIPAddressResources = 204, CreateNetworkName = 205, ClusterGroupOnline = 206, GettingCurrentMembership = 300, AddNodeToCluster = 301, NodeUp = 302, MoveGroup = 400, DeleteGroup = 401, CleanupCOs = 402, OfflineGroup = 403, EvictNode = 404, CleanupNode = 405, CoreGroupCleanup = 406, FailureCleanup = 999, }; pub const ClusterSetupPhaseInitialize = CLUSTER_SETUP_PHASE.Initialize; pub const ClusterSetupPhaseValidateNodeState = CLUSTER_SETUP_PHASE.ValidateNodeState; pub const ClusterSetupPhaseValidateNetft = CLUSTER_SETUP_PHASE.ValidateNetft; pub const ClusterSetupPhaseValidateClusDisk = CLUSTER_SETUP_PHASE.ValidateClusDisk; pub const ClusterSetupPhaseConfigureClusSvc = CLUSTER_SETUP_PHASE.ConfigureClusSvc; pub const ClusterSetupPhaseStartingClusSvc = CLUSTER_SETUP_PHASE.StartingClusSvc; pub const ClusterSetupPhaseQueryClusterNameAccount = CLUSTER_SETUP_PHASE.QueryClusterNameAccount; pub const ClusterSetupPhaseValidateClusterNameAccount = CLUSTER_SETUP_PHASE.ValidateClusterNameAccount; pub const ClusterSetupPhaseCreateClusterAccount = CLUSTER_SETUP_PHASE.CreateClusterAccount; pub const ClusterSetupPhaseConfigureClusterAccount = CLUSTER_SETUP_PHASE.ConfigureClusterAccount; pub const ClusterSetupPhaseFormingCluster = CLUSTER_SETUP_PHASE.FormingCluster; pub const ClusterSetupPhaseAddClusterProperties = CLUSTER_SETUP_PHASE.AddClusterProperties; pub const ClusterSetupPhaseCreateResourceTypes = CLUSTER_SETUP_PHASE.CreateResourceTypes; pub const ClusterSetupPhaseCreateGroups = CLUSTER_SETUP_PHASE.CreateGroups; pub const ClusterSetupPhaseCreateIPAddressResources = CLUSTER_SETUP_PHASE.CreateIPAddressResources; pub const ClusterSetupPhaseCreateNetworkName = CLUSTER_SETUP_PHASE.CreateNetworkName; pub const ClusterSetupPhaseClusterGroupOnline = CLUSTER_SETUP_PHASE.ClusterGroupOnline; pub const ClusterSetupPhaseGettingCurrentMembership = CLUSTER_SETUP_PHASE.GettingCurrentMembership; pub const ClusterSetupPhaseAddNodeToCluster = CLUSTER_SETUP_PHASE.AddNodeToCluster; pub const ClusterSetupPhaseNodeUp = CLUSTER_SETUP_PHASE.NodeUp; pub const ClusterSetupPhaseMoveGroup = CLUSTER_SETUP_PHASE.MoveGroup; pub const ClusterSetupPhaseDeleteGroup = CLUSTER_SETUP_PHASE.DeleteGroup; pub const ClusterSetupPhaseCleanupCOs = CLUSTER_SETUP_PHASE.CleanupCOs; pub const ClusterSetupPhaseOfflineGroup = CLUSTER_SETUP_PHASE.OfflineGroup; pub const ClusterSetupPhaseEvictNode = CLUSTER_SETUP_PHASE.EvictNode; pub const ClusterSetupPhaseCleanupNode = CLUSTER_SETUP_PHASE.CleanupNode; pub const ClusterSetupPhaseCoreGroupCleanup = CLUSTER_SETUP_PHASE.CoreGroupCleanup; pub const ClusterSetupPhaseFailureCleanup = CLUSTER_SETUP_PHASE.FailureCleanup; pub const CLUSTER_SETUP_PHASE_TYPE = enum(i32) { Start = 1, Continue = 2, End = 3, Report = 4, }; pub const ClusterSetupPhaseStart = CLUSTER_SETUP_PHASE_TYPE.Start; pub const ClusterSetupPhaseContinue = CLUSTER_SETUP_PHASE_TYPE.Continue; pub const ClusterSetupPhaseEnd = CLUSTER_SETUP_PHASE_TYPE.End; pub const ClusterSetupPhaseReport = CLUSTER_SETUP_PHASE_TYPE.Report; pub const CLUSTER_SETUP_PHASE_SEVERITY = enum(i32) { Informational = 1, Warning = 2, Fatal = 3, }; pub const ClusterSetupPhaseInformational = CLUSTER_SETUP_PHASE_SEVERITY.Informational; pub const ClusterSetupPhaseWarning = CLUSTER_SETUP_PHASE_SEVERITY.Warning; pub const ClusterSetupPhaseFatal = CLUSTER_SETUP_PHASE_SEVERITY.Fatal; pub const PCLUSTER_SETUP_PROGRESS_CALLBACK = fn( pvCallbackArg: ?*anyopaque, eSetupPhase: CLUSTER_SETUP_PHASE, ePhaseType: CLUSTER_SETUP_PHASE_TYPE, ePhaseSeverity: CLUSTER_SETUP_PHASE_SEVERITY, dwPercentComplete: u32, lpszObjectName: ?[*:0]const u16, dwStatus: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_CREATE_CLUSTER = fn( pConfig: ?*CREATE_CLUSTER_CONFIG, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_CREATE_CLUSTER_CNOLESS = fn( pConfig: ?*CREATE_CLUSTER_CONFIG, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; pub const PCLUSAPI_CREATE_CLUSTER_NAME_ACCOUNT = fn( hCluster: ?*_HCLUSTER, pConfig: ?*CREATE_CLUSTER_NAME_ACCOUNT, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_REMOVE_CLUSTER_NAME_ACCOUNT = fn( hCluster: ?*_HCLUSTER, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_ADD_CLUSTER_NODE = fn( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub const PCLUSAPI_ADD_CLUSTER_NODE_EX = fn( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, dwFlags: u32, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub const PCLUSAPI_DESTROY_CLUSTER = fn( hCluster: ?*_HCLUSTER, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, fdeleteVirtualComputerObjects: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PLACEMENT_OPTIONS = enum(i32) { MIN_VALUE = 0, // DEFAULT_PLACEMENT_OPTIONS = 0, this enum value conflicts with MIN_VALUE DISABLE_CSV_VM_DEPENDENCY = 1, CONSIDER_OFFLINE_VMS = 2, DONT_USE_MEMORY = 4, DONT_USE_CPU = 8, DONT_USE_LOCAL_TEMP_DISK = 16, DONT_RESUME_VMS_WITH_EXISTING_TEMP_DISK = 32, SAVE_VMS_WITH_LOCAL_DISK_ON_DRAIN_OVERWRITE = 64, DONT_RESUME_AVAILABILTY_SET_VMS_WITH_EXISTING_TEMP_DISK = 128, SAVE_AVAILABILTY_SET_VMS_WITH_LOCAL_DISK_ON_DRAIN_OVERWRITE = 256, AVAILABILITY_SET_DOMAIN_AFFINITY = 512, ALL = 1023, }; pub const PLACEMENT_OPTIONS_MIN_VALUE = PLACEMENT_OPTIONS.MIN_VALUE; pub const PLACEMENT_OPTIONS_DEFAULT_PLACEMENT_OPTIONS = PLACEMENT_OPTIONS.MIN_VALUE; pub const PLACEMENT_OPTIONS_DISABLE_CSV_VM_DEPENDENCY = PLACEMENT_OPTIONS.DISABLE_CSV_VM_DEPENDENCY; pub const PLACEMENT_OPTIONS_CONSIDER_OFFLINE_VMS = PLACEMENT_OPTIONS.CONSIDER_OFFLINE_VMS; pub const PLACEMENT_OPTIONS_DONT_USE_MEMORY = PLACEMENT_OPTIONS.DONT_USE_MEMORY; pub const PLACEMENT_OPTIONS_DONT_USE_CPU = PLACEMENT_OPTIONS.DONT_USE_CPU; pub const PLACEMENT_OPTIONS_DONT_USE_LOCAL_TEMP_DISK = PLACEMENT_OPTIONS.DONT_USE_LOCAL_TEMP_DISK; pub const PLACEMENT_OPTIONS_DONT_RESUME_VMS_WITH_EXISTING_TEMP_DISK = PLACEMENT_OPTIONS.DONT_RESUME_VMS_WITH_EXISTING_TEMP_DISK; pub const PLACEMENT_OPTIONS_SAVE_VMS_WITH_LOCAL_DISK_ON_DRAIN_OVERWRITE = PLACEMENT_OPTIONS.SAVE_VMS_WITH_LOCAL_DISK_ON_DRAIN_OVERWRITE; pub const PLACEMENT_OPTIONS_DONT_RESUME_AVAILABILTY_SET_VMS_WITH_EXISTING_TEMP_DISK = PLACEMENT_OPTIONS.DONT_RESUME_AVAILABILTY_SET_VMS_WITH_EXISTING_TEMP_DISK; pub const PLACEMENT_OPTIONS_SAVE_AVAILABILTY_SET_VMS_WITH_LOCAL_DISK_ON_DRAIN_OVERWRITE = PLACEMENT_OPTIONS.SAVE_AVAILABILTY_SET_VMS_WITH_LOCAL_DISK_ON_DRAIN_OVERWRITE; pub const PLACEMENT_OPTIONS_AVAILABILITY_SET_DOMAIN_AFFINITY = PLACEMENT_OPTIONS.AVAILABILITY_SET_DOMAIN_AFFINITY; pub const PLACEMENT_OPTIONS_ALL = PLACEMENT_OPTIONS.ALL; pub const GRP_PLACEMENT_OPTIONS = enum(i32) { MIN_VALUE = 0, // DEFAULT = 0, this enum value conflicts with MIN_VALUE DISABLE_AUTOBALANCING = 1, // ALL = 1, this enum value conflicts with DISABLE_AUTOBALANCING }; pub const GRP_PLACEMENT_OPTIONS_MIN_VALUE = GRP_PLACEMENT_OPTIONS.MIN_VALUE; pub const GRP_PLACEMENT_OPTIONS_DEFAULT = GRP_PLACEMENT_OPTIONS.MIN_VALUE; pub const GRP_PLACEMENT_OPTIONS_DISABLE_AUTOBALANCING = GRP_PLACEMENT_OPTIONS.DISABLE_AUTOBALANCING; pub const GRP_PLACEMENT_OPTIONS_ALL = GRP_PLACEMENT_OPTIONS.DISABLE_AUTOBALANCING; pub const SR_RESOURCE_TYPE_REPLICATED_PARTITION_INFO = extern struct { PartitionOffset: u64, Capabilities: u32, }; pub const SR_RESOURCE_TYPE_REPLICATED_PARTITION_ARRAY = extern struct { Count: u32, PartitionArray: [1]SR_RESOURCE_TYPE_REPLICATED_PARTITION_INFO, }; pub const SR_REPLICATED_DISK_TYPE = enum(i32) { None = 0, Source = 1, LogSource = 2, Destination = 3, LogDestination = 4, NotInParthership = 5, LogNotInParthership = 6, Other = 7, }; pub const SrReplicatedDiskTypeNone = SR_REPLICATED_DISK_TYPE.None; pub const SrReplicatedDiskTypeSource = SR_REPLICATED_DISK_TYPE.Source; pub const SrReplicatedDiskTypeLogSource = SR_REPLICATED_DISK_TYPE.LogSource; pub const SrReplicatedDiskTypeDestination = SR_REPLICATED_DISK_TYPE.Destination; pub const SrReplicatedDiskTypeLogDestination = SR_REPLICATED_DISK_TYPE.LogDestination; pub const SrReplicatedDiskTypeNotInParthership = SR_REPLICATED_DISK_TYPE.NotInParthership; pub const SrReplicatedDiskTypeLogNotInParthership = SR_REPLICATED_DISK_TYPE.LogNotInParthership; pub const SrReplicatedDiskTypeOther = SR_REPLICATED_DISK_TYPE.Other; pub const SR_DISK_REPLICATION_ELIGIBLE = enum(i32) { None = 0, Yes = 1, Offline = 2, NotGpt = 3, PartitionLayoutMismatch = 4, InsufficientFreeSpace = 5, NotInSameSite = 6, InSameSite = 7, FileSystemNotSupported = 8, AlreadyInReplication = 9, SameAsSpecifiedDisk = 10, Other = 9999, }; pub const SrDiskReplicationEligibleNone = SR_DISK_REPLICATION_ELIGIBLE.None; pub const SrDiskReplicationEligibleYes = SR_DISK_REPLICATION_ELIGIBLE.Yes; pub const SrDiskReplicationEligibleOffline = SR_DISK_REPLICATION_ELIGIBLE.Offline; pub const SrDiskReplicationEligibleNotGpt = SR_DISK_REPLICATION_ELIGIBLE.NotGpt; pub const SrDiskReplicationEligiblePartitionLayoutMismatch = SR_DISK_REPLICATION_ELIGIBLE.PartitionLayoutMismatch; pub const SrDiskReplicationEligibleInsufficientFreeSpace = SR_DISK_REPLICATION_ELIGIBLE.InsufficientFreeSpace; pub const SrDiskReplicationEligibleNotInSameSite = SR_DISK_REPLICATION_ELIGIBLE.NotInSameSite; pub const SrDiskReplicationEligibleInSameSite = SR_DISK_REPLICATION_ELIGIBLE.InSameSite; pub const SrDiskReplicationEligibleFileSystemNotSupported = SR_DISK_REPLICATION_ELIGIBLE.FileSystemNotSupported; pub const SrDiskReplicationEligibleAlreadyInReplication = SR_DISK_REPLICATION_ELIGIBLE.AlreadyInReplication; pub const SrDiskReplicationEligibleSameAsSpecifiedDisk = SR_DISK_REPLICATION_ELIGIBLE.SameAsSpecifiedDisk; pub const SrDiskReplicationEligibleOther = SR_DISK_REPLICATION_ELIGIBLE.Other; pub const SR_RESOURCE_TYPE_QUERY_ELIGIBLE_LOGDISKS = extern struct { DataDiskGuid: Guid, IncludeOfflineDisks: BOOLEAN, }; pub const SR_RESOURCE_TYPE_QUERY_ELIGIBLE_TARGET_DATADISKS = extern struct { SourceDataDiskGuid: Guid, TargetReplicationGroupGuid: Guid, SkipConnectivityCheck: BOOLEAN, IncludeOfflineDisks: BOOLEAN, }; pub const SR_RESOURCE_TYPE_QUERY_ELIGIBLE_SOURCE_DATADISKS = extern struct { DataDiskGuid: Guid, IncludeAvailableStoargeDisks: BOOLEAN, }; pub const SR_RESOURCE_TYPE_DISK_INFO = extern struct { Reason: SR_DISK_REPLICATION_ELIGIBLE, DiskGuid: Guid, }; pub const SR_RESOURCE_TYPE_ELIGIBLE_DISKS_RESULT = extern struct { Count: u16, DiskInfo: [1]SR_RESOURCE_TYPE_DISK_INFO, }; pub const SR_RESOURCE_TYPE_REPLICATED_DISK = extern struct { Type: SR_REPLICATED_DISK_TYPE, ClusterDiskResourceGuid: Guid, ReplicationGroupId: Guid, ReplicationGroupName: [260]u16, }; pub const SR_RESOURCE_TYPE_REPLICATED_DISKS_RESULT = extern struct { Count: u16, ReplicatedDisks: [1]SR_RESOURCE_TYPE_REPLICATED_DISK, }; pub const SR_RESOURCE_TYPE_ADD_REPLICATION_GROUP = extern struct { ReplicationGroupName: [260]u16, Description: [260]u16, LogPath: [260]u16, MaxLogSizeInBytes: u64, LogType: u16, ReplicationMode: u32, MinimumPartnersInSync: u32, EnableWriteConsistency: BOOLEAN, EnableEncryption: BOOLEAN, CertificateThumbprint: [260]u16, VolumeNameCount: u32, VolumeNames: [260]u16, }; pub const SR_RESOURCE_TYPE_ADD_REPLICATION_GROUP_RESULT = extern struct { Result: u32, ErrorString: [260]u16, }; pub const CLUSCTL_RESOURCE_TYPE_STORAGE_GET_AVAILABLE_DISKS_EX2_INPUT = extern struct { dwFlags: u32, guidPoolFilter: Guid, }; pub const RESOURCE_STATUS = extern struct { ResourceState: CLUSTER_RESOURCE_STATE, CheckPoint: u32, WaitHint: u32, EventHandle: ?HANDLE, }; pub const NodeUtilizationInfoElement = extern struct { Id: u64, AvailableMemory: u64, AvailableMemoryAfterReclamation: u64, }; pub const ResourceUtilizationInfoElement = extern struct { PhysicalNumaId: u64, CurrentMemory: u64, }; pub const VM_RESDLL_CONTEXT = enum(i32) { TurnOff = 0, Save = 1, Shutdown = 2, ShutdownForce = 3, LiveMigration = 4, }; pub const VmResdllContextTurnOff = VM_RESDLL_CONTEXT.TurnOff; pub const VmResdllContextSave = VM_RESDLL_CONTEXT.Save; pub const VmResdllContextShutdown = VM_RESDLL_CONTEXT.Shutdown; pub const VmResdllContextShutdownForce = VM_RESDLL_CONTEXT.ShutdownForce; pub const VmResdllContextLiveMigration = VM_RESDLL_CONTEXT.LiveMigration; pub const RESDLL_CONTEXT_OPERATION_TYPE = enum(i32) { Failback = 0, Drain = 1, DrainFailure = 2, EmbeddedFailure = 3, Preemption = 4, NetworkDisconnect = 5, NetworkDisconnectMoveRetry = 6, }; pub const ResdllContextOperationTypeFailback = RESDLL_CONTEXT_OPERATION_TYPE.Failback; pub const ResdllContextOperationTypeDrain = RESDLL_CONTEXT_OPERATION_TYPE.Drain; pub const ResdllContextOperationTypeDrainFailure = RESDLL_CONTEXT_OPERATION_TYPE.DrainFailure; pub const ResdllContextOperationTypeEmbeddedFailure = RESDLL_CONTEXT_OPERATION_TYPE.EmbeddedFailure; pub const ResdllContextOperationTypePreemption = RESDLL_CONTEXT_OPERATION_TYPE.Preemption; pub const ResdllContextOperationTypeNetworkDisconnect = RESDLL_CONTEXT_OPERATION_TYPE.NetworkDisconnect; pub const ResdllContextOperationTypeNetworkDisconnectMoveRetry = RESDLL_CONTEXT_OPERATION_TYPE.NetworkDisconnectMoveRetry; pub const GET_OPERATION_CONTEXT_PARAMS = extern struct { Size: u32, Version: u32, Type: RESDLL_CONTEXT_OPERATION_TYPE, Priority: u32, }; pub const RESOURCE_STATUS_EX = extern struct { ResourceState: CLUSTER_RESOURCE_STATE, CheckPoint: u32, EventHandle: ?HANDLE, ApplicationSpecificErrorCode: u32, Flags: u32, WaitHint: u32, }; pub const PSET_RESOURCE_STATUS_ROUTINE_EX = fn( ResourceHandle: isize, ResourceStatus: ?*RESOURCE_STATUS_EX, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PSET_RESOURCE_STATUS_ROUTINE = fn( ResourceHandle: isize, ResourceStatus: ?*RESOURCE_STATUS, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PQUORUM_RESOURCE_LOST = fn( Resource: isize, ) callconv(@import("std").os.windows.WINAPI) void; pub const LOG_LEVEL = enum(i32) { INFORMATION = 0, WARNING = 1, ERROR = 2, SEVERE = 3, }; pub const LOG_INFORMATION = LOG_LEVEL.INFORMATION; pub const LOG_WARNING = LOG_LEVEL.WARNING; pub const LOG_ERROR = LOG_LEVEL.ERROR; pub const LOG_SEVERE = LOG_LEVEL.SEVERE; pub const PLOG_EVENT_ROUTINE = fn( ResourceHandle: isize, LogLevel: LOG_LEVEL, FormatString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) void; pub const POPEN_ROUTINE = fn( ResourceName: ?[*:0]const u16, ResourceKey: ?HKEY, ResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; pub const PCLOSE_ROUTINE = fn( Resource: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PONLINE_ROUTINE = fn( Resource: ?*anyopaque, EventHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const POFFLINE_ROUTINE = fn( Resource: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PTERMINATE_ROUTINE = fn( Resource: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const PIS_ALIVE_ROUTINE = fn( Resource: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PLOOKS_ALIVE_ROUTINE = fn( Resource: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PARBITRATE_ROUTINE = fn( Resource: ?*anyopaque, LostQuorumResource: ?PQUORUM_RESOURCE_LOST, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRELEASE_ROUTINE = fn( Resource: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESOURCE_CONTROL_ROUTINE = fn( Resource: ?*anyopaque, ControlCode: u32, InBuffer: ?*anyopaque, InBufferSize: u32, OutBuffer: ?*anyopaque, OutBufferSize: u32, BytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESOURCE_TYPE_CONTROL_ROUTINE = fn( ResourceTypeName: ?[*:0]const u16, ControlCode: u32, InBuffer: ?*anyopaque, InBufferSize: u32, OutBuffer: ?*anyopaque, OutBufferSize: u32, BytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const POPEN_V2_ROUTINE = fn( ResourceName: ?[*:0]const u16, ResourceKey: ?HKEY, ResourceHandle: isize, OpenFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; pub const PONLINE_V2_ROUTINE = fn( Resource: ?*anyopaque, EventHandle: ?*?HANDLE, OnlineFlags: u32, // TODO: what to do with BytesParamIndex 4? InBuffer: ?*u8, InBufferSize: u32, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const POFFLINE_V2_ROUTINE = fn( Resource: ?*anyopaque, DestinationNodeName: ?[*:0]const u16, OfflineFlags: u32, // TODO: what to do with BytesParamIndex 4? InBuffer: ?*u8, InBufferSize: u32, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCANCEL_ROUTINE = fn( Resource: ?*anyopaque, CancelFlags_RESERVED: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PBEGIN_RESCALL_ROUTINE = fn( Resource: ?*anyopaque, ControlCode: u32, InBuffer: ?*anyopaque, InBufferSize: u32, OutBuffer: ?*anyopaque, OutBufferSize: u32, BytesReturned: ?*u32, context: i64, ReturnedAsynchronously: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PBEGIN_RESTYPECALL_ROUTINE = fn( ResourceTypeName: ?[*:0]const u16, ControlCode: u32, InBuffer: ?*anyopaque, InBufferSize: u32, OutBuffer: ?*anyopaque, OutBufferSize: u32, BytesReturned: ?*u32, context: i64, ReturnedAsynchronously: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const RESOURCE_EXIT_STATE = enum(i32) { Continue = 0, Terminate = 1, Max = 2, }; pub const ResourceExitStateContinue = RESOURCE_EXIT_STATE.Continue; pub const ResourceExitStateTerminate = RESOURCE_EXIT_STATE.Terminate; pub const ResourceExitStateMax = RESOURCE_EXIT_STATE.Max; pub const PBEGIN_RESCALL_AS_USER_ROUTINE = fn( Resource: ?*anyopaque, TokenHandle: ?HANDLE, ControlCode: u32, InBuffer: ?*anyopaque, InBufferSize: u32, OutBuffer: ?*anyopaque, OutBufferSize: u32, BytesReturned: ?*u32, context: i64, ReturnedAsynchronously: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PBEGIN_RESTYPECALL_AS_USER_ROUTINE = fn( ResourceTypeName: ?[*:0]const u16, TokenHandle: ?HANDLE, ControlCode: u32, InBuffer: ?*anyopaque, InBufferSize: u32, OutBuffer: ?*anyopaque, OutBufferSize: u32, BytesReturned: ?*u32, context: i64, ReturnedAsynchronously: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLRES_V1_FUNCTIONS = extern struct { Open: ?POPEN_ROUTINE, Close: ?PCLOSE_ROUTINE, Online: ?PONLINE_ROUTINE, Offline: ?POFFLINE_ROUTINE, Terminate: ?PTERMINATE_ROUTINE, LooksAlive: ?PLOOKS_ALIVE_ROUTINE, IsAlive: ?PIS_ALIVE_ROUTINE, Arbitrate: ?PARBITRATE_ROUTINE, Release: ?PRELEASE_ROUTINE, ResourceControl: ?PRESOURCE_CONTROL_ROUTINE, ResourceTypeControl: ?PRESOURCE_TYPE_CONTROL_ROUTINE, }; pub const CLRES_V2_FUNCTIONS = extern struct { Open: ?POPEN_V2_ROUTINE, Close: ?PCLOSE_ROUTINE, Online: ?PONLINE_V2_ROUTINE, Offline: ?POFFLINE_V2_ROUTINE, Terminate: ?PTERMINATE_ROUTINE, LooksAlive: ?PLOOKS_ALIVE_ROUTINE, IsAlive: ?PIS_ALIVE_ROUTINE, Arbitrate: ?PARBITRATE_ROUTINE, Release: ?PRELEASE_ROUTINE, ResourceControl: ?PRESOURCE_CONTROL_ROUTINE, ResourceTypeControl: ?PRESOURCE_TYPE_CONTROL_ROUTINE, Cancel: ?PCANCEL_ROUTINE, }; pub const CLRES_V3_FUNCTIONS = extern struct { Open: ?POPEN_V2_ROUTINE, Close: ?PCLOSE_ROUTINE, Online: ?PONLINE_V2_ROUTINE, Offline: ?POFFLINE_V2_ROUTINE, Terminate: ?PTERMINATE_ROUTINE, LooksAlive: ?PLOOKS_ALIVE_ROUTINE, IsAlive: ?PIS_ALIVE_ROUTINE, Arbitrate: ?PARBITRATE_ROUTINE, Release: ?PRELEASE_ROUTINE, BeginResourceControl: ?PBEGIN_RESCALL_ROUTINE, BeginResourceTypeControl: ?PBEGIN_RESTYPECALL_ROUTINE, Cancel: ?PCANCEL_ROUTINE, }; pub const CLRES_V4_FUNCTIONS = extern struct { Open: ?POPEN_V2_ROUTINE, Close: ?PCLOSE_ROUTINE, Online: ?PONLINE_V2_ROUTINE, Offline: ?POFFLINE_V2_ROUTINE, Terminate: ?PTERMINATE_ROUTINE, LooksAlive: ?PLOOKS_ALIVE_ROUTINE, IsAlive: ?PIS_ALIVE_ROUTINE, Arbitrate: ?PARBITRATE_ROUTINE, Release: ?PRELEASE_ROUTINE, BeginResourceControl: ?PBEGIN_RESCALL_ROUTINE, BeginResourceTypeControl: ?PBEGIN_RESTYPECALL_ROUTINE, Cancel: ?PCANCEL_ROUTINE, BeginResourceControlAsUser: ?PBEGIN_RESCALL_AS_USER_ROUTINE, BeginResourceTypeControlAsUser: ?PBEGIN_RESTYPECALL_AS_USER_ROUTINE, }; pub const CLRES_FUNCTION_TABLE = extern struct { TableSize: u32, Version: u32, Anonymous: extern union { V1Functions: CLRES_V1_FUNCTIONS, V2Functions: CLRES_V2_FUNCTIONS, V3Functions: CLRES_V3_FUNCTIONS, V4Functions: CLRES_V4_FUNCTIONS, }, }; pub const RESUTIL_LARGEINT_DATA = extern struct { Default: LARGE_INTEGER, Minimum: LARGE_INTEGER, Maximum: LARGE_INTEGER, }; pub const RESUTIL_ULARGEINT_DATA = extern struct { Default: ULARGE_INTEGER, Minimum: ULARGE_INTEGER, Maximum: ULARGE_INTEGER, }; pub const RESUTIL_FILETIME_DATA = extern struct { Default: FILETIME, Minimum: FILETIME, Maximum: FILETIME, }; pub const RESUTIL_PROPERTY_ITEM = extern struct { Name: ?PWSTR, KeyName: ?PWSTR, Format: u32, Anonymous: extern union { DefaultPtr: usize, Default: u32, lpDefault: ?*anyopaque, LargeIntData: ?*RESUTIL_LARGEINT_DATA, ULargeIntData: ?*RESUTIL_ULARGEINT_DATA, FileTimeData: ?*RESUTIL_FILETIME_DATA, }, Minimum: u32, Maximum: u32, Flags: u32, Offset: u32, }; pub const PSTARTUP_ROUTINE = fn( ResourceType: ?[*:0]const u16, MinVersionSupported: u32, MaxVersionSupported: u32, SetResourceStatus: ?PSET_RESOURCE_STATUS_ROUTINE, LogEvent: ?PLOG_EVENT_ROUTINE, FunctionTable: ?*?*CLRES_FUNCTION_TABLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const FAILURE_TYPE = enum(i32) { GENERAL = 0, EMBEDDED = 1, NETWORK_LOSS = 2, }; pub const FAILURE_TYPE_GENERAL = FAILURE_TYPE.GENERAL; pub const FAILURE_TYPE_EMBEDDED = FAILURE_TYPE.EMBEDDED; pub const FAILURE_TYPE_NETWORK_LOSS = FAILURE_TYPE.NETWORK_LOSS; pub const CLUSTER_RESOURCE_APPLICATION_STATE = enum(i32) { StateUnknown = 1, OSHeartBeat = 2, Ready = 3, }; pub const ClusterResourceApplicationStateUnknown = CLUSTER_RESOURCE_APPLICATION_STATE.StateUnknown; pub const ClusterResourceApplicationOSHeartBeat = CLUSTER_RESOURCE_APPLICATION_STATE.OSHeartBeat; pub const ClusterResourceApplicationReady = CLUSTER_RESOURCE_APPLICATION_STATE.Ready; pub const PSET_RESOURCE_LOCKED_MODE_ROUTINE = fn( ResourceHandle: isize, LockedModeEnabled: BOOL, LockedModeReason: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PSIGNAL_FAILURE_ROUTINE = fn( ResourceHandle: isize, FailureType: FAILURE_TYPE, ApplicationSpecificErrorCode: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PSET_RESOURCE_INMEMORY_NODELOCAL_PROPERTIES_ROUTINE = fn( ResourceHandle: isize, propertyListBuffer: ?*u8, propertyListBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PEND_CONTROL_CALL = fn( context: i64, status: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PEND_TYPE_CONTROL_CALL = fn( context: i64, status: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PEXTEND_RES_CONTROL_CALL = fn( context: i64, newTimeoutInMs: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PEXTEND_RES_TYPE_CONTROL_CALL = fn( context: i64, newTimeoutInMs: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRAISE_RES_TYPE_NOTIFICATION = fn( ResourceType: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 2? pPayload: ?*const u8, payloadSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCHANGE_RESOURCE_PROCESS_FOR_DUMPS = fn( resource: isize, processName: ?[*:0]const u16, processId: u32, isAdd: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCHANGE_RES_TYPE_PROCESS_FOR_DUMPS = fn( resourceTypeName: ?[*:0]const u16, processName: ?[*:0]const u16, processId: u32, isAdd: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PSET_INTERNAL_STATE = fn( param0: isize, stateType: CLUSTER_RESOURCE_APPLICATION_STATE, active: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PSET_RESOURCE_LOCKED_MODE_EX_ROUTINE = fn( ResourceHandle: isize, LockedModeEnabled: BOOL, LockedModeReason: u32, LockedModeFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PREQUEST_DUMP_ROUTINE = fn( ResourceHandle: isize, DumpDueToCallInProgress: BOOL, DumpDelayInMs: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLRES_CALLBACK_FUNCTION_TABLE = extern struct { LogEvent: ?PLOG_EVENT_ROUTINE, SetResourceStatusEx: ?PSET_RESOURCE_STATUS_ROUTINE_EX, SetResourceLockedMode: ?PSET_RESOURCE_LOCKED_MODE_ROUTINE, SignalFailure: ?PSIGNAL_FAILURE_ROUTINE, SetResourceInMemoryNodeLocalProperties: ?PSET_RESOURCE_INMEMORY_NODELOCAL_PROPERTIES_ROUTINE, EndControlCall: ?PEND_CONTROL_CALL, EndTypeControlCall: ?PEND_TYPE_CONTROL_CALL, ExtendControlCall: ?PEXTEND_RES_CONTROL_CALL, ExtendTypeControlCall: ?PEXTEND_RES_TYPE_CONTROL_CALL, RaiseResTypeNotification: ?PRAISE_RES_TYPE_NOTIFICATION, ChangeResourceProcessForDumps: ?PCHANGE_RESOURCE_PROCESS_FOR_DUMPS, ChangeResTypeProcessForDumps: ?PCHANGE_RES_TYPE_PROCESS_FOR_DUMPS, SetInternalState: ?PSET_INTERNAL_STATE, SetResourceLockedModeEx: ?PSET_RESOURCE_LOCKED_MODE_EX_ROUTINE, RequestDump: ?PREQUEST_DUMP_ROUTINE, }; pub const PSTARTUP_EX_ROUTINE = fn( ResourceType: ?[*:0]const u16, MinVersionSupported: u32, MaxVersionSupported: u32, MonitorCallbackFunctions: ?*CLRES_CALLBACK_FUNCTION_TABLE, ResourceDllInterfaceFunctions: ?*?*CLRES_FUNCTION_TABLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const RESOURCE_MONITOR_STATE = enum(i32) { Initializing = 0, Idle = 1, StartingResource = 2, InitializingResource = 3, OnlineResource = 4, OfflineResource = 5, ShutdownResource = 6, DeletingResource = 7, IsAlivePoll = 8, LooksAlivePoll = 9, ArbitrateResource = 10, ReleaseResource = 11, ResourceControl = 12, ResourceTypeControl = 13, TerminateResource = 14, Deadlocked = 15, }; pub const RmonInitializing = RESOURCE_MONITOR_STATE.Initializing; pub const RmonIdle = RESOURCE_MONITOR_STATE.Idle; pub const RmonStartingResource = RESOURCE_MONITOR_STATE.StartingResource; pub const RmonInitializingResource = RESOURCE_MONITOR_STATE.InitializingResource; pub const RmonOnlineResource = RESOURCE_MONITOR_STATE.OnlineResource; pub const RmonOfflineResource = RESOURCE_MONITOR_STATE.OfflineResource; pub const RmonShutdownResource = RESOURCE_MONITOR_STATE.ShutdownResource; pub const RmonDeletingResource = RESOURCE_MONITOR_STATE.DeletingResource; pub const RmonIsAlivePoll = RESOURCE_MONITOR_STATE.IsAlivePoll; pub const RmonLooksAlivePoll = RESOURCE_MONITOR_STATE.LooksAlivePoll; pub const RmonArbitrateResource = RESOURCE_MONITOR_STATE.ArbitrateResource; pub const RmonReleaseResource = RESOURCE_MONITOR_STATE.ReleaseResource; pub const RmonResourceControl = RESOURCE_MONITOR_STATE.ResourceControl; pub const RmonResourceTypeControl = RESOURCE_MONITOR_STATE.ResourceTypeControl; pub const RmonTerminateResource = RESOURCE_MONITOR_STATE.TerminateResource; pub const RmonDeadlocked = RESOURCE_MONITOR_STATE.Deadlocked; pub const MONITOR_STATE = extern struct { LastUpdate: LARGE_INTEGER, State: RESOURCE_MONITOR_STATE, ActiveResource: ?HANDLE, ResmonStop: BOOL, }; pub const POST_UPGRADE_VERSION_INFO = extern struct { newMajorVersion: u32, newUpgradeVersion: u32, oldMajorVersion: u32, oldUpgradeVersion: u32, reserved: u32, }; pub const CLUSTER_HEALTH_FAULT = extern struct { Id: ?PWSTR, ErrorType: u32, ErrorCode: u32, Description: ?PWSTR, Provider: ?PWSTR, Flags: u32, Reserved: u32, }; pub const CLUSTER_HEALTH_FAULT_ARRAY = extern struct { numFaults: u32, faults: ?*CLUSTER_HEALTH_FAULT, }; pub const PRESUTIL_START_RESOURCE_SERVICE = fn( pszServiceName: ?[*:0]const u16, phServiceHandle: ?*isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_VERIFY_RESOURCE_SERVICE = fn( pszServiceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_STOP_RESOURCE_SERVICE = fn( pszServiceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_VERIFY_SERVICE = fn( hServiceHandle: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_STOP_SERVICE = fn( hServiceHandle: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_CREATE_DIRECTORY_TREE = fn( pszPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_IS_PATH_VALID = fn( pszPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PRESUTIL_ENUM_PROPERTIES = fn( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 2? pszOutProperties: ?PWSTR, cbOutPropertiesSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_ENUM_PRIVATE_PROPERTIES = fn( hkeyClusterKey: ?HKEY, // TODO: what to do with BytesParamIndex 2? pszOutProperties: ?PWSTR, cbOutPropertiesSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_PROPERTIES = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pOutPropertyList: ?*anyopaque, cbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_ALL_PROPERTIES = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pOutPropertyList: ?*anyopaque, cbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_PRIVATE_PROPERTIES = fn( hkeyClusterKey: ?HKEY, // TODO: what to do with BytesParamIndex 2? pOutPropertyList: ?*anyopaque, cbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_PROPERTY_SIZE = fn( hkeyClusterKey: ?HKEY, pPropertyTableItem: ?*const RESUTIL_PROPERTY_ITEM, pcbOutPropertyListSize: ?*u32, pnPropertyCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_PROPERTY = fn( hkeyClusterKey: ?HKEY, pPropertyTableItem: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pOutPropertyItem: ?*?*anyopaque, pcbOutPropertyItemSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_VERIFY_PROPERTY_TABLE = fn( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, bAllowUnknownProperties: BOOL, // TODO: what to do with BytesParamIndex 4? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_PROPERTY_TABLE = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, bAllowUnknownProperties: BOOL, // TODO: what to do with BytesParamIndex 5? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_PROPERTY_TABLE_EX = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, bAllowUnknownProperties: BOOL, pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, bForceWrite: BOOL, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_PROPERTY_PARAMETER_BLOCK = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, pInParams: ?*const u8, pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_PROPERTY_PARAMETER_BLOCK_EX = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, pInParams: ?*const u8, pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, bForceWrite: BOOL, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_UNKNOWN_PROPERTIES = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_PROPERTIES_TO_PARAMETER_BLOCK = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, pOutParams: ?*u8, bCheckForRequiredProperties: BOOL, pszNameOfPropInError: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_PROPERTY_LIST_FROM_PARAMETER_BLOCK = fn( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 2? pOutPropertyList: ?*anyopaque, pcbOutPropertyListSize: ?*u32, pInParams: ?*const u8, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_DUP_PARAMETER_BLOCK = fn( pOutParams: ?*u8, pInParams: ?*const u8, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FREE_PARAMETER_BLOCK = fn( pOutParams: ?*u8, pInParams: ?*const u8, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, ) callconv(@import("std").os.windows.WINAPI) void; pub const PRESUTIL_ADD_UNKNOWN_PROPERTIES = fn( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, pOutPropertyList: ?*anyopaque, pcbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_PRIVATE_PROPERTY_LIST = fn( hkeyClusterKey: ?HKEY, // TODO: what to do with BytesParamIndex 2? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_VERIFY_PRIVATE_PROPERTY_LIST = fn( // TODO: what to do with BytesParamIndex 1? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_DUP_STRING = fn( pszInString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub const PRESUTIL_GET_BINARY_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? ppbOutValue: ?*?*u8, pcbOutValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_SZ_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub const PRESUTIL_GET_EXPAND_SZ_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, bExpand: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub const PRESUTIL_GET_DWORD_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pdwOutValue: ?*u32, dwDefaultValue: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_QWORD_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pqwOutValue: ?*u64, qwDefaultValue: u64, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_BINARY_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pbNewValue: ?*const u8, cbNewValueSize: u32, // TODO: what to do with BytesParamIndex 5? ppbOutValue: ?*?*u8, pcbOutValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_SZ_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pszNewValue: ?[*:0]const u16, ppszOutString: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_EXPAND_SZ_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pszNewValue: ?[*:0]const u16, ppszOutString: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_MULTI_SZ_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pszNewValue: ?[*:0]const u16, cbNewValueSize: u32, // TODO: what to do with BytesParamIndex 5? ppszOutValue: ?*?PWSTR, pcbOutValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_DWORD_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, dwNewValue: u32, pdwOutValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_QWORD_VALUE = fn( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, qwNewValue: u64, pqwOutValue: ?*u64, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_BINARY_PROPERTY = fn( ppbOutValue: ?*?*u8, pcbOutValueSize: ?*u32, pValueStruct: ?*const CLUSPROP_BINARY, // TODO: what to do with BytesParamIndex 4? pbOldValue: ?*const u8, cbOldValueSize: u32, // TODO: what to do with BytesParamIndex 6? ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_SZ_PROPERTY = fn( ppszOutValue: ?*?PWSTR, pValueStruct: ?*const CLUSPROP_SZ, pszOldValue: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_MULTI_SZ_PROPERTY = fn( ppszOutValue: ?*?PWSTR, pcbOutValueSize: ?*u32, pValueStruct: ?*const CLUSPROP_SZ, // TODO: what to do with BytesParamIndex 4? pszOldValue: ?[*:0]const u16, cbOldValueSize: u32, // TODO: what to do with BytesParamIndex 6? ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_DWORD_PROPERTY = fn( pdwOutValue: ?*u32, pValueStruct: ?*const CLUSPROP_DWORD, dwOldValue: u32, dwMinimum: u32, dwMaximum: u32, ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_LONG_PROPERTY = fn( plOutValue: ?*i32, pValueStruct: ?*const CLUSPROP_LONG, lOldValue: i32, lMinimum: i32, lMaximum: i32, ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_FILETIME_PROPERTY = fn( pftOutValue: ?*FILETIME, pValueStruct: ?*const CLUSPROP_FILETIME, ftOldValue: FILETIME, ftMinimum: FILETIME, ftMaximum: FILETIME, ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_ENVIRONMENT_WITH_NET_NAME = fn( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; pub const PRESUTIL_FREE_ENVIRONMENT = fn( lpEnvironment: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_EXPAND_ENVIRONMENT_STRINGS = fn( pszSrc: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; pub const PRESUTIL_SET_RESOURCE_SERVICE_ENVIRONMENT = fn( pszServiceName: ?[*:0]const u16, hResource: ?*_HRESOURCE, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_REMOVE_RESOURCE_SERVICE_ENVIRONMENT = fn( pszServiceName: ?[*:0]const u16, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS = fn( pszServiceName: ?[*:0]const u16, schSCMHandle: SC_HANDLE, phService: ?*isize, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_SZ_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pszPropertyValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_EXPAND_SZ_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pszPropertyValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_EXPANDED_SZ_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pszPropertyValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_DWORD_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pdwPropertyValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_BINARY_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? pbPropertyValue: ?*?*u8, pcbPropertyValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_MULTI_SZ_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? pszPropertyValue: ?*?PWSTR, pcbPropertyValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_LONG_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, plPropertyValue: ?*i32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_ULARGEINTEGER_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, plPropertyValue: ?*u64, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_FILETIME_PROPERTY = fn( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pftPropertyValue: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUS_WORKER = extern struct { hThread: ?HANDLE, Terminate: BOOL, }; pub const PWORKER_START_ROUTINE = fn( pWorker: ?*CLUS_WORKER, lpThreadParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPI_CLUS_WORKER_CREATE = fn( lpWorker: ?*CLUS_WORKER, lpStartAddress: ?PWORKER_START_ROUTINE, lpParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSAPIClusWorkerCheckTerminate = fn( lpWorker: ?*CLUS_WORKER, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSAPI_CLUS_WORKER_TERMINATE = fn( lpWorker: ?*CLUS_WORKER, ) callconv(@import("std").os.windows.WINAPI) void; pub const LPRESOURCE_CALLBACK = fn( param0: ?*_HRESOURCE, param1: ?*_HRESOURCE, param2: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPRESOURCE_CALLBACK_EX = fn( param0: ?*_HCLUSTER, param1: ?*_HRESOURCE, param2: ?*_HRESOURCE, param3: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPGROUP_CALLBACK_EX = fn( param0: ?*_HCLUSTER, param1: ?*_HGROUP, param2: ?*_HGROUP, param3: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const LPNODE_CALLBACK = fn( param0: ?*_HCLUSTER, param1: ?*_HNODE, param2: CLUSTER_NODE_STATE, param3: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_RESOURCES_EQUAL = fn( hSelf: ?*_HRESOURCE, hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PRESUTIL_RESOURCE_TYPES_EQUAL = fn( lpszResourceTypeName: ?[*:0]const u16, hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PRESUTIL_IS_RESOURCE_CLASS_EQUAL = fn( prci: ?*CLUS_RESOURCE_CLASS_INFO, hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PRESUTIL_ENUM_RESOURCES = fn( hSelf: ?*_HRESOURCE, lpszResTypeName: ?[*:0]const u16, pResCallBack: ?LPRESOURCE_CALLBACK, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_ENUM_RESOURCES_EX = fn( hCluster: ?*_HCLUSTER, hSelf: ?*_HRESOURCE, lpszResTypeName: ?[*:0]const u16, pResCallBack: ?LPRESOURCE_CALLBACK_EX, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_RESOURCE_DEPENDENCY = fn( hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_NAME = fn( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, bRecurse: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS = fn( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, prci: ?*CLUS_RESOURCE_CLASS_INFO, bRecurse: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY = fn( lpszResourceName: ?[*:0]const u16, lpszResourceType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_DEPENDENTIP_ADDRESS_PROPS = fn( hResource: ?*_HRESOURCE, pszAddress: [*:0]u16, pcchAddress: ?*u32, pszSubnetMask: [*:0]u16, pcchSubnetMask: ?*u32, pszNetwork: [*:0]u16, pcchNetwork: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_FIND_DEPENDENT_DISK_RESOURCE_DRIVE_LETTER = fn( hCluster: ?*_HCLUSTER, hResource: ?*_HRESOURCE, pszDriveLetter: [*:0]u16, pcchDriveLetter: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_TERMINATE_SERVICE_PROCESS_FROM_RES_DLL = fn( dwServicePid: u32, bOffline: BOOL, pdwResourceState: ?*u32, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_PROPERTY_FORMATS = fn( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 2? pOutPropertyFormatList: ?*anyopaque, cbPropertyFormatListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_CORE_CLUSTER_RESOURCES = fn( hCluster: ?*_HCLUSTER, phClusterNameResource: ?*?*_HRESOURCE, phClusterIPAddressResource: ?*?*_HRESOURCE, phClusterQuorumResource: ?*?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_RESOURCE_NAME = fn( hResource: ?*_HRESOURCE, pszResourceName: [*:0]u16, pcchResourceNameInOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUSTER_ROLE = enum(i32) { DHCP = 0, DTC = 1, FileServer = 2, GenericApplication = 3, GenericScript = 4, GenericService = 5, ISCSINameServer = 6, MSMQ = 7, NFS = 8, PrintServer = 9, StandAloneNamespaceServer = 10, VolumeShadowCopyServiceTask = 11, WINS = 12, TaskScheduler = 13, NetworkFileSystem = 14, DFSReplicatedFolder = 15, DistributedFileSystem = 16, DistributedNetworkName = 17, FileShare = 18, FileShareWitness = 19, HardDisk = 20, IPAddress = 21, IPV6Address = 22, IPV6TunnelAddress = 23, ISCSITargetServer = 24, NetworkName = 25, PhysicalDisk = 26, SODAFileServer = 27, StoragePool = 28, VirtualMachine = 29, VirtualMachineConfiguration = 30, VirtualMachineReplicaBroker = 31, }; pub const ClusterRoleDHCP = CLUSTER_ROLE.DHCP; pub const ClusterRoleDTC = CLUSTER_ROLE.DTC; pub const ClusterRoleFileServer = CLUSTER_ROLE.FileServer; pub const ClusterRoleGenericApplication = CLUSTER_ROLE.GenericApplication; pub const ClusterRoleGenericScript = CLUSTER_ROLE.GenericScript; pub const ClusterRoleGenericService = CLUSTER_ROLE.GenericService; pub const ClusterRoleISCSINameServer = CLUSTER_ROLE.ISCSINameServer; pub const ClusterRoleMSMQ = CLUSTER_ROLE.MSMQ; pub const ClusterRoleNFS = CLUSTER_ROLE.NFS; pub const ClusterRolePrintServer = CLUSTER_ROLE.PrintServer; pub const ClusterRoleStandAloneNamespaceServer = CLUSTER_ROLE.StandAloneNamespaceServer; pub const ClusterRoleVolumeShadowCopyServiceTask = CLUSTER_ROLE.VolumeShadowCopyServiceTask; pub const ClusterRoleWINS = CLUSTER_ROLE.WINS; pub const ClusterRoleTaskScheduler = CLUSTER_ROLE.TaskScheduler; pub const ClusterRoleNetworkFileSystem = CLUSTER_ROLE.NetworkFileSystem; pub const ClusterRoleDFSReplicatedFolder = CLUSTER_ROLE.DFSReplicatedFolder; pub const ClusterRoleDistributedFileSystem = CLUSTER_ROLE.DistributedFileSystem; pub const ClusterRoleDistributedNetworkName = CLUSTER_ROLE.DistributedNetworkName; pub const ClusterRoleFileShare = CLUSTER_ROLE.FileShare; pub const ClusterRoleFileShareWitness = CLUSTER_ROLE.FileShareWitness; pub const ClusterRoleHardDisk = CLUSTER_ROLE.HardDisk; pub const ClusterRoleIPAddress = CLUSTER_ROLE.IPAddress; pub const ClusterRoleIPV6Address = CLUSTER_ROLE.IPV6Address; pub const ClusterRoleIPV6TunnelAddress = CLUSTER_ROLE.IPV6TunnelAddress; pub const ClusterRoleISCSITargetServer = CLUSTER_ROLE.ISCSITargetServer; pub const ClusterRoleNetworkName = CLUSTER_ROLE.NetworkName; pub const ClusterRolePhysicalDisk = CLUSTER_ROLE.PhysicalDisk; pub const ClusterRoleSODAFileServer = CLUSTER_ROLE.SODAFileServer; pub const ClusterRoleStoragePool = CLUSTER_ROLE.StoragePool; pub const ClusterRoleVirtualMachine = CLUSTER_ROLE.VirtualMachine; pub const ClusterRoleVirtualMachineConfiguration = CLUSTER_ROLE.VirtualMachineConfiguration; pub const ClusterRoleVirtualMachineReplicaBroker = CLUSTER_ROLE.VirtualMachineReplicaBroker; pub const CLUSTER_ROLE_STATE = enum(i32) { Unknown = -1, Clustered = 0, Unclustered = 1, }; pub const ClusterRoleUnknown = CLUSTER_ROLE_STATE.Unknown; pub const ClusterRoleClustered = CLUSTER_ROLE_STATE.Clustered; pub const ClusterRoleUnclustered = CLUSTER_ROLE_STATE.Unclustered; pub const PCLUSTER_IS_PATH_ON_SHARED_VOLUME = fn( lpszPathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSTER_GET_VOLUME_PATH_NAME = fn( lpszFileName: ?[*:0]const u16, lpszVolumePathName: ?PWSTR, cchBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSTER_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT = fn( lpszVolumeMountPoint: ?[*:0]const u16, lpszVolumeName: ?PWSTR, cchBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PCLUSTER_PREPARE_SHARED_VOLUME_FOR_BACKUP = fn( lpszFileName: ?[*:0]const u16, lpszVolumePathName: ?PWSTR, lpcchVolumePathName: ?*u32, lpszVolumeName: ?PWSTR, lpcchVolumeName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSTER_CLEAR_BACKUP_STATE_FOR_SHARED_VOLUME = fn( lpszVolumePathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS_EX = fn( pszServiceName: ?[*:0]const u16, schSCMHandle: SC_HANDLE, phService: ?*isize, dwDesiredAccess: u32, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_ENUM_RESOURCES_EX2 = fn( hCluster: ?*_HCLUSTER, hSelf: ?*_HRESOURCE, lpszResTypeName: ?[*:0]const u16, pResCallBack: ?LPRESOURCE_CALLBACK_EX, pParameter: ?*anyopaque, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESUTIL_GET_RESOURCE_DEPENDENCY_EX = fn( hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_NAME_EX = fn( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, bRecurse: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS_EX = fn( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, prci: ?*CLUS_RESOURCE_CLASS_INFO, bRecurse: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY_EX = fn( lpszResourceName: ?[*:0]const u16, lpszResourceType: ?[*:0]const u16, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; pub const PRESUTIL_GET_CORE_CLUSTER_RESOURCES_EX = fn( hClusterIn: ?*_HCLUSTER, phClusterNameResourceOut: ?*?*_HRESOURCE, phClusterIPAddressResourceOut: ?*?*_HRESOURCE, phClusterQuorumResourceOut: ?*?*_HRESOURCE, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const _HCLUSCRYPTPROVIDER = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const POPEN_CLUSTER_CRYPT_PROVIDER = fn( lpszResource: ?[*:0]const u16, lpszProvider: ?*i8, dwType: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSCRYPTPROVIDER; pub const POPEN_CLUSTER_CRYPT_PROVIDEREX = fn( lpszResource: ?[*:0]const u16, lpszKeyname: ?[*:0]const u16, lpszProvider: ?*i8, dwType: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSCRYPTPROVIDER; pub const PCLOSE_CLUSTER_CRYPT_PROVIDER = fn( hClusCryptProvider: ?*_HCLUSCRYPTPROVIDER, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSTER_ENCRYPT = fn( hClusCryptProvider: ?*_HCLUSCRYPTPROVIDER, pData: [*:0]u8, cbData: u32, ppData: ?*?*u8, pcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PCLUSTER_DECRYPT = fn( hClusCryptProvider: ?*_HCLUSCRYPTPROVIDER, pCryptInput: ?*u8, cbCryptInput: u32, ppCryptOutput: ?*?*u8, pcbCryptOutput: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFREE_CLUSTER_CRYPT = fn( pCryptInfo: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRES_UTIL_VERIFY_SHUTDOWN_SAFE = fn( flags: u32, reason: u32, pResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PaxosTagCStruct = extern struct { __padding__PaxosTagVtable: u64, __padding__NextEpochVtable: u64, __padding__NextEpoch_DateTimeVtable: u64, NextEpoch_DateTime_ticks: u64, NextEpoch_Value: i32, __padding__BoundryNextEpoch: u32, __padding__EpochVtable: u64, __padding__Epoch_DateTimeVtable: u64, Epoch_DateTime_ticks: u64, Epoch_Value: i32, __padding__BoundryEpoch: u32, Sequence: i32, __padding__BoundrySequence: u32, }; pub const WitnessTagUpdateHelper = extern struct { Version: i32, paxosToSet: PaxosTagCStruct, paxosToValidate: PaxosTagCStruct, }; pub const WitnessTagHelper = extern struct { Version: i32, paxosToValidate: PaxosTagCStruct, }; pub const PREGISTER_APPINSTANCE = fn( ProcessHandle: ?HANDLE, AppInstanceId: ?*Guid, ChildrenInheritAppInstance: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PREGISTER_APPINSTANCE_VERSION = fn( AppInstanceId: ?*Guid, InstanceVersionHigh: u64, InstanceVersionLow: u64, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PQUERY_APPINSTANCE_VERSION = fn( AppInstanceId: ?*Guid, InstanceVersionHigh: ?*u64, InstanceVersionLow: ?*u64, VersionStatus: ?*NTSTATUS, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PRESET_ALL_APPINSTANCE_VERSIONS = fn( ) callconv(@import("std").os.windows.WINAPI) u32; pub const SET_APP_INSTANCE_CSV_FLAGS = fn( ProcessHandle: ?HANDLE, Mask: u32, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const CLUADMEX_OBJECT_TYPE = enum(i32) { NONE = 0, CLUSTER = 1, NODE = 2, GROUP = 3, RESOURCE = 4, RESOURCETYPE = 5, NETWORK = 6, NETINTERFACE = 7, }; pub const CLUADMEX_OT_NONE = CLUADMEX_OBJECT_TYPE.NONE; pub const CLUADMEX_OT_CLUSTER = CLUADMEX_OBJECT_TYPE.CLUSTER; pub const CLUADMEX_OT_NODE = CLUADMEX_OBJECT_TYPE.NODE; pub const CLUADMEX_OT_GROUP = CLUADMEX_OBJECT_TYPE.GROUP; pub const CLUADMEX_OT_RESOURCE = CLUADMEX_OBJECT_TYPE.RESOURCE; pub const CLUADMEX_OT_RESOURCETYPE = CLUADMEX_OBJECT_TYPE.RESOURCETYPE; pub const CLUADMEX_OT_NETWORK = CLUADMEX_OBJECT_TYPE.NETWORK; pub const CLUADMEX_OT_NETINTERFACE = CLUADMEX_OBJECT_TYPE.NETINTERFACE; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterUIInfo_Value = Guid.initString("97dede50-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterUIInfo = &IID_IGetClusterUIInfo_Value; pub const IGetClusterUIInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClusterName: fn( self: *const IGetClusterUIInfo, lpszName: ?BSTR, pcchName: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocale: fn( self: *const IGetClusterUIInfo, ) callconv(@import("std").os.windows.WINAPI) u32, GetFont: fn( self: *const IGetClusterUIInfo, ) callconv(@import("std").os.windows.WINAPI) ?HFONT, GetIcon: fn( self: *const IGetClusterUIInfo, ) callconv(@import("std").os.windows.WINAPI) ?HICON, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterUIInfo_GetClusterName(self: *const T, lpszName: ?BSTR, pcchName: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetClusterUIInfo.VTable, self.vtable).GetClusterName(@ptrCast(*const IGetClusterUIInfo, self), lpszName, pcchName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterUIInfo_GetLocale(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IGetClusterUIInfo.VTable, self.vtable).GetLocale(@ptrCast(*const IGetClusterUIInfo, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterUIInfo_GetFont(self: *const T) callconv(.Inline) ?HFONT { return @ptrCast(*const IGetClusterUIInfo.VTable, self.vtable).GetFont(@ptrCast(*const IGetClusterUIInfo, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterUIInfo_GetIcon(self: *const T) callconv(.Inline) ?HICON { return @ptrCast(*const IGetClusterUIInfo.VTable, self.vtable).GetIcon(@ptrCast(*const IGetClusterUIInfo, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterDataInfo_Value = Guid.initString("97dede51-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterDataInfo = &IID_IGetClusterDataInfo_Value; pub const IGetClusterDataInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClusterName: fn( self: *const IGetClusterDataInfo, lpszName: ?BSTR, pcchName: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetClusterHandle: fn( self: *const IGetClusterDataInfo, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER, GetObjectCount: fn( self: *const IGetClusterDataInfo, ) callconv(@import("std").os.windows.WINAPI) i32, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterDataInfo_GetClusterName(self: *const T, lpszName: ?BSTR, pcchName: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetClusterDataInfo.VTable, self.vtable).GetClusterName(@ptrCast(*const IGetClusterDataInfo, self), lpszName, pcchName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterDataInfo_GetClusterHandle(self: *const T) callconv(.Inline) ?*_HCLUSTER { return @ptrCast(*const IGetClusterDataInfo.VTable, self.vtable).GetClusterHandle(@ptrCast(*const IGetClusterDataInfo, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterDataInfo_GetObjectCount(self: *const T) callconv(.Inline) i32 { return @ptrCast(*const IGetClusterDataInfo.VTable, self.vtable).GetObjectCount(@ptrCast(*const IGetClusterDataInfo, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterObjectInfo_Value = Guid.initString("97dede52-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterObjectInfo = &IID_IGetClusterObjectInfo_Value; pub const IGetClusterObjectInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObjectName: fn( self: *const IGetClusterObjectInfo, lObjIndex: i32, lpszName: ?BSTR, pcchName: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectType: fn( self: *const IGetClusterObjectInfo, lObjIndex: i32, ) callconv(@import("std").os.windows.WINAPI) CLUADMEX_OBJECT_TYPE, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterObjectInfo_GetObjectName(self: *const T, lObjIndex: i32, lpszName: ?BSTR, pcchName: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetClusterObjectInfo.VTable, self.vtable).GetObjectName(@ptrCast(*const IGetClusterObjectInfo, self), lObjIndex, lpszName, pcchName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterObjectInfo_GetObjectType(self: *const T, lObjIndex: i32) callconv(.Inline) CLUADMEX_OBJECT_TYPE { return @ptrCast(*const IGetClusterObjectInfo.VTable, self.vtable).GetObjectType(@ptrCast(*const IGetClusterObjectInfo, self), lObjIndex); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterNodeInfo_Value = Guid.initString("97dede53-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterNodeInfo = &IID_IGetClusterNodeInfo_Value; pub const IGetClusterNodeInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNodeHandle: fn( self: *const IGetClusterNodeInfo, lObjIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterNodeInfo_GetNodeHandle(self: *const T, lObjIndex: i32) callconv(.Inline) ?*_HNODE { return @ptrCast(*const IGetClusterNodeInfo.VTable, self.vtable).GetNodeHandle(@ptrCast(*const IGetClusterNodeInfo, self), lObjIndex); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterGroupInfo_Value = Guid.initString("97dede54-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterGroupInfo = &IID_IGetClusterGroupInfo_Value; pub const IGetClusterGroupInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetGroupHandle: fn( self: *const IGetClusterGroupInfo, lObjIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterGroupInfo_GetGroupHandle(self: *const T, lObjIndex: i32) callconv(.Inline) ?*_HGROUP { return @ptrCast(*const IGetClusterGroupInfo.VTable, self.vtable).GetGroupHandle(@ptrCast(*const IGetClusterGroupInfo, self), lObjIndex); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterResourceInfo_Value = Guid.initString("97dede55-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterResourceInfo = &IID_IGetClusterResourceInfo_Value; pub const IGetClusterResourceInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetResourceHandle: fn( self: *const IGetClusterResourceInfo, lObjIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE, GetResourceTypeName: fn( self: *const IGetClusterResourceInfo, lObjIndex: i32, lpszResTypeName: ?BSTR, pcchResTypeName: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetResourceNetworkName: fn( self: *const IGetClusterResourceInfo, lObjIndex: i32, lpszNetName: ?BSTR, pcchNetName: ?*u32, ) 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 IGetClusterResourceInfo_GetResourceHandle(self: *const T, lObjIndex: i32) callconv(.Inline) ?*_HRESOURCE { return @ptrCast(*const IGetClusterResourceInfo.VTable, self.vtable).GetResourceHandle(@ptrCast(*const IGetClusterResourceInfo, self), lObjIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterResourceInfo_GetResourceTypeName(self: *const T, lObjIndex: i32, lpszResTypeName: ?BSTR, pcchResTypeName: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetClusterResourceInfo.VTable, self.vtable).GetResourceTypeName(@ptrCast(*const IGetClusterResourceInfo, self), lObjIndex, lpszResTypeName, pcchResTypeName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterResourceInfo_GetResourceNetworkName(self: *const T, lObjIndex: i32, lpszNetName: ?BSTR, pcchNetName: ?*u32) callconv(.Inline) BOOL { return @ptrCast(*const IGetClusterResourceInfo.VTable, self.vtable).GetResourceNetworkName(@ptrCast(*const IGetClusterResourceInfo, self), lObjIndex, lpszNetName, pcchNetName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterNetworkInfo_Value = Guid.initString("97dede56-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterNetworkInfo = &IID_IGetClusterNetworkInfo_Value; pub const IGetClusterNetworkInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNetworkHandle: fn( self: *const IGetClusterNetworkInfo, lObjIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORK, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterNetworkInfo_GetNetworkHandle(self: *const T, lObjIndex: i32) callconv(.Inline) ?*_HNETWORK { return @ptrCast(*const IGetClusterNetworkInfo.VTable, self.vtable).GetNetworkHandle(@ptrCast(*const IGetClusterNetworkInfo, self), lObjIndex); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IGetClusterNetInterfaceInfo_Value = Guid.initString("97dede57-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IGetClusterNetInterfaceInfo = &IID_IGetClusterNetInterfaceInfo_Value; pub const IGetClusterNetInterfaceInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNetInterfaceHandle: fn( self: *const IGetClusterNetInterfaceInfo, lObjIndex: i32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETINTERFACE, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IGetClusterNetInterfaceInfo_GetNetInterfaceHandle(self: *const T, lObjIndex: i32) callconv(.Inline) ?*_HNETINTERFACE { return @ptrCast(*const IGetClusterNetInterfaceInfo.VTable, self.vtable).GetNetInterfaceHandle(@ptrCast(*const IGetClusterNetInterfaceInfo, self), lObjIndex); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2008' const IID_IWCPropertySheetCallback_Value = Guid.initString("97dede60-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWCPropertySheetCallback = &IID_IWCPropertySheetCallback_Value; pub const IWCPropertySheetCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddPropertySheetPage: fn( self: *const IWCPropertySheetCallback, hpage: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWCPropertySheetCallback_AddPropertySheetPage(self: *const T, hpage: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IWCPropertySheetCallback.VTable, self.vtable).AddPropertySheetPage(@ptrCast(*const IWCPropertySheetCallback, self), hpage); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2008' const IID_IWEExtendPropertySheet_Value = Guid.initString("97dede61-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWEExtendPropertySheet = &IID_IWEExtendPropertySheet_Value; pub const IWEExtendPropertySheet = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreatePropertySheetPages: fn( self: *const IWEExtendPropertySheet, piData: ?*IUnknown, piCallback: ?*IWCPropertySheetCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWEExtendPropertySheet_CreatePropertySheetPages(self: *const T, piData: ?*IUnknown, piCallback: ?*IWCPropertySheetCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IWEExtendPropertySheet.VTable, self.vtable).CreatePropertySheetPages(@ptrCast(*const IWEExtendPropertySheet, self), piData, piCallback); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWCWizardCallback_Value = Guid.initString("97dede62-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWCWizardCallback = &IID_IWCWizardCallback_Value; pub const IWCWizardCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddWizardPage: fn( self: *const IWCWizardCallback, hpage: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableNext: fn( self: *const IWCWizardCallback, hpage: ?*i32, bEnable: 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 IWCWizardCallback_AddWizardPage(self: *const T, hpage: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IWCWizardCallback.VTable, self.vtable).AddWizardPage(@ptrCast(*const IWCWizardCallback, self), hpage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWCWizardCallback_EnableNext(self: *const T, hpage: ?*i32, bEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IWCWizardCallback.VTable, self.vtable).EnableNext(@ptrCast(*const IWCWizardCallback, self), hpage, bEnable); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWEExtendWizard_Value = Guid.initString("97dede63-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWEExtendWizard = &IID_IWEExtendWizard_Value; pub const IWEExtendWizard = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateWizardPages: fn( self: *const IWEExtendWizard, piData: ?*IUnknown, piCallback: ?*IWCWizardCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWEExtendWizard_CreateWizardPages(self: *const T, piData: ?*IUnknown, piCallback: ?*IWCWizardCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IWEExtendWizard.VTable, self.vtable).CreateWizardPages(@ptrCast(*const IWEExtendWizard, self), piData, piCallback); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWCContextMenuCallback_Value = Guid.initString("97dede64-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWCContextMenuCallback = &IID_IWCContextMenuCallback_Value; pub const IWCContextMenuCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddExtensionMenuItem: fn( self: *const IWCContextMenuCallback, lpszName: ?BSTR, lpszStatusBarText: ?BSTR, nCommandID: u32, nSubmenuCommandID: u32, uFlags: 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 IWCContextMenuCallback_AddExtensionMenuItem(self: *const T, lpszName: ?BSTR, lpszStatusBarText: ?BSTR, nCommandID: u32, nSubmenuCommandID: u32, uFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IWCContextMenuCallback.VTable, self.vtable).AddExtensionMenuItem(@ptrCast(*const IWCContextMenuCallback, self), lpszName, lpszStatusBarText, nCommandID, nSubmenuCommandID, uFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWEExtendContextMenu_Value = Guid.initString("97dede65-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWEExtendContextMenu = &IID_IWEExtendContextMenu_Value; pub const IWEExtendContextMenu = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddContextMenuItems: fn( self: *const IWEExtendContextMenu, piData: ?*IUnknown, piCallback: ?*IWCContextMenuCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWEExtendContextMenu_AddContextMenuItems(self: *const T, piData: ?*IUnknown, piCallback: ?*IWCContextMenuCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IWEExtendContextMenu.VTable, self.vtable).AddContextMenuItems(@ptrCast(*const IWEExtendContextMenu, self), piData, piCallback); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWEInvokeCommand_Value = Guid.initString("97dede66-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWEInvokeCommand = &IID_IWEInvokeCommand_Value; pub const IWEInvokeCommand = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, InvokeCommand: fn( self: *const IWEInvokeCommand, nCommandID: u32, piData: ?*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 IWEInvokeCommand_InvokeCommand(self: *const T, nCommandID: u32, piData: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IWEInvokeCommand.VTable, self.vtable).InvokeCommand(@ptrCast(*const IWEInvokeCommand, self), nCommandID, piData); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWCWizard97Callback_Value = Guid.initString("97dede67-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWCWizard97Callback = &IID_IWCWizard97Callback_Value; pub const IWCWizard97Callback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddWizard97Page: fn( self: *const IWCWizard97Callback, hpage: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableNext: fn( self: *const IWCWizard97Callback, hpage: ?*i32, bEnable: 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 IWCWizard97Callback_AddWizard97Page(self: *const T, hpage: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IWCWizard97Callback.VTable, self.vtable).AddWizard97Page(@ptrCast(*const IWCWizard97Callback, self), hpage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWCWizard97Callback_EnableNext(self: *const T, hpage: ?*i32, bEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IWCWizard97Callback.VTable, self.vtable).EnableNext(@ptrCast(*const IWCWizard97Callback, self), hpage, bEnable); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2003' const IID_IWEExtendWizard97_Value = Guid.initString("97dede68-fc6b-11cf-b5f5-00a0c90ab505"); pub const IID_IWEExtendWizard97 = &IID_IWEExtendWizard97_Value; pub const IWEExtendWizard97 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateWizard97Pages: fn( self: *const IWEExtendWizard97, piData: ?*IUnknown, piCallback: ?*IWCWizard97Callback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWEExtendWizard97_CreateWizard97Pages(self: *const T, piData: ?*IUnknown, piCallback: ?*IWCWizard97Callback) callconv(.Inline) HRESULT { return @ptrCast(*const IWEExtendWizard97.VTable, self.vtable).CreateWizard97Pages(@ptrCast(*const IWEExtendWizard97, self), piData, piCallback); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_ClusApplication_Value = Guid.initString("f2e606e5-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusApplication = &CLSID_ClusApplication_Value; const CLSID_Cluster_Value = Guid.initString("f2e606e3-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_Cluster = &CLSID_Cluster_Value; const CLSID_ClusVersion_Value = Guid.initString("f2e60715-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusVersion = &CLSID_ClusVersion_Value; const CLSID_ClusResType_Value = Guid.initString("f2e6070f-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResType = &CLSID_ClusResType_Value; const CLSID_ClusProperty_Value = Guid.initString("f2e606fd-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusProperty = &CLSID_ClusProperty_Value; const CLSID_ClusProperties_Value = Guid.initString("f2e606ff-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusProperties = &CLSID_ClusProperties_Value; const CLSID_DomainNames_Value = Guid.initString("f2e606e1-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_DomainNames = &CLSID_DomainNames_Value; const CLSID_ClusNetwork_Value = Guid.initString("f2e606f1-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNetwork = &CLSID_ClusNetwork_Value; const CLSID_ClusNetInterface_Value = Guid.initString("f2e606ed-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNetInterface = &CLSID_ClusNetInterface_Value; const CLSID_ClusNetInterfaces_Value = Guid.initString("f2e606ef-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNetInterfaces = &CLSID_ClusNetInterfaces_Value; const CLSID_ClusResDependencies_Value = Guid.initString("f2e60703-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResDependencies = &CLSID_ClusResDependencies_Value; const CLSID_ClusResGroupResources_Value = Guid.initString("f2e606e9-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResGroupResources = &CLSID_ClusResGroupResources_Value; const CLSID_ClusResTypeResources_Value = Guid.initString("f2e60713-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResTypeResources = &CLSID_ClusResTypeResources_Value; const CLSID_ClusResGroupPreferredOwnerNodes_Value = Guid.initString("f2e606e7-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResGroupPreferredOwnerNodes = &CLSID_ClusResGroupPreferredOwnerNodes_Value; const CLSID_ClusResPossibleOwnerNodes_Value = Guid.initString("f2e6070d-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResPossibleOwnerNodes = &CLSID_ClusResPossibleOwnerNodes_Value; const CLSID_ClusNetworks_Value = Guid.initString("f2e606f3-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNetworks = &CLSID_ClusNetworks_Value; const CLSID_ClusNetworkNetInterfaces_Value = Guid.initString("f2e606f5-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNetworkNetInterfaces = &CLSID_ClusNetworkNetInterfaces_Value; const CLSID_ClusNodeNetInterfaces_Value = Guid.initString("f2e606fb-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNodeNetInterfaces = &CLSID_ClusNodeNetInterfaces_Value; const CLSID_ClusRefObject_Value = Guid.initString("f2e60701-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusRefObject = &CLSID_ClusRefObject_Value; const CLSID_ClusterNames_Value = Guid.initString("f2e606eb-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusterNames = &CLSID_ClusterNames_Value; const CLSID_ClusNode_Value = Guid.initString("f2e606f7-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNode = &CLSID_ClusNode_Value; const CLSID_ClusNodes_Value = Guid.initString("f2e606f9-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusNodes = &CLSID_ClusNodes_Value; const CLSID_ClusResGroup_Value = Guid.initString("f2e60705-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResGroup = &CLSID_ClusResGroup_Value; const CLSID_ClusResGroups_Value = Guid.initString("f2e60707-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResGroups = &CLSID_ClusResGroups_Value; const CLSID_ClusResource_Value = Guid.initString("f2e60709-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResource = &CLSID_ClusResource_Value; const CLSID_ClusResources_Value = Guid.initString("f2e6070b-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResources = &CLSID_ClusResources_Value; const CLSID_ClusResTypes_Value = Guid.initString("f2e60711-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResTypes = &CLSID_ClusResTypes_Value; const CLSID_ClusResTypePossibleOwnerNodes_Value = Guid.initString("f2e60717-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResTypePossibleOwnerNodes = &CLSID_ClusResTypePossibleOwnerNodes_Value; const CLSID_ClusPropertyValue_Value = Guid.initString("f2e60719-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusPropertyValue = &CLSID_ClusPropertyValue_Value; const CLSID_ClusPropertyValues_Value = Guid.initString("f2e6071b-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusPropertyValues = &CLSID_ClusPropertyValues_Value; const CLSID_ClusPropertyValueData_Value = Guid.initString("f2e6071d-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusPropertyValueData = &CLSID_ClusPropertyValueData_Value; const CLSID_ClusPartition_Value = Guid.initString("f2e6071f-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusPartition = &CLSID_ClusPartition_Value; const CLSID_ClusPartitionEx_Value = Guid.initString("53d51d26-b51b-4a79-b2c3-5048d93a98fc"); pub const CLSID_ClusPartitionEx = &CLSID_ClusPartitionEx_Value; const CLSID_ClusPartitions_Value = Guid.initString("f2e60721-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusPartitions = &CLSID_ClusPartitions_Value; const CLSID_ClusDisk_Value = Guid.initString("f2e60723-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusDisk = &CLSID_ClusDisk_Value; const CLSID_ClusDisks_Value = Guid.initString("f2e60725-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusDisks = &CLSID_ClusDisks_Value; const CLSID_ClusScsiAddress_Value = Guid.initString("f2e60727-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusScsiAddress = &CLSID_ClusScsiAddress_Value; const CLSID_ClusRegistryKeys_Value = Guid.initString("f2e60729-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusRegistryKeys = &CLSID_ClusRegistryKeys_Value; const CLSID_ClusCryptoKeys_Value = Guid.initString("f2e6072b-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusCryptoKeys = &CLSID_ClusCryptoKeys_Value; const CLSID_ClusResDependents_Value = Guid.initString("f2e6072d-2631-11d1-89f1-00a0c90d061e"); pub const CLSID_ClusResDependents = &CLSID_ClusResDependents_Value; const IID_ISClusApplication_Value = Guid.initString("f2e606e6-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusApplication = &IID_ISClusApplication_Value; pub const ISClusApplication = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DomainNames: fn( self: *const ISClusApplication, ppDomains: ?*?*ISDomainNames, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClusterNames: fn( self: *const ISClusApplication, bstrDomainName: ?BSTR, ppClusters: ?*?*ISClusterNames, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenCluster: fn( self: *const ISClusApplication, bstrClusterName: ?BSTR, pCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusApplication_get_DomainNames(self: *const T, ppDomains: ?*?*ISDomainNames) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusApplication.VTable, self.vtable).get_DomainNames(@ptrCast(*const ISClusApplication, self), ppDomains); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusApplication_get_ClusterNames(self: *const T, bstrDomainName: ?BSTR, ppClusters: ?*?*ISClusterNames) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusApplication.VTable, self.vtable).get_ClusterNames(@ptrCast(*const ISClusApplication, self), bstrDomainName, ppClusters); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusApplication_OpenCluster(self: *const T, bstrClusterName: ?BSTR, pCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusApplication.VTable, self.vtable).OpenCluster(@ptrCast(*const ISClusApplication, self), bstrClusterName, pCluster); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISDomainNames_Value = Guid.initString("f2e606e2-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISDomainNames = &IID_ISDomainNames_Value; pub const ISDomainNames = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISDomainNames, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISDomainNames, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISDomainNames, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISDomainNames, varIndex: VARIANT, pbstrDomainName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISDomainNames_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISDomainNames.VTable, self.vtable).get_Count(@ptrCast(*const ISDomainNames, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISDomainNames_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISDomainNames.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISDomainNames, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISDomainNames_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISDomainNames.VTable, self.vtable).Refresh(@ptrCast(*const ISDomainNames, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISDomainNames_get_Item(self: *const T, varIndex: VARIANT, pbstrDomainName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISDomainNames.VTable, self.vtable).get_Item(@ptrCast(*const ISDomainNames, self), varIndex, pbstrDomainName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusterNames_Value = Guid.initString("f2e606ec-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusterNames = &IID_ISClusterNames_Value; pub const ISClusterNames = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusterNames, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusterNames, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusterNames, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusterNames, varIndex: VARIANT, pbstrClusterName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DomainName: fn( self: *const ISClusterNames, pbstrDomainName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusterNames_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusterNames.VTable, self.vtable).get_Count(@ptrCast(*const ISClusterNames, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusterNames_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusterNames.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusterNames, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusterNames_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusterNames.VTable, self.vtable).Refresh(@ptrCast(*const ISClusterNames, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusterNames_get_Item(self: *const T, varIndex: VARIANT, pbstrClusterName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusterNames.VTable, self.vtable).get_Item(@ptrCast(*const ISClusterNames, self), varIndex, pbstrClusterName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusterNames_get_DomainName(self: *const T, pbstrDomainName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusterNames.VTable, self.vtable).get_DomainName(@ptrCast(*const ISClusterNames, self), pbstrDomainName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusRefObject_Value = Guid.initString("f2e60702-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusRefObject = &IID_ISClusRefObject_Value; pub const ISClusRefObject = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISClusRefObject, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRefObject_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRefObject.VTable, self.vtable).get_Handle(@ptrCast(*const ISClusRefObject, self), phandle); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusVersion_Value = Guid.initString("f2e60716-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusVersion = &IID_ISClusVersion_Value; pub const ISClusVersion = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusVersion, pbstrClusterName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MajorVersion: fn( self: *const ISClusVersion, pnMajorVersion: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MinorVersion: fn( self: *const ISClusVersion, pnMinorVersion: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_BuildNumber: fn( self: *const ISClusVersion, pnBuildNumber: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_VendorId: fn( self: *const ISClusVersion, pbstrVendorId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CSDVersion: fn( self: *const ISClusVersion, pbstrCSDVersion: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClusterHighestVersion: fn( self: *const ISClusVersion, pnClusterHighestVersion: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClusterLowestVersion: fn( self: *const ISClusVersion, pnClusterLowestVersion: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const ISClusVersion, pnFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MixedVersion: fn( self: *const ISClusVersion, pvarMixedVersion: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_Name(self: *const T, pbstrClusterName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_Name(@ptrCast(*const ISClusVersion, self), pbstrClusterName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_MajorVersion(self: *const T, pnMajorVersion: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_MajorVersion(@ptrCast(*const ISClusVersion, self), pnMajorVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_MinorVersion(self: *const T, pnMinorVersion: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_MinorVersion(@ptrCast(*const ISClusVersion, self), pnMinorVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_BuildNumber(self: *const T, pnBuildNumber: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_BuildNumber(@ptrCast(*const ISClusVersion, self), pnBuildNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_VendorId(self: *const T, pbstrVendorId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_VendorId(@ptrCast(*const ISClusVersion, self), pbstrVendorId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_CSDVersion(self: *const T, pbstrCSDVersion: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_CSDVersion(@ptrCast(*const ISClusVersion, self), pbstrCSDVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_ClusterHighestVersion(self: *const T, pnClusterHighestVersion: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_ClusterHighestVersion(@ptrCast(*const ISClusVersion, self), pnClusterHighestVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_ClusterLowestVersion(self: *const T, pnClusterLowestVersion: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_ClusterLowestVersion(@ptrCast(*const ISClusVersion, self), pnClusterLowestVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_Flags(self: *const T, pnFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_Flags(@ptrCast(*const ISClusVersion, self), pnFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusVersion_get_MixedVersion(self: *const T, pvarMixedVersion: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusVersion.VTable, self.vtable).get_MixedVersion(@ptrCast(*const ISClusVersion, self), pvarMixedVersion); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISCluster_Value = Guid.initString("f2e606e4-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISCluster = &IID_ISCluster_Value; pub const ISCluster = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISCluster, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISCluster, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISCluster, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISCluster, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISCluster, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Open: fn( self: *const ISCluster, bstrClusterName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISCluster, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const ISCluster, bstrClusterName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Version: fn( self: *const ISCluster, ppClusVersion: ?*?*ISClusVersion, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_QuorumResource: fn( self: *const ISCluster, pClusterResource: ?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_QuorumResource: fn( self: *const ISCluster, pClusterResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_QuorumLogSize: fn( self: *const ISCluster, pnLogSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_QuorumLogSize: fn( self: *const ISCluster, nLogSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_QuorumPath: fn( self: *const ISCluster, ppPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_QuorumPath: fn( self: *const ISCluster, pPath: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Nodes: fn( self: *const ISCluster, ppNodes: ?*?*ISClusNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ResourceGroups: fn( self: *const ISCluster, ppClusterResourceGroups: ?*?*ISClusResGroups, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Resources: fn( self: *const ISCluster, ppClusterResources: ?*?*ISClusResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ResourceTypes: fn( self: *const ISCluster, ppResourceTypes: ?*?*ISClusResTypes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Networks: fn( self: *const ISCluster, ppNetworks: ?*?*ISClusNetworks, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NetInterfaces: fn( self: *const ISCluster, ppNetInterfaces: ?*?*ISClusNetInterfaces, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISCluster, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISCluster, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISCluster, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISCluster, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_Handle(@ptrCast(*const ISCluster, self), phandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_Open(self: *const T, bstrClusterName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).Open(@ptrCast(*const ISCluster, self), bstrClusterName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_Name(@ptrCast(*const ISCluster, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_put_Name(self: *const T, bstrClusterName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).put_Name(@ptrCast(*const ISCluster, self), bstrClusterName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_Version(self: *const T, ppClusVersion: ?*?*ISClusVersion) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_Version(@ptrCast(*const ISCluster, self), ppClusVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_put_QuorumResource(self: *const T, pClusterResource: ?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).put_QuorumResource(@ptrCast(*const ISCluster, self), pClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_QuorumResource(self: *const T, pClusterResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_QuorumResource(@ptrCast(*const ISCluster, self), pClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_QuorumLogSize(self: *const T, pnLogSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_QuorumLogSize(@ptrCast(*const ISCluster, self), pnLogSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_put_QuorumLogSize(self: *const T, nLogSize: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).put_QuorumLogSize(@ptrCast(*const ISCluster, self), nLogSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_QuorumPath(self: *const T, ppPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_QuorumPath(@ptrCast(*const ISCluster, self), ppPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_put_QuorumPath(self: *const T, pPath: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).put_QuorumPath(@ptrCast(*const ISCluster, self), pPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_Nodes(self: *const T, ppNodes: ?*?*ISClusNodes) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_Nodes(@ptrCast(*const ISCluster, self), ppNodes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_ResourceGroups(self: *const T, ppClusterResourceGroups: ?*?*ISClusResGroups) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_ResourceGroups(@ptrCast(*const ISCluster, self), ppClusterResourceGroups); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_Resources(self: *const T, ppClusterResources: ?*?*ISClusResources) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_Resources(@ptrCast(*const ISCluster, self), ppClusterResources); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_ResourceTypes(self: *const T, ppResourceTypes: ?*?*ISClusResTypes) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_ResourceTypes(@ptrCast(*const ISCluster, self), ppResourceTypes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_Networks(self: *const T, ppNetworks: ?*?*ISClusNetworks) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_Networks(@ptrCast(*const ISCluster, self), ppNetworks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISCluster_get_NetInterfaces(self: *const T, ppNetInterfaces: ?*?*ISClusNetInterfaces) callconv(.Inline) HRESULT { return @ptrCast(*const ISCluster.VTable, self.vtable).get_NetInterfaces(@ptrCast(*const ISCluster, self), ppNetInterfaces); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNode_Value = Guid.initString("f2e606f8-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNode = &IID_ISClusNode_Value; pub const ISClusNode = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISClusNode, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISClusNode, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISClusNode, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISClusNode, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusNode, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISClusNode, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NodeID: fn( self: *const ISClusNode, pbstrNodeID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const ISClusNode, dwState: ?*CLUSTER_NODE_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Pause: fn( self: *const ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resume: fn( self: *const ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Evict: fn( self: *const ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ResourceGroups: fn( self: *const ISClusNode, ppResourceGroups: ?*?*ISClusResGroups, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cluster: fn( self: *const ISClusNode, ppCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NetInterfaces: fn( self: *const ISClusNode, ppClusNetInterfaces: ?*?*ISClusNodeNetInterfaces, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISClusNode, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISClusNode, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISClusNode, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISClusNode, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_Name(@ptrCast(*const ISClusNode, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_Handle(@ptrCast(*const ISClusNode, self), phandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_NodeID(self: *const T, pbstrNodeID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_NodeID(@ptrCast(*const ISClusNode, self), pbstrNodeID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_State(self: *const T, dwState: ?*CLUSTER_NODE_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_State(@ptrCast(*const ISClusNode, self), dwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_Pause(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).Pause(@ptrCast(*const ISClusNode, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_Resume(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).Resume(@ptrCast(*const ISClusNode, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_Evict(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).Evict(@ptrCast(*const ISClusNode, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_ResourceGroups(self: *const T, ppResourceGroups: ?*?*ISClusResGroups) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_ResourceGroups(@ptrCast(*const ISClusNode, self), ppResourceGroups); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_Cluster(self: *const T, ppCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_Cluster(@ptrCast(*const ISClusNode, self), ppCluster); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNode_get_NetInterfaces(self: *const T, ppClusNetInterfaces: ?*?*ISClusNodeNetInterfaces) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNode.VTable, self.vtable).get_NetInterfaces(@ptrCast(*const ISClusNode, self), ppClusNetInterfaces); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNodes_Value = Guid.initString("f2e606fa-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNodes = &IID_ISClusNodes_Value; pub const ISClusNodes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusNodes, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusNodes, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusNodes, varIndex: VARIANT, ppNode: ?*?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodes_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodes.VTable, self.vtable).get_Count(@ptrCast(*const ISClusNodes, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodes_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodes.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusNodes, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodes_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodes.VTable, self.vtable).Refresh(@ptrCast(*const ISClusNodes, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodes_get_Item(self: *const T, varIndex: VARIANT, ppNode: ?*?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodes.VTable, self.vtable).get_Item(@ptrCast(*const ISClusNodes, self), varIndex, ppNode); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNetwork_Value = Guid.initString("f2e606f2-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNetwork = &IID_ISClusNetwork_Value; pub const ISClusNetwork = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISClusNetwork, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISClusNetwork, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISClusNetwork, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISClusNetwork, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISClusNetwork, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusNetwork, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const ISClusNetwork, bstrNetworkName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NetworkID: fn( self: *const ISClusNetwork, pbstrNetworkID: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const ISClusNetwork, dwState: ?*CLUSTER_NETWORK_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NetInterfaces: fn( self: *const ISClusNetwork, ppClusNetInterfaces: ?*?*ISClusNetworkNetInterfaces, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cluster: fn( self: *const ISClusNetwork, ppCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISClusNetwork, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISClusNetwork, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISClusNetwork, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISClusNetwork, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_Handle(@ptrCast(*const ISClusNetwork, self), phandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_Name(@ptrCast(*const ISClusNetwork, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_put_Name(self: *const T, bstrNetworkName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).put_Name(@ptrCast(*const ISClusNetwork, self), bstrNetworkName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_NetworkID(self: *const T, pbstrNetworkID: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_NetworkID(@ptrCast(*const ISClusNetwork, self), pbstrNetworkID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_State(self: *const T, dwState: ?*CLUSTER_NETWORK_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_State(@ptrCast(*const ISClusNetwork, self), dwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_NetInterfaces(self: *const T, ppClusNetInterfaces: ?*?*ISClusNetworkNetInterfaces) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_NetInterfaces(@ptrCast(*const ISClusNetwork, self), ppClusNetInterfaces); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetwork_get_Cluster(self: *const T, ppCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetwork.VTable, self.vtable).get_Cluster(@ptrCast(*const ISClusNetwork, self), ppCluster); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNetworks_Value = Guid.initString("f2e606f4-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNetworks = &IID_ISClusNetworks_Value; pub const ISClusNetworks = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusNetworks, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusNetworks, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusNetworks, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusNetworks, varIndex: VARIANT, ppClusNetwork: ?*?*ISClusNetwork, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworks_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworks.VTable, self.vtable).get_Count(@ptrCast(*const ISClusNetworks, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworks_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworks.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusNetworks, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworks_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworks.VTable, self.vtable).Refresh(@ptrCast(*const ISClusNetworks, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworks_get_Item(self: *const T, varIndex: VARIANT, ppClusNetwork: ?*?*ISClusNetwork) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworks.VTable, self.vtable).get_Item(@ptrCast(*const ISClusNetworks, self), varIndex, ppClusNetwork); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNetInterface_Value = Guid.initString("f2e606ee-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNetInterface = &IID_ISClusNetInterface_Value; pub const ISClusNetInterface = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISClusNetInterface, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISClusNetInterface, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISClusNetInterface, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISClusNetInterface, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusNetInterface, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISClusNetInterface, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const ISClusNetInterface, dwState: ?*CLUSTER_NETINTERFACE_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cluster: fn( self: *const ISClusNetInterface, ppCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISClusNetInterface, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISClusNetInterface, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISClusNetInterface, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISClusNetInterface, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_Name(@ptrCast(*const ISClusNetInterface, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_Handle(@ptrCast(*const ISClusNetInterface, self), phandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_State(self: *const T, dwState: ?*CLUSTER_NETINTERFACE_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_State(@ptrCast(*const ISClusNetInterface, self), dwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterface_get_Cluster(self: *const T, ppCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterface.VTable, self.vtable).get_Cluster(@ptrCast(*const ISClusNetInterface, self), ppCluster); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNetInterfaces_Value = Guid.initString("f2e606f0-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNetInterfaces = &IID_ISClusNetInterfaces_Value; pub const ISClusNetInterfaces = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusNetInterfaces, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusNetInterfaces, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusNetInterfaces, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusNetInterfaces, varIndex: VARIANT, ppClusNetInterface: ?*?*ISClusNetInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterfaces_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterfaces.VTable, self.vtable).get_Count(@ptrCast(*const ISClusNetInterfaces, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterfaces_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterfaces.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusNetInterfaces, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterfaces_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterfaces.VTable, self.vtable).Refresh(@ptrCast(*const ISClusNetInterfaces, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetInterfaces_get_Item(self: *const T, varIndex: VARIANT, ppClusNetInterface: ?*?*ISClusNetInterface) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetInterfaces.VTable, self.vtable).get_Item(@ptrCast(*const ISClusNetInterfaces, self), varIndex, ppClusNetInterface); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNodeNetInterfaces_Value = Guid.initString("f2e606fc-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNodeNetInterfaces = &IID_ISClusNodeNetInterfaces_Value; pub const ISClusNodeNetInterfaces = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusNodeNetInterfaces, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusNodeNetInterfaces, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusNodeNetInterfaces, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusNodeNetInterfaces, varIndex: VARIANT, ppClusNetInterface: ?*?*ISClusNetInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodeNetInterfaces_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodeNetInterfaces.VTable, self.vtable).get_Count(@ptrCast(*const ISClusNodeNetInterfaces, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodeNetInterfaces_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodeNetInterfaces.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusNodeNetInterfaces, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodeNetInterfaces_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodeNetInterfaces.VTable, self.vtable).Refresh(@ptrCast(*const ISClusNodeNetInterfaces, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNodeNetInterfaces_get_Item(self: *const T, varIndex: VARIANT, ppClusNetInterface: ?*?*ISClusNetInterface) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNodeNetInterfaces.VTable, self.vtable).get_Item(@ptrCast(*const ISClusNodeNetInterfaces, self), varIndex, ppClusNetInterface); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusNetworkNetInterfaces_Value = Guid.initString("f2e606f6-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusNetworkNetInterfaces = &IID_ISClusNetworkNetInterfaces_Value; pub const ISClusNetworkNetInterfaces = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusNetworkNetInterfaces, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusNetworkNetInterfaces, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusNetworkNetInterfaces, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusNetworkNetInterfaces, varIndex: VARIANT, ppClusNetInterface: ?*?*ISClusNetInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworkNetInterfaces_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworkNetInterfaces.VTable, self.vtable).get_Count(@ptrCast(*const ISClusNetworkNetInterfaces, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworkNetInterfaces_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworkNetInterfaces.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusNetworkNetInterfaces, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworkNetInterfaces_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworkNetInterfaces.VTable, self.vtable).Refresh(@ptrCast(*const ISClusNetworkNetInterfaces, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusNetworkNetInterfaces_get_Item(self: *const T, varIndex: VARIANT, ppClusNetInterface: ?*?*ISClusNetInterface) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusNetworkNetInterfaces.VTable, self.vtable).get_Item(@ptrCast(*const ISClusNetworkNetInterfaces, self), varIndex, ppClusNetInterface); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResGroup_Value = Guid.initString("f2e60706-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResGroup = &IID_ISClusResGroup_Value; pub const ISClusResGroup = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISClusResGroup, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISClusResGroup, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISClusResGroup, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISClusResGroup, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISClusResGroup, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusResGroup, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const ISClusResGroup, bstrGroupName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const ISClusResGroup, dwState: ?*CLUSTER_GROUP_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_OwnerNode: fn( self: *const ISClusResGroup, ppOwnerNode: ?*?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Resources: fn( self: *const ISClusResGroup, ppClusterGroupResources: ?*?*ISClusResGroupResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PreferredOwnerNodes: fn( self: *const ISClusResGroup, ppOwnerNodes: ?*?*ISClusResGroupPreferredOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const ISClusResGroup, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Online: fn( self: *const ISClusResGroup, varTimeout: VARIANT, varNode: VARIANT, pvarPending: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const ISClusResGroup, varTimeout: VARIANT, varNode: VARIANT, pvarPending: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Offline: fn( self: *const ISClusResGroup, varTimeout: VARIANT, pvarPending: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cluster: fn( self: *const ISClusResGroup, ppCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISClusResGroup, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISClusResGroup, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISClusResGroup, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISClusResGroup, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_Handle(@ptrCast(*const ISClusResGroup, self), phandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_Name(@ptrCast(*const ISClusResGroup, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_put_Name(self: *const T, bstrGroupName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).put_Name(@ptrCast(*const ISClusResGroup, self), bstrGroupName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_State(self: *const T, dwState: ?*CLUSTER_GROUP_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_State(@ptrCast(*const ISClusResGroup, self), dwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_OwnerNode(self: *const T, ppOwnerNode: ?*?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_OwnerNode(@ptrCast(*const ISClusResGroup, self), ppOwnerNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_Resources(self: *const T, ppClusterGroupResources: ?*?*ISClusResGroupResources) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_Resources(@ptrCast(*const ISClusResGroup, self), ppClusterGroupResources); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_PreferredOwnerNodes(self: *const T, ppOwnerNodes: ?*?*ISClusResGroupPreferredOwnerNodes) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_PreferredOwnerNodes(@ptrCast(*const ISClusResGroup, self), ppOwnerNodes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).Delete(@ptrCast(*const ISClusResGroup, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_Online(self: *const T, varTimeout: VARIANT, varNode: VARIANT, pvarPending: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).Online(@ptrCast(*const ISClusResGroup, self), varTimeout, varNode, pvarPending); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_Move(self: *const T, varTimeout: VARIANT, varNode: VARIANT, pvarPending: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).Move(@ptrCast(*const ISClusResGroup, self), varTimeout, varNode, pvarPending); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_Offline(self: *const T, varTimeout: VARIANT, pvarPending: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).Offline(@ptrCast(*const ISClusResGroup, self), varTimeout, pvarPending); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroup_get_Cluster(self: *const T, ppCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroup.VTable, self.vtable).get_Cluster(@ptrCast(*const ISClusResGroup, self), ppCluster); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResGroups_Value = Guid.initString("f2e60708-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResGroups = &IID_ISClusResGroups_Value; pub const ISClusResGroups = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResGroups, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResGroups, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResGroups, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResGroups, varIndex: VARIANT, ppClusResGroup: ?*?*ISClusResGroup, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResGroups, bstrResourceGroupName: ?BSTR, ppResourceGroup: ?*?*ISClusResGroup, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResGroups, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroups_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroups.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResGroups, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroups_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroups.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResGroups, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroups_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroups.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResGroups, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroups_get_Item(self: *const T, varIndex: VARIANT, ppClusResGroup: ?*?*ISClusResGroup) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroups.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResGroups, self), varIndex, ppClusResGroup); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroups_CreateItem(self: *const T, bstrResourceGroupName: ?BSTR, ppResourceGroup: ?*?*ISClusResGroup) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroups.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResGroups, self), bstrResourceGroupName, ppResourceGroup); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroups_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroups.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResGroups, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResource_Value = Guid.initString("f2e6070a-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResource = &IID_ISClusResource_Value; pub const ISClusResource = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISClusResource, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISClusResource, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISClusResource, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISClusResource, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const ISClusResource, phandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusResource, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const ISClusResource, bstrResourceName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const ISClusResource, dwState: ?*CLUSTER_RESOURCE_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CoreFlag: fn( self: *const ISClusResource, dwCoreFlag: ?*CLUS_FLAGS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BecomeQuorumResource: fn( self: *const ISClusResource, bstrDevicePath: ?BSTR, lMaxLogSize: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Fail: fn( self: *const ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Online: fn( self: *const ISClusResource, nTimeout: i32, pvarPending: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Offline: fn( self: *const ISClusResource, nTimeout: i32, pvarPending: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ChangeResourceGroup: fn( self: *const ISClusResource, pResourceGroup: ?*ISClusResGroup, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddResourceNode: fn( self: *const ISClusResource, pNode: ?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveResourceNode: fn( self: *const ISClusResource, pNode: ?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CanResourceBeDependent: fn( self: *const ISClusResource, pResource: ?*ISClusResource, pvarDependent: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PossibleOwnerNodes: fn( self: *const ISClusResource, ppOwnerNodes: ?*?*ISClusResPossibleOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Dependencies: fn( self: *const ISClusResource, ppResDependencies: ?*?*ISClusResDependencies, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Dependents: fn( self: *const ISClusResource, ppResDependents: ?*?*ISClusResDependents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Group: fn( self: *const ISClusResource, ppResGroup: ?*?*ISClusResGroup, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_OwnerNode: fn( self: *const ISClusResource, ppOwnerNode: ?*?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cluster: fn( self: *const ISClusResource, ppCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClassInfo: fn( self: *const ISClusResource, prcClassInfo: ?*CLUSTER_RESOURCE_CLASS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Disk: fn( self: *const ISClusResource, ppDisk: ?*?*ISClusDisk, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RegistryKeys: fn( self: *const ISClusResource, ppRegistryKeys: ?*?*ISClusRegistryKeys, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CryptoKeys: fn( self: *const ISClusResource, ppCryptoKeys: ?*?*ISClusCryptoKeys, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TypeName: fn( self: *const ISClusResource, pbstrTypeName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const ISClusResource, ppResourceType: ?*?*ISClusResType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaintenanceMode: fn( self: *const ISClusResource, pbMaintenanceMode: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MaintenanceMode: fn( self: *const ISClusResource, bMaintenanceMode: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISClusResource, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISClusResource, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISClusResource, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISClusResource, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Handle(self: *const T, phandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Handle(@ptrCast(*const ISClusResource, self), phandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Name(@ptrCast(*const ISClusResource, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_put_Name(self: *const T, bstrResourceName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).put_Name(@ptrCast(*const ISClusResource, self), bstrResourceName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_State(self: *const T, dwState: ?*CLUSTER_RESOURCE_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_State(@ptrCast(*const ISClusResource, self), dwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_CoreFlag(self: *const T, dwCoreFlag: ?*CLUS_FLAGS) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_CoreFlag(@ptrCast(*const ISClusResource, self), dwCoreFlag); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_BecomeQuorumResource(self: *const T, bstrDevicePath: ?BSTR, lMaxLogSize: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).BecomeQuorumResource(@ptrCast(*const ISClusResource, self), bstrDevicePath, lMaxLogSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).Delete(@ptrCast(*const ISClusResource, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_Fail(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).Fail(@ptrCast(*const ISClusResource, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_Online(self: *const T, nTimeout: i32, pvarPending: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).Online(@ptrCast(*const ISClusResource, self), nTimeout, pvarPending); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_Offline(self: *const T, nTimeout: i32, pvarPending: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).Offline(@ptrCast(*const ISClusResource, self), nTimeout, pvarPending); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_ChangeResourceGroup(self: *const T, pResourceGroup: ?*ISClusResGroup) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).ChangeResourceGroup(@ptrCast(*const ISClusResource, self), pResourceGroup); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_AddResourceNode(self: *const T, pNode: ?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).AddResourceNode(@ptrCast(*const ISClusResource, self), pNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_RemoveResourceNode(self: *const T, pNode: ?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).RemoveResourceNode(@ptrCast(*const ISClusResource, self), pNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_CanResourceBeDependent(self: *const T, pResource: ?*ISClusResource, pvarDependent: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).CanResourceBeDependent(@ptrCast(*const ISClusResource, self), pResource, pvarDependent); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_PossibleOwnerNodes(self: *const T, ppOwnerNodes: ?*?*ISClusResPossibleOwnerNodes) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_PossibleOwnerNodes(@ptrCast(*const ISClusResource, self), ppOwnerNodes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Dependencies(self: *const T, ppResDependencies: ?*?*ISClusResDependencies) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Dependencies(@ptrCast(*const ISClusResource, self), ppResDependencies); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Dependents(self: *const T, ppResDependents: ?*?*ISClusResDependents) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Dependents(@ptrCast(*const ISClusResource, self), ppResDependents); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Group(self: *const T, ppResGroup: ?*?*ISClusResGroup) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Group(@ptrCast(*const ISClusResource, self), ppResGroup); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_OwnerNode(self: *const T, ppOwnerNode: ?*?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_OwnerNode(@ptrCast(*const ISClusResource, self), ppOwnerNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Cluster(self: *const T, ppCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Cluster(@ptrCast(*const ISClusResource, self), ppCluster); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_ClassInfo(self: *const T, prcClassInfo: ?*CLUSTER_RESOURCE_CLASS) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_ClassInfo(@ptrCast(*const ISClusResource, self), prcClassInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Disk(self: *const T, ppDisk: ?*?*ISClusDisk) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Disk(@ptrCast(*const ISClusResource, self), ppDisk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_RegistryKeys(self: *const T, ppRegistryKeys: ?*?*ISClusRegistryKeys) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_RegistryKeys(@ptrCast(*const ISClusResource, self), ppRegistryKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_CryptoKeys(self: *const T, ppCryptoKeys: ?*?*ISClusCryptoKeys) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_CryptoKeys(@ptrCast(*const ISClusResource, self), ppCryptoKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_TypeName(self: *const T, pbstrTypeName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_TypeName(@ptrCast(*const ISClusResource, self), pbstrTypeName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_Type(self: *const T, ppResourceType: ?*?*ISClusResType) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_Type(@ptrCast(*const ISClusResource, self), ppResourceType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_get_MaintenanceMode(self: *const T, pbMaintenanceMode: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).get_MaintenanceMode(@ptrCast(*const ISClusResource, self), pbMaintenanceMode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResource_put_MaintenanceMode(self: *const T, bMaintenanceMode: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResource.VTable, self.vtable).put_MaintenanceMode(@ptrCast(*const ISClusResource, self), bMaintenanceMode); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResDependencies_Value = Guid.initString("f2e60704-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResDependencies = &IID_ISClusResDependencies_Value; pub const ISClusResDependencies = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResDependencies, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResDependencies, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResDependencies, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResDependencies, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResDependencies, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResDependencies, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddItem: fn( self: *const ISClusResDependencies, pResource: ?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusResDependencies, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResDependencies, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResDependencies, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResDependencies, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_get_Item(self: *const T, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResDependencies, self), varIndex, ppClusResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_CreateItem(self: *const T, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResDependencies, self), bstrResourceName, bstrResourceType, dwFlags, ppClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResDependencies, self), varIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_AddItem(self: *const T, pResource: ?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).AddItem(@ptrCast(*const ISClusResDependencies, self), pResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependencies_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependencies.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusResDependencies, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResGroupResources_Value = Guid.initString("f2e606ea-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResGroupResources = &IID_ISClusResGroupResources_Value; pub const ISClusResGroupResources = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResGroupResources, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResGroupResources, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResGroupResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResGroupResources, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResGroupResources, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResGroupResources, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupResources_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupResources.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResGroupResources, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupResources_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupResources.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResGroupResources, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupResources_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupResources.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResGroupResources, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupResources_get_Item(self: *const T, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupResources.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResGroupResources, self), varIndex, ppClusResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupResources_CreateItem(self: *const T, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupResources.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResGroupResources, self), bstrResourceName, bstrResourceType, dwFlags, ppClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupResources_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupResources.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResGroupResources, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResTypeResources_Value = Guid.initString("f2e60714-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResTypeResources = &IID_ISClusResTypeResources_Value; pub const ISClusResTypeResources = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResTypeResources, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResTypeResources, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResTypeResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResTypeResources, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResTypeResources, bstrResourceName: ?BSTR, bstrGroupName: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResTypeResources, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypeResources_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypeResources.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResTypeResources, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypeResources_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypeResources.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResTypeResources, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypeResources_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypeResources.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResTypeResources, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypeResources_get_Item(self: *const T, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypeResources.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResTypeResources, self), varIndex, ppClusResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypeResources_CreateItem(self: *const T, bstrResourceName: ?BSTR, bstrGroupName: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypeResources.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResTypeResources, self), bstrResourceName, bstrGroupName, dwFlags, ppClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypeResources_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypeResources.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResTypeResources, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResources_Value = Guid.initString("f2e6070c-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResources = &IID_ISClusResources_Value; pub const ISClusResources = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResources, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResources, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResources, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResources, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, bstrGroupName: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResources, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResources_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResources.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResources, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResources_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResources.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResources, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResources_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResources.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResources, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResources_get_Item(self: *const T, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResources.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResources, self), varIndex, ppClusResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResources_CreateItem(self: *const T, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, bstrGroupName: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResources.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResources, self), bstrResourceName, bstrResourceType, bstrGroupName, dwFlags, ppClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResources_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResources.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResources, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResGroupPreferredOwnerNodes_Value = Guid.initString("f2e606e8-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResGroupPreferredOwnerNodes = &IID_ISClusResGroupPreferredOwnerNodes_Value; pub const ISClusResGroupPreferredOwnerNodes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResGroupPreferredOwnerNodes, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResGroupPreferredOwnerNodes, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResGroupPreferredOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResGroupPreferredOwnerNodes, varIndex: VARIANT, ppNode: ?*?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InsertItem: fn( self: *const ISClusResGroupPreferredOwnerNodes, pNode: ?*ISClusNode, nPosition: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusResGroupPreferredOwnerNodes, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Modified: fn( self: *const ISClusResGroupPreferredOwnerNodes, pvarModified: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveChanges: fn( self: *const ISClusResGroupPreferredOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddItem: fn( self: *const ISClusResGroupPreferredOwnerNodes, pNode: ?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_get_Item(self: *const T, varIndex: VARIANT, ppNode: ?*?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), varIndex, ppNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_InsertItem(self: *const T, pNode: ?*ISClusNode, nPosition: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).InsertItem(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), pNode, nPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), varIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_get_Modified(self: *const T, pvarModified: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).get_Modified(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), pvarModified); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_SaveChanges(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).SaveChanges(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResGroupPreferredOwnerNodes_AddItem(self: *const T, pNode: ?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResGroupPreferredOwnerNodes.VTable, self.vtable).AddItem(@ptrCast(*const ISClusResGroupPreferredOwnerNodes, self), pNode); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResPossibleOwnerNodes_Value = Guid.initString("f2e6070e-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResPossibleOwnerNodes = &IID_ISClusResPossibleOwnerNodes_Value; pub const ISClusResPossibleOwnerNodes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResPossibleOwnerNodes, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResPossibleOwnerNodes, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResPossibleOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResPossibleOwnerNodes, varIndex: VARIANT, ppNode: ?*?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddItem: fn( self: *const ISClusResPossibleOwnerNodes, pNode: ?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusResPossibleOwnerNodes, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Modified: fn( self: *const ISClusResPossibleOwnerNodes, pvarModified: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResPossibleOwnerNodes, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResPossibleOwnerNodes, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResPossibleOwnerNodes, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_get_Item(self: *const T, varIndex: VARIANT, ppNode: ?*?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResPossibleOwnerNodes, self), varIndex, ppNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_AddItem(self: *const T, pNode: ?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).AddItem(@ptrCast(*const ISClusResPossibleOwnerNodes, self), pNode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusResPossibleOwnerNodes, self), varIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResPossibleOwnerNodes_get_Modified(self: *const T, pvarModified: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResPossibleOwnerNodes.VTable, self.vtable).get_Modified(@ptrCast(*const ISClusResPossibleOwnerNodes, self), pvarModified); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResTypePossibleOwnerNodes_Value = Guid.initString("f2e60718-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResTypePossibleOwnerNodes = &IID_ISClusResTypePossibleOwnerNodes_Value; pub const ISClusResTypePossibleOwnerNodes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResTypePossibleOwnerNodes, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResTypePossibleOwnerNodes, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResTypePossibleOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResTypePossibleOwnerNodes, varIndex: VARIANT, ppNode: ?*?*ISClusNode, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypePossibleOwnerNodes_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypePossibleOwnerNodes.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResTypePossibleOwnerNodes, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypePossibleOwnerNodes_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypePossibleOwnerNodes.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResTypePossibleOwnerNodes, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypePossibleOwnerNodes_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypePossibleOwnerNodes.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResTypePossibleOwnerNodes, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypePossibleOwnerNodes_get_Item(self: *const T, varIndex: VARIANT, ppNode: ?*?*ISClusNode) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypePossibleOwnerNodes.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResTypePossibleOwnerNodes, self), varIndex, ppNode); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResType_Value = Guid.initString("f2e60710-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResType = &IID_ISClusResType_Value; pub const ISClusResType = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonProperties: fn( self: *const ISClusResType, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateProperties: fn( self: *const ISClusResType, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CommonROProperties: fn( self: *const ISClusResType, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PrivateROProperties: fn( self: *const ISClusResType, ppProperties: ?*?*ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusResType, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const ISClusResType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cluster: fn( self: *const ISClusResType, ppCluster: ?*?*ISCluster, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Resources: fn( self: *const ISClusResType, ppClusterResTypeResources: ?*?*ISClusResTypeResources, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PossibleOwnerNodes: fn( self: *const ISClusResType, ppOwnerNodes: ?*?*ISClusResTypePossibleOwnerNodes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AvailableDisks: fn( self: *const ISClusResType, ppAvailableDisks: ?*?*ISClusDisks, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_CommonProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_CommonProperties(@ptrCast(*const ISClusResType, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_PrivateProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_PrivateProperties(@ptrCast(*const ISClusResType, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_CommonROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_CommonROProperties(@ptrCast(*const ISClusResType, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_PrivateROProperties(self: *const T, ppProperties: ?*?*ISClusProperties) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_PrivateROProperties(@ptrCast(*const ISClusResType, self), ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_Name(@ptrCast(*const ISClusResType, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_Delete(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).Delete(@ptrCast(*const ISClusResType, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_Cluster(self: *const T, ppCluster: ?*?*ISCluster) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_Cluster(@ptrCast(*const ISClusResType, self), ppCluster); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_Resources(self: *const T, ppClusterResTypeResources: ?*?*ISClusResTypeResources) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_Resources(@ptrCast(*const ISClusResType, self), ppClusterResTypeResources); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_PossibleOwnerNodes(self: *const T, ppOwnerNodes: ?*?*ISClusResTypePossibleOwnerNodes) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_PossibleOwnerNodes(@ptrCast(*const ISClusResType, self), ppOwnerNodes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResType_get_AvailableDisks(self: *const T, ppAvailableDisks: ?*?*ISClusDisks) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResType.VTable, self.vtable).get_AvailableDisks(@ptrCast(*const ISClusResType, self), ppAvailableDisks); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResTypes_Value = Guid.initString("f2e60712-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResTypes = &IID_ISClusResTypes_Value; pub const ISClusResTypes = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResTypes, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResTypes, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResTypes, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResTypes, varIndex: VARIANT, ppClusResType: ?*?*ISClusResType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResTypes, bstrResourceTypeName: ?BSTR, bstrDisplayName: ?BSTR, bstrResourceTypeDll: ?BSTR, dwLooksAlivePollInterval: i32, dwIsAlivePollInterval: i32, ppResourceType: ?*?*ISClusResType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResTypes, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypes_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypes.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResTypes, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypes_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypes.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResTypes, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypes_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypes.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResTypes, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypes_get_Item(self: *const T, varIndex: VARIANT, ppClusResType: ?*?*ISClusResType) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypes.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResTypes, self), varIndex, ppClusResType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypes_CreateItem(self: *const T, bstrResourceTypeName: ?BSTR, bstrDisplayName: ?BSTR, bstrResourceTypeDll: ?BSTR, dwLooksAlivePollInterval: i32, dwIsAlivePollInterval: i32, ppResourceType: ?*?*ISClusResType) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypes.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResTypes, self), bstrResourceTypeName, bstrDisplayName, bstrResourceTypeDll, dwLooksAlivePollInterval, dwIsAlivePollInterval, ppResourceType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResTypes_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResTypes.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResTypes, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusProperty_Value = Guid.initString("f2e606fe-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusProperty = &IID_ISClusProperty_Value; pub const ISClusProperty = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ISClusProperty, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Length: fn( self: *const ISClusProperty, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ValueCount: fn( self: *const ISClusProperty, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Values: fn( self: *const ISClusProperty, ppClusterPropertyValues: ?*?*ISClusPropertyValues, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Value: fn( self: *const ISClusProperty, pvarValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Value: fn( self: *const ISClusProperty, varValue: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const ISClusProperty, pType: ?*CLUSTER_PROPERTY_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Type: fn( self: *const ISClusProperty, Type: CLUSTER_PROPERTY_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Format: fn( self: *const ISClusProperty, pFormat: ?*CLUSTER_PROPERTY_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Format: fn( self: *const ISClusProperty, Format: CLUSTER_PROPERTY_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ReadOnly: fn( self: *const ISClusProperty, pvarReadOnly: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Private: fn( self: *const ISClusProperty, pvarPrivate: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Common: fn( self: *const ISClusProperty, pvarCommon: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Modified: fn( self: *const ISClusProperty, pvarModified: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UseDefaultValue: fn( self: *const ISClusProperty, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Name(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Name(@ptrCast(*const ISClusProperty, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Length(self: *const T, pLength: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Length(@ptrCast(*const ISClusProperty, self), pLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_ValueCount(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_ValueCount(@ptrCast(*const ISClusProperty, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Values(self: *const T, ppClusterPropertyValues: ?*?*ISClusPropertyValues) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Values(@ptrCast(*const ISClusProperty, self), ppClusterPropertyValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Value(self: *const T, pvarValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Value(@ptrCast(*const ISClusProperty, self), pvarValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_put_Value(self: *const T, varValue: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).put_Value(@ptrCast(*const ISClusProperty, self), varValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Type(self: *const T, pType: ?*CLUSTER_PROPERTY_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Type(@ptrCast(*const ISClusProperty, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_put_Type(self: *const T, Type: CLUSTER_PROPERTY_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).put_Type(@ptrCast(*const ISClusProperty, self), Type); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Format(self: *const T, pFormat: ?*CLUSTER_PROPERTY_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Format(@ptrCast(*const ISClusProperty, self), pFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_put_Format(self: *const T, Format: CLUSTER_PROPERTY_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).put_Format(@ptrCast(*const ISClusProperty, self), Format); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_ReadOnly(self: *const T, pvarReadOnly: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_ReadOnly(@ptrCast(*const ISClusProperty, self), pvarReadOnly); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Private(self: *const T, pvarPrivate: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Private(@ptrCast(*const ISClusProperty, self), pvarPrivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Common(self: *const T, pvarCommon: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Common(@ptrCast(*const ISClusProperty, self), pvarCommon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_get_Modified(self: *const T, pvarModified: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).get_Modified(@ptrCast(*const ISClusProperty, self), pvarModified); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperty_UseDefaultValue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperty.VTable, self.vtable).UseDefaultValue(@ptrCast(*const ISClusProperty, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusPropertyValue_Value = Guid.initString("f2e6071a-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusPropertyValue = &IID_ISClusPropertyValue_Value; pub const ISClusPropertyValue = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Value: fn( self: *const ISClusPropertyValue, pvarValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Value: fn( self: *const ISClusPropertyValue, varValue: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const ISClusPropertyValue, pType: ?*CLUSTER_PROPERTY_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Type: fn( self: *const ISClusPropertyValue, Type: CLUSTER_PROPERTY_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Format: fn( self: *const ISClusPropertyValue, pFormat: ?*CLUSTER_PROPERTY_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Format: fn( self: *const ISClusPropertyValue, Format: CLUSTER_PROPERTY_FORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Length: fn( self: *const ISClusPropertyValue, pLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DataCount: fn( self: *const ISClusPropertyValue, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Data: fn( self: *const ISClusPropertyValue, ppClusterPropertyValueData: ?*?*ISClusPropertyValueData, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_get_Value(self: *const T, pvarValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).get_Value(@ptrCast(*const ISClusPropertyValue, self), pvarValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_put_Value(self: *const T, varValue: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).put_Value(@ptrCast(*const ISClusPropertyValue, self), varValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_get_Type(self: *const T, pType: ?*CLUSTER_PROPERTY_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).get_Type(@ptrCast(*const ISClusPropertyValue, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_put_Type(self: *const T, Type: CLUSTER_PROPERTY_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).put_Type(@ptrCast(*const ISClusPropertyValue, self), Type); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_get_Format(self: *const T, pFormat: ?*CLUSTER_PROPERTY_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).get_Format(@ptrCast(*const ISClusPropertyValue, self), pFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_put_Format(self: *const T, Format: CLUSTER_PROPERTY_FORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).put_Format(@ptrCast(*const ISClusPropertyValue, self), Format); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_get_Length(self: *const T, pLength: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).get_Length(@ptrCast(*const ISClusPropertyValue, self), pLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_get_DataCount(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).get_DataCount(@ptrCast(*const ISClusPropertyValue, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValue_get_Data(self: *const T, ppClusterPropertyValueData: ?*?*ISClusPropertyValueData) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValue.VTable, self.vtable).get_Data(@ptrCast(*const ISClusPropertyValue, self), ppClusterPropertyValueData); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusPropertyValues_Value = Guid.initString("f2e6071c-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusPropertyValues = &IID_ISClusPropertyValues_Value; pub const ISClusPropertyValues = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusPropertyValues, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusPropertyValues, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusPropertyValues, varIndex: VARIANT, ppPropertyValue: ?*?*ISClusPropertyValue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusPropertyValues, bstrName: ?BSTR, varValue: VARIANT, ppPropertyValue: ?*?*ISClusPropertyValue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusPropertyValues, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValues_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValues.VTable, self.vtable).get_Count(@ptrCast(*const ISClusPropertyValues, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValues_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValues.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusPropertyValues, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValues_get_Item(self: *const T, varIndex: VARIANT, ppPropertyValue: ?*?*ISClusPropertyValue) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValues.VTable, self.vtable).get_Item(@ptrCast(*const ISClusPropertyValues, self), varIndex, ppPropertyValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValues_CreateItem(self: *const T, bstrName: ?BSTR, varValue: VARIANT, ppPropertyValue: ?*?*ISClusPropertyValue) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValues.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusPropertyValues, self), bstrName, varValue, ppPropertyValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValues_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValues.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusPropertyValues, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusProperties_Value = Guid.initString("f2e60700-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusProperties = &IID_ISClusProperties_Value; pub const ISClusProperties = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusProperties, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusProperties, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusProperties, varIndex: VARIANT, ppClusProperty: ?*?*ISClusProperty, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusProperties, bstrName: ?BSTR, varValue: VARIANT, pProperty: ?*?*ISClusProperty, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UseDefaultValue: fn( self: *const ISClusProperties, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveChanges: fn( self: *const ISClusProperties, pvarStatusCode: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ReadOnly: fn( self: *const ISClusProperties, pvarReadOnly: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Private: fn( self: *const ISClusProperties, pvarPrivate: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Common: fn( self: *const ISClusProperties, pvarCommon: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Modified: fn( self: *const ISClusProperties, pvarModified: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get_Count(@ptrCast(*const ISClusProperties, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusProperties, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).Refresh(@ptrCast(*const ISClusProperties, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get_Item(self: *const T, varIndex: VARIANT, ppClusProperty: ?*?*ISClusProperty) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get_Item(@ptrCast(*const ISClusProperties, self), varIndex, ppClusProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_CreateItem(self: *const T, bstrName: ?BSTR, varValue: VARIANT, pProperty: ?*?*ISClusProperty) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusProperties, self), bstrName, varValue, pProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_UseDefaultValue(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).UseDefaultValue(@ptrCast(*const ISClusProperties, self), varIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_SaveChanges(self: *const T, pvarStatusCode: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).SaveChanges(@ptrCast(*const ISClusProperties, self), pvarStatusCode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get_ReadOnly(self: *const T, pvarReadOnly: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get_ReadOnly(@ptrCast(*const ISClusProperties, self), pvarReadOnly); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get_Private(self: *const T, pvarPrivate: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get_Private(@ptrCast(*const ISClusProperties, self), pvarPrivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get_Common(self: *const T, pvarCommon: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get_Common(@ptrCast(*const ISClusProperties, self), pvarCommon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusProperties_get_Modified(self: *const T, pvarModified: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusProperties.VTable, self.vtable).get_Modified(@ptrCast(*const ISClusProperties, self), pvarModified); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusPropertyValueData_Value = Guid.initString("f2e6071e-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusPropertyValueData = &IID_ISClusPropertyValueData_Value; pub const ISClusPropertyValueData = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusPropertyValueData, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusPropertyValueData, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusPropertyValueData, varIndex: VARIANT, pvarValue: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusPropertyValueData, varValue: VARIANT, pvarData: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusPropertyValueData, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValueData_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValueData.VTable, self.vtable).get_Count(@ptrCast(*const ISClusPropertyValueData, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValueData_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValueData.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusPropertyValueData, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValueData_get_Item(self: *const T, varIndex: VARIANT, pvarValue: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValueData.VTable, self.vtable).get_Item(@ptrCast(*const ISClusPropertyValueData, self), varIndex, pvarValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValueData_CreateItem(self: *const T, varValue: VARIANT, pvarData: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValueData.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusPropertyValueData, self), varValue, pvarData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPropertyValueData_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPropertyValueData.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusPropertyValueData, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusPartition_Value = Guid.initString("f2e60720-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusPartition = &IID_ISClusPartition_Value; pub const ISClusPartition = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Flags: fn( self: *const ISClusPartition, plFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DeviceName: fn( self: *const ISClusPartition, pbstrDeviceName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_VolumeLabel: fn( self: *const ISClusPartition, pbstrVolumeLabel: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SerialNumber: fn( self: *const ISClusPartition, plSerialNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaximumComponentLength: fn( self: *const ISClusPartition, plMaximumComponentLength: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FileSystemFlags: fn( self: *const ISClusPartition, plFileSystemFlags: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FileSystem: fn( self: *const ISClusPartition, pbstrFileSystem: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_Flags(self: *const T, plFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_Flags(@ptrCast(*const ISClusPartition, self), plFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_DeviceName(self: *const T, pbstrDeviceName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_DeviceName(@ptrCast(*const ISClusPartition, self), pbstrDeviceName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_VolumeLabel(self: *const T, pbstrVolumeLabel: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_VolumeLabel(@ptrCast(*const ISClusPartition, self), pbstrVolumeLabel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_SerialNumber(self: *const T, plSerialNumber: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_SerialNumber(@ptrCast(*const ISClusPartition, self), plSerialNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_MaximumComponentLength(self: *const T, plMaximumComponentLength: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_MaximumComponentLength(@ptrCast(*const ISClusPartition, self), plMaximumComponentLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_FileSystemFlags(self: *const T, plFileSystemFlags: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_FileSystemFlags(@ptrCast(*const ISClusPartition, self), plFileSystemFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartition_get_FileSystem(self: *const T, pbstrFileSystem: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartition.VTable, self.vtable).get_FileSystem(@ptrCast(*const ISClusPartition, self), pbstrFileSystem); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windowsServer2008' const IID_ISClusPartitionEx_Value = Guid.initString("8802d4fe-b32e-4ad1-9dbd-64f18e1166ce"); pub const IID_ISClusPartitionEx = &IID_ISClusPartitionEx_Value; pub const ISClusPartitionEx = extern struct { pub const VTable = extern struct { base: ISClusPartition.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TotalSize: fn( self: *const ISClusPartitionEx, plTotalSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_FreeSpace: fn( self: *const ISClusPartitionEx, plFreeSpace: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DeviceNumber: fn( self: *const ISClusPartitionEx, plDeviceNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PartitionNumber: fn( self: *const ISClusPartitionEx, plPartitionNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_VolumeGuid: fn( self: *const ISClusPartitionEx, pbstrVolumeGuid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISClusPartition.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitionEx_get_TotalSize(self: *const T, plTotalSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitionEx.VTable, self.vtable).get_TotalSize(@ptrCast(*const ISClusPartitionEx, self), plTotalSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitionEx_get_FreeSpace(self: *const T, plFreeSpace: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitionEx.VTable, self.vtable).get_FreeSpace(@ptrCast(*const ISClusPartitionEx, self), plFreeSpace); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitionEx_get_DeviceNumber(self: *const T, plDeviceNumber: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitionEx.VTable, self.vtable).get_DeviceNumber(@ptrCast(*const ISClusPartitionEx, self), plDeviceNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitionEx_get_PartitionNumber(self: *const T, plPartitionNumber: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitionEx.VTable, self.vtable).get_PartitionNumber(@ptrCast(*const ISClusPartitionEx, self), plPartitionNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitionEx_get_VolumeGuid(self: *const T, pbstrVolumeGuid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitionEx.VTable, self.vtable).get_VolumeGuid(@ptrCast(*const ISClusPartitionEx, self), pbstrVolumeGuid); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusPartitions_Value = Guid.initString("f2e60722-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusPartitions = &IID_ISClusPartitions_Value; pub const ISClusPartitions = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusPartitions, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusPartitions, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusPartitions, varIndex: VARIANT, ppPartition: ?*?*ISClusPartition, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitions_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitions.VTable, self.vtable).get_Count(@ptrCast(*const ISClusPartitions, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitions_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitions.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusPartitions, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusPartitions_get_Item(self: *const T, varIndex: VARIANT, ppPartition: ?*?*ISClusPartition) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusPartitions.VTable, self.vtable).get_Item(@ptrCast(*const ISClusPartitions, self), varIndex, ppPartition); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusDisk_Value = Guid.initString("f2e60724-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusDisk = &IID_ISClusDisk_Value; pub const ISClusDisk = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Signature: fn( self: *const ISClusDisk, plSignature: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ScsiAddress: fn( self: *const ISClusDisk, ppScsiAddress: ?*?*ISClusScsiAddress, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DiskNumber: fn( self: *const ISClusDisk, plDiskNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Partitions: fn( self: *const ISClusDisk, ppPartitions: ?*?*ISClusPartitions, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisk_get_Signature(self: *const T, plSignature: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisk.VTable, self.vtable).get_Signature(@ptrCast(*const ISClusDisk, self), plSignature); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisk_get_ScsiAddress(self: *const T, ppScsiAddress: ?*?*ISClusScsiAddress) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisk.VTable, self.vtable).get_ScsiAddress(@ptrCast(*const ISClusDisk, self), ppScsiAddress); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisk_get_DiskNumber(self: *const T, plDiskNumber: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisk.VTable, self.vtable).get_DiskNumber(@ptrCast(*const ISClusDisk, self), plDiskNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisk_get_Partitions(self: *const T, ppPartitions: ?*?*ISClusPartitions) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisk.VTable, self.vtable).get_Partitions(@ptrCast(*const ISClusDisk, self), ppPartitions); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusDisks_Value = Guid.initString("f2e60726-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusDisks = &IID_ISClusDisks_Value; pub const ISClusDisks = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusDisks, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusDisks, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusDisks, varIndex: VARIANT, ppDisk: ?*?*ISClusDisk, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisks_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisks.VTable, self.vtable).get_Count(@ptrCast(*const ISClusDisks, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisks_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisks.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusDisks, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusDisks_get_Item(self: *const T, varIndex: VARIANT, ppDisk: ?*?*ISClusDisk) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusDisks.VTable, self.vtable).get_Item(@ptrCast(*const ISClusDisks, self), varIndex, ppDisk); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusScsiAddress_Value = Guid.initString("f2e60728-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusScsiAddress = &IID_ISClusScsiAddress_Value; pub const ISClusScsiAddress = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PortNumber: fn( self: *const ISClusScsiAddress, pvarPortNumber: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_PathId: fn( self: *const ISClusScsiAddress, pvarPathId: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TargetId: fn( self: *const ISClusScsiAddress, pvarTargetId: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Lun: fn( self: *const ISClusScsiAddress, pvarLun: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusScsiAddress_get_PortNumber(self: *const T, pvarPortNumber: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusScsiAddress.VTable, self.vtable).get_PortNumber(@ptrCast(*const ISClusScsiAddress, self), pvarPortNumber); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusScsiAddress_get_PathId(self: *const T, pvarPathId: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusScsiAddress.VTable, self.vtable).get_PathId(@ptrCast(*const ISClusScsiAddress, self), pvarPathId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusScsiAddress_get_TargetId(self: *const T, pvarTargetId: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusScsiAddress.VTable, self.vtable).get_TargetId(@ptrCast(*const ISClusScsiAddress, self), pvarTargetId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusScsiAddress_get_Lun(self: *const T, pvarLun: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusScsiAddress.VTable, self.vtable).get_Lun(@ptrCast(*const ISClusScsiAddress, self), pvarLun); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusRegistryKeys_Value = Guid.initString("f2e6072a-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusRegistryKeys = &IID_ISClusRegistryKeys_Value; pub const ISClusRegistryKeys = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusRegistryKeys, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusRegistryKeys, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusRegistryKeys, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusRegistryKeys, varIndex: VARIANT, pbstrRegistryKey: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddItem: fn( self: *const ISClusRegistryKeys, bstrRegistryKey: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusRegistryKeys, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRegistryKeys_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRegistryKeys.VTable, self.vtable).get_Count(@ptrCast(*const ISClusRegistryKeys, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRegistryKeys_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRegistryKeys.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusRegistryKeys, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRegistryKeys_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRegistryKeys.VTable, self.vtable).Refresh(@ptrCast(*const ISClusRegistryKeys, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRegistryKeys_get_Item(self: *const T, varIndex: VARIANT, pbstrRegistryKey: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRegistryKeys.VTable, self.vtable).get_Item(@ptrCast(*const ISClusRegistryKeys, self), varIndex, pbstrRegistryKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRegistryKeys_AddItem(self: *const T, bstrRegistryKey: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRegistryKeys.VTable, self.vtable).AddItem(@ptrCast(*const ISClusRegistryKeys, self), bstrRegistryKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusRegistryKeys_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusRegistryKeys.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusRegistryKeys, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusCryptoKeys_Value = Guid.initString("f2e6072c-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusCryptoKeys = &IID_ISClusCryptoKeys_Value; pub const ISClusCryptoKeys = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusCryptoKeys, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusCryptoKeys, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusCryptoKeys, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusCryptoKeys, varIndex: VARIANT, pbstrCyrptoKey: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddItem: fn( self: *const ISClusCryptoKeys, bstrCryptoKey: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusCryptoKeys, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusCryptoKeys_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusCryptoKeys.VTable, self.vtable).get_Count(@ptrCast(*const ISClusCryptoKeys, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusCryptoKeys_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusCryptoKeys.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusCryptoKeys, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusCryptoKeys_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusCryptoKeys.VTable, self.vtable).Refresh(@ptrCast(*const ISClusCryptoKeys, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusCryptoKeys_get_Item(self: *const T, varIndex: VARIANT, pbstrCyrptoKey: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusCryptoKeys.VTable, self.vtable).get_Item(@ptrCast(*const ISClusCryptoKeys, self), varIndex, pbstrCyrptoKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusCryptoKeys_AddItem(self: *const T, bstrCryptoKey: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusCryptoKeys.VTable, self.vtable).AddItem(@ptrCast(*const ISClusCryptoKeys, self), bstrCryptoKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusCryptoKeys_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusCryptoKeys.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusCryptoKeys, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISClusResDependents_Value = Guid.initString("f2e6072e-2631-11d1-89f1-00a0c90d061e"); pub const IID_ISClusResDependents = &IID_ISClusResDependents_Value; pub const ISClusResDependents = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ISClusResDependents, plCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ISClusResDependents, retval: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const ISClusResDependents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ISClusResDependents, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateItem: fn( self: *const ISClusResDependents, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteItem: fn( self: *const ISClusResDependents, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddItem: fn( self: *const ISClusResDependents, pResource: ?*ISClusResource, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveItem: fn( self: *const ISClusResDependents, varIndex: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_get_Count(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).get_Count(@ptrCast(*const ISClusResDependents, self), plCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_get__NewEnum(self: *const T, retval: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).get__NewEnum(@ptrCast(*const ISClusResDependents, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).Refresh(@ptrCast(*const ISClusResDependents, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_get_Item(self: *const T, varIndex: VARIANT, ppClusResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).get_Item(@ptrCast(*const ISClusResDependents, self), varIndex, ppClusResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_CreateItem(self: *const T, bstrResourceName: ?BSTR, bstrResourceType: ?BSTR, dwFlags: CLUSTER_RESOURCE_CREATE_FLAGS, ppClusterResource: ?*?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).CreateItem(@ptrCast(*const ISClusResDependents, self), bstrResourceName, bstrResourceType, dwFlags, ppClusterResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_DeleteItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).DeleteItem(@ptrCast(*const ISClusResDependents, self), varIndex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_AddItem(self: *const T, pResource: ?*ISClusResource) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).AddItem(@ptrCast(*const ISClusResDependents, self), pResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISClusResDependents_RemoveItem(self: *const T, varIndex: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISClusResDependents.VTable, self.vtable).RemoveItem(@ptrCast(*const ISClusResDependents, self), varIndex); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (351) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetNodeClusterState( lpszNodeName: ?[*:0]const u16, pdwClusterState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenCluster( lpszClusterName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterEx( lpszClusterName: ?[*:0]const u16, DesiredAccess: u32, GrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseCluster( hCluster: ?*_HCLUSTER, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterName( hCluster: ?*_HCLUSTER, lpszNewClusterName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterInformation( hCluster: ?*_HCLUSTER, lpszClusterName: [*:0]u16, lpcchClusterName: ?*u32, lpClusterInfo: ?*CLUSTERVERSIONINFO, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterQuorumResource( hCluster: ?*_HCLUSTER, lpszResourceName: [*:0]u16, lpcchResourceName: ?*u32, lpszDeviceName: [*:0]u16, lpcchDeviceName: ?*u32, lpdwMaxQuorumLogSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterQuorumResource( hResource: ?*_HRESOURCE, lpszDeviceName: ?[*:0]const u16, dwMaxQuoLogSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2003' pub extern "CLUSAPI" fn BackupClusterDatabase( hCluster: ?*_HCLUSTER, lpszPathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2003' pub extern "CLUSAPI" fn RestoreClusterDatabase( lpszPathName: ?[*:0]const u16, bForce: BOOL, lpszQuorumDriveLetter: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2003' pub extern "CLUSAPI" fn SetClusterNetworkPriorityOrder( hCluster: ?*_HCLUSTER, NetworkCount: u32, NetworkList: [*]?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2003' pub extern "CLUSAPI" fn SetClusterServiceAccountPassword( lpszClusterName: ?[*:0]const u16, lpszNewPassword: ?[*:0]const u16, dwFlags: u32, // TODO: what to do with BytesParamIndex 4? lpReturnStatusBuffer: ?*CLUSTER_SET_PASSWORD_STATUS, lpcbReturnStatusBufferSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterControl( hCluster: ?*_HCLUSTER, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterUpgradeFunctionalLevel( hCluster: ?*_HCLUSTER, perform: BOOL, pfnProgressCallback: ?PCLUSTER_UPGRADE_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn CreateClusterNotifyPortV2( hChange: ?*_HCHANGE, hCluster: ?*_HCLUSTER, Filters: ?*NOTIFY_FILTER_AND_TYPE, dwFilterCount: u32, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) ?*_HCHANGE; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn RegisterClusterNotifyV2( hChange: ?*_HCHANGE, Filter: NOTIFY_FILTER_AND_TYPE, hObject: ?HANDLE, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn GetNotifyEventHandle( hChange: ?*_HCHANGE, lphTargetEvent: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn GetClusterNotifyV2( hChange: ?*_HCHANGE, lpdwNotifyKey: ?*usize, pFilterAndType: ?*NOTIFY_FILTER_AND_TYPE, // TODO: what to do with BytesParamIndex 4? buffer: ?*u8, lpbBufferSize: ?*u32, lpszObjectId: ?[*:0]u16, lpcchObjectId: ?*u32, lpszParentId: ?[*:0]u16, lpcchParentId: ?*u32, lpszName: ?[*:0]u16, lpcchName: ?*u32, lpszType: ?[*:0]u16, lpcchType: ?*u32, dwMilliseconds: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CreateClusterNotifyPort( hChange: ?*_HCHANGE, hCluster: ?*_HCLUSTER, dwFilter: u32, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) ?*_HCHANGE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn RegisterClusterNotify( hChange: ?*_HCHANGE, dwFilterType: u32, hObject: ?HANDLE, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNotify( hChange: ?*_HCHANGE, lpdwNotifyKey: ?*usize, lpdwFilterType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, dwMilliseconds: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseClusterNotifyPort( hChange: ?*_HCHANGE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterOpenEnum( hCluster: ?*_HCLUSTER, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSENUM; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGetEnumCount( hEnum: ?*_HCLUSENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterEnum( hEnum: ?*_HCLUSENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterCloseEnum( hEnum: ?*_HCLUSENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterOpenEnumEx( hCluster: ?*_HCLUSTER, dwType: u32, pOptions: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSENUMEX; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGetEnumCountEx( hClusterEnum: ?*_HCLUSENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterEnumEx( hClusterEnum: ?*_HCLUSENUMEX, dwIndex: u32, pItem: ?*CLUSTER_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterCloseEnumEx( hClusterEnum: ?*_HCLUSENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn CreateClusterGroupSet( hCluster: ?*_HCLUSTER, groupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSET; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn OpenClusterGroupSet( hCluster: ?*_HCLUSTER, lpszGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSET; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn CloseClusterGroupSet( hGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn DeleteClusterGroupSet( hGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterAddGroupToGroupSet( hGroupSet: ?*_HGROUPSET, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ClusterAddGroupToGroupSetWithDomains( hGroupSet: ?*_HGROUPSET, hGroup: ?*_HGROUP, faultDomain: u32, updateDomain: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterRemoveGroupFromGroupSet( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterGroupSetControl( hGroupSet: ?*_HGROUPSET, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn AddClusterGroupDependency( hDependentGroup: ?*_HGROUP, hProviderGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn SetGroupDependencyExpression( hGroup: ?*_HGROUP, lpszDependencyExpression: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn RemoveClusterGroupDependency( hGroup: ?*_HGROUP, hDependsOn: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn AddClusterGroupSetDependency( hDependentGroupSet: ?*_HGROUPSET, hProviderGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn SetClusterGroupSetDependencyExpression( hGroupSet: ?*_HGROUPSET, lpszDependencyExprssion: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn RemoveClusterGroupSetDependency( hGroupSet: ?*_HGROUPSET, hDependsOn: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn AddClusterGroupToGroupSetDependency( hDependentGroup: ?*_HGROUP, hProviderGroupSet: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn RemoveClusterGroupToGroupSetDependency( hGroup: ?*_HGROUP, hDependsOn: ?*_HGROUPSET, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterGroupSetOpenEnum( hCluster: ?*_HCLUSTER, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSETENUM; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterGroupSetGetEnumCount( hGroupSetEnum: ?*_HGROUPSETENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterGroupSetEnum( hGroupSetEnum: ?*_HGROUPSETENUM, dwIndex: u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterGroupSetCloseEnum( hGroupSetEnum: ?*_HGROUPSETENUM, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn AddCrossClusterGroupSetDependency( hDependentGroupSet: ?*_HGROUPSET, lpRemoteClusterName: ?[*:0]const u16, lpRemoteGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn RemoveCrossClusterGroupSetDependency( hDependentGroupSet: ?*_HGROUPSET, lpRemoteClusterName: ?[*:0]const u16, lpRemoteGroupSetName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn CreateClusterAvailabilitySet( hCluster: ?*_HCLUSTER, lpAvailabilitySetName: ?[*:0]const u16, pAvailabilitySetConfig: ?*CLUSTER_AVAILABILITY_SET_CONFIG, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPSET; pub extern "CLUSAPI" fn ClusterNodeReplacement( hCluster: ?*_HCLUSTER, lpszNodeNameCurrent: ?[*:0]const u16, lpszNodeNameNew: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ClusterCreateAffinityRule( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, ruleType: CLUS_AFFINITY_RULE_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ClusterRemoveAffinityRule( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ClusterAddGroupToAffinityRule( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ClusterRemoveGroupFromAffinityRule( hCluster: ?*_HCLUSTER, ruleName: ?[*:0]const u16, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ClusterAffinityRuleControl( hCluster: ?*_HCLUSTER, affinityRuleName: ?[*:0]const u16, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 5? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 7? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterNode( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterNodeEx( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub extern "CLUSAPI" fn OpenClusterNodeById( hCluster: ?*_HCLUSTER, nodeId: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseClusterNode( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNodeState( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_NODE_STATE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNodeId( hNode: ?*_HNODE, lpszNodeId: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterFromNode( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn PauseClusterNode( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ResumeClusterNode( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn EvictClusterNode( hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterNetInterfaceOpenEnum( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, lpszNetworkName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETINTERFACEENUM; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterNetInterfaceEnum( hNetInterfaceEnum: ?*_HNETINTERFACEENUM, dwIndex: u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterNetInterfaceCloseEnum( hNetInterfaceEnum: ?*_HNETINTERFACEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeOpenEnum( hNode: ?*_HNODE, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODEENUM; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeOpenEnumEx( hNode: ?*_HNODE, dwType: u32, pOptions: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODEENUMEX; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeGetEnumCountEx( hNodeEnum: ?*_HNODEENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeEnumEx( hNodeEnum: ?*_HNODEENUMEX, dwIndex: u32, pItem: ?*CLUSTER_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeCloseEnumEx( hNodeEnum: ?*_HNODEENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeGetEnumCount( hNodeEnum: ?*_HNODEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeCloseEnum( hNodeEnum: ?*_HNODEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeEnum( hNodeEnum: ?*_HNODEENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn EvictClusterNodeEx( hNode: ?*_HNODE, dwTimeOut: u32, phrCleanupStatus: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterResourceTypeKey( hCluster: ?*_HCLUSTER, lpszTypeName: ?[*:0]const u16, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CreateClusterGroup( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterGroup( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterGroupEx( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn PauseClusterNodeEx( hNode: ?*_HNODE, bDrainNode: BOOL, dwPauseFlags: u32, hNodeDrainTarget: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ResumeClusterNodeEx( hNode: ?*_HNODE, eResumeFailbackType: CLUSTER_NODE_RESUME_FAILBACK_TYPE, dwResumeFlagsReserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn CreateClusterGroupEx( hCluster: ?*_HCLUSTER, lpszGroupName: ?[*:0]const u16, pGroupInfo: ?*CLUSTER_CREATE_GROUP_INFO, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterGroupOpenEnumEx( hCluster: ?*_HCLUSTER, // TODO: what to do with BytesParamIndex 2? lpszProperties: ?[*:0]const u16, cbProperties: u32, // TODO: what to do with BytesParamIndex 4? lpszRoProperties: ?[*:0]const u16, cbRoProperties: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPENUMEX; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterGroupGetEnumCountEx( hGroupEnumEx: ?*_HGROUPENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterGroupEnumEx( hGroupEnumEx: ?*_HGROUPENUMEX, dwIndex: u32, pItem: ?*CLUSTER_GROUP_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterGroupCloseEnumEx( hGroupEnumEx: ?*_HGROUPENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterResourceOpenEnumEx( hCluster: ?*_HCLUSTER, // TODO: what to do with BytesParamIndex 2? lpszProperties: ?[*:0]const u16, cbProperties: u32, // TODO: what to do with BytesParamIndex 4? lpszRoProperties: ?[*:0]const u16, cbRoProperties: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESENUMEX; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterResourceGetEnumCountEx( hResourceEnumEx: ?*_HRESENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterResourceEnumEx( hResourceEnumEx: ?*_HRESENUMEX, dwIndex: u32, pItem: ?*CLUSTER_RESOURCE_ENUM_ITEM, cbItem: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterResourceCloseEnumEx( hResourceEnumEx: ?*_HRESENUMEX, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn OnlineClusterGroupEx( hGroup: ?*_HGROUP, hDestinationNode: ?*_HNODE, dwOnlineFlags: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*u8, cbInBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn OfflineClusterGroupEx( hGroup: ?*_HGROUP, dwOfflineFlags: u32, // TODO: what to do with BytesParamIndex 3? lpInBuffer: ?*u8, cbInBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn OnlineClusterResourceEx( hResource: ?*_HRESOURCE, dwOnlineFlags: u32, // TODO: what to do with BytesParamIndex 3? lpInBuffer: ?*u8, cbInBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn OfflineClusterResourceEx( hResource: ?*_HRESOURCE, dwOfflineFlags: u32, // TODO: what to do with BytesParamIndex 3? lpInBuffer: ?*u8, cbInBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn MoveClusterGroupEx( hGroup: ?*_HGROUP, hDestinationNode: ?*_HNODE, dwMoveFlags: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*u8, cbInBufferSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn CancelClusterGroupOperation( hGroup: ?*_HGROUP, dwCancelFlags_RESERVED: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn RestartClusterResource( hResource: ?*_HRESOURCE, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseClusterGroup( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterFromGroup( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterGroupState( hGroup: ?*_HGROUP, lpszNodeName: ?[*:0]u16, lpcchNodeName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_GROUP_STATE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterGroupName( hGroup: ?*_HGROUP, lpszGroupName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterGroupNodeList( hGroup: ?*_HGROUP, NodeCount: u32, NodeList: ?[*]?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OnlineClusterGroup( hGroup: ?*_HGROUP, hDestinationNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn MoveClusterGroup( hGroup: ?*_HGROUP, hDestinationNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OfflineClusterGroup( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn DeleteClusterGroup( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn DestroyClusterGroup( hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGroupOpenEnum( hGroup: ?*_HGROUP, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUPENUM; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGroupGetEnumCount( hGroupEnum: ?*_HGROUPENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGroupEnum( hGroupEnum: ?*_HGROUPENUM, dwIndex: u32, lpdwType: ?*u32, lpszResourceName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGroupCloseEnum( hGroupEnum: ?*_HGROUPENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CreateClusterResource( hGroup: ?*_HGROUP, lpszResourceName: ?[*:0]const u16, lpszResourceType: ?[*:0]const u16, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterResource( hCluster: ?*_HCLUSTER, lpszResourceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterResourceEx( hCluster: ?*_HCLUSTER, lpszResourceName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseClusterResource( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterFromResource( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn DeleteClusterResource( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterResourceState( hResource: ?*_HRESOURCE, lpszNodeName: ?[*:0]u16, lpcchNodeName: ?*u32, lpszGroupName: ?[*:0]u16, lpcchGroupName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_RESOURCE_STATE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterResourceName( hResource: ?*_HRESOURCE, lpszResourceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn FailClusterResource( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OnlineClusterResource( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OfflineClusterResource( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ChangeClusterResourceGroup( hResource: ?*_HRESOURCE, hGroup: ?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn ChangeClusterResourceGroupEx( hResource: ?*_HRESOURCE, hGroup: ?*_HGROUP, Flags: u64, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn AddClusterResourceNode( hResource: ?*_HRESOURCE, hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn RemoveClusterResourceNode( hResource: ?*_HRESOURCE, hNode: ?*_HNODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn AddClusterResourceDependency( hResource: ?*_HRESOURCE, hDependsOn: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn RemoveClusterResourceDependency( hResource: ?*_HRESOURCE, hDependsOn: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterResourceDependencyExpression( hResource: ?*_HRESOURCE, lpszDependencyExpression: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterResourceDependencyExpression( hResource: ?*_HRESOURCE, lpszDependencyExpression: ?[*:0]u16, lpcchDependencyExpression: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn AddResourceToClusterSharedVolumes( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn RemoveResourceFromClusterSharedVolumes( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn IsFileOnClusterSharedVolume( lpszPathName: ?[*:0]const u16, pbFileIsOnSharedVolume: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterSharedVolumeSetSnapshotState( guidSnapshotSet: Guid, lpszVolumeName: ?[*:0]const u16, state: CLUSTER_SHARED_VOLUME_SNAPSHOT_STATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CanResourceBeDependent( hResource: ?*_HRESOURCE, hResourceDependent: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceControl( hResource: ?*_HRESOURCE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterResourceControlAsUser( hResource: ?*_HRESOURCE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, cbInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, cbOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceTypeControl( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 5? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 7? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterResourceTypeControlAsUser( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 5? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 7? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterGroupControl( hGroup: ?*_HGROUP, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNodeControl( hNode: ?*_HNODE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterResourceNetworkName( hResource: ?*_HRESOURCE, lpBuffer: [*:0]u16, nSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceOpenEnum( hResource: ?*_HRESOURCE, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESENUM; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceGetEnumCount( hResEnum: ?*_HRESENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceEnum( hResEnum: ?*_HRESENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceCloseEnum( hResEnum: ?*_HRESENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CreateClusterResourceType( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, lpszDisplayName: ?[*:0]const u16, lpszResourceTypeDll: ?[*:0]const u16, dwLooksAlivePollInterval: u32, dwIsAlivePollInterval: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn DeleteClusterResourceType( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceTypeOpenEnum( hCluster: ?*_HCLUSTER, lpszResourceTypeName: ?[*:0]const u16, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESTYPEENUM; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceTypeGetEnumCount( hResTypeEnum: ?*_HRESTYPEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceTypeEnum( hResTypeEnum: ?*_HRESTYPEENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterResourceTypeCloseEnum( hResTypeEnum: ?*_HRESTYPEENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterNetwork( hCluster: ?*_HCLUSTER, lpszNetworkName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORK; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterNetworkEx( hCluster: ?*_HCLUSTER, lpszNetworkName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORK; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseClusterNetwork( hNetwork: ?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterFromNetwork( hNetwork: ?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNetworkOpenEnum( hNetwork: ?*_HNETWORK, dwType: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETWORKENUM; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNetworkGetEnumCount( hNetworkEnum: ?*_HNETWORKENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNetworkEnum( hNetworkEnum: ?*_HNETWORKENUM, dwIndex: u32, lpdwType: ?*u32, lpszName: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNetworkCloseEnum( hNetworkEnum: ?*_HNETWORKENUM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNetworkState( hNetwork: ?*_HNETWORK, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_NETWORK_STATE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn SetClusterNetworkName( hNetwork: ?*_HNETWORK, lpszName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNetworkId( hNetwork: ?*_HNETWORK, lpszNetworkId: [*:0]u16, lpcchName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNetworkControl( hNetwork: ?*_HNETWORK, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterNetInterface( hCluster: ?*_HCLUSTER, lpszInterfaceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETINTERFACE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn OpenClusterNetInterfaceEx( hCluster: ?*_HCLUSTER, lpszInterfaceName: ?[*:0]const u16, dwDesiredAccess: u32, lpdwGrantedAccess: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HNETINTERFACE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNetInterface( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, lpszNetworkName: ?[*:0]const u16, lpszInterfaceName: [*:0]u16, lpcchInterfaceName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CloseClusterNetInterface( hNetInterface: ?*_HNETINTERFACE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterFromNetInterface( hNetInterface: ?*_HNETINTERFACE, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNetInterfaceState( hNetInterface: ?*_HNETINTERFACE, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_NETINTERFACE_STATE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterNetInterfaceControl( hNetInterface: ?*_HNETINTERFACE, hHostNode: ?*_HNODE, dwControlCode: u32, // TODO: what to do with BytesParamIndex 4? lpInBuffer: ?*anyopaque, nInBufferSize: u32, // TODO: what to do with BytesParamIndex 6? lpOutBuffer: ?*anyopaque, nOutBufferSize: u32, lpBytesReturned: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterKey( hCluster: ?*_HCLUSTER, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterGroupKey( hGroup: ?*_HGROUP, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterResourceKey( hResource: ?*_HRESOURCE, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNodeKey( hNode: ?*_HNODE, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNetworkKey( hNetwork: ?*_HNETWORK, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn GetClusterNetInterfaceKey( hNetInterface: ?*_HNETINTERFACE, samDesired: u32, ) callconv(@import("std").os.windows.WINAPI) ?HKEY; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegCreateKey( hKey: ?HKEY, lpszSubKey: ?[*:0]const u16, dwOptions: u32, samDesired: u32, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES, phkResult: ?*?HKEY, lpdwDisposition: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegOpenKey( hKey: ?HKEY, lpszSubKey: ?[*:0]const u16, samDesired: u32, phkResult: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegDeleteKey( hKey: ?HKEY, lpszSubKey: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegCloseKey( hKey: ?HKEY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegEnumKey( hKey: ?HKEY, dwIndex: u32, lpszName: [*:0]u16, lpcchName: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegSetValue( hKey: ?HKEY, lpszValueName: ?[*:0]const u16, dwType: u32, lpData: ?*const u8, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegDeleteValue( hKey: ?HKEY, lpszValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegQueryValue( hKey: ?HKEY, lpszValueName: ?[*:0]const u16, lpdwValueType: ?*u32, // TODO: what to do with BytesParamIndex 4? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegEnumValue( hKey: ?HKEY, dwIndex: u32, lpszValueName: [*:0]u16, lpcchValueName: ?*u32, lpdwType: ?*u32, // TODO: what to do with BytesParamIndex 6? lpData: ?*u8, lpcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegQueryInfoKey( hKey: ?HKEY, lpcSubKeys: ?*u32, lpcchMaxSubKeyLen: ?*u32, lpcValues: ?*u32, lpcchMaxValueNameLen: ?*u32, lpcbMaxValueLen: ?*u32, lpcbSecurityDescriptor: ?*u32, lpftLastWriteTime: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegGetKeySecurity( hKey: ?HKEY, RequestedInformation: u32, // TODO: what to do with BytesParamIndex 3? pSecurityDescriptor: ?*SECURITY_DESCRIPTOR, lpcbSecurityDescriptor: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegSetKeySecurity( hKey: ?HKEY, SecurityInformation: u32, pSecurityDescriptor: ?*SECURITY_DESCRIPTOR, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegSyncDatabase( hCluster: ?*_HCLUSTER, flags: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegCreateBatch( hKey: ?HKEY, pHREGBATCH: ?*?*_HREGBATCH, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegBatchAddCommand( hRegBatch: ?*_HREGBATCH, dwCommand: CLUSTER_REG_COMMAND, wzName: ?[*:0]const u16, dwOptions: u32, // TODO: what to do with BytesParamIndex 5? lpData: ?*const anyopaque, cbData: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegCloseBatch( hRegBatch: ?*_HREGBATCH, bCommit: BOOL, failedCommandNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegCloseBatchEx( hRegBatch: ?*_HREGBATCH, flags: u32, failedCommandNumber: ?*i32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegBatchReadCommand( hBatchNotification: ?*_HREGBATCHNOTIFICATION, pBatchCommand: ?*CLUSTER_BATCH_COMMAND, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegBatchCloseNotification( hBatchNotification: ?*_HREGBATCHNOTIFICATION, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegCreateBatchNotifyPort( hKey: ?HKEY, phBatchNotifyPort: ?*?*_HREGBATCHPORT, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegCloseBatchNotifyPort( hBatchNotifyPort: ?*_HREGBATCHPORT, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn ClusterRegGetBatchNotification( hBatchNotify: ?*_HREGBATCHPORT, phBatchNotification: ?*?*_HREGBATCHNOTIFICATION, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegCreateReadBatch( hKey: ?HKEY, phRegReadBatch: ?*?*_HREGREADBATCH, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegReadBatchAddCommand( hRegReadBatch: ?*_HREGREADBATCH, wzSubkeyName: ?[*:0]const u16, wzValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegCloseReadBatch( hRegReadBatch: ?*_HREGREADBATCH, phRegReadBatchReply: ?*?*_HREGREADBATCHREPLY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterRegCloseReadBatchEx( hRegReadBatch: ?*_HREGREADBATCH, flags: u32, phRegReadBatchReply: ?*?*_HREGREADBATCHREPLY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegReadBatchReplyNextCommand( hRegReadBatchReply: ?*_HREGREADBATCHREPLY, pBatchCommand: ?*CLUSTER_READ_BATCH_COMMAND, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "CLUSAPI" fn ClusterRegCloseReadBatchReply( hRegReadBatchReply: ?*_HREGREADBATCHREPLY, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn ClusterSetAccountAccess( hCluster: ?*_HCLUSTER, szAccountSID: ?[*:0]const u16, dwAccess: u32, dwControlType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn CreateCluster( pConfig: ?*CREATE_CLUSTER_CONFIG, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSTER; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn CreateClusterNameAccount( hCluster: ?*_HCLUSTER, pConfig: ?*CREATE_CLUSTER_NAME_ACCOUNT, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn RemoveClusterNameAccount( hCluster: ?*_HCLUSTER, bDeleteComputerObjects: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn DetermineCNOResTypeFromNodelist( cNodes: u32, ppszNodeNames: ?*?PWSTR, pCNOResType: ?*CLUSTER_MGMT_POINT_RESTYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn DetermineCNOResTypeFromCluster( hCluster: ?*_HCLUSTER, pCNOResType: ?*CLUSTER_MGMT_POINT_RESTYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn DetermineClusterCloudTypeFromNodelist( cNodes: u32, ppszNodeNames: ?*?PWSTR, pCloudType: ?*CLUSTER_CLOUD_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn DetermineClusterCloudTypeFromCluster( hCluster: ?*_HCLUSTER, pCloudType: ?*CLUSTER_CLOUD_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn GetNodeCloudTypeDW( ppszNodeName: ?[*:0]const u16, NodeCloudType: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "CLUSAPI" fn RegisterClusterResourceTypeNotifyV2( hChange: ?*_HCHANGE, hCluster: ?*_HCLUSTER, Flags: i64, resTypeName: ?[*:0]const u16, dwNotifyKey: usize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn AddClusterNode( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub extern "CLUSAPI" fn AddClusterStorageNode( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, lpszClusterStorageNodeDescription: ?[*:0]const u16, lpszClusterStorageNodeLocation: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "CLUSAPI" fn AddClusterNodeEx( hCluster: ?*_HCLUSTER, lpszNodeName: ?[*:0]const u16, dwFlags: u32, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*_HNODE; pub extern "CLUSAPI" fn RemoveClusterStorageNode( hCluster: ?*_HCLUSTER, lpszClusterStorageEnclosureName: ?[*:0]const u16, dwTimeout: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "CLUSAPI" fn DestroyCluster( hCluster: ?*_HCLUSTER, pfnProgressCallback: ?PCLUSTER_SETUP_PROGRESS_CALLBACK, pvCallbackArg: ?*anyopaque, fdeleteVirtualComputerObjects: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn InitializeClusterHealthFault( clusterHealthFault: ?*CLUSTER_HEALTH_FAULT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn InitializeClusterHealthFaultArray( clusterHealthFaultArray: ?*CLUSTER_HEALTH_FAULT_ARRAY, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn FreeClusterHealthFault( clusterHealthFault: ?*CLUSTER_HEALTH_FAULT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn FreeClusterHealthFaultArray( clusterHealthFaultArray: ?*CLUSTER_HEALTH_FAULT_ARRAY, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ClusGetClusterHealthFaults( hCluster: ?*_HCLUSTER, objects: ?*CLUSTER_HEALTH_FAULT_ARRAY, flags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ClusRemoveClusterHealthFault( hCluster: ?*_HCLUSTER, id: ?[*:0]const u16, flags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ClusAddClusterHealthFault( hCluster: ?*_HCLUSTER, failure: ?*CLUSTER_HEALTH_FAULT, param2: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilStartResourceService( pszServiceName: ?[*:0]const u16, phServiceHandle: ?*isize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilVerifyResourceService( pszServiceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilStopResourceService( pszServiceName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilVerifyService( hServiceHandle: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilStopService( hServiceHandle: SC_HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilCreateDirectoryTree( pszPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilIsPathValid( pszPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilEnumProperties( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 2? pszOutProperties: ?PWSTR, cbOutPropertiesSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilEnumPrivateProperties( hkeyClusterKey: ?HKEY, // TODO: what to do with BytesParamIndex 2? pszOutProperties: ?PWSTR, cbOutPropertiesSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetProperties( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pOutPropertyList: ?*anyopaque, cbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetAllProperties( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pOutPropertyList: ?*anyopaque, cbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetPrivateProperties( hkeyClusterKey: ?HKEY, // TODO: what to do with BytesParamIndex 2? pOutPropertyList: ?*anyopaque, cbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetPropertySize( hkeyClusterKey: ?HKEY, pPropertyTableItem: ?*const RESUTIL_PROPERTY_ITEM, pcbOutPropertyListSize: ?*u32, pnPropertyCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetProperty( hkeyClusterKey: ?HKEY, pPropertyTableItem: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pOutPropertyItem: ?*?*anyopaque, pcbOutPropertyItemSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilVerifyPropertyTable( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, bAllowUnknownProperties: BOOL, // TODO: what to do with BytesParamIndex 4? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetPropertyTable( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, bAllowUnknownProperties: BOOL, // TODO: what to do with BytesParamIndex 5? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetPropertyTableEx( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, bAllowUnknownProperties: BOOL, pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, bForceWrite: BOOL, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetPropertyParameterBlock( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, pInParams: ?*const u8, pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetPropertyParameterBlockEx( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, Reserved: ?*anyopaque, pInParams: ?*const u8, pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, bForceWrite: BOOL, pOutParams: ?*u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetUnknownProperties( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 3? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetPropertiesToParameterBlock( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, pOutParams: ?*u8, bCheckForRequiredProperties: BOOL, pszNameOfPropInError: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilPropertyListFromParameterBlock( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 2? pOutPropertyList: ?*anyopaque, pcbOutPropertyListSize: ?*u32, pInParams: ?*const u8, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilDupParameterBlock( pOutParams: ?*u8, pInParams: ?*const u8, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFreeParameterBlock( pOutParams: ?*u8, pInParams: ?*const u8, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilAddUnknownProperties( hkeyClusterKey: ?HKEY, pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, pOutPropertyList: ?*anyopaque, pcbOutPropertyListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetPrivatePropertyList( hkeyClusterKey: ?HKEY, // TODO: what to do with BytesParamIndex 2? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilVerifyPrivatePropertyList( // TODO: what to do with BytesParamIndex 1? pInPropertyList: ?*const anyopaque, cbInPropertyListSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilDupString( pszInString: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetBinaryValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? ppbOutValue: ?*?*u8, pcbOutValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetSzValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetDwordValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pdwOutValue: ?*u32, dwDefaultValue: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetQwordValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pqwOutValue: ?*u64, qwDefaultValue: u64, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetBinaryValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pbNewValue: ?*const u8, cbNewValueSize: u32, // TODO: what to do with BytesParamIndex 5? ppbOutValue: ?*?*u8, pcbOutValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetSzValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pszNewValue: ?[*:0]const u16, ppszOutString: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetExpandSzValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, pszNewValue: ?[*:0]const u16, ppszOutString: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetMultiSzValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 3? pszNewValue: ?[*:0]const u16, cbNewValueSize: u32, // TODO: what to do with BytesParamIndex 5? ppszOutValue: ?*?PWSTR, pcbOutValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetDwordValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, dwNewValue: u32, pdwOutValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetQwordValue( hkeyClusterKey: ?HKEY, pszValueName: ?[*:0]const u16, qwNewValue: u64, pqwOutValue: ?*u64, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilSetValueEx( hkeyClusterKey: ?HKEY, valueName: ?[*:0]const u16, valueType: u32, // TODO: what to do with BytesParamIndex 4? valueData: ?*const u8, valueSize: u32, flags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetBinaryProperty( ppbOutValue: ?*?*u8, pcbOutValueSize: ?*u32, pValueStruct: ?*const CLUSPROP_BINARY, // TODO: what to do with BytesParamIndex 4? pbOldValue: ?*const u8, cbOldValueSize: u32, // TODO: what to do with BytesParamIndex 6? ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetSzProperty( ppszOutValue: ?*?PWSTR, pValueStruct: ?*const CLUSPROP_SZ, pszOldValue: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetMultiSzProperty( ppszOutValue: ?*?PWSTR, pcbOutValueSize: ?*u32, pValueStruct: ?*const CLUSPROP_SZ, // TODO: what to do with BytesParamIndex 4? pszOldValue: ?[*:0]const u16, cbOldValueSize: u32, // TODO: what to do with BytesParamIndex 6? ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetDwordProperty( pdwOutValue: ?*u32, pValueStruct: ?*const CLUSPROP_DWORD, dwOldValue: u32, dwMinimum: u32, dwMaximum: u32, ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetLongProperty( plOutValue: ?*i32, pValueStruct: ?*const CLUSPROP_LONG, lOldValue: i32, lMinimum: i32, lMaximum: i32, ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetFileTimeProperty( pftOutValue: ?*FILETIME, pValueStruct: ?*const CLUSPROP_FILETIME, ftOldValue: FILETIME, ftMinimum: FILETIME, ftMaximum: FILETIME, ppPropertyList: ?*?*u8, pcbPropertyListSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetEnvironmentWithNetName( hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFreeEnvironment( lpEnvironment: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilExpandEnvironmentStrings( pszSrc: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetResourceServiceEnvironment( pszServiceName: ?[*:0]const u16, hResource: ?*_HRESOURCE, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilRemoveResourceServiceEnvironment( pszServiceName: ?[*:0]const u16, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilSetResourceServiceStartParameters( pszServiceName: ?[*:0]const u16, schSCMHandle: SC_HANDLE, phService: ?*isize, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindSzProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pszPropertyValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindExpandSzProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pszPropertyValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindExpandedSzProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pszPropertyValue: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindDwordProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pdwPropertyValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindBinaryProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? pbPropertyValue: ?*?*u8, pcbPropertyValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindMultiSzProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 4? pszPropertyValue: ?*?PWSTR, pcbPropertyValueSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindLongProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, plPropertyValue: ?*i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ResUtilFindULargeIntegerProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, plPropertyValue: ?*u64, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindFileTimeProperty( // TODO: what to do with BytesParamIndex 1? pPropertyList: ?*const anyopaque, cbPropertyListSize: u32, pszPropertyName: ?[*:0]const u16, pftPropertyValue: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusWorkerCreate( lpWorker: ?*CLUS_WORKER, lpStartAddress: ?PWORKER_START_ROUTINE, lpParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusWorkerCheckTerminate( lpWorker: ?*CLUS_WORKER, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "RESUTILS" fn ClusWorkerTerminate( lpWorker: ?*CLUS_WORKER, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ClusWorkerTerminateEx( ClusWorker: ?*CLUS_WORKER, TimeoutInMilliseconds: u32, WaitOnly: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ClusWorkersTerminate( ClusWorkers: [*]?*CLUS_WORKER, ClusWorkersCount: usize, TimeoutInMilliseconds: u32, WaitOnly: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilResourcesEqual( hSelf: ?*_HRESOURCE, hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilResourceTypesEqual( lpszResourceTypeName: ?[*:0]const u16, hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilIsResourceClassEqual( prci: ?*CLUS_RESOURCE_CLASS_INFO, hResource: ?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilEnumResources( hSelf: ?*_HRESOURCE, lpszResTypeName: ?[*:0]const u16, pResCallBack: ?LPRESOURCE_CALLBACK, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilEnumResourcesEx( hCluster: ?*_HCLUSTER, hSelf: ?*_HRESOURCE, lpszResTypeName: ?[*:0]const u16, pResCallBack: ?LPRESOURCE_CALLBACK_EX, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetResourceDependency( hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetResourceDependencyByName( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, bRecurse: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetResourceDependencyByClass( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, prci: ?*CLUS_RESOURCE_CLASS_INFO, bRecurse: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetResourceNameDependency( lpszResourceName: ?[*:0]const u16, lpszResourceType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetResourceDependentIPAddressProps( hResource: ?*_HRESOURCE, pszAddress: [*:0]u16, pcchAddress: ?*u32, pszSubnetMask: [*:0]u16, pcchSubnetMask: ?*u32, pszNetwork: [*:0]u16, pcchNetwork: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilFindDependentDiskResourceDriveLetter( hCluster: ?*_HCLUSTER, hResource: ?*_HRESOURCE, pszDriveLetter: [*:0]u16, pcchDriveLetter: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilTerminateServiceProcessFromResDll( dwServicePid: u32, bOffline: BOOL, pdwResourceState: ?*u32, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetPropertyFormats( pPropertyTable: ?*const RESUTIL_PROPERTY_ITEM, // TODO: what to do with BytesParamIndex 2? pOutPropertyFormatList: ?*anyopaque, cbPropertyFormatListSize: u32, pcbBytesReturned: ?*u32, pcbRequired: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetCoreClusterResources( hCluster: ?*_HCLUSTER, phClusterNameResource: ?*?*_HRESOURCE, phClusterIPAddressResource: ?*?*_HRESOURCE, phClusterQuorumResource: ?*?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetResourceName( hResource: ?*_HRESOURCE, pszResourceName: [*:0]u16, pcchResourceNameInOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ResUtilGetClusterRoleState( hCluster: ?*_HCLUSTER, eClusterRole: CLUSTER_ROLE, ) callconv(@import("std").os.windows.WINAPI) CLUSTER_ROLE_STATE; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusterIsPathOnSharedVolume( lpszPathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusterGetVolumePathName( lpszFileName: ?[*:0]const u16, lpszVolumePathName: ?PWSTR, cchBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusterGetVolumeNameForVolumeMountPoint( lpszVolumeMountPoint: ?[*:0]const u16, lpszVolumeName: ?PWSTR, cchBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusterPrepareSharedVolumeForBackup( lpszFileName: ?[*:0]const u16, lpszVolumePathName: ?PWSTR, lpcchVolumePathName: ?*u32, lpszVolumeName: ?PWSTR, lpcchVolumeName: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2008' pub extern "RESUTILS" fn ClusterClearBackupStateForSharedVolume( lpszVolumePathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilSetResourceServiceStartParametersEx( pszServiceName: ?[*:0]const u16, schSCMHandle: SC_HANDLE, phService: ?*isize, dwDesiredAccess: u32, pfnLogEvent: ?PLOG_EVENT_ROUTINE, hResourceHandle: isize, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilEnumResourcesEx2( hCluster: ?*_HCLUSTER, hSelf: ?*_HRESOURCE, lpszResTypeName: ?[*:0]const u16, pResCallBack: ?LPRESOURCE_CALLBACK_EX, pParameter: ?*anyopaque, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilGetResourceDependencyEx( hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilGetResourceDependencyByNameEx( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, lpszResourceType: ?[*:0]const u16, bRecurse: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilGetResourceDependencyByClassEx( hCluster: ?*_HCLUSTER, hSelf: ?HANDLE, prci: ?*CLUS_RESOURCE_CLASS_INFO, bRecurse: BOOL, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilGetResourceNameDependencyEx( lpszResourceName: ?[*:0]const u16, lpszResourceType: ?[*:0]const u16, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HRESOURCE; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ResUtilGetCoreClusterResourcesEx( hClusterIn: ?*_HCLUSTER, phClusterNameResourceOut: ?*?*_HRESOURCE, phClusterQuorumResourceOut: ?*?*_HRESOURCE, dwDesiredAccess: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn OpenClusterCryptProvider( lpszResource: ?[*:0]const u16, lpszProvider: ?*i8, dwType: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSCRYPTPROVIDER; pub extern "RESUTILS" fn OpenClusterCryptProviderEx( lpszResource: ?[*:0]const u16, lpszKeyname: ?[*:0]const u16, lpszProvider: ?*i8, dwType: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?*_HCLUSCRYPTPROVIDER; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn CloseClusterCryptProvider( hClusCryptProvider: ?*_HCLUSCRYPTPROVIDER, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ClusterEncrypt( hClusCryptProvider: ?*_HCLUSCRYPTPROVIDER, pData: [*:0]u8, cbData: u32, ppData: ?*?*u8, pcbData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn ClusterDecrypt( hClusCryptProvider: ?*_HCLUSCRYPTPROVIDER, pCryptInput: ?*u8, cbCryptInput: u32, ppCryptOutput: ?*?*u8, pcbCryptOutput: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "RESUTILS" fn FreeClusterCrypt( pCryptInfo: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilVerifyShutdownSafe( flags: u32, reason: u32, pResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ResUtilPaxosComparer( left: ?*const PaxosTagCStruct, right: ?*const PaxosTagCStruct, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windowsServer2016' pub extern "RESUTILS" fn ResUtilLeftPaxosIsLessThanRight( left: ?*const PaxosTagCStruct, right: ?*const PaxosTagCStruct, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "RESUTILS" fn ResUtilsDeleteKeyTree( key: ?HKEY, keyName: ?[*:0]const u16, treatNoKeyAsError: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilGroupsEqual( hSelf: ?*_HGROUP, hGroup: ?*_HGROUP, pEqual: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilEnumGroups( hCluster: ?*_HCLUSTER, hSelf: ?*_HGROUP, pResCallBack: ?LPGROUP_CALLBACK_EX, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilEnumGroupsEx( hCluster: ?*_HCLUSTER, hSelf: ?*_HGROUP, groupType: CLUSGROUP_TYPE, pResCallBack: ?LPGROUP_CALLBACK_EX, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilDupGroup( group: ?*_HGROUP, copy: ?*?*_HGROUP, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilGetClusterGroupType( hGroup: ?*_HGROUP, groupType: ?*CLUSGROUP_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilGetCoreGroup( hCluster: ?*_HCLUSTER, ) callconv(@import("std").os.windows.WINAPI) ?*_HGROUP; pub extern "RESUTILS" fn ResUtilResourceDepEnum( hSelf: ?*_HRESOURCE, enumType: u32, pResCallBack: ?LPRESOURCE_CALLBACK_EX, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilDupResource( group: ?*_HRESOURCE, copy: ?*?*_HRESOURCE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilGetClusterId( hCluster: ?*_HCLUSTER, guid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "RESUTILS" fn ResUtilNodeEnum( hCluster: ?*_HCLUSTER, pNodeCallBack: ?LPNODE_CALLBACK, pParameter: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2012' pub extern "NTLANMAN" fn RegisterAppInstance( ProcessHandle: ?HANDLE, AppInstanceId: ?*Guid, ChildrenInheritAppInstance: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "NTLANMAN" fn RegisterAppInstanceVersion( AppInstanceId: ?*Guid, InstanceVersionHigh: u64, InstanceVersionLow: u64, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "NTLANMAN" fn QueryAppInstanceVersion( AppInstanceId: ?*Guid, InstanceVersionHigh: ?*u64, InstanceVersionLow: ?*u64, VersionStatus: ?*NTSTATUS, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "NTLANMAN" fn ResetAllAppInstanceVersions( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windowsServer2016' pub extern "NTLANMAN" fn SetAppInstanceCsvFlags( ProcessHandle: ?HANDLE, Mask: u32, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (22) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const BSTR = @import("../foundation.zig").BSTR; const FILETIME = @import("../foundation.zig").FILETIME; const HANDLE = @import("../foundation.zig").HANDLE; const HFONT = @import("../graphics/gdi.zig").HFONT; const HICON = @import("../ui/windows_and_messaging.zig").HICON; const HKEY = @import("../system/registry.zig").HKEY; const HRESULT = @import("../foundation.zig").HRESULT; const IDispatch = @import("../system/com.zig").IDispatch; const IUnknown = @import("../system/com.zig").IUnknown; const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER; const NTSTATUS = @import("../foundation.zig").NTSTATUS; const PWSTR = @import("../foundation.zig").PWSTR; const SC_HANDLE = @import("../security.zig").SC_HANDLE; const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES; const SECURITY_DESCRIPTOR = @import("../security.zig").SECURITY_DESCRIPTOR; const SECURITY_DESCRIPTOR_RELATIVE = @import("../system/system_services.zig").SECURITY_DESCRIPTOR_RELATIVE; const SYSTEMTIME = @import("../foundation.zig").SYSTEMTIME; const ULARGE_INTEGER = @import("../foundation.zig").ULARGE_INTEGER; const VARIANT = @import("../system/com.zig").VARIANT; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PCLUSAPI_GET_NODE_CLUSTER_STATE")) { _ = PCLUSAPI_GET_NODE_CLUSTER_STATE; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER")) { _ = PCLUSAPI_OPEN_CLUSTER; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_EX")) { _ = PCLUSAPI_OPEN_CLUSTER_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER")) { _ = PCLUSAPI_CLOSE_CLUSTER; } if (@hasDecl(@This(), "PCLUSAPI_SetClusterName")) { _ = PCLUSAPI_SetClusterName; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_INFORMATION")) { _ = PCLUSAPI_GET_CLUSTER_INFORMATION; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_QUORUM_RESOURCE")) { _ = PCLUSAPI_GET_CLUSTER_QUORUM_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_QUORUM_RESOURCE")) { _ = PCLUSAPI_SET_CLUSTER_QUORUM_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_BACKUP_CLUSTER_DATABASE")) { _ = PCLUSAPI_BACKUP_CLUSTER_DATABASE; } if (@hasDecl(@This(), "PCLUSAPI_RESTORE_CLUSTER_DATABASE")) { _ = PCLUSAPI_RESTORE_CLUSTER_DATABASE; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_NETWORK_PRIORITY_ORDER")) { _ = PCLUSAPI_SET_CLUSTER_NETWORK_PRIORITY_ORDER; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_SERVICE_ACCOUNT_PASSWORD")) { _ = PCLUSAPI_SET_CLUSTER_SERVICE_ACCOUNT_PASSWORD; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_CONTROL")) { _ = PCLUSAPI_CLUSTER_CONTROL; } if (@hasDecl(@This(), "PCLUSTER_UPGRADE_PROGRESS_CALLBACK")) { _ = PCLUSTER_UPGRADE_PROGRESS_CALLBACK; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_UPGRADE")) { _ = PCLUSAPI_CLUSTER_UPGRADE; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_NOTIFY_PORT_V2")) { _ = PCLUSAPI_CREATE_CLUSTER_NOTIFY_PORT_V2; } if (@hasDecl(@This(), "PCLUSAPI_REGISTER_CLUSTER_NOTIFY_V2")) { _ = PCLUSAPI_REGISTER_CLUSTER_NOTIFY_V2; } if (@hasDecl(@This(), "PCLUSAPI_GET_NOTIFY_EVENT_HANDLE_V2")) { _ = PCLUSAPI_GET_NOTIFY_EVENT_HANDLE_V2; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NOTIFY_V2")) { _ = PCLUSAPI_GET_CLUSTER_NOTIFY_V2; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_NOTIFY_PORT")) { _ = PCLUSAPI_CREATE_CLUSTER_NOTIFY_PORT; } if (@hasDecl(@This(), "PCLUSAPI_REGISTER_CLUSTER_NOTIFY")) { _ = PCLUSAPI_REGISTER_CLUSTER_NOTIFY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NOTIFY")) { _ = PCLUSAPI_GET_CLUSTER_NOTIFY; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_NOTIFY_PORT")) { _ = PCLUSAPI_CLOSE_CLUSTER_NOTIFY_PORT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_OPEN_ENUM")) { _ = PCLUSAPI_CLUSTER_OPEN_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GET_ENUM_COUNT")) { _ = PCLUSAPI_CLUSTER_GET_ENUM_COUNT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_ENUM")) { _ = PCLUSAPI_CLUSTER_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_CLOSE_ENUM")) { _ = PCLUSAPI_CLUSTER_CLOSE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_OPEN_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_OPEN_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GET_ENUM_COUNT_EX")) { _ = PCLUSAPI_CLUSTER_GET_ENUM_COUNT_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_CLOSE_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_CLOSE_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_GROUP_GROUPSET")) { _ = PCLUSAPI_CREATE_CLUSTER_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_GROUP_GROUPSET")) { _ = PCLUSAPI_OPEN_CLUSTER_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_GROUP_GROUPSET")) { _ = PCLUSAPI_CLOSE_CLUSTER_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_DELETE_CLUSTER_GROUP_GROUPSET")) { _ = PCLUSAPI_DELETE_CLUSTER_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_ADD_GROUP_TO_GROUP_GROUPSET")) { _ = PCLUSAPI_CLUSTER_ADD_GROUP_TO_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REMOVE_GROUP_FROM_GROUP_GROUPSET")) { _ = PCLUSAPI_CLUSTER_REMOVE_GROUP_FROM_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_GROUPSET_CONTROL")) { _ = PCLUSAPI_CLUSTER_GROUP_GROUPSET_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_GROUP_DEPENDENCY")) { _ = PCLUSAPI_ADD_CLUSTER_GROUP_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_SET_GROUP_DEPENDENCY_EXPRESSION")) { _ = PCLUSAPI_SET_GROUP_DEPENDENCY_EXPRESSION; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CLUSTER_GROUP_DEPENDENCY")) { _ = PCLUSAPI_REMOVE_CLUSTER_GROUP_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_GROUP_GROUPSET_DEPENDENCY")) { _ = PCLUSAPI_ADD_CLUSTER_GROUP_GROUPSET_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_GROUP_GROUPSET_DEPENDENCY_EXPRESSION")) { _ = PCLUSAPI_SET_CLUSTER_GROUP_GROUPSET_DEPENDENCY_EXPRESSION; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CLUSTER_GROUP_GROUPSET_DEPENDENCY")) { _ = PCLUSAPI_REMOVE_CLUSTER_GROUP_GROUPSET_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_GROUP_TO_GROUP_GROUPSET_DEPENDENCY")) { _ = PCLUSAPI_ADD_CLUSTER_GROUP_TO_GROUP_GROUPSET_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CLUSTER_GROUP_TO_GROUP_GROUPSET_DEPENDENCY")) { _ = PCLUSAPI_REMOVE_CLUSTER_GROUP_TO_GROUP_GROUPSET_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_FROM_GROUP_GROUPSET")) { _ = PCLUSAPI_GET_CLUSTER_FROM_GROUP_GROUPSET; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CROSS_CLUSTER_GROUPSET_DEPENDENCY")) { _ = PCLUSAPI_ADD_CROSS_CLUSTER_GROUPSET_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CROSS_CLUSTER_GROUPSET_DEPENDENCY")) { _ = PCLUSAPI_REMOVE_CROSS_CLUSTER_GROUPSET_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_AVAILABILITY_SET")) { _ = PCLUSAPI_CREATE_CLUSTER_AVAILABILITY_SET; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_CREATE_AFFINITY_RULE")) { _ = PCLUSAPI_CLUSTER_CREATE_AFFINITY_RULE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REMOVE_AFFINITY_RULE")) { _ = PCLUSAPI_CLUSTER_REMOVE_AFFINITY_RULE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_ADD_GROUP_TO_AFFINITY_RULE")) { _ = PCLUSAPI_CLUSTER_ADD_GROUP_TO_AFFINITY_RULE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REMOVE_GROUP_FROM_AFFINITY_RULE")) { _ = PCLUSAPI_CLUSTER_REMOVE_GROUP_FROM_AFFINITY_RULE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_AFFINITY_RULE_CONTROL")) { _ = PCLUSAPI_CLUSTER_AFFINITY_RULE_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_NODE")) { _ = PCLUSAPI_OPEN_CLUSTER_NODE; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_NODE_EX")) { _ = PCLUSAPI_OPEN_CLUSTER_NODE_EX; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_NODE_BY_ID")) { _ = PCLUSAPI_OPEN_NODE_BY_ID; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_NODE")) { _ = PCLUSAPI_CLOSE_CLUSTER_NODE; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NODE_STATE")) { _ = PCLUSAPI_GET_CLUSTER_NODE_STATE; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NODE_ID")) { _ = PCLUSAPI_GET_CLUSTER_NODE_ID; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_FROM_NODE")) { _ = PCLUSAPI_GET_CLUSTER_FROM_NODE; } if (@hasDecl(@This(), "PCLUSAPI_PAUSE_CLUSTER_NODE")) { _ = PCLUSAPI_PAUSE_CLUSTER_NODE; } if (@hasDecl(@This(), "PCLUSAPI_RESUME_CLUSTER_NODE")) { _ = PCLUSAPI_RESUME_CLUSTER_NODE; } if (@hasDecl(@This(), "PCLUSAPI_EVICT_CLUSTER_NODE")) { _ = PCLUSAPI_EVICT_CLUSTER_NODE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_OPEN_ENUM")) { _ = PCLUSAPI_CLUSTER_NODE_OPEN_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_OPEN_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_NODE_OPEN_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_GET_ENUM_COUNT_EX")) { _ = PCLUSAPI_CLUSTER_NODE_GET_ENUM_COUNT_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_NODE_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_CLOSE_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_NODE_CLOSE_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_GET_ENUM_COUNT")) { _ = PCLUSAPI_CLUSTER_NODE_GET_ENUM_COUNT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_CLOSE_ENUM")) { _ = PCLUSAPI_CLUSTER_NODE_CLOSE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_ENUM")) { _ = PCLUSAPI_CLUSTER_NODE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_EVICT_CLUSTER_NODE_EX")) { _ = PCLUSAPI_EVICT_CLUSTER_NODE_EX; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_RESOURCE_TYPE_KEY")) { _ = PCLUSAPI_GET_CLUSTER_RESOURCE_TYPE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_GROUP")) { _ = PCLUSAPI_CREATE_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_GROUP")) { _ = PCLUSAPI_OPEN_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_GROUP_EX")) { _ = PCLUSAPI_OPEN_CLUSTER_GROUP_EX; } if (@hasDecl(@This(), "PCLUSAPI_PAUSE_CLUSTER_NODE_EX")) { _ = PCLUSAPI_PAUSE_CLUSTER_NODE_EX; } if (@hasDecl(@This(), "PCLUSAPI_RESUME_CLUSTER_NODE_EX")) { _ = PCLUSAPI_RESUME_CLUSTER_NODE_EX; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_GROUPEX")) { _ = PCLUSAPI_CREATE_CLUSTER_GROUPEX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_OPEN_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_GROUP_OPEN_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_GET_ENUM_COUNT_EX")) { _ = PCLUSAPI_CLUSTER_GROUP_GET_ENUM_COUNT_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_GROUP_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_CLOSE_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_GROUP_CLOSE_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_OPEN_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_RESOURCE_OPEN_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_GET_ENUM_COUNT_EX")) { _ = PCLUSAPI_CLUSTER_RESOURCE_GET_ENUM_COUNT_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_RESOURCE_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_CLOSE_ENUM_EX")) { _ = PCLUSAPI_CLUSTER_RESOURCE_CLOSE_ENUM_EX; } if (@hasDecl(@This(), "PCLUSAPI_RESTART_CLUSTER_RESOURCE")) { _ = PCLUSAPI_RESTART_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_GROUP")) { _ = PCLUSAPI_CLOSE_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_FROM_GROUP")) { _ = PCLUSAPI_GET_CLUSTER_FROM_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_GROUP_STATE")) { _ = PCLUSAPI_GET_CLUSTER_GROUP_STATE; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_GROUP_NAME")) { _ = PCLUSAPI_SET_CLUSTER_GROUP_NAME; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_GROUP_NODE_LIST")) { _ = PCLUSAPI_SET_CLUSTER_GROUP_NODE_LIST; } if (@hasDecl(@This(), "PCLUSAPI_ONLINE_CLUSTER_GROUP")) { _ = PCLUSAPI_ONLINE_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_MOVE_CLUSTER_GROUP")) { _ = PCLUSAPI_MOVE_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_OFFLINE_CLUSTER_GROUP")) { _ = PCLUSAPI_OFFLINE_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_DELETE_CLUSTER_GROUP")) { _ = PCLUSAPI_DELETE_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_DESTROY_CLUSTER_GROUP")) { _ = PCLUSAPI_DESTROY_CLUSTER_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_OPEN_ENUM")) { _ = PCLUSAPI_CLUSTER_GROUP_OPEN_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_GET_ENUM_COUNT")) { _ = PCLUSAPI_CLUSTER_GROUP_GET_ENUM_COUNT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_ENUM")) { _ = PCLUSAPI_CLUSTER_GROUP_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_CLOSE_ENUM")) { _ = PCLUSAPI_CLUSTER_GROUP_CLOSE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_RESOURCE")) { _ = PCLUSAPI_CREATE_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_RESOURCE")) { _ = PCLUSAPI_OPEN_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_RESOURCE_EX")) { _ = PCLUSAPI_OPEN_CLUSTER_RESOURCE_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_RESOURCE")) { _ = PCLUSAPI_CLOSE_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_FROM_RESOURCE")) { _ = PCLUSAPI_GET_CLUSTER_FROM_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_DELETE_CLUSTER_RESOURCE")) { _ = PCLUSAPI_DELETE_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_RESOURCE_STATE")) { _ = PCLUSAPI_GET_CLUSTER_RESOURCE_STATE; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_RESOURCE_NAME")) { _ = PCLUSAPI_SET_CLUSTER_RESOURCE_NAME; } if (@hasDecl(@This(), "PCLUSAPI_FAIL_CLUSTER_RESOURCE")) { _ = PCLUSAPI_FAIL_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_ONLINE_CLUSTER_RESOURCE")) { _ = PCLUSAPI_ONLINE_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_OFFLINE_CLUSTER_RESOURCE")) { _ = PCLUSAPI_OFFLINE_CLUSTER_RESOURCE; } if (@hasDecl(@This(), "PCLUSAPI_CHANGE_CLUSTER_RESOURCE_GROUP")) { _ = PCLUSAPI_CHANGE_CLUSTER_RESOURCE_GROUP; } if (@hasDecl(@This(), "PCLUSAPI_CHANGE_CLUSTER_RESOURCE_GROUP_EX")) { _ = PCLUSAPI_CHANGE_CLUSTER_RESOURCE_GROUP_EX; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_RESOURCE_NODE")) { _ = PCLUSAPI_ADD_CLUSTER_RESOURCE_NODE; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CLUSTER_RESOURCE_NODE")) { _ = PCLUSAPI_REMOVE_CLUSTER_RESOURCE_NODE; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_RESOURCE_DEPENDENCY")) { _ = PCLUSAPI_ADD_CLUSTER_RESOURCE_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CLUSTER_RESOURCE_DEPENDENCY")) { _ = PCLUSAPI_REMOVE_CLUSTER_RESOURCE_DEPENDENCY; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_RESOURCE_DEPENDENCY_EXPRESSION")) { _ = PCLUSAPI_SET_CLUSTER_RESOURCE_DEPENDENCY_EXPRESSION; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_RESOURCE_DEPENDENCY_EXPRESSION")) { _ = PCLUSAPI_GET_CLUSTER_RESOURCE_DEPENDENCY_EXPRESSION; } if (@hasDecl(@This(), "PCLUSAPI_ADD_RESOURCE_TO_CLUSTER_SHARED_VOLUMES")) { _ = PCLUSAPI_ADD_RESOURCE_TO_CLUSTER_SHARED_VOLUMES; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_RESOURCE_FROM_CLUSTER_SHARED_VOLUMES")) { _ = PCLUSAPI_REMOVE_RESOURCE_FROM_CLUSTER_SHARED_VOLUMES; } if (@hasDecl(@This(), "PCLUSAPI_IS_FILE_ON_CLUSTER_SHARED_VOLUME")) { _ = PCLUSAPI_IS_FILE_ON_CLUSTER_SHARED_VOLUME; } if (@hasDecl(@This(), "PCLUSAPI_SHARED_VOLUME_SET_SNAPSHOT_STATE")) { _ = PCLUSAPI_SHARED_VOLUME_SET_SNAPSHOT_STATE; } if (@hasDecl(@This(), "PCLUSAPI_CAN_RESOURCE_BE_DEPENDENT")) { _ = PCLUSAPI_CAN_RESOURCE_BE_DEPENDENT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_CONTROL")) { _ = PCLUSAPI_CLUSTER_RESOURCE_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_TYPE_CONTROL")) { _ = PCLUSAPI_CLUSTER_RESOURCE_TYPE_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_GROUP_CONTROL")) { _ = PCLUSAPI_CLUSTER_GROUP_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NODE_CONTROL")) { _ = PCLUSAPI_CLUSTER_NODE_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_RESOURCE_NETWORK_NAME")) { _ = PCLUSAPI_GET_CLUSTER_RESOURCE_NETWORK_NAME; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_OPEN_ENUM")) { _ = PCLUSAPI_CLUSTER_RESOURCE_OPEN_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_GET_ENUM_COUNT")) { _ = PCLUSAPI_CLUSTER_RESOURCE_GET_ENUM_COUNT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_ENUM")) { _ = PCLUSAPI_CLUSTER_RESOURCE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_CLOSE_ENUM")) { _ = PCLUSAPI_CLUSTER_RESOURCE_CLOSE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_RESOURCE_TYPE")) { _ = PCLUSAPI_CREATE_CLUSTER_RESOURCE_TYPE; } if (@hasDecl(@This(), "PCLUSAPI_DELETE_CLUSTER_RESOURCE_TYPE")) { _ = PCLUSAPI_DELETE_CLUSTER_RESOURCE_TYPE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_TYPE_OPEN_ENUM")) { _ = PCLUSAPI_CLUSTER_RESOURCE_TYPE_OPEN_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_TYPE_GET_ENUM_COUNT")) { _ = PCLUSAPI_CLUSTER_RESOURCE_TYPE_GET_ENUM_COUNT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_TYPE_ENUM")) { _ = PCLUSAPI_CLUSTER_RESOURCE_TYPE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_RESOURCE_TYPE_CLOSE_ENUM")) { _ = PCLUSAPI_CLUSTER_RESOURCE_TYPE_CLOSE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_NETWORK")) { _ = PCLUSAPI_OPEN_CLUSTER_NETWORK; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_NETWORK_EX")) { _ = PCLUSAPI_OPEN_CLUSTER_NETWORK_EX; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_NETWORK")) { _ = PCLUSAPI_CLOSE_CLUSTER_NETWORK; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_FROM_NETWORK")) { _ = PCLUSAPI_GET_CLUSTER_FROM_NETWORK; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NETWORK_OPEN_ENUM")) { _ = PCLUSAPI_CLUSTER_NETWORK_OPEN_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NETWORK_GET_ENUM_COUNT")) { _ = PCLUSAPI_CLUSTER_NETWORK_GET_ENUM_COUNT; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NETWORK_ENUM")) { _ = PCLUSAPI_CLUSTER_NETWORK_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NETWORK_CLOSE_ENUM")) { _ = PCLUSAPI_CLUSTER_NETWORK_CLOSE_ENUM; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NETWORK_STATE")) { _ = PCLUSAPI_GET_CLUSTER_NETWORK_STATE; } if (@hasDecl(@This(), "PCLUSAPI_SET_CLUSTER_NETWORK_NAME")) { _ = PCLUSAPI_SET_CLUSTER_NETWORK_NAME; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NETWORK_ID")) { _ = PCLUSAPI_GET_CLUSTER_NETWORK_ID; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NETWORK_CONTROL")) { _ = PCLUSAPI_CLUSTER_NETWORK_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_NET_INTERFACE")) { _ = PCLUSAPI_OPEN_CLUSTER_NET_INTERFACE; } if (@hasDecl(@This(), "PCLUSAPI_OPEN_CLUSTER_NETINTERFACE_EX")) { _ = PCLUSAPI_OPEN_CLUSTER_NETINTERFACE_EX; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NET_INTERFACE")) { _ = PCLUSAPI_GET_CLUSTER_NET_INTERFACE; } if (@hasDecl(@This(), "PCLUSAPI_CLOSE_CLUSTER_NET_INTERFACE")) { _ = PCLUSAPI_CLOSE_CLUSTER_NET_INTERFACE; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_FROM_NET_INTERFACE")) { _ = PCLUSAPI_GET_CLUSTER_FROM_NET_INTERFACE; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NET_INTERFACE_STATE")) { _ = PCLUSAPI_GET_CLUSTER_NET_INTERFACE_STATE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_NET_INTERFACE_CONTROL")) { _ = PCLUSAPI_CLUSTER_NET_INTERFACE_CONTROL; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_KEY")) { _ = PCLUSAPI_GET_CLUSTER_KEY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_GROUP_KEY")) { _ = PCLUSAPI_GET_CLUSTER_GROUP_KEY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_RESOURCE_KEY")) { _ = PCLUSAPI_GET_CLUSTER_RESOURCE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NODE_KEY")) { _ = PCLUSAPI_GET_CLUSTER_NODE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NETWORK_KEY")) { _ = PCLUSAPI_GET_CLUSTER_NETWORK_KEY; } if (@hasDecl(@This(), "PCLUSAPI_GET_CLUSTER_NET_INTERFACE_KEY")) { _ = PCLUSAPI_GET_CLUSTER_NET_INTERFACE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_CREATE_KEY")) { _ = PCLUSAPI_CLUSTER_REG_CREATE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_OPEN_KEY")) { _ = PCLUSAPI_CLUSTER_REG_OPEN_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_DELETE_KEY")) { _ = PCLUSAPI_CLUSTER_REG_DELETE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_CLOSE_KEY")) { _ = PCLUSAPI_CLUSTER_REG_CLOSE_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_ENUM_KEY")) { _ = PCLUSAPI_CLUSTER_REG_ENUM_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_SET_VALUE")) { _ = PCLUSAPI_CLUSTER_REG_SET_VALUE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_DELETE_VALUE")) { _ = PCLUSAPI_CLUSTER_REG_DELETE_VALUE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_QUERY_VALUE")) { _ = PCLUSAPI_CLUSTER_REG_QUERY_VALUE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_ENUM_VALUE")) { _ = PCLUSAPI_CLUSTER_REG_ENUM_VALUE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_QUERY_INFO_KEY")) { _ = PCLUSAPI_CLUSTER_REG_QUERY_INFO_KEY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_GET_KEY_SECURITY")) { _ = PCLUSAPI_CLUSTER_REG_GET_KEY_SECURITY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_SET_KEY_SECURITY")) { _ = PCLUSAPI_CLUSTER_REG_SET_KEY_SECURITY; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_SYNC_DATABASE")) { _ = PCLUSAPI_CLUSTER_REG_SYNC_DATABASE; } if (@hasDecl(@This(), "PCLUSAPI_CLUSTER_REG_CREATE_BATCH")) { _ = PCLUSAPI_CLUSTER_REG_CREATE_BATCH; } if (@hasDecl(@This(), "PCLUSTER_REG_BATCH_ADD_COMMAND")) { _ = PCLUSTER_REG_BATCH_ADD_COMMAND; } if (@hasDecl(@This(), "PCLUSTER_REG_CLOSE_BATCH")) { _ = PCLUSTER_REG_CLOSE_BATCH; } if (@hasDecl(@This(), "PCLUSTER_REG_BATCH_READ_COMMAND")) { _ = PCLUSTER_REG_BATCH_READ_COMMAND; } if (@hasDecl(@This(), "PCLUSTER_REG_BATCH_CLOSE_NOTIFICATION")) { _ = PCLUSTER_REG_BATCH_CLOSE_NOTIFICATION; } if (@hasDecl(@This(), "PCLUSTER_REG_CREATE_BATCH_NOTIFY_PORT")) { _ = PCLUSTER_REG_CREATE_BATCH_NOTIFY_PORT; } if (@hasDecl(@This(), "PCLUSTER_REG_CLOSE_BATCH_NOTIFY_PORT")) { _ = PCLUSTER_REG_CLOSE_BATCH_NOTIFY_PORT; } if (@hasDecl(@This(), "PCLUSTER_REG_GET_BATCH_NOTIFICATION")) { _ = PCLUSTER_REG_GET_BATCH_NOTIFICATION; } if (@hasDecl(@This(), "PCLUSTER_REG_CREATE_READ_BATCH")) { _ = PCLUSTER_REG_CREATE_READ_BATCH; } if (@hasDecl(@This(), "PCLUSTER_REG_READ_BATCH_ADD_COMMAND")) { _ = PCLUSTER_REG_READ_BATCH_ADD_COMMAND; } if (@hasDecl(@This(), "PCLUSTER_REG_CLOSE_READ_BATCH")) { _ = PCLUSTER_REG_CLOSE_READ_BATCH; } if (@hasDecl(@This(), "PCLUSTER_REG_CLOSE_READ_BATCH_EX")) { _ = PCLUSTER_REG_CLOSE_READ_BATCH_EX; } if (@hasDecl(@This(), "PCLUSTER_REG_READ_BATCH_REPLY_NEXT_COMMAND")) { _ = PCLUSTER_REG_READ_BATCH_REPLY_NEXT_COMMAND; } if (@hasDecl(@This(), "PCLUSTER_REG_CLOSE_READ_BATCH_REPLY")) { _ = PCLUSTER_REG_CLOSE_READ_BATCH_REPLY; } if (@hasDecl(@This(), "PCLUSTER_SET_ACCOUNT_ACCESS")) { _ = PCLUSTER_SET_ACCOUNT_ACCESS; } if (@hasDecl(@This(), "PCLUSTER_SETUP_PROGRESS_CALLBACK")) { _ = PCLUSTER_SETUP_PROGRESS_CALLBACK; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER")) { _ = PCLUSAPI_CREATE_CLUSTER; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_CNOLESS")) { _ = PCLUSAPI_CREATE_CLUSTER_CNOLESS; } if (@hasDecl(@This(), "PCLUSAPI_CREATE_CLUSTER_NAME_ACCOUNT")) { _ = PCLUSAPI_CREATE_CLUSTER_NAME_ACCOUNT; } if (@hasDecl(@This(), "PCLUSAPI_REMOVE_CLUSTER_NAME_ACCOUNT")) { _ = PCLUSAPI_REMOVE_CLUSTER_NAME_ACCOUNT; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_NODE")) { _ = PCLUSAPI_ADD_CLUSTER_NODE; } if (@hasDecl(@This(), "PCLUSAPI_ADD_CLUSTER_NODE_EX")) { _ = PCLUSAPI_ADD_CLUSTER_NODE_EX; } if (@hasDecl(@This(), "PCLUSAPI_DESTROY_CLUSTER")) { _ = PCLUSAPI_DESTROY_CLUSTER; } if (@hasDecl(@This(), "PSET_RESOURCE_STATUS_ROUTINE_EX")) { _ = PSET_RESOURCE_STATUS_ROUTINE_EX; } if (@hasDecl(@This(), "PSET_RESOURCE_STATUS_ROUTINE")) { _ = PSET_RESOURCE_STATUS_ROUTINE; } if (@hasDecl(@This(), "PQUORUM_RESOURCE_LOST")) { _ = PQUORUM_RESOURCE_LOST; } if (@hasDecl(@This(), "PLOG_EVENT_ROUTINE")) { _ = PLOG_EVENT_ROUTINE; } if (@hasDecl(@This(), "POPEN_ROUTINE")) { _ = POPEN_ROUTINE; } if (@hasDecl(@This(), "PCLOSE_ROUTINE")) { _ = PCLOSE_ROUTINE; } if (@hasDecl(@This(), "PONLINE_ROUTINE")) { _ = PONLINE_ROUTINE; } if (@hasDecl(@This(), "POFFLINE_ROUTINE")) { _ = POFFLINE_ROUTINE; } if (@hasDecl(@This(), "PTERMINATE_ROUTINE")) { _ = PTERMINATE_ROUTINE; } if (@hasDecl(@This(), "PIS_ALIVE_ROUTINE")) { _ = PIS_ALIVE_ROUTINE; } if (@hasDecl(@This(), "PLOOKS_ALIVE_ROUTINE")) { _ = PLOOKS_ALIVE_ROUTINE; } if (@hasDecl(@This(), "PARBITRATE_ROUTINE")) { _ = PARBITRATE_ROUTINE; } if (@hasDecl(@This(), "PRELEASE_ROUTINE")) { _ = PRELEASE_ROUTINE; } if (@hasDecl(@This(), "PRESOURCE_CONTROL_ROUTINE")) { _ = PRESOURCE_CONTROL_ROUTINE; } if (@hasDecl(@This(), "PRESOURCE_TYPE_CONTROL_ROUTINE")) { _ = PRESOURCE_TYPE_CONTROL_ROUTINE; } if (@hasDecl(@This(), "POPEN_V2_ROUTINE")) { _ = POPEN_V2_ROUTINE; } if (@hasDecl(@This(), "PONLINE_V2_ROUTINE")) { _ = PONLINE_V2_ROUTINE; } if (@hasDecl(@This(), "POFFLINE_V2_ROUTINE")) { _ = POFFLINE_V2_ROUTINE; } if (@hasDecl(@This(), "PCANCEL_ROUTINE")) { _ = PCANCEL_ROUTINE; } if (@hasDecl(@This(), "PBEGIN_RESCALL_ROUTINE")) { _ = PBEGIN_RESCALL_ROUTINE; } if (@hasDecl(@This(), "PBEGIN_RESTYPECALL_ROUTINE")) { _ = PBEGIN_RESTYPECALL_ROUTINE; } if (@hasDecl(@This(), "PBEGIN_RESCALL_AS_USER_ROUTINE")) { _ = PBEGIN_RESCALL_AS_USER_ROUTINE; } if (@hasDecl(@This(), "PBEGIN_RESTYPECALL_AS_USER_ROUTINE")) { _ = PBEGIN_RESTYPECALL_AS_USER_ROUTINE; } if (@hasDecl(@This(), "PSTARTUP_ROUTINE")) { _ = PSTARTUP_ROUTINE; } if (@hasDecl(@This(), "PSET_RESOURCE_LOCKED_MODE_ROUTINE")) { _ = PSET_RESOURCE_LOCKED_MODE_ROUTINE; } if (@hasDecl(@This(), "PSIGNAL_FAILURE_ROUTINE")) { _ = PSIGNAL_FAILURE_ROUTINE; } if (@hasDecl(@This(), "PSET_RESOURCE_INMEMORY_NODELOCAL_PROPERTIES_ROUTINE")) { _ = PSET_RESOURCE_INMEMORY_NODELOCAL_PROPERTIES_ROUTINE; } if (@hasDecl(@This(), "PEND_CONTROL_CALL")) { _ = PEND_CONTROL_CALL; } if (@hasDecl(@This(), "PEND_TYPE_CONTROL_CALL")) { _ = PEND_TYPE_CONTROL_CALL; } if (@hasDecl(@This(), "PEXTEND_RES_CONTROL_CALL")) { _ = PEXTEND_RES_CONTROL_CALL; } if (@hasDecl(@This(), "PEXTEND_RES_TYPE_CONTROL_CALL")) { _ = PEXTEND_RES_TYPE_CONTROL_CALL; } if (@hasDecl(@This(), "PRAISE_RES_TYPE_NOTIFICATION")) { _ = PRAISE_RES_TYPE_NOTIFICATION; } if (@hasDecl(@This(), "PCHANGE_RESOURCE_PROCESS_FOR_DUMPS")) { _ = PCHANGE_RESOURCE_PROCESS_FOR_DUMPS; } if (@hasDecl(@This(), "PCHANGE_RES_TYPE_PROCESS_FOR_DUMPS")) { _ = PCHANGE_RES_TYPE_PROCESS_FOR_DUMPS; } if (@hasDecl(@This(), "PSET_INTERNAL_STATE")) { _ = PSET_INTERNAL_STATE; } if (@hasDecl(@This(), "PSET_RESOURCE_LOCKED_MODE_EX_ROUTINE")) { _ = PSET_RESOURCE_LOCKED_MODE_EX_ROUTINE; } if (@hasDecl(@This(), "PREQUEST_DUMP_ROUTINE")) { _ = PREQUEST_DUMP_ROUTINE; } if (@hasDecl(@This(), "PSTARTUP_EX_ROUTINE")) { _ = PSTARTUP_EX_ROUTINE; } if (@hasDecl(@This(), "PRESUTIL_START_RESOURCE_SERVICE")) { _ = PRESUTIL_START_RESOURCE_SERVICE; } if (@hasDecl(@This(), "PRESUTIL_VERIFY_RESOURCE_SERVICE")) { _ = PRESUTIL_VERIFY_RESOURCE_SERVICE; } if (@hasDecl(@This(), "PRESUTIL_STOP_RESOURCE_SERVICE")) { _ = PRESUTIL_STOP_RESOURCE_SERVICE; } if (@hasDecl(@This(), "PRESUTIL_VERIFY_SERVICE")) { _ = PRESUTIL_VERIFY_SERVICE; } if (@hasDecl(@This(), "PRESUTIL_STOP_SERVICE")) { _ = PRESUTIL_STOP_SERVICE; } if (@hasDecl(@This(), "PRESUTIL_CREATE_DIRECTORY_TREE")) { _ = PRESUTIL_CREATE_DIRECTORY_TREE; } if (@hasDecl(@This(), "PRESUTIL_IS_PATH_VALID")) { _ = PRESUTIL_IS_PATH_VALID; } if (@hasDecl(@This(), "PRESUTIL_ENUM_PROPERTIES")) { _ = PRESUTIL_ENUM_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_ENUM_PRIVATE_PROPERTIES")) { _ = PRESUTIL_ENUM_PRIVATE_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_GET_PROPERTIES")) { _ = PRESUTIL_GET_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_GET_ALL_PROPERTIES")) { _ = PRESUTIL_GET_ALL_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_GET_PRIVATE_PROPERTIES")) { _ = PRESUTIL_GET_PRIVATE_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_GET_PROPERTY_SIZE")) { _ = PRESUTIL_GET_PROPERTY_SIZE; } if (@hasDecl(@This(), "PRESUTIL_GET_PROPERTY")) { _ = PRESUTIL_GET_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_VERIFY_PROPERTY_TABLE")) { _ = PRESUTIL_VERIFY_PROPERTY_TABLE; } if (@hasDecl(@This(), "PRESUTIL_SET_PROPERTY_TABLE")) { _ = PRESUTIL_SET_PROPERTY_TABLE; } if (@hasDecl(@This(), "PRESUTIL_SET_PROPERTY_TABLE_EX")) { _ = PRESUTIL_SET_PROPERTY_TABLE_EX; } if (@hasDecl(@This(), "PRESUTIL_SET_PROPERTY_PARAMETER_BLOCK")) { _ = PRESUTIL_SET_PROPERTY_PARAMETER_BLOCK; } if (@hasDecl(@This(), "PRESUTIL_SET_PROPERTY_PARAMETER_BLOCK_EX")) { _ = PRESUTIL_SET_PROPERTY_PARAMETER_BLOCK_EX; } if (@hasDecl(@This(), "PRESUTIL_SET_UNKNOWN_PROPERTIES")) { _ = PRESUTIL_SET_UNKNOWN_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_GET_PROPERTIES_TO_PARAMETER_BLOCK")) { _ = PRESUTIL_GET_PROPERTIES_TO_PARAMETER_BLOCK; } if (@hasDecl(@This(), "PRESUTIL_PROPERTY_LIST_FROM_PARAMETER_BLOCK")) { _ = PRESUTIL_PROPERTY_LIST_FROM_PARAMETER_BLOCK; } if (@hasDecl(@This(), "PRESUTIL_DUP_PARAMETER_BLOCK")) { _ = PRESUTIL_DUP_PARAMETER_BLOCK; } if (@hasDecl(@This(), "PRESUTIL_FREE_PARAMETER_BLOCK")) { _ = PRESUTIL_FREE_PARAMETER_BLOCK; } if (@hasDecl(@This(), "PRESUTIL_ADD_UNKNOWN_PROPERTIES")) { _ = PRESUTIL_ADD_UNKNOWN_PROPERTIES; } if (@hasDecl(@This(), "PRESUTIL_SET_PRIVATE_PROPERTY_LIST")) { _ = PRESUTIL_SET_PRIVATE_PROPERTY_LIST; } if (@hasDecl(@This(), "PRESUTIL_VERIFY_PRIVATE_PROPERTY_LIST")) { _ = PRESUTIL_VERIFY_PRIVATE_PROPERTY_LIST; } if (@hasDecl(@This(), "PRESUTIL_DUP_STRING")) { _ = PRESUTIL_DUP_STRING; } if (@hasDecl(@This(), "PRESUTIL_GET_BINARY_VALUE")) { _ = PRESUTIL_GET_BINARY_VALUE; } if (@hasDecl(@This(), "PRESUTIL_GET_SZ_VALUE")) { _ = PRESUTIL_GET_SZ_VALUE; } if (@hasDecl(@This(), "PRESUTIL_GET_EXPAND_SZ_VALUE")) { _ = PRESUTIL_GET_EXPAND_SZ_VALUE; } if (@hasDecl(@This(), "PRESUTIL_GET_DWORD_VALUE")) { _ = PRESUTIL_GET_DWORD_VALUE; } if (@hasDecl(@This(), "PRESUTIL_GET_QWORD_VALUE")) { _ = PRESUTIL_GET_QWORD_VALUE; } if (@hasDecl(@This(), "PRESUTIL_SET_BINARY_VALUE")) { _ = PRESUTIL_SET_BINARY_VALUE; } if (@hasDecl(@This(), "PRESUTIL_SET_SZ_VALUE")) { _ = PRESUTIL_SET_SZ_VALUE; } if (@hasDecl(@This(), "PRESUTIL_SET_EXPAND_SZ_VALUE")) { _ = PRESUTIL_SET_EXPAND_SZ_VALUE; } if (@hasDecl(@This(), "PRESUTIL_SET_MULTI_SZ_VALUE")) { _ = PRESUTIL_SET_MULTI_SZ_VALUE; } if (@hasDecl(@This(), "PRESUTIL_SET_DWORD_VALUE")) { _ = PRESUTIL_SET_DWORD_VALUE; } if (@hasDecl(@This(), "PRESUTIL_SET_QWORD_VALUE")) { _ = PRESUTIL_SET_QWORD_VALUE; } if (@hasDecl(@This(), "PRESUTIL_GET_BINARY_PROPERTY")) { _ = PRESUTIL_GET_BINARY_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_GET_SZ_PROPERTY")) { _ = PRESUTIL_GET_SZ_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_GET_MULTI_SZ_PROPERTY")) { _ = PRESUTIL_GET_MULTI_SZ_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_GET_DWORD_PROPERTY")) { _ = PRESUTIL_GET_DWORD_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_GET_LONG_PROPERTY")) { _ = PRESUTIL_GET_LONG_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_GET_FILETIME_PROPERTY")) { _ = PRESUTIL_GET_FILETIME_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_GET_ENVIRONMENT_WITH_NET_NAME")) { _ = PRESUTIL_GET_ENVIRONMENT_WITH_NET_NAME; } if (@hasDecl(@This(), "PRESUTIL_FREE_ENVIRONMENT")) { _ = PRESUTIL_FREE_ENVIRONMENT; } if (@hasDecl(@This(), "PRESUTIL_EXPAND_ENVIRONMENT_STRINGS")) { _ = PRESUTIL_EXPAND_ENVIRONMENT_STRINGS; } if (@hasDecl(@This(), "PRESUTIL_SET_RESOURCE_SERVICE_ENVIRONMENT")) { _ = PRESUTIL_SET_RESOURCE_SERVICE_ENVIRONMENT; } if (@hasDecl(@This(), "PRESUTIL_REMOVE_RESOURCE_SERVICE_ENVIRONMENT")) { _ = PRESUTIL_REMOVE_RESOURCE_SERVICE_ENVIRONMENT; } if (@hasDecl(@This(), "PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS")) { _ = PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS; } if (@hasDecl(@This(), "PRESUTIL_FIND_SZ_PROPERTY")) { _ = PRESUTIL_FIND_SZ_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_EXPAND_SZ_PROPERTY")) { _ = PRESUTIL_FIND_EXPAND_SZ_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_EXPANDED_SZ_PROPERTY")) { _ = PRESUTIL_FIND_EXPANDED_SZ_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_DWORD_PROPERTY")) { _ = PRESUTIL_FIND_DWORD_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_BINARY_PROPERTY")) { _ = PRESUTIL_FIND_BINARY_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_MULTI_SZ_PROPERTY")) { _ = PRESUTIL_FIND_MULTI_SZ_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_LONG_PROPERTY")) { _ = PRESUTIL_FIND_LONG_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_ULARGEINTEGER_PROPERTY")) { _ = PRESUTIL_FIND_ULARGEINTEGER_PROPERTY; } if (@hasDecl(@This(), "PRESUTIL_FIND_FILETIME_PROPERTY")) { _ = PRESUTIL_FIND_FILETIME_PROPERTY; } if (@hasDecl(@This(), "PWORKER_START_ROUTINE")) { _ = PWORKER_START_ROUTINE; } if (@hasDecl(@This(), "PCLUSAPI_CLUS_WORKER_CREATE")) { _ = PCLUSAPI_CLUS_WORKER_CREATE; } if (@hasDecl(@This(), "PCLUSAPIClusWorkerCheckTerminate")) { _ = PCLUSAPIClusWorkerCheckTerminate; } if (@hasDecl(@This(), "PCLUSAPI_CLUS_WORKER_TERMINATE")) { _ = PCLUSAPI_CLUS_WORKER_TERMINATE; } if (@hasDecl(@This(), "LPRESOURCE_CALLBACK")) { _ = LPRESOURCE_CALLBACK; } if (@hasDecl(@This(), "LPRESOURCE_CALLBACK_EX")) { _ = LPRESOURCE_CALLBACK_EX; } if (@hasDecl(@This(), "LPGROUP_CALLBACK_EX")) { _ = LPGROUP_CALLBACK_EX; } if (@hasDecl(@This(), "LPNODE_CALLBACK")) { _ = LPNODE_CALLBACK; } if (@hasDecl(@This(), "PRESUTIL_RESOURCES_EQUAL")) { _ = PRESUTIL_RESOURCES_EQUAL; } if (@hasDecl(@This(), "PRESUTIL_RESOURCE_TYPES_EQUAL")) { _ = PRESUTIL_RESOURCE_TYPES_EQUAL; } if (@hasDecl(@This(), "PRESUTIL_IS_RESOURCE_CLASS_EQUAL")) { _ = PRESUTIL_IS_RESOURCE_CLASS_EQUAL; } if (@hasDecl(@This(), "PRESUTIL_ENUM_RESOURCES")) { _ = PRESUTIL_ENUM_RESOURCES; } if (@hasDecl(@This(), "PRESUTIL_ENUM_RESOURCES_EX")) { _ = PRESUTIL_ENUM_RESOURCES_EX; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENCY")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENCY; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_NAME")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_NAME; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY")) { _ = PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENTIP_ADDRESS_PROPS")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENTIP_ADDRESS_PROPS; } if (@hasDecl(@This(), "PRESUTIL_FIND_DEPENDENT_DISK_RESOURCE_DRIVE_LETTER")) { _ = PRESUTIL_FIND_DEPENDENT_DISK_RESOURCE_DRIVE_LETTER; } if (@hasDecl(@This(), "PRESUTIL_TERMINATE_SERVICE_PROCESS_FROM_RES_DLL")) { _ = PRESUTIL_TERMINATE_SERVICE_PROCESS_FROM_RES_DLL; } if (@hasDecl(@This(), "PRESUTIL_GET_PROPERTY_FORMATS")) { _ = PRESUTIL_GET_PROPERTY_FORMATS; } if (@hasDecl(@This(), "PRESUTIL_GET_CORE_CLUSTER_RESOURCES")) { _ = PRESUTIL_GET_CORE_CLUSTER_RESOURCES; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_NAME")) { _ = PRESUTIL_GET_RESOURCE_NAME; } if (@hasDecl(@This(), "PCLUSTER_IS_PATH_ON_SHARED_VOLUME")) { _ = PCLUSTER_IS_PATH_ON_SHARED_VOLUME; } if (@hasDecl(@This(), "PCLUSTER_GET_VOLUME_PATH_NAME")) { _ = PCLUSTER_GET_VOLUME_PATH_NAME; } if (@hasDecl(@This(), "PCLUSTER_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT")) { _ = PCLUSTER_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT; } if (@hasDecl(@This(), "PCLUSTER_PREPARE_SHARED_VOLUME_FOR_BACKUP")) { _ = PCLUSTER_PREPARE_SHARED_VOLUME_FOR_BACKUP; } if (@hasDecl(@This(), "PCLUSTER_CLEAR_BACKUP_STATE_FOR_SHARED_VOLUME")) { _ = PCLUSTER_CLEAR_BACKUP_STATE_FOR_SHARED_VOLUME; } if (@hasDecl(@This(), "PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS_EX")) { _ = PRESUTIL_SET_RESOURCE_SERVICE_START_PARAMETERS_EX; } if (@hasDecl(@This(), "PRESUTIL_ENUM_RESOURCES_EX2")) { _ = PRESUTIL_ENUM_RESOURCES_EX2; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENCY_EX")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENCY_EX; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_NAME_EX")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_NAME_EX; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS_EX")) { _ = PRESUTIL_GET_RESOURCE_DEPENDENCY_BY_CLASS_EX; } if (@hasDecl(@This(), "PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY_EX")) { _ = PRESUTIL_GET_RESOURCE_NAME_DEPENDENCY_EX; } if (@hasDecl(@This(), "PRESUTIL_GET_CORE_CLUSTER_RESOURCES_EX")) { _ = PRESUTIL_GET_CORE_CLUSTER_RESOURCES_EX; } if (@hasDecl(@This(), "POPEN_CLUSTER_CRYPT_PROVIDER")) { _ = POPEN_CLUSTER_CRYPT_PROVIDER; } if (@hasDecl(@This(), "POPEN_CLUSTER_CRYPT_PROVIDEREX")) { _ = POPEN_CLUSTER_CRYPT_PROVIDEREX; } if (@hasDecl(@This(), "PCLOSE_CLUSTER_CRYPT_PROVIDER")) { _ = PCLOSE_CLUSTER_CRYPT_PROVIDER; } if (@hasDecl(@This(), "PCLUSTER_ENCRYPT")) { _ = PCLUSTER_ENCRYPT; } if (@hasDecl(@This(), "PCLUSTER_DECRYPT")) { _ = PCLUSTER_DECRYPT; } if (@hasDecl(@This(), "PFREE_CLUSTER_CRYPT")) { _ = PFREE_CLUSTER_CRYPT; } if (@hasDecl(@This(), "PRES_UTIL_VERIFY_SHUTDOWN_SAFE")) { _ = PRES_UTIL_VERIFY_SHUTDOWN_SAFE; } if (@hasDecl(@This(), "PREGISTER_APPINSTANCE")) { _ = PREGISTER_APPINSTANCE; } if (@hasDecl(@This(), "PREGISTER_APPINSTANCE_VERSION")) { _ = PREGISTER_APPINSTANCE_VERSION; } if (@hasDecl(@This(), "PQUERY_APPINSTANCE_VERSION")) { _ = PQUERY_APPINSTANCE_VERSION; } if (@hasDecl(@This(), "PRESET_ALL_APPINSTANCE_VERSIONS")) { _ = PRESET_ALL_APPINSTANCE_VERSIONS; } if (@hasDecl(@This(), "SET_APP_INSTANCE_CSV_FLAGS")) { _ = SET_APP_INSTANCE_CSV_FLAGS; } @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/networking/clustering.zig
pub const FIND_RESOURCE_DIRECTORY_TYPES = @as(u32, 256); pub const FIND_RESOURCE_DIRECTORY_NAMES = @as(u32, 512); pub const FIND_RESOURCE_DIRECTORY_LANGUAGES = @as(u32, 1024); pub const RESOURCE_ENUM_LN = @as(u32, 1); pub const RESOURCE_ENUM_MUI = @as(u32, 2); pub const RESOURCE_ENUM_MUI_SYSTEM = @as(u32, 4); pub const RESOURCE_ENUM_VALIDATE = @as(u32, 8); pub const RESOURCE_ENUM_MODULE_EXACT = @as(u32, 16); pub const SUPPORT_LANG_NUMBER = @as(u32, 32); pub const GET_MODULE_HANDLE_EX_FLAG_PIN = @as(u32, 1); pub const GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT = @as(u32, 2); pub const GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS = @as(u32, 4); pub const CURRENT_IMPORT_REDIRECTION_VERSION = @as(u32, 1); pub const LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY = @as(u32, 32768); //-------------------------------------------------------------------------------- // Section: Types (12) //-------------------------------------------------------------------------------- pub const LOAD_LIBRARY_FLAGS = enum(u32) { DONT_RESOLVE_DLL_REFERENCES = 1, LOAD_LIBRARY_AS_DATAFILE = 2, LOAD_WITH_ALTERED_SEARCH_PATH = 8, LOAD_IGNORE_CODE_AUTHZ_LEVEL = 16, LOAD_LIBRARY_AS_IMAGE_RESOURCE = 32, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = 64, LOAD_LIBRARY_REQUIRE_SIGNED_TARGET = 128, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = 256, LOAD_LIBRARY_SEARCH_APPLICATION_DIR = 512, LOAD_LIBRARY_SEARCH_USER_DIRS = 1024, LOAD_LIBRARY_SEARCH_SYSTEM32 = 2048, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 4096, LOAD_LIBRARY_SAFE_CURRENT_DIRS = 8192, LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER = 16384, _, pub fn initFlags(o: struct { DONT_RESOLVE_DLL_REFERENCES: u1 = 0, LOAD_LIBRARY_AS_DATAFILE: u1 = 0, LOAD_WITH_ALTERED_SEARCH_PATH: u1 = 0, LOAD_IGNORE_CODE_AUTHZ_LEVEL: u1 = 0, LOAD_LIBRARY_AS_IMAGE_RESOURCE: u1 = 0, LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: u1 = 0, LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: u1 = 0, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: u1 = 0, LOAD_LIBRARY_SEARCH_APPLICATION_DIR: u1 = 0, LOAD_LIBRARY_SEARCH_USER_DIRS: u1 = 0, LOAD_LIBRARY_SEARCH_SYSTEM32: u1 = 0, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: u1 = 0, LOAD_LIBRARY_SAFE_CURRENT_DIRS: u1 = 0, LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER: u1 = 0, }) LOAD_LIBRARY_FLAGS { return @intToEnum(LOAD_LIBRARY_FLAGS, (if (o.DONT_RESOLVE_DLL_REFERENCES == 1) @enumToInt(LOAD_LIBRARY_FLAGS.DONT_RESOLVE_DLL_REFERENCES) else 0) | (if (o.LOAD_LIBRARY_AS_DATAFILE == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_AS_DATAFILE) else 0) | (if (o.LOAD_WITH_ALTERED_SEARCH_PATH == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_WITH_ALTERED_SEARCH_PATH) else 0) | (if (o.LOAD_IGNORE_CODE_AUTHZ_LEVEL == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_IGNORE_CODE_AUTHZ_LEVEL) else 0) | (if (o.LOAD_LIBRARY_AS_IMAGE_RESOURCE == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_AS_IMAGE_RESOURCE) else 0) | (if (o.LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE) else 0) | (if (o.LOAD_LIBRARY_REQUIRE_SIGNED_TARGET == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_REQUIRE_SIGNED_TARGET) else 0) | (if (o.LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR) else 0) | (if (o.LOAD_LIBRARY_SEARCH_APPLICATION_DIR == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_APPLICATION_DIR) else 0) | (if (o.LOAD_LIBRARY_SEARCH_USER_DIRS == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_USER_DIRS) else 0) | (if (o.LOAD_LIBRARY_SEARCH_SYSTEM32 == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_SYSTEM32) else 0) | (if (o.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS) else 0) | (if (o.LOAD_LIBRARY_SAFE_CURRENT_DIRS == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SAFE_CURRENT_DIRS) else 0) | (if (o.LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER == 1) @enumToInt(LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER) else 0) ); } }; pub const DONT_RESOLVE_DLL_REFERENCES = LOAD_LIBRARY_FLAGS.DONT_RESOLVE_DLL_REFERENCES; pub const LOAD_LIBRARY_AS_DATAFILE = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_AS_DATAFILE; pub const LOAD_WITH_ALTERED_SEARCH_PATH = LOAD_LIBRARY_FLAGS.LOAD_WITH_ALTERED_SEARCH_PATH; pub const LOAD_IGNORE_CODE_AUTHZ_LEVEL = LOAD_LIBRARY_FLAGS.LOAD_IGNORE_CODE_AUTHZ_LEVEL; pub const LOAD_LIBRARY_AS_IMAGE_RESOURCE = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_AS_IMAGE_RESOURCE; pub const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE; pub const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_REQUIRE_SIGNED_TARGET; pub const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR; pub const LOAD_LIBRARY_SEARCH_APPLICATION_DIR = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_APPLICATION_DIR; pub const LOAD_LIBRARY_SEARCH_USER_DIRS = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_USER_DIRS; pub const LOAD_LIBRARY_SEARCH_SYSTEM32 = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_SYSTEM32; pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_DEFAULT_DIRS; pub const LOAD_LIBRARY_SAFE_CURRENT_DIRS = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SAFE_CURRENT_DIRS; pub const LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER = LOAD_LIBRARY_FLAGS.LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER; pub const ENUMUILANG = extern struct { NumOfEnumUILang: u32, SizeOfEnumUIBuffer: u32, pEnumUIBuffer: ?*u16, }; pub const ENUMRESLANGPROCA = fn( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpName: ?[*:0]const u8, wLanguage: u16, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const ENUMRESLANGPROCW = fn( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpName: ?[*:0]const u16, wLanguage: u16, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const ENUMRESNAMEPROCA = fn( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpName: ?PSTR, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const ENUMRESNAMEPROCW = fn( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpName: ?PWSTR, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const ENUMRESTYPEPROCA = fn( hModule: ?HINSTANCE, lpType: ?PSTR, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const ENUMRESTYPEPROCW = fn( hModule: ?HINSTANCE, lpType: ?PWSTR, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PGET_MODULE_HANDLE_EXA = fn( dwFlags: u32, lpModuleName: ?[*:0]const u8, phModule: ?*?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const PGET_MODULE_HANDLE_EXW = fn( dwFlags: u32, lpModuleName: ?[*:0]const u16, phModule: ?*?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const REDIRECTION_FUNCTION_DESCRIPTOR = extern struct { DllName: ?[*:0]const u8, FunctionName: ?[*:0]const u8, RedirectionTarget: ?*anyopaque, }; pub const REDIRECTION_DESCRIPTOR = extern struct { Version: u32, FunctionCount: u32, Redirections: ?*REDIRECTION_FUNCTION_DESCRIPTOR, }; //-------------------------------------------------------------------------------- // Section: Functions (49) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn DisableThreadLibraryCalls( hLibModule: ?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "KERNEL32" fn FindResourceExW( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpName: ?[*:0]const u16, wLanguage: u16, ) callconv(@import("std").os.windows.WINAPI) ?HRSRC; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn FreeLibrary( hLibModule: ?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn FreeLibraryAndExitThread( hLibModule: ?HINSTANCE, dwExitCode: u32, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FreeResource( hResData: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetModuleFileNameA( hModule: ?HINSTANCE, lpFilename: [*:0]u8, nSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetModuleFileNameW( hModule: ?HINSTANCE, lpFilename: [*:0]u16, nSize: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetModuleHandleA( lpModuleName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetModuleHandleW( lpModuleName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetModuleHandleExA( dwFlags: u32, lpModuleName: ?[*:0]const u8, phModule: ?*?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetModuleHandleExW( dwFlags: u32, lpModuleName: ?[*:0]const u16, phModule: ?*?HINSTANCE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetProcAddress( hModule: ?HINSTANCE, lpProcName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?FARPROC; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn LoadLibraryExA( lpLibFileName: ?[*:0]const u8, hFile: ?HANDLE, dwFlags: LOAD_LIBRARY_FLAGS, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn LoadLibraryExW( lpLibFileName: ?[*:0]const u16, hFile: ?HANDLE, dwFlags: LOAD_LIBRARY_FLAGS, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn LoadResource( hModule: ?HINSTANCE, hResInfo: ?HRSRC, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn LockResource( hResData: isize, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SizeofResource( hModule: ?HINSTANCE, hResInfo: ?HRSRC, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "KERNEL32" fn AddDllDirectory( NewDirectory: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; // TODO: this type is limited to platform 'windows8.0' pub extern "KERNEL32" fn RemoveDllDirectory( Cookie: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "KERNEL32" fn SetDefaultDllDirectories( DirectoryFlags: LOAD_LIBRARY_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumResourceLanguagesExA( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpName: ?[*:0]const u8, lpEnumFunc: ?ENUMRESLANGPROCA, lParam: isize, dwFlags: u32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumResourceLanguagesExW( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpName: ?[*:0]const u16, lpEnumFunc: ?ENUMRESLANGPROCW, lParam: isize, dwFlags: u32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumResourceNamesExA( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpEnumFunc: ?ENUMRESNAMEPROCA, lParam: isize, dwFlags: u32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumResourceNamesExW( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpEnumFunc: ?ENUMRESNAMEPROCW, lParam: isize, dwFlags: u32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumResourceTypesExA( hModule: ?HINSTANCE, lpEnumFunc: ?ENUMRESTYPEPROCA, lParam: isize, dwFlags: u32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn EnumResourceTypesExW( hModule: ?HINSTANCE, lpEnumFunc: ?ENUMRESTYPEPROCW, lParam: isize, dwFlags: u32, LangId: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "KERNEL32" fn FindResourceW( hModule: ?HINSTANCE, lpName: ?[*:0]const u16, lpType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HRSRC; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn LoadLibraryA( lpLibFileName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn LoadLibraryW( lpLibFileName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; pub extern "KERNEL32" fn EnumResourceNamesW( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpEnumFunc: ?ENUMRESNAMEPROCW, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumResourceNamesA( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpEnumFunc: ?ENUMRESNAMEPROCA, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn LoadModule( lpModuleName: ?[*:0]const u8, lpParameterBlock: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows8.0' pub extern "KERNEL32" fn LoadPackagedLibrary( lpwLibFileName: ?[*:0]const u16, Reserved: u32, ) callconv(@import("std").os.windows.WINAPI) ?HINSTANCE; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FindResourceA( hModule: ?HINSTANCE, lpName: ?[*:0]const u8, lpType: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?HRSRC; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn FindResourceExA( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpName: ?[*:0]const u8, wLanguage: u16, ) callconv(@import("std").os.windows.WINAPI) ?HRSRC; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumResourceTypesA( hModule: ?HINSTANCE, lpEnumFunc: ?ENUMRESTYPEPROCA, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumResourceTypesW( hModule: ?HINSTANCE, lpEnumFunc: ?ENUMRESTYPEPROCW, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumResourceLanguagesA( hModule: ?HINSTANCE, lpType: ?[*:0]const u8, lpName: ?[*:0]const u8, lpEnumFunc: ?ENUMRESLANGPROCA, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EnumResourceLanguagesW( hModule: ?HINSTANCE, lpType: ?[*:0]const u16, lpName: ?[*:0]const u16, lpEnumFunc: ?ENUMRESLANGPROCW, lParam: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn BeginUpdateResourceA( pFileName: ?[*:0]const u8, bDeleteExistingResources: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn BeginUpdateResourceW( pFileName: ?[*:0]const u16, bDeleteExistingResources: BOOL, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn UpdateResourceA( hUpdate: ?HANDLE, lpType: ?[*:0]const u8, lpName: ?[*:0]const u8, wLanguage: u16, // TODO: what to do with BytesParamIndex 5? lpData: ?*anyopaque, cb: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn UpdateResourceW( hUpdate: ?HANDLE, lpType: ?[*:0]const u16, lpName: ?[*:0]const u16, wLanguage: u16, // TODO: what to do with BytesParamIndex 5? lpData: ?*anyopaque, cb: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EndUpdateResourceA( hUpdate: ?HANDLE, fDiscard: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn EndUpdateResourceW( hUpdate: ?HANDLE, fDiscard: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn SetDllDirectoryA( lpPathName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn SetDllDirectoryW( lpPathName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetDllDirectoryA( nBufferLength: u32, lpBuffer: ?[*:0]u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn GetDllDirectoryW( nBufferLength: u32, lpBuffer: ?[*:0]u16, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (22) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const ENUMRESLANGPROC = thismodule.ENUMRESLANGPROCA; pub const ENUMRESNAMEPROC = thismodule.ENUMRESNAMEPROCA; pub const ENUMRESTYPEPROC = thismodule.ENUMRESTYPEPROCA; pub const PGET_MODULE_HANDLE_EX = thismodule.PGET_MODULE_HANDLE_EXA; pub const FindResourceEx = thismodule.FindResourceExA; pub const GetModuleFileName = thismodule.GetModuleFileNameA; pub const GetModuleHandle = thismodule.GetModuleHandleA; pub const GetModuleHandleEx = thismodule.GetModuleHandleExA; pub const LoadLibraryEx = thismodule.LoadLibraryExA; pub const EnumResourceLanguagesEx = thismodule.EnumResourceLanguagesExA; pub const EnumResourceNamesEx = thismodule.EnumResourceNamesExA; pub const EnumResourceTypesEx = thismodule.EnumResourceTypesExA; pub const FindResource = thismodule.FindResourceA; pub const LoadLibrary = thismodule.LoadLibraryA; pub const EnumResourceNames = thismodule.EnumResourceNamesA; pub const EnumResourceTypes = thismodule.EnumResourceTypesA; pub const EnumResourceLanguages = thismodule.EnumResourceLanguagesA; pub const BeginUpdateResource = thismodule.BeginUpdateResourceA; pub const UpdateResource = thismodule.UpdateResourceA; pub const EndUpdateResource = thismodule.EndUpdateResourceA; pub const SetDllDirectory = thismodule.SetDllDirectoryA; pub const GetDllDirectory = thismodule.GetDllDirectoryA; }, .wide => struct { pub const ENUMRESLANGPROC = thismodule.ENUMRESLANGPROCW; pub const ENUMRESNAMEPROC = thismodule.ENUMRESNAMEPROCW; pub const ENUMRESTYPEPROC = thismodule.ENUMRESTYPEPROCW; pub const PGET_MODULE_HANDLE_EX = thismodule.PGET_MODULE_HANDLE_EXW; pub const FindResourceEx = thismodule.FindResourceExW; pub const GetModuleFileName = thismodule.GetModuleFileNameW; pub const GetModuleHandle = thismodule.GetModuleHandleW; pub const GetModuleHandleEx = thismodule.GetModuleHandleExW; pub const LoadLibraryEx = thismodule.LoadLibraryExW; pub const EnumResourceLanguagesEx = thismodule.EnumResourceLanguagesExW; pub const EnumResourceNamesEx = thismodule.EnumResourceNamesExW; pub const EnumResourceTypesEx = thismodule.EnumResourceTypesExW; pub const FindResource = thismodule.FindResourceW; pub const LoadLibrary = thismodule.LoadLibraryW; pub const EnumResourceNames = thismodule.EnumResourceNamesW; pub const EnumResourceTypes = thismodule.EnumResourceTypesW; pub const EnumResourceLanguages = thismodule.EnumResourceLanguagesW; pub const BeginUpdateResource = thismodule.BeginUpdateResourceW; pub const UpdateResource = thismodule.UpdateResourceW; pub const EndUpdateResource = thismodule.EndUpdateResourceW; pub const SetDllDirectory = thismodule.SetDllDirectoryW; pub const GetDllDirectory = thismodule.GetDllDirectoryW; }, .unspecified => if (@import("builtin").is_test) struct { pub const ENUMRESLANGPROC = *opaque{}; pub const ENUMRESNAMEPROC = *opaque{}; pub const ENUMRESTYPEPROC = *opaque{}; pub const PGET_MODULE_HANDLE_EX = *opaque{}; pub const FindResourceEx = *opaque{}; pub const GetModuleFileName = *opaque{}; pub const GetModuleHandle = *opaque{}; pub const GetModuleHandleEx = *opaque{}; pub const LoadLibraryEx = *opaque{}; pub const EnumResourceLanguagesEx = *opaque{}; pub const EnumResourceNamesEx = *opaque{}; pub const EnumResourceTypesEx = *opaque{}; pub const FindResource = *opaque{}; pub const LoadLibrary = *opaque{}; pub const EnumResourceNames = *opaque{}; pub const EnumResourceTypes = *opaque{}; pub const EnumResourceLanguages = *opaque{}; pub const BeginUpdateResource = *opaque{}; pub const UpdateResource = *opaque{}; pub const EndUpdateResource = *opaque{}; pub const SetDllDirectory = *opaque{}; pub const GetDllDirectory = *opaque{}; } else struct { pub const ENUMRESLANGPROC = @compileError("'ENUMRESLANGPROC' requires that UNICODE be set to true or false in the root module"); pub const ENUMRESNAMEPROC = @compileError("'ENUMRESNAMEPROC' requires that UNICODE be set to true or false in the root module"); pub const ENUMRESTYPEPROC = @compileError("'ENUMRESTYPEPROC' requires that UNICODE be set to true or false in the root module"); pub const PGET_MODULE_HANDLE_EX = @compileError("'PGET_MODULE_HANDLE_EX' requires that UNICODE be set to true or false in the root module"); pub const FindResourceEx = @compileError("'FindResourceEx' requires that UNICODE be set to true or false in the root module"); pub const GetModuleFileName = @compileError("'GetModuleFileName' requires that UNICODE be set to true or false in the root module"); pub const GetModuleHandle = @compileError("'GetModuleHandle' requires that UNICODE be set to true or false in the root module"); pub const GetModuleHandleEx = @compileError("'GetModuleHandleEx' requires that UNICODE be set to true or false in the root module"); pub const LoadLibraryEx = @compileError("'LoadLibraryEx' requires that UNICODE be set to true or false in the root module"); pub const EnumResourceLanguagesEx = @compileError("'EnumResourceLanguagesEx' requires that UNICODE be set to true or false in the root module"); pub const EnumResourceNamesEx = @compileError("'EnumResourceNamesEx' requires that UNICODE be set to true or false in the root module"); pub const EnumResourceTypesEx = @compileError("'EnumResourceTypesEx' requires that UNICODE be set to true or false in the root module"); pub const FindResource = @compileError("'FindResource' requires that UNICODE be set to true or false in the root module"); pub const LoadLibrary = @compileError("'LoadLibrary' requires that UNICODE be set to true or false in the root module"); pub const EnumResourceNames = @compileError("'EnumResourceNames' requires that UNICODE be set to true or false in the root module"); pub const EnumResourceTypes = @compileError("'EnumResourceTypes' requires that UNICODE be set to true or false in the root module"); pub const EnumResourceLanguages = @compileError("'EnumResourceLanguages' requires that UNICODE be set to true or false in the root module"); pub const BeginUpdateResource = @compileError("'BeginUpdateResource' requires that UNICODE be set to true or false in the root module"); pub const UpdateResource = @compileError("'UpdateResource' requires that UNICODE be set to true or false in the root module"); pub const EndUpdateResource = @compileError("'EndUpdateResource' requires that UNICODE be set to true or false in the root module"); pub const SetDllDirectory = @compileError("'SetDllDirectory' requires that UNICODE be set to true or false in the root module"); pub const GetDllDirectory = @compileError("'GetDllDirectory' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (7) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const FARPROC = @import("../foundation.zig").FARPROC; const HANDLE = @import("../foundation.zig").HANDLE; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HRSRC = @import("../foundation.zig").HRSRC; 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(), "ENUMRESLANGPROCA")) { _ = ENUMRESLANGPROCA; } if (@hasDecl(@This(), "ENUMRESLANGPROCW")) { _ = ENUMRESLANGPROCW; } if (@hasDecl(@This(), "ENUMRESNAMEPROCA")) { _ = ENUMRESNAMEPROCA; } if (@hasDecl(@This(), "ENUMRESNAMEPROCW")) { _ = ENUMRESNAMEPROCW; } if (@hasDecl(@This(), "ENUMRESTYPEPROCA")) { _ = ENUMRESTYPEPROCA; } if (@hasDecl(@This(), "ENUMRESTYPEPROCW")) { _ = ENUMRESTYPEPROCW; } if (@hasDecl(@This(), "PGET_MODULE_HANDLE_EXA")) { _ = PGET_MODULE_HANDLE_EXA; } if (@hasDecl(@This(), "PGET_MODULE_HANDLE_EXW")) { _ = PGET_MODULE_HANDLE_EXW; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/library_loader.zig
const std = @import("std"); const Options = @import("../../build.zig").Options; pub fn build(b: *std.build.Builder, options: Options) *std.build.LibExeObjStep { const exe_options = b.addOptions(); exe_options.addOption(bool, "enable_pix", options.enable_pix); exe_options.addOption(bool, "enable_dx_debug", options.enable_dx_debug); exe_options.addOption(bool, "enable_dx_gpu_debug", options.enable_dx_gpu_debug); exe_options.addOption(bool, "enable_tracy", options.tracy != null); exe_options.addOption(bool, "enable_d2d", true); const exe = b.addExecutable("vector_graphics_test", thisDir() ++ "/src/vector_graphics_test.zig"); exe.setBuildMode(options.build_mode); exe.setTarget(options.target); exe.addOptions("build_options", exe_options); // This is needed to export symbols from an .exe file. // We export D3D12SDKVersion and D3D12SDKPath symbols which // is required by DirectX 12 Agility SDK. exe.rdynamic = true; exe.want_lto = false; const options_pkg = std.build.Pkg{ .name = "build_options", .path = exe_options.getSource(), }; const zwin32_pkg = std.build.Pkg{ .name = "zwin32", .path = .{ .path = thisDir() ++ "/../../libs/zwin32/zwin32.zig" }, }; exe.addPackage(zwin32_pkg); const ztracy_pkg = std.build.Pkg{ .name = "ztracy", .path = .{ .path = thisDir() ++ "/../../libs/ztracy/src/ztracy.zig" }, .dependencies = &[_]std.build.Pkg{options_pkg}, }; exe.addPackage(ztracy_pkg); @import("../../libs/ztracy/build.zig").link(b, exe, .{ .tracy_path = options.tracy }); const zd3d12_pkg = std.build.Pkg{ .name = "zd3d12", .path = .{ .path = thisDir() ++ "/../../libs/zd3d12/src/zd3d12.zig" }, .dependencies = &[_]std.build.Pkg{ zwin32_pkg, ztracy_pkg, options_pkg, }, }; exe.addPackage(zd3d12_pkg); @import("../../libs/zd3d12/build.zig").link(b, exe); const common_pkg = std.build.Pkg{ .name = "common", .path = .{ .path = thisDir() ++ "/../../libs/common/src/common.zig" }, .dependencies = &[_]std.build.Pkg{ zwin32_pkg, zd3d12_pkg, ztracy_pkg, options_pkg, }, }; exe.addPackage(common_pkg); @import("../../libs/common/build.zig").link(b, exe); return exe; } fn thisDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; }
samples/vector_graphics_test/build.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const limit = 1 * 1024 * 1024 * 1024; const text = try std.fs.cwd().readFileAlloc(allocator, "day12.txt", limit); defer allocator.free(text); var process_groups: [2000]u16 = undefined; for (process_groups) |*g, i| { g.* = @intCast(u16, i); } var used_groups: [process_groups.len]bool = undefined; var dirty = true; while (dirty) { dirty = false; std.mem.set(bool, &used_groups, false); var it = std.mem.split(u8, text, "\n"); while (it.next()) |line0| { const line = std.mem.trim(u8, line0, " \n\t\r"); if (line.len == 0) continue; const min_group = blk: { var g: ?u16 = null; var it2 = std.mem.tokenize(u8, line, "<->, \t"); while (it2.next()) |num| { const process = std.fmt.parseInt(u32, num, 10) catch unreachable; if (g == null or g.? > process_groups[process]) g = process_groups[process]; } break :blk g.?; }; var it2 = std.mem.tokenize(u8, line, "<->, \t"); while (it2.next()) |num| { const process = std.fmt.parseInt(u32, num, 10) catch unreachable; if (process_groups[process] != min_group) { assert(process_groups[process] > min_group); process_groups[process] = min_group; dirty = true; } } used_groups[min_group] = true; } } const group0size = blk: { var c: u32 = 0; for (process_groups) |g| { if (g == 0) c += 1; } break :blk c; }; const numgroups = blk: { var c: u32 = 0; for (used_groups) |used| { if (used) c += 1; } break :blk c; }; try stdout.print("group0={}, numgroups={}\n", .{ group0size, numgroups }); }
2017/day12.zig
const std = @import("std"); const regs = @import("registers.zig"); pub const port = struct { pub const a = GpioWrapper(regs.GPIOA){}; pub const b = GpioWrapper(regs.GPIOB){}; pub const c = GpioWrapper(regs.GPIOC){}; pub const d = GpioWrapper(regs.GPIOD){}; pub const e = GpioWrapper(regs.GPIOE){}; pub const f = GpioWrapper(regs.GPIOF){}; pub const g = GpioWrapper(regs.GPIOG){}; pub const h = GpioWrapper(regs.GPIOH){}; pub const i = GpioWrapper(regs.GPIOI){}; pub const j = GpioWrapper(regs.GPIOJ){}; pub const k = GpioWrapper(regs.GPIOK){}; }; pub const Mode = enum { input, output, alternate_function, analog }; pub const PupdMode = enum { floating, pull_down, pull_up }; pub const OutputMode = enum { open_drain, push_pull }; pub const Speed = enum { low, medium, high, very_high }; pub const InputConfig = struct { mode: PupdMode = .floating, }; pub const OutputConfig = struct { mode: OutputMode = .push_pull, pupd_mode: PupdMode = .floating, speed: Speed = .low, }; pub const AlternateFunctionConfig = struct { mode: OutputMode = .push_pull, pupd_mode: PupdMode = .floating, af_mode: u4 = 0b0000, speed: Speed = .low, }; pub const AnalogConfig = struct {}; pub const Config = union(Mode) { input: InputConfig, output: OutputConfig, alternate_function: AlternateFunctionConfig, analog: AnalogConfig, }; pub fn GpioWrapper(comptime gpio: anytype) type { return struct { regs: @TypeOf(gpio) = gpio, const Self = @This(); pub fn set_mode( comptime self: Self, comptime pin: u4, comptime config: Config, ) void { switch (config) { Mode.input => |mode| { self.set_mode_impl(pin, 0b00); self.set_pupd_mode(pin, mode.mode); }, Mode.output => |mode| { self.set_mode_impl(pin, 0b01); self.set_output_mode(pin, mode.mode); self.set_pupd_mode(pin, mode.pupd_mode); self.set_output_speed(pin, mode.speed); }, Mode.alternate_function => |mode| { self.set_mode_impl(pin, 0b10); self.set_output_mode(pin, mode.mode); self.set_pupd_mode(pin, mode.pupd_mode); self.set_output_speed(pin, mode.speed); self.set_af_mode(pin, mode.af_mode); }, Mode.analog => { self.set_mode_impl(pin, 0b11); self.set_pupd_mode(pin, .floating); }, } } pub fn set_mode_impl( comptime self: Self, comptime pin: u4, comptime moder_value: u2, ) void { const reg_name = comptime get_pin_reg_name("MODER", pin); self.regs.MODER.modifyByName(.{.{ reg_name, moder_value }}); } pub fn set_pupd_mode( comptime self: Self, comptime pin: u4, comptime mode: PupdMode, ) void { const reg_name = comptime get_pin_reg_name("PUPDR", pin); const pupdr_value: u2 = switch (mode) { .floating => 0b00, .pull_up => 0b01, .pull_down => 0b10, }; self.regs.PUPDR.modifyByName(.{.{ reg_name, pupdr_value }}); } pub fn set_output_mode( comptime self: Self, comptime pin: u4, comptime mode: OutputMode, ) void { const reg_name = comptime get_pin_reg_name("OT", pin); const ot_value: u1 = switch (mode) { .push_pull => 0b0, .open_drain => 0b1, }; self.regs.OTYPER.modifyByName(.{.{ reg_name, ot_value }}); } pub fn set_output_speed( comptime self: Self, comptime pin: u4, comptime speed: Speed, ) void { const reg_name = comptime get_pin_reg_name("OSPEEDR", pin); const ospeedr_value: u2 = switch (speed) { .low => 0b00, .medium => 0b01, .high => 0b10, .very_high => 0b11, }; self.regs.OSPEEDR.modifyByName(.{.{ reg_name, ospeedr_value }}); } pub fn set_af_mode( comptime self: Self, comptime pin: u4, comptime af_mode: u4, ) void { if (pin < 8) { const reg_name = comptime get_pin_reg_name("AFRL", pin); self.regs.AFRL.modifyByName(.{.{ reg_name, af_mode }}); } else { const reg_name = comptime get_pin_reg_name("AFRH", pin); self.regs.AFRH.modifyByName(.{.{ reg_name, af_mode }}); } } pub fn read_input(comptime self: Self, comptime pin: u4) u1 { const reg_name = comptime get_pin_reg_name("IDR", pin); var reg = self.regs.IDR.read(); return @field(reg, reg_name); } pub fn read_output(comptime self: Self, comptime pin: u4) u1 { const reg_name = comptime get_pin_reg_name("ODR", pin); var reg = self.regs.ODR.read(); return @field(reg, reg_name); } fn get_pin_reg_name( comptime reg_base: []const u8, comptime pin: u4, ) *const [std.fmt.count("{s}{}", .{ reg_base, pin }):0]u8 { return std.fmt.comptimePrint("{s}{}", .{ reg_base, pin }); } }; }
src/gpio.zig
const std = @import("std"); usingnamespace @import("semaphore.zig"); pub const Lock = struct { const Self = @This(); inner_mutex: std.Mutex = std.Mutex{}, pub fn acquire(self: *Self) void { _ = self.inner_mutex.acquire(); } pub fn release(self: *Self) void { (std.Mutex.Held{ .mutex = &self.inner_mutex }).release(); } }; pub const ConditionVariable = struct { const Self = @This(); head: ?*Waiter = null, const Waiter = struct { prev: ?*Waiter, next: ?*Waiter, last: *Waiter, event: std.ResetEvent, }; pub fn wait(self: *Self, lock: *Lock) void { var waiter: Waiter = undefined; waiter.event = std.ResetEvent.init(); defer waiter.event.deinit(); self.push(&waiter); lock.release(); waiter.event.wait(); lock.acquire(); } pub fn timedWait(self: *Self, lock: *Lock, timeout: u64) error{TimedOut}!void { var waiter: Waiter = undefined; waiter.event = std.ResetEvent.init(); defer waiter.event.deinit(); self.push(&waiter); lock.release(); const timed_out = blk: { if (waiter.event.timedWait(timeout)) |_| { break :blk false; } else |_| { break :blk true; } }; lock.acquire(); self.remove(&waiter); if (timed_out) return error.TimedOut; } pub fn signal(self: *Self) void { if (self.pop()) |waiter| waiter.event.set(); } pub fn broadcast(self: *Self) void { while (self.pop()) |waiter| waiter.event.set(); } fn push(self: *Self, waiter: *Waiter) void { waiter.next = null; waiter.last = waiter; if (self.head) |head| { waiter.prev = head.last; head.last.next = waiter; head.last = waiter; } else { waiter.prev = null; self.head = waiter; } } fn pop(self: *Self) ?*Waiter { const waiter = self.head orelse return null; self.remove(waiter); return waiter; } fn remove(self: *Self, waiter: *Waiter) void { const head = self.head orelse return; if (waiter.prev) |prev| prev.next = waiter.next; if (waiter.next) |next| next.prev = waiter.prev; if (head == waiter) { self.head = waiter.next; if (self.head) |new_head| new_head.last = head.last; } else if (head.last == waiter) { head.last = waiter.prev.?; } waiter.prev = null; waiter.next = null; waiter.last = waiter; } }; test "C++'s condition_variable::notify_one" { // http://www.cplusplus.com/reference/condition_variable/condition_variable/notify_one/ const ThreadContext = struct { const Self = @This(); cargo: u32 = 0, cv_produce: ConditionVariable = ConditionVariable{}, cv_consume: ConditionVariable = ConditionVariable{}, fn consumer(self: *Self) void { var lock = Lock{}; while (0 == self.cargo) self.cv_consume.wait(&lock); std.debug.print("Thread {} => consuming => {}\n", .{std.Thread.getCurrentId(), self.cargo}); self.cargo = 0; self.cv_produce.signal(); } fn producer(self: *Self) void { var lock = Lock{}; while (0 != self.cargo) self.cv_produce.wait(&lock); self.cargo = std.Thread.getCurrentId(); self.cv_consume.signal(); } }; std.debug.print("\n\n", .{}); var thread_context = ThreadContext{}; const thread_count = 11; var consumers: [thread_count]*std.Thread = undefined; var producers: [thread_count]*std.Thread = undefined; for (consumers) |*cs| { cs.* = try std.Thread.spawn(&thread_context, ThreadContext.consumer); } for (producers) |*pd| { pd.* = try std.Thread.spawn(&thread_context, ThreadContext.producer); } for (consumers) |cs| cs.wait(); for (producers) |pd| pd.wait(); } test "C++'s condition_variable::notify_all" { // http://www.cplusplus.com/reference/condition_variable/condition_variable/notify_all/ const ThreadContext = struct { const Self = @This(); ready: bool = false, condition_variable: ConditionVariable = ConditionVariable{}, fn print_id(self: *Self) void { var lock = Lock{}; while (false == self.ready) self.condition_variable.wait(&lock); std.debug.print("Thread ID = {}\n", .{std.Thread.getCurrentId()}); } fn go(self: *Self) void { var lock = Lock{}; self.ready = true; self.condition_variable.broadcast(); } }; std.debug.print("\n\n", .{}); var thread_context = ThreadContext{}; const thread_count = 11; var threads: [thread_count]*std.Thread = undefined; for (threads) |*thread| { thread.* = try std.Thread.spawn(&thread_context, ThreadContext.print_id); } thread_context.go(); for (threads) |thread| thread.wait(); }
Mutlithreading/condition_variable.zig
const std = @import("std"); const SegmentedList = std.SegmentedList; const Token = std.c.Token; const Source = std.c.tokenizer.Source; pub const TokenIndex = usize; pub const Tree = struct { tokens: TokenList, sources: SourceList, root_node: *Node.Root, arena_allocator: std.heap.ArenaAllocator, msgs: MsgList, pub const SourceList = SegmentedList(Source, 4); pub const TokenList = Source.TokenList; pub const MsgList = SegmentedList(Msg, 0); pub fn deinit(self: *Tree) void { // Here we copy the arena allocator into stack memory, because // otherwise it would destroy itself while it was still working. var arena_allocator = self.arena_allocator; arena_allocator.deinit(); // self is destroyed } pub fn tokenSlice(tree: *Tree, token: TokenIndex) []const u8 { return tree.tokens.at(token).slice(); } pub fn tokenEql(tree: *Tree, a: TokenIndex, b: TokenIndex) bool { const atok = tree.tokens.at(a); const btok = tree.tokens.at(b); return atok.eql(btok.*); } }; pub const Msg = struct { kind: enum { Error, Warning, Note, }, inner: Error, }; pub const Error = union(enum) { InvalidToken: SingleTokenError("invalid token '{}'"), ExpectedToken: ExpectedToken, ExpectedExpr: SingleTokenError("expected expression, found '{}'"), ExpectedTypeName: SingleTokenError("expected type name, found '{}'"), ExpectedFnBody: SingleTokenError("expected function body, found '{}'"), ExpectedDeclarator: SingleTokenError("expected declarator, found '{}'"), ExpectedInitializer: SingleTokenError("expected initializer, found '{}'"), ExpectedEnumField: SingleTokenError("expected enum field, found '{}'"), ExpectedType: SingleTokenError("expected enum field, found '{}'"), InvalidTypeSpecifier: InvalidTypeSpecifier, InvalidStorageClass: SingleTokenError("invalid storage class, found '{}'"), InvalidDeclarator: SimpleError("invalid declarator"), DuplicateQualifier: SingleTokenError("duplicate type qualifier '{}'"), DuplicateSpecifier: SingleTokenError("duplicate declaration specifier '{}'"), MustUseKwToRefer: MustUseKwToRefer, FnSpecOnNonFn: SingleTokenError("function specifier '{}' on non function"), NothingDeclared: SimpleError("declaration doesn't declare anything"), QualifierIgnored: SingleTokenError("qualifier '{}' ignored"), pub fn render(self: *const Error, tree: *Tree, stream: anytype) !void { switch (self.*) { .InvalidToken => |*x| return x.render(tree, stream), .ExpectedToken => |*x| return x.render(tree, stream), .ExpectedExpr => |*x| return x.render(tree, stream), .ExpectedTypeName => |*x| return x.render(tree, stream), .ExpectedDeclarator => |*x| return x.render(tree, stream), .ExpectedFnBody => |*x| return x.render(tree, stream), .ExpectedInitializer => |*x| return x.render(tree, stream), .ExpectedEnumField => |*x| return x.render(tree, stream), .ExpectedType => |*x| return x.render(tree, stream), .InvalidTypeSpecifier => |*x| return x.render(tree, stream), .InvalidStorageClass => |*x| return x.render(tree, stream), .InvalidDeclarator => |*x| return x.render(tree, stream), .DuplicateQualifier => |*x| return x.render(tree, stream), .DuplicateSpecifier => |*x| return x.render(tree, stream), .MustUseKwToRefer => |*x| return x.render(tree, stream), .FnSpecOnNonFn => |*x| return x.render(tree, stream), .NothingDeclared => |*x| return x.render(tree, stream), .QualifierIgnored => |*x| return x.render(tree, stream), } } pub fn loc(self: *const Error) TokenIndex { switch (self.*) { .InvalidToken => |x| return x.token, .ExpectedToken => |x| return x.token, .ExpectedExpr => |x| return x.token, .ExpectedTypeName => |x| return x.token, .ExpectedDeclarator => |x| return x.token, .ExpectedFnBody => |x| return x.token, .ExpectedInitializer => |x| return x.token, .ExpectedEnumField => |x| return x.token, .ExpectedType => |*x| return x.token, .InvalidTypeSpecifier => |x| return x.token, .InvalidStorageClass => |x| return x.token, .InvalidDeclarator => |x| return x.token, .DuplicateQualifier => |x| return x.token, .DuplicateSpecifier => |x| return x.token, .MustUseKwToRefer => |*x| return x.name, .FnSpecOnNonFn => |*x| return x.name, .NothingDeclared => |*x| return x.name, .QualifierIgnored => |*x| return x.name, } } pub const ExpectedToken = struct { token: TokenIndex, expected_id: @TagType(Token.Id), pub fn render(self: *const ExpectedToken, tree: *Tree, stream: anytype) !void { const found_token = tree.tokens.at(self.token); if (found_token.id == .Invalid) { return stream.print("expected '{}', found invalid bytes", .{self.expected_id.symbol()}); } else { const token_name = found_token.id.symbol(); return stream.print("expected '{}', found '{}'", .{ self.expected_id.symbol(), token_name }); } } }; pub const InvalidTypeSpecifier = struct { token: TokenIndex, type_spec: *Node.TypeSpec, pub fn render(self: *const ExpectedToken, tree: *Tree, stream: anytype) !void { try stream.write("invalid type specifier '"); try type_spec.spec.print(tree, stream); const token_name = tree.tokens.at(self.token).id.symbol(); return stream.print("{}'", .{token_name}); } }; pub const MustUseKwToRefer = struct { kw: TokenIndex, name: TokenIndex, pub fn render(self: *const ExpectedToken, tree: *Tree, stream: anytype) !void { return stream.print("must use '{}' tag to refer to type '{}'", .{ tree.slice(kw), tree.slice(name) }); } }; fn SingleTokenError(comptime msg: []const u8) type { return struct { token: TokenIndex, pub fn render(self: *const @This(), tree: *Tree, stream: anytype) !void { const actual_token = tree.tokens.at(self.token); return stream.print(msg, .{actual_token.id.symbol()}); } }; } fn SimpleError(comptime msg: []const u8) type { return struct { const ThisError = @This(); token: TokenIndex, pub fn render(self: *const ThisError, tokens: *Tree.TokenList, stream: anytype) !void { return stream.write(msg); } }; } }; pub const Type = struct { pub const TypeList = std.SegmentedList(*Type, 4); @"const": bool = false, atomic: bool = false, @"volatile": bool = false, restrict: bool = false, id: union(enum) { Int: struct { id: Id, is_signed: bool, pub const Id = enum { Char, Short, Int, Long, LongLong, }; }, Float: struct { id: Id, pub const Id = enum { Float, Double, LongDouble, }; }, Pointer: *Type, Function: struct { return_type: *Type, param_types: TypeList, }, Typedef: *Type, Record: *Node.RecordType, Enum: *Node.EnumType, /// Special case for macro parameters that can be any type. /// Only present if `retain_macros == true`. Macro, }, }; pub const Node = struct { id: Id, pub const Id = enum { Root, EnumField, RecordField, RecordDeclarator, JumpStmt, ExprStmt, LabeledStmt, CompoundStmt, IfStmt, SwitchStmt, WhileStmt, DoStmt, ForStmt, StaticAssert, Declarator, Pointer, FnDecl, Typedef, VarDecl, }; pub const Root = struct { base: Node = Node{ .id = .Root }, decls: DeclList, eof: TokenIndex, pub const DeclList = SegmentedList(*Node, 4); }; pub const DeclSpec = struct { storage_class: union(enum) { Auto: TokenIndex, Extern: TokenIndex, Register: TokenIndex, Static: TokenIndex, Typedef: TokenIndex, None, } = .None, thread_local: ?TokenIndex = null, type_spec: TypeSpec = TypeSpec{}, fn_spec: union(enum) { Inline: TokenIndex, Noreturn: TokenIndex, None, } = .None, align_spec: ?struct { alignas: TokenIndex, expr: *Node, rparen: TokenIndex, } = null, }; pub const TypeSpec = struct { qual: TypeQual = TypeQual{}, spec: union(enum) { /// error or default to int None, Void: TokenIndex, Char: struct { sign: ?TokenIndex = null, char: TokenIndex, }, Short: struct { sign: ?TokenIndex = null, short: TokenIndex = null, int: ?TokenIndex = null, }, Int: struct { sign: ?TokenIndex = null, int: ?TokenIndex = null, }, Long: struct { sign: ?TokenIndex = null, long: TokenIndex, longlong: ?TokenIndex = null, int: ?TokenIndex = null, }, Float: struct { float: TokenIndex, complex: ?TokenIndex = null, }, Double: struct { long: ?TokenIndex = null, double: ?TokenIndex, complex: ?TokenIndex = null, }, Bool: TokenIndex, Atomic: struct { atomic: TokenIndex, typename: *Node, rparen: TokenIndex, }, Enum: *EnumType, Record: *RecordType, Typedef: struct { sym: TokenIndex, sym_type: *Type, }, pub fn print(self: *@This(), self: *const @This(), tree: *Tree, stream: anytype) !void { switch (self.spec) { .None => unreachable, .Void => |index| try stream.write(tree.slice(index)), .Char => |char| { if (char.sign) |s| { try stream.write(tree.slice(s)); try stream.writeByte(' '); } try stream.write(tree.slice(char.char)); }, .Short => |short| { if (short.sign) |s| { try stream.write(tree.slice(s)); try stream.writeByte(' '); } try stream.write(tree.slice(short.short)); if (short.int) |i| { try stream.writeByte(' '); try stream.write(tree.slice(i)); } }, .Int => |int| { if (int.sign) |s| { try stream.write(tree.slice(s)); try stream.writeByte(' '); } if (int.int) |i| { try stream.writeByte(' '); try stream.write(tree.slice(i)); } }, .Long => |long| { if (long.sign) |s| { try stream.write(tree.slice(s)); try stream.writeByte(' '); } try stream.write(tree.slice(long.long)); if (long.longlong) |l| { try stream.writeByte(' '); try stream.write(tree.slice(l)); } if (long.int) |i| { try stream.writeByte(' '); try stream.write(tree.slice(i)); } }, .Float => |float| { try stream.write(tree.slice(float.float)); if (float.complex) |c| { try stream.writeByte(' '); try stream.write(tree.slice(c)); } }, .Double => |double| { if (double.long) |l| { try stream.write(tree.slice(l)); try stream.writeByte(' '); } try stream.write(tree.slice(double.double)); if (double.complex) |c| { try stream.writeByte(' '); try stream.write(tree.slice(c)); } }, .Bool => |index| try stream.write(tree.slice(index)), .Typedef => |typedef| try stream.write(tree.slice(typedef.sym)), else => try stream.print("TODO print {}", self.spec), } } } = .None, }; pub const EnumType = struct { tok: TokenIndex, name: ?TokenIndex, body: ?struct { lbrace: TokenIndex, /// always EnumField fields: FieldList, rbrace: TokenIndex, }, pub const FieldList = Root.DeclList; }; pub const EnumField = struct { base: Node = Node{ .id = .EnumField }, name: TokenIndex, value: ?*Node, }; pub const RecordType = struct { tok: TokenIndex, kind: enum { Struct, Union, }, name: ?TokenIndex, body: ?struct { lbrace: TokenIndex, /// RecordField or StaticAssert fields: FieldList, rbrace: TokenIndex, }, pub const FieldList = Root.DeclList; }; pub const RecordField = struct { base: Node = Node{ .id = .RecordField }, type_spec: TypeSpec, declarators: DeclaratorList, semicolon: TokenIndex, pub const DeclaratorList = Root.DeclList; }; pub const RecordDeclarator = struct { base: Node = Node{ .id = .RecordDeclarator }, declarator: ?*Declarator, bit_field_expr: ?*Expr, }; pub const TypeQual = struct { @"const": ?TokenIndex = null, atomic: ?TokenIndex = null, @"volatile": ?TokenIndex = null, restrict: ?TokenIndex = null, }; pub const JumpStmt = struct { base: Node = Node{ .id = .JumpStmt }, ltoken: TokenIndex, kind: union(enum) { Break, Continue, Return: ?*Node, Goto: TokenIndex, }, semicolon: TokenIndex, }; pub const ExprStmt = struct { base: Node = Node{ .id = .ExprStmt }, expr: ?*Expr, semicolon: TokenIndex, }; pub const LabeledStmt = struct { base: Node = Node{ .id = .LabeledStmt }, kind: union(enum) { Label: TokenIndex, Case: TokenIndex, Default: TokenIndex, }, stmt: *Node, }; pub const CompoundStmt = struct { base: Node = Node{ .id = .CompoundStmt }, lbrace: TokenIndex, statements: StmtList, rbrace: TokenIndex, pub const StmtList = Root.DeclList; }; pub const IfStmt = struct { base: Node = Node{ .id = .IfStmt }, @"if": TokenIndex, cond: *Node, body: *Node, @"else": ?struct { tok: TokenIndex, body: *Node, }, }; pub const SwitchStmt = struct { base: Node = Node{ .id = .SwitchStmt }, @"switch": TokenIndex, expr: *Expr, rparen: TokenIndex, stmt: *Node, }; pub const WhileStmt = struct { base: Node = Node{ .id = .WhileStmt }, @"while": TokenIndex, cond: *Expr, rparen: TokenIndex, body: *Node, }; pub const DoStmt = struct { base: Node = Node{ .id = .DoStmt }, do: TokenIndex, body: *Node, @"while": TokenIndex, cond: *Expr, semicolon: TokenIndex, }; pub const ForStmt = struct { base: Node = Node{ .id = .ForStmt }, @"for": TokenIndex, init: ?*Node, cond: ?*Expr, semicolon: TokenIndex, incr: ?*Expr, rparen: TokenIndex, body: *Node, }; pub const StaticAssert = struct { base: Node = Node{ .id = .StaticAssert }, assert: TokenIndex, expr: *Node, semicolon: TokenIndex, }; pub const Declarator = struct { base: Node = Node{ .id = .Declarator }, pointer: ?*Pointer, prefix: union(enum) { None, Identifer: TokenIndex, Complex: struct { lparen: TokenIndex, inner: *Node, rparen: TokenIndex, }, }, suffix: union(enum) { None, Fn: struct { lparen: TokenIndex, params: Params, rparen: TokenIndex, }, Array: Arrays, }, pub const Arrays = std.SegmentedList(*Array, 2); pub const Params = std.SegmentedList(*Param, 4); }; pub const Array = struct { lbracket: TokenIndex, inner: union(enum) { Inferred, Unspecified: TokenIndex, Variable: struct { asterisk: ?TokenIndex, static: ?TokenIndex, qual: TypeQual, expr: *Expr, }, }, rbracket: TokenIndex, }; pub const Pointer = struct { base: Node = Node{ .id = .Pointer }, asterisk: TokenIndex, qual: TypeQual, pointer: ?*Pointer, }; pub const Param = struct { kind: union(enum) { Variable, Old: TokenIndex, Normal: struct { decl_spec: *DeclSpec, declarator: *Node, }, }, }; pub const FnDecl = struct { base: Node = Node{ .id = .FnDecl }, decl_spec: DeclSpec, declarator: *Declarator, old_decls: OldDeclList, body: ?*CompoundStmt, pub const OldDeclList = SegmentedList(*Node, 0); }; pub const Typedef = struct { base: Node = Node{ .id = .Typedef }, decl_spec: DeclSpec, declarators: DeclaratorList, semicolon: TokenIndex, pub const DeclaratorList = Root.DeclList; }; pub const VarDecl = struct { base: Node = Node{ .id = .VarDecl }, decl_spec: DeclSpec, initializers: Initializers, semicolon: TokenIndex, pub const Initializers = Root.DeclList; }; pub const Initialized = struct { base: Node = Node{ .id = Initialized }, declarator: *Declarator, eq: TokenIndex, init: Initializer, }; pub const Initializer = union(enum) { list: struct { initializers: InitializerList, rbrace: TokenIndex, }, expr: *Expr, pub const InitializerList = std.SegmentedList(*Initializer, 4); }; pub const Macro = struct { base: Node = Node{ .id = Macro }, kind: union(enum) { Undef: []const u8, Fn: struct { params: []const []const u8, expr: *Expr, }, Expr: *Expr, }, }; }; pub const Expr = struct { id: Id, ty: *Type, value: union(enum) { None, }, pub const Id = enum { Infix, Literal, }; pub const Infix = struct { base: Expr = Expr{ .id = .Infix }, lhs: *Expr, op_token: TokenIndex, op: Op, rhs: *Expr, pub const Op = enum {}; }; };
lib/std/c/ast.zig
const cli = @import("flags.zig"); const std = @import("std"); const Args = cli.Args; const Cli = cli.Cli; const Command = cli.Command; const Context = cli.Context; const Flag = cli.Flag; const FlagItem = cli.FlagSet.FlagItem; const testing = std.testing; const warn = std.debug.warn; test "command" { var a = std.debug.global_allocator; const app = Cli{ .name = "hoodie", .flags = null, .commands = [_]Command{ Command{ .name = "fmt", .flags = [_]Flag{Flag{ .name = "f", .desc = null, .kind = .Bool, }}, .action = nothing, .sub_commands = null, }, Command{ .name = "outline", .flags = [_]Flag{Flag{ .name = "modified", .desc = null, .kind = .Bool, }}, .action = nothing, .sub_commands = null, }, }, .action = nothing, }; // check for correct commands const TestCase = struct { src: []const []const u8, command: ?[]const u8, mode: Context.Mode, flags: ?[]const FlagItem, }; const cases = [_]TestCase{ TestCase{ .src = [_][]const u8{}, .command = null, .mode = .Global, .flags = null, }, TestCase{ .src = [_][]const u8{"fmt"}, .command = "fmt", .mode = .Local, .flags = null, }, TestCase{ .src = [_][]const u8{"outline"}, .command = "outline", .mode = .Local, .flags = null, }, TestCase{ .src = [_][]const u8{ "outline", "some", "args" }, .command = "outline", .mode = .Local, .flags = null, }, TestCase{ .src = [_][]const u8{ "outline", "--modified", "args" }, .command = "outline", .mode = .Local, .flags = [_]FlagItem{FlagItem{ .flag = Flag{ .name = "modified", .desc = null, .kind = .Bool, }, .index = 1, }}, }, }; for (cases) |ts| { var args = &try Args.initList(a, ts.src); var ctx = &try app.parse(a, args); testing.expectEqual(ts.mode, ctx.mode); if (ts.command) |cmd| { testing.expectEqual(ctx.command.?.name, cmd); } if (ts.flags) |flags| { switch (ctx.mode) { .Local => { for (flags) |flag, idx| { const got = ctx.local_flags.list.at(idx); testing.expectEqual(flag, got); } }, .Global => {}, else => unreachable, } } args.deinit(); } } fn nothing( ctx: *const Context, ) anyerror!void {}
src/flags/cli_test.zig
const std = @import("std"); const reg = @import("registry.zig"); const xml = @import("../xml.zig"); const renderRegistry = @import("render.zig").render; const parseXml = @import("parse.zig").parseXml; const IdRenderer = @import("../id_render.zig").IdRenderer; const mem = std.mem; const Allocator = mem.Allocator; const FeatureLevel = reg.FeatureLevel; const EnumFieldMerger = struct { const EnumExtensionMap = std.StringArrayHashMap(std.ArrayListUnmanaged(reg.Enum.Field)); const FieldSet = std.StringArrayHashMap(void); gpa: *Allocator, reg_arena: *Allocator, registry: *reg.Registry, enum_extensions: EnumExtensionMap, field_set: FieldSet, fn init(gpa: *Allocator, reg_arena: *Allocator, registry: *reg.Registry) EnumFieldMerger { return .{ .gpa = gpa, .reg_arena = reg_arena, .registry = registry, .enum_extensions = EnumExtensionMap.init(gpa), .field_set = FieldSet.init(gpa), }; } fn deinit(self: *EnumFieldMerger) void { for (self.enum_extensions.items()) |*entry| { entry.value.deinit(self.gpa); } self.field_set.deinit(); self.enum_extensions.deinit(); } fn putEnumExtension(self: *EnumFieldMerger, enum_name: []const u8, field: reg.Enum.Field) !void { const res = try self.enum_extensions.getOrPut(enum_name); if (!res.found_existing) { res.entry.value = std.ArrayListUnmanaged(reg.Enum.Field){}; } try res.entry.value.append(self.gpa, field); } fn addRequires(self: *EnumFieldMerger, reqs: []const reg.Require) !void { for (reqs) |req| { for (req.extends) |enum_ext| { try self.putEnumExtension(enum_ext.extends, enum_ext.field); } } } fn mergeEnumFields(self: *EnumFieldMerger, name: []const u8, base_enum: *reg.Enum) !void { // If there are no extensions for this enum, assume its valid. const extensions = self.enum_extensions.get(name) orelse return; self.field_set.clearRetainingCapacity(); const n_fields_upper_bound = base_enum.fields.len + extensions.items.len; const new_fields = try self.reg_arena.alloc(reg.Enum.Field, n_fields_upper_bound); var i: usize = 0; for (base_enum.fields) |field| { const res = try self.field_set.getOrPut(field.name); if (!res.found_existing) { new_fields[i] = field; i += 1; } } // Assume that if a field name clobbers, the value is the same for (extensions.items) |field| { const res = try self.field_set.getOrPut(field.name); if (!res.found_existing) { new_fields[i] = field; i += 1; } } // Existing base_enum.fields was allocatued by `self.reg_arena`, so // it gets cleaned up whenever that is deinited. base_enum.fields = self.reg_arena.shrink(new_fields, i); } fn merge(self: *EnumFieldMerger) !void { for (self.registry.features) |feature| { try self.addRequires(feature.requires); } for (self.registry.extensions) |ext| { try self.addRequires(ext.requires); } // Merge all the enum fields. // Assume that all keys of enum_extensions appear in `self.registry.decls` for (self.registry.decls) |*decl| { if (decl.decl_type == .enumeration) { try self.mergeEnumFields(decl.name, &decl.decl_type.enumeration); } } } }; const TagFixerUpper = struct { allocator: *Allocator, registry: *reg.Registry, names: std.StringHashMap(void), id_renderer: *const IdRenderer, fn init(allocator: *Allocator, registry: *reg.Registry, id_renderer: *const IdRenderer) TagFixerUpper { return .{ .allocator = allocator, .registry = registry, .names = std.StringHashMap(void).init(allocator), .id_renderer = id_renderer, }; } fn deinit(self: *TagFixerUpper) void { self.names.deinit(); } fn insertName(self: *TagFixerUpper, name: []const u8) !void { const tagless = self.id_renderer.stripAuthorTag(name); const result = try self.names.getOrPut(name); if (result.found_existing) { return error.DuplicateDefinition; } } fn extractNames(self: *TagFixerUpper) !void { for (self.registry.decls) |decl| { try self.insertName(decl.name); switch (decl.decl_type) { .enumeration => |enumeration| { for (enumeration.fields) |field| { try self.insertName(field.name); } }, else => {}, } } } fn fixAlias(self: *TagFixerUpper, name: *[]const u8) !void { if (self.names.contains(name.*)) { // The alias exists, everything is fine return; } // The alias does not exist, check if the tagless version exists const tagless = self.id_renderer.stripAuthorTag(name.*); if (self.names.contains(tagless)) { // Fix up the name to the tagless version name.* = tagless; return; } // Neither original nor tagless version exists return error.InvalidRegistry; } fn fixCommand(self: *TagFixerUpper, command: *reg.Command) !void { for (command.params) |*param| { try self.fixTypeInfo(&param.param_type); } try self.fixTypeInfo(command.return_type); for (command.success_codes) |*code| { try self.fixAlias(code); } for (command.error_codes) |*code| { try self.fixAlias(code); } } fn fixTypeInfo(self: *TagFixerUpper, type_info: *reg.TypeInfo) error{InvalidRegistry}!void { switch (type_info.*) { .name => |*name| try self.fixAlias(name), .command_ptr => |*command| try self.fixCommand(command), .pointer => |ptr| try self.fixTypeInfo(ptr.child), .array => |arr| try self.fixTypeInfo(arr.child), } } fn fixNames(self: *TagFixerUpper) !void { for (self.registry.decls) |*decl| { switch (decl.decl_type) { .container => |*container| { for (container.fields) |*field| { try self.fixTypeInfo(&field.field_type); } }, .enumeration => |*enumeration| { for (enumeration.fields) |*field| { if (field.value == .alias) { try self.fixAlias(&field.value.alias.name); } } }, .bitmask => |*bitmask| { if (bitmask.bits_enum) |*bits| { try self.fixAlias(bits); } }, .command => |*command| try self.fixCommand(command), .alias => |*alias| try self.fixAlias(&alias.name), .typedef => |*type_info| try self.fixTypeInfo(type_info), else => {}, } } } fn fixup(self: *TagFixerUpper) !void { // Extract all non-aliases try self.extractNames(); // Fix aliases try self.fixNames(); } }; pub const Generator = struct { gpa: *Allocator, reg_arena: std.heap.ArenaAllocator, registry: reg.Registry, id_renderer: IdRenderer, fn init(allocator: *Allocator, spec: *xml.Element) !Generator { const result = try parseXml(allocator, spec); const tags = try allocator.alloc([]const u8, result.registry.tags.len); for (tags) |*tag, i| tag.* = result.registry.tags[i].name; return Generator{ .gpa = allocator, .reg_arena = result.arena, .registry = result.registry, .id_renderer = IdRenderer.init(allocator, tags), }; } fn deinit(self: Generator) void { self.gpa.free(self.id_renderer.tags); self.reg_arena.deinit(); } fn removePromotedExtensions(self: *Generator) void { var write_index: usize = 0; for (self.registry.extensions) |ext| { if (ext.promoted_to == .none) { self.registry.extensions[write_index] = ext; write_index += 1; } } self.registry.extensions.len = write_index; } fn stripFlagBits(self: Generator, name: []const u8) []const u8 { const tagless = self.id_renderer.stripAuthorTag(name); return tagless[0 .. tagless.len - "FlagBits".len]; } fn stripFlags(self: Generator, name: []const u8) []const u8 { const tagless = self.id_renderer.stripAuthorTag(name); return tagless[0 .. tagless.len - "Flags64".len]; } fn fixupBitmasks(self: *Generator) !void { var bits = std.StringHashMap([]const u8).init(self.gpa); defer bits.deinit(); for (self.registry.decls) |decl| { if (decl.decl_type == .enumeration and decl.decl_type.enumeration.is_bitmask) { try bits.put(self.stripFlagBits(decl.name), decl.name); } } for (self.registry.decls) |*decl| { switch (decl.decl_type) { .bitmask => |*bitmask| { const base_name = self.stripFlags(decl.name); if (bitmask.bits_enum) |bits_enum| { if (bits.get(base_name) == null) { bitmask.bits_enum = null; } } else if (bits.get(base_name)) |bits_enum| { bitmask.bits_enum = bits_enum; } }, else => {}, } } } // Solve `registry.declarations` according to `registry.extensions` and `registry.features`. fn mergeEnumFields(self: *Generator) !void { var merger = EnumFieldMerger.init(self.gpa, &self.reg_arena.allocator, &self.registry); defer merger.deinit(); try merger.merge(); } fn fixupTags(self: *Generator) !void { var fixer_upper = TagFixerUpper.init(self.gpa, &self.registry, &self.id_renderer); defer fixer_upper.deinit(); try fixer_upper.fixup(); } fn render(self: *Generator, writer: anytype) !void { try renderRegistry(writer, &self.reg_arena.allocator, &self.registry, &self.id_renderer); } }; /// Main function for generating the OpenXR bindings. xr.xml is to be provided via `spec_xml`, /// and the resulting binding is written to `writer`. `allocator` will be used to allocate temporary /// internal datastructures - mostly via an ArenaAllocator, but sometimes a hashmap uses this allocator /// directly. pub fn generate(allocator: *Allocator, spec_xml: []const u8, writer: anytype) !void { const spec = try xml.parse(allocator, spec_xml); defer spec.deinit(); var gen = try Generator.init(allocator, spec.root); defer gen.deinit(); gen.removePromotedExtensions(); try gen.mergeEnumFields(); try gen.fixupBitmasks(); try gen.fixupTags(); try gen.render(writer); }
generator/openxr/generator.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqualStrings = std.testing.expectEqualStrings; const mem = std.mem; const builtin = @import("builtin"); fn emptyFn() void {} const addr1 = @ptrCast(*const u8, emptyFn); test "comptime cast fn to ptr" { const addr2 = @ptrCast(*const u8, emptyFn); comptime try expect(addr1 == addr2); } test "equality compare fn ptrs" { var a = emptyFn; try expect(a == a); } test "string escapes" { try expectEqualStrings("\"", "\x22"); try expectEqualStrings("\'", "\x27"); try expectEqualStrings("\n", "\x0a"); try expectEqualStrings("\r", "\x0d"); try expectEqualStrings("\t", "\x09"); try expectEqualStrings("\\", "\x5c"); try expectEqualStrings("\u{1234}\u{069}\u{1}", "\xe1\x88\xb4\x69\x01"); } test "explicit cast optional pointers" { const a: ?*i32 = undefined; const b: ?*f32 = @ptrCast(?*f32, a); _ = b; } test "pointer comparison" { const a = @as([]const u8, "a"); const b = &a; try expect(ptrEql(b, b)); } fn ptrEql(a: *const []const u8, b: *const []const u8) bool { return a == b; } test "string concatenation" { const a = "OK" ++ " IT " ++ "WORKED"; const b = "OK IT WORKED"; comptime try expect(@TypeOf(a) == *const [12:0]u8); comptime try expect(@TypeOf(b) == *const [12:0]u8); const len = mem.len(b); const len_with_null = len + 1; { var i: u32 = 0; while (i < len_with_null) : (i += 1) { try expect(a[i] == b[i]); } } try expect(a[len] == 0); try expect(b[len] == 0); } // can't really run this test but we can make sure it has no compile error // and generates code const vram = @intToPtr([*]volatile u8, 0x20000000)[0..0x8000]; export fn writeToVRam() void { vram[0] = 'X'; } const PackedStruct = packed struct { a: u8, b: u8, }; const PackedUnion = packed union { a: u8, b: u32, }; test "packed struct, enum, union parameters in extern function" { testPackedStuff(&(PackedStruct{ .a = 1, .b = 2, }), &(PackedUnion{ .a = 1 })); } export fn testPackedStuff(a: *const PackedStruct, b: *const PackedUnion) void { if (false) { a; b; } } test "thread local variable" { const S = struct { threadlocal var t: i32 = 1234; }; S.t += 1; try expect(S.t == 1235); } fn maybe(x: bool) anyerror!?u32 { return switch (x) { true => @as(u32, 42), else => null, }; } test "result location is optional inside error union" { const x = maybe(true) catch unreachable; try expect(x.? == 42); } threadlocal var buffer: [11]u8 = undefined; test "pointer to thread local array" { const s = "Hello world"; std.mem.copy(u8, buffer[0..], s); try std.testing.expectEqualSlices(u8, buffer[0..], s); } test "auto created variables have correct alignment" { const S = struct { fn foo(str: [*]const u8) u32 { for (@ptrCast([*]align(1) const u32, str)[0..1]) |v| { return v; } return 0; } }; try expect(S.foo("\x7a\x7a\x7a\x7a") == 0x7a7a7a7a); comptime try expect(S.foo("\x7a\x7a\x7a\x7a") == 0x7a7a7a7a); } extern var opaque_extern_var: opaque {}; var var_to_export: u32 = 42; test "extern variable with non-pointer opaque type" { @export(var_to_export, .{ .name = "opaque_extern_var" }); try expect(@ptrCast(*align(1) u32, &opaque_extern_var).* == 42); } test "lazy typeInfo value as generic parameter" { const S = struct { fn foo(args: anytype) void { _ = args; } }; S.foo(@typeInfo(@TypeOf(.{}))); } test "variable name containing underscores does not shadow int primitive" { const _u0 = 0; const i_8 = 0; const u16_ = 0; const i3_2 = 0; const u6__4 = 0; const i2_04_8 = 0; _ = _u0; _ = i_8; _ = u16_; _ = i3_2; _ = u6__4; _ = i2_04_8; }
test/behavior/misc.zig
const std = @import("std"); const zort = @import("main.zig"); const testing = std.testing; pub const ItemsType = i32; pub const items = [_]i32{ -9, 1, -4, 12, 3, 4 }; pub const expectedASC = [_]i32{ -9, -4, 1, 3, 4, 12 }; pub const expectedDESC = [_]i32{ 12, 4, 3, 1, -4, -9 }; fn asc(a: i32, b: i32) bool { return a < b; } fn desc(a: i32, b: i32) bool { return a > b; } test "bubble" { { var arr = items; zort.bubbleSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.bubbleSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "comb" { { var arr = items; zort.combSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.combSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "heap" { { var arr = items; zort.heapSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.heapSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "insertion" { { var arr = items; zort.insertionSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.insertionSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "merge" { { var arr = items; try zort.mergeSort(ItemsType, testing.allocator, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; try zort.mergeSort(ItemsType, testing.allocator, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "quick" { { var arr = items; zort.quickSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.quickSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "radix" { return error.SkipZigTest; // { // var arr = items; // try zort.radixSort(ItemsType, &arr, testing.allocator); // try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); // } } test "selection" { { var arr = items; zort.selectionSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.selectionSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "shell" { { var arr = items; zort.shellSort(ItemsType, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; zort.shellSort(ItemsType, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "tim" { { var arr = items; try zort.timSort(ItemsType, testing.allocator, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; try zort.timSort(ItemsType, testing.allocator, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "tail" { { var arr = items; try zort.tailSort(ItemsType, testing.allocator, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; try zort.tailSort(ItemsType, testing.allocator, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } } test "twin" { { var arr = items; try zort.twinSort(ItemsType, testing.allocator, &arr, asc); try testing.expectEqualSlices(ItemsType, &arr, &expectedASC); } { var arr = items; try zort.twinSort(ItemsType, testing.allocator, &arr, desc); try testing.expectEqualSlices(ItemsType, &arr, &expectedDESC); } }
src/test.zig
const std = @import("std"); const gemini = @import("gemtext.zig"); const c = @cImport({ @cInclude("gemtext.h"); }); const allocator = if (@import("builtin").is_test) std.testing.allocator else std.heap.c_allocator; const Error = error{ OutOfMemory, }; fn errorToC(err: Error) c.gemtext_error { return switch (err) { error.OutOfMemory => return c.GEMTEXT_ERR_OUT_OF_MEMORY, }; } fn getFragments(document: *c.gemtext_document) []c.gemtext_fragment { var result: []c.gemtext_fragment = undefined; if (document.fragment_count > 0) { // we can safely remove `const` here as we've allocated this memory ourselves and // know that it's mutable! result = @intToPtr([*]c.gemtext_fragment, @ptrToInt(document.fragments))[0..document.fragment_count]; } else { result = std.mem.zeroes([]c.gemtext_fragment); } return result; } fn setFragments(document: *c.gemtext_document, slice: []c.gemtext_fragment) void { document.fragment_count = slice.len; document.fragments = slice.ptr; } fn dupeString(src: [*:0]const u8) ![*:0]u8 { return (try allocator.dupeZ(u8, std.mem.span(src))).ptr; } fn freeString(src: [*:0]const u8) void { allocator.free(std.mem.spanZ(@intToPtr([*:0]u8, @ptrToInt(src)))); } fn dupeLines(src_lines: c.gemtext_lines) !c.gemtext_lines { const lines = try allocator.alloc([*c]const u8, src_lines.count); errdefer allocator.free(lines); var offset: usize = 0; errdefer for (lines[0..offset]) |line| allocator.free(std.mem.spanZ(line)); while (offset < lines.len) : (offset += 1) { lines[offset] = (try allocator.dupeZ(u8, std.mem.spanZ(src_lines.lines[offset]))).ptr; } return c.gemtext_lines{ .count = lines.len, .lines = lines.ptr, }; } fn duplicateFragment(src: c.gemtext_fragment) !c.gemtext_fragment { return switch (src.type) { c.GEMTEXT_FRAGMENT_EMPTY => return src, c.GEMTEXT_FRAGMENT_PARAGRAPH => c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PARAGRAPH, .unnamed_0 = .{ .paragraph = try dupeString(src.unnamed_0.paragraph), }, }, c.GEMTEXT_FRAGMENT_PREFORMATTED => blk: { var container = c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PREFORMATTED, .unnamed_0 = .{ .preformatted = .{ .lines = undefined, .alt_text = undefined, }, }, }; container.unnamed_0.preformatted.lines = try dupeLines(src.unnamed_0.preformatted.lines); errdefer destroyLines(&container.unnamed_0.preformatted.lines); container.unnamed_0.preformatted.alt_text = if (src.unnamed_0.preformatted.alt_text) |alt_text| try dupeString(alt_text) else null; break :blk container; }, c.GEMTEXT_FRAGMENT_QUOTE => c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_QUOTE, .unnamed_0 = .{ .quote = try dupeLines(src.unnamed_0.quote), }, }, c.GEMTEXT_FRAGMENT_LINK => blk: { var container = c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_LINK, .unnamed_0 = .{ .link = .{ .href = undefined, .title = undefined, }, }, }; container.unnamed_0.link.href = try dupeString(src.unnamed_0.link.href); errdefer freeString(container.unnamed_0.link.href); container.unnamed_0.link.title = if (src.unnamed_0.link.title) |title| try dupeString(title) else null; break :blk container; }, c.GEMTEXT_FRAGMENT_LIST => c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_LIST, .unnamed_0 = .{ .list = try dupeLines(src.unnamed_0.list), }, }, c.GEMTEXT_FRAGMENT_HEADING => c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_HEADING, .unnamed_0 = .{ .heading = .{ .level = src.unnamed_0.heading.level, .text = try dupeString(src.unnamed_0.paragraph), }, }, }, else => @panic("Passed an invalid fragment to gemtext!"), }; } fn destroyLines(src_lines: *c.gemtext_lines) void { if (src_lines.count > 0) { const lines = src_lines.lines[0..src_lines.count]; for (lines) |line| { allocator.free(std.mem.spanZ(line)); } allocator.free(lines); } } fn destroyFragment(fragment: *c.gemtext_fragment) void { switch (fragment.type) { c.GEMTEXT_FRAGMENT_EMPTY => {}, c.GEMTEXT_FRAGMENT_PARAGRAPH => freeString(fragment.unnamed_0.paragraph), c.GEMTEXT_FRAGMENT_PREFORMATTED => { if (fragment.unnamed_0.preformatted.alt_text) |alt| freeString(alt); destroyLines(&fragment.unnamed_0.preformatted.lines); }, c.GEMTEXT_FRAGMENT_QUOTE => destroyLines(&fragment.unnamed_0.quote), c.GEMTEXT_FRAGMENT_LINK => { if (fragment.unnamed_0.link.title) |title| freeString(title); freeString(fragment.unnamed_0.link.href); }, c.GEMTEXT_FRAGMENT_LIST => destroyLines(&fragment.unnamed_0.list), c.GEMTEXT_FRAGMENT_HEADING => freeString(fragment.unnamed_0.heading.text), else => @panic("Passed an invalid fragment to gemtext!"), } fragment.* = undefined; } export fn gemtextDocumentCreate(document: *c.gemtext_document) c.gemtext_error { document.* = .{ .fragment_count = undefined, .fragments = undefined, }; setFragments(document, allocator.alloc(c.gemtext_fragment, 0) catch |e| return errorToC(e)); return c.GEMTEXT_SUCCESS; } fn debugPrintFragment(comptime header: []const u8, fragment: c.gemtext_fragment) void { std.debug.print(header, .{}); switch (fragment.type) { .GEMTEXT_FRAGMENT_EMPTY => std.debug.print(" GEMTEXT_FRAGMENT_EMPTY\n", .{}), .GEMTEXT_FRAGMENT_PARAGRAPH => std.debug.print(" GEMTEXT_FRAGMENT_PARAGRAPH => {s}\n", .{fragment.unnamed_0.paragraph}), .GEMTEXT_FRAGMENT_PREFORMATTED => std.debug.print(" GEMTEXT_FRAGMENT_PREFORMATTED => {}\n", .{fragment.unnamed_0.preformatted}), .GEMTEXT_FRAGMENT_QUOTE => std.debug.print(" GEMTEXT_FRAGMENT_QUOTE => {}\n", .{fragment.unnamed_0.quote}), .GEMTEXT_FRAGMENT_LINK => std.debug.print(" GEMTEXT_FRAGMENT_LINK => {}\n", .{fragment.unnamed_0.link}), .GEMTEXT_FRAGMENT_LIST => std.debug.print(" GEMTEXT_FRAGMENT_LIST => {}\n", .{fragment.unnamed_0.list}), .GEMTEXT_FRAGMENT_HEADING => std.debug.print(" GEMTEXT_FRAGMENT_HEADING => {}\n", .{fragment.unnamed_0.heading}), else => unreachable, } } export fn gemtextDocumentInsert(document: *c.gemtext_document, index: usize, fragment: *const c.gemtext_fragment) c.gemtext_error { var fragments = getFragments(document); defer setFragments(document, fragments); if (index > fragments.len) return c.GEMTEXT_ERR_OUT_OF_BOUNDS; var fragment_dupe = duplicateFragment(fragment.*) catch |e| return errorToC(e); fragments = allocator.realloc(fragments, fragments.len + 1) catch |e| { destroyFragment(&fragment_dupe); return errorToC(e); }; const shift_count = fragments.len - index; if (shift_count > 0) { std.mem.copyBackwards( c.gemtext_fragment, fragments[index + 1 .. fragments.len], fragments[index .. fragments.len - 1], ); } fragments[index] = fragment_dupe; return c.GEMTEXT_SUCCESS; } export fn gemtextDocumentAppend(document: *c.gemtext_document, fragment: *const c.gemtext_fragment) c.gemtext_error { return gemtextDocumentInsert(document, document.fragment_count, fragment); } export fn gemtextDocumentRemove(document: *c.gemtext_document, index: usize) void { var fragments = getFragments(document); defer setFragments(document, fragments); if (index > fragments.len) return; destroyFragment(&fragments[index]); const shift_count = document.fragment_count - index; if (shift_count > 0) { std.mem.copy( c.gemtext_fragment, fragments[index .. fragments.len - 1], fragments[index + 1 .. fragments.len], ); } fragments = allocator.shrink(fragments, fragments.len - 1); } export fn gemtextDocumentDestroy(document: *c.gemtext_document) void { const fragments = getFragments(document); for (fragments) |*frag| { destroyFragment(frag); } allocator.free(fragments); document.* = undefined; } export fn gemtextParserCreate(raw_parser: *c.gemtext_parser) c.gemtext_error { const parser = @ptrCast(*gemini.Parser, raw_parser); parser.* = gemini.Parser.init(allocator); return c.GEMTEXT_SUCCESS; } export fn gemtextParserDestroy(raw_parser: *c.gemtext_parser) void { const parser = @ptrCast(*gemini.Parser, raw_parser); parser.deinit(); raw_parser.* = undefined; } fn ensureCString(str: [*:0]const u8) [*:0]const u8 { return str; } /// Converts a TextLines element to a c.gemtext_lines and destroys /// the `.lines` array of TextLines on the way. If the conversion fails, /// the `.lines` is kept alive. fn convertTextLinesToC(src_lines: *gemini.TextLines) !c.gemtext_lines { const lines = try allocator.alloc([*:0]const u8, src_lines.lines.len); for (lines) |*line, i| { line.* = src_lines.lines[i].ptr; } allocator.free(src_lines.lines); src_lines.* = undefined; return c.gemtext_lines{ .count = lines.len, .lines = @ptrCast([*][*c]const u8, lines), }; } fn convertFragmentToC(fragment: *gemini.Fragment) !c.gemtext_fragment { return switch (fragment.*) { .empty => c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_EMPTY, .unnamed_0 = undefined, }, .paragraph => |paragraph| c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PARAGRAPH, .unnamed_0 = .{ .paragraph = ensureCString(paragraph.ptr), }, }, .preformatted => |*preformatted| c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PREFORMATTED, .unnamed_0 = .{ .preformatted = .{ .alt_text = if (preformatted.alt_text) |alt_text| ensureCString(alt_text.ptr) else null, .lines = try convertTextLinesToC(&preformatted.text), }, }, }, .quote => |*quote| c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_QUOTE, .unnamed_0 = .{ .quote = try convertTextLinesToC(quote), }, }, .link => |link| c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_LINK, .unnamed_0 = .{ .link = .{ .href = ensureCString(link.href.ptr), .title = if (link.title) |title| ensureCString(title) else null, }, }, }, .list => |*list| c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_LIST, .unnamed_0 = .{ .list = try convertTextLinesToC(list), }, }, .heading => |heading| c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_HEADING, .unnamed_0 = .{ .heading = .{ .level = switch (heading.level) { .h1 => c.GEMTEXT_HEADING_H1, .h2 => c.GEMTEXT_HEADING_H2, .h3 => c.GEMTEXT_HEADING_H3, }, .text = ensureCString(heading.text.ptr), }, }, }, }; } export fn gemtextParserFeed( raw_parser: *c.gemtext_parser, out_fragment: *c.gemtext_fragment, consumed_bytes: *usize, total_bytes: usize, bytes: [*]const u8, ) c.gemtext_error { const parser = @ptrCast(*gemini.Parser, raw_parser); const input_slice = bytes[0..total_bytes]; var result = parser.feed(allocator, input_slice) catch |e| return errorToC(e); consumed_bytes.* = result.consumed; if (result.fragment) |*fragment| { // as we used c_allocator, we can just return a "flat" copy of the gemini.Fragment here out_fragment.* = convertFragmentToC(fragment) catch |e| { fragment.free(allocator); return errorToC(e); }; return c.GEMTEXT_SUCCESS_FRAGMENT; } else { out_fragment.* = undefined; return c.GEMTEXT_SUCCESS; } } export fn gemtextParserFinalize( raw_parser: *c.gemtext_parser, out_fragment: *c.gemtext_fragment, ) c.gemtext_error { const parser = @ptrCast(*gemini.Parser, raw_parser); var result = parser.finalize(allocator) catch |e| return errorToC(e); if (result) |*fragment| { // as we used c_allocator, we can just return a "flat" copy of the gemini.Fragment here out_fragment.* = convertFragmentToC(fragment) catch |e| { fragment.free(allocator); return errorToC(e); }; return c.GEMTEXT_SUCCESS_FRAGMENT; } else { out_fragment.* = undefined; return c.GEMTEXT_SUCCESS; } } export fn gemtextParserDestroyFragment( parser: *c.gemtext_parser, fragment: *c.gemtext_fragment, ) void { _ = parser; // we ignore the parser for this, it's just here for future safety destroyFragment(fragment); } const CStream = struct { const Self = @This(); context: ?*c_void, render: fn (ctx: ?*c_void, bytes: [*]const u8, length: usize) callconv(.C) void, const StreamError = error{}; const Writer = std.io.Writer(Self, StreamError, write); pub fn writer(self: Self) Writer { return Writer{ .context = self }; } fn write(self: Self, slice: []const u8) StreamError!usize { self.render(self.context, slice.ptr, slice.len); return slice.len; } }; fn convertTextLinesToZig(src_lines: c.gemtext_lines) !gemini.TextLines { var lines = try allocator.alloc([:0]const u8, src_lines.count); errdefer allocator.free(lines); var offset: usize = 0; errdefer for (lines[0..offset]) |frag| allocator.free(frag); while (offset < lines.len) : (offset += 1) { lines[offset] = try allocator.dupeZ(u8, std.mem.spanZ(src_lines.lines[offset])); } return gemini.TextLines{ .lines = lines, }; } fn convertFragmentToZig(src_fragment: c.gemtext_fragment) !gemini.Fragment { return switch (src_fragment.type) { c.GEMTEXT_FRAGMENT_EMPTY => gemini.Fragment{ .empty = {} }, c.GEMTEXT_FRAGMENT_PARAGRAPH => gemini.Fragment{ .paragraph = try allocator.dupeZ(u8, std.mem.spanZ(src_fragment.unnamed_0.paragraph)), }, c.GEMTEXT_FRAGMENT_PREFORMATTED => blk: { var pre = gemini.Preformatted{ .text = undefined, .alt_text = if (src_fragment.unnamed_0.preformatted.alt_text) |alt_text| try allocator.dupeZ(u8, std.mem.spanZ(alt_text)) else null, }; defer if (pre.alt_text) |alt_text| allocator.free(alt_text); pre.text = try convertTextLinesToZig(src_fragment.unnamed_0.preformatted.lines); break :blk gemini.Fragment{ .preformatted = pre, }; }, c.GEMTEXT_FRAGMENT_QUOTE => gemini.Fragment{ .quote = try convertTextLinesToZig(src_fragment.unnamed_0.quote), }, c.GEMTEXT_FRAGMENT_LINK => blk: { var link = gemini.Link{ .title = null, .href = try allocator.dupeZ(u8, std.mem.spanZ(src_fragment.unnamed_0.link.href)), }; errdefer allocator.free(link.href); link.title = if (src_fragment.unnamed_0.link.title) |title| try allocator.dupeZ(u8, std.mem.spanZ(title)) else null; break :blk gemini.Fragment{ .link = link }; }, c.GEMTEXT_FRAGMENT_LIST => gemini.Fragment{ .list = try convertTextLinesToZig(src_fragment.unnamed_0.list), }, c.GEMTEXT_FRAGMENT_HEADING => gemini.Fragment{ .heading = .{ .text = try allocator.dupeZ(u8, std.mem.spanZ(src_fragment.unnamed_0.heading.text)), .level = switch (src_fragment.unnamed_0.heading.level) { c.GEMTEXT_HEADING_H1 => .h1, c.GEMTEXT_HEADING_H2 => .h2, c.GEMTEXT_HEADING_H3 => .h3, else => @panic("passed invalid fragment to gemtext!"), }, }, }, else => @panic("passed invalid fragment to gemtext!"), }; } export fn gemtextRender( renderer: c.gemtext_renderer, raw_fragments: [*]const c.gemtext_fragment, fragment_count: usize, context: ?*c_void, render: fn (ctx: ?*c_void, bytes: [*]const u8, length: usize) callconv(.C) void, ) c.gemtext_error { var stream = CStream{ .context = context, .render = render, }; if (fragment_count == 0) return c.GEMTEXT_SUCCESS; for (raw_fragments[0..fragment_count]) |raw_fragment| { var fragment = convertFragmentToZig(raw_fragment) catch |e| return errorToC(e); defer fragment.free(allocator); const fragments = &[_]gemini.Fragment{fragment}; switch (renderer) { c.GEMTEXT_RENDER_GEMTEXT => gemini.renderer.gemtext(fragments, stream.writer()) catch unreachable, c.GEMTEXT_RENDER_HTML => gemini.renderer.html(fragments, stream.writer()) catch unreachable, c.GEMTEXT_RENDER_MARKDOWN => gemini.renderer.markdown(fragments, stream.writer()) catch unreachable, c.GEMTEXT_RENDER_RTF => gemini.renderer.rtf(fragments, stream.writer()) catch unreachable, else => @panic("invalid renderer passed to gemtextRender!"), } } return c.GEMTEXT_SUCCESS; } export fn gemtextDocumentParseString(document: *c.gemtext_document, raw_text: [*]const u8, length: usize) c.gemtext_error { var err: c.gemtext_error = undefined; err = c.gemtextDocumentCreate(document); if (err != c.GEMTEXT_SUCCESS) return err; var success = false; // cheap workaround for errdefer defer if (!success) { c.gemtextDocumentDestroy(document); }; var parser: c.gemtext_parser = undefined; err = c.gemtextParserCreate(&parser); if (err != c.GEMTEXT_SUCCESS) return err; defer c.gemtextParserDestroy(&parser); var fragment: c.gemtext_fragment = undefined; var offset: usize = 0; while (offset < length) { var used: usize = undefined; err = c.gemtextParserFeed( &parser, &fragment, &used, length - offset, raw_text + offset, ); if (err == c.GEMTEXT_SUCCESS_FRAGMENT) { defer c.gemtextParserDestroyFragment(&parser, &fragment); err = c.gemtextDocumentAppend(document, &fragment); if (err != c.GEMTEXT_SUCCESS) return err; } else if (err != c.GEMTEXT_SUCCESS) { return err; } offset += used; } err = c.gemtextParserFinalize(&parser, &fragment); if (err == c.GEMTEXT_SUCCESS_FRAGMENT) { defer c.gemtextParserDestroyFragment(&parser, &fragment); err = c.gemtextDocumentAppend(document, &fragment); if (err != c.GEMTEXT_SUCCESS) return err; } else if (err != c.GEMTEXT_SUCCESS) return err; success = true; // prevent defer-killing "document" return c.GEMTEXT_SUCCESS; } export fn gemtextDocumentParseFile(document: *c.gemtext_document, file: *std.c.FILE) c.gemtext_error { var err: c.gemtext_error = undefined; err = c.gemtextDocumentCreate(document); if (err != c.GEMTEXT_SUCCESS) return err; var success = false; // cheap workaround for errdefer defer if (!success) { c.gemtextDocumentDestroy(document); }; var parser: c.gemtext_parser = undefined; err = c.gemtextParserCreate(&parser); if (err != c.GEMTEXT_SUCCESS) return err; defer c.gemtextParserDestroy(&parser); var fragment: c.gemtext_fragment = undefined; while (true) { var buffer: [8192]u8 = undefined; const len = std.c.fread(&buffer, 1, buffer.len, file); if (len == 0) break; var offset: usize = 0; while (offset < len) { var used: usize = undefined; err = c.gemtextParserFeed( &parser, &fragment, &used, len - offset, @as([*]const u8, &buffer) + offset, ); if (err == c.GEMTEXT_SUCCESS_FRAGMENT) { defer c.gemtextParserDestroyFragment(&parser, &fragment); err = c.gemtextDocumentAppend(document, &fragment); if (err != c.GEMTEXT_SUCCESS) return err; } else if (err != c.GEMTEXT_SUCCESS) { return err; } offset += used; } } err = c.gemtextParserFinalize(&parser, &fragment); if (err == c.GEMTEXT_SUCCESS_FRAGMENT) { defer c.gemtextParserDestroyFragment(&parser, &fragment); err = c.gemtextDocumentAppend(document, &fragment); if (err != c.GEMTEXT_SUCCESS) return err; } else if (err != c.GEMTEXT_SUCCESS) return err; success = true; // prevent defer-killing "document" return c.GEMTEXT_SUCCESS; } test "empty document creation/deletion" { var doc: c.gemtext_document = undefined; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentCreate(&doc)); c.gemtextDocumentDestroy(&doc); } test "basic document interface" { var doc: c.gemtext_document = undefined; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentCreate(&doc)); defer c.gemtextDocumentDestroy(&doc); var temp_buffer = "Line 2".*; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentAppend(&doc, &c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PARAGRAPH, .unnamed_0 = .{ .paragraph = &temp_buffer }, })); temp_buffer = "Line 1".*; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentInsert(&doc, 0, &c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PARAGRAPH, .unnamed_0 = .{ .paragraph = &temp_buffer }, })); temp_buffer = "Line 3".*; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentInsert(&doc, 2, &c.gemtext_fragment{ .type = c.GEMTEXT_FRAGMENT_PARAGRAPH, .unnamed_0 = .{ .paragraph = &temp_buffer }, })); temp_buffer = undefined; try std.testing.expectEqual(@as(usize, 3), doc.fragment_count); try std.testing.expectEqual(@intCast(c_uint, c.GEMTEXT_FRAGMENT_PARAGRAPH), doc.fragments[0].type); try std.testing.expectEqual(@intCast(c_uint, c.GEMTEXT_FRAGMENT_PARAGRAPH), doc.fragments[1].type); try std.testing.expectEqual(@intCast(c_uint, c.GEMTEXT_FRAGMENT_PARAGRAPH), doc.fragments[2].type); try std.testing.expectEqualStrings("Line 1", std.mem.span(doc.fragments[0].unnamed_0.paragraph)); try std.testing.expectEqualStrings("Line 2", std.mem.span(doc.fragments[1].unnamed_0.paragraph)); try std.testing.expectEqualStrings("Line 3", std.mem.span(doc.fragments[2].unnamed_0.paragraph)); c.gemtextDocumentRemove(&doc, 1); try std.testing.expectEqual(@as(usize, 2), doc.fragment_count); try std.testing.expectEqual(@intCast(c_uint, c.GEMTEXT_FRAGMENT_PARAGRAPH), doc.fragments[0].type); try std.testing.expectEqual(@intCast(c_uint, c.GEMTEXT_FRAGMENT_PARAGRAPH), doc.fragments[1].type); try std.testing.expectEqualStrings("Line 1", std.mem.span(doc.fragments[0].unnamed_0.paragraph)); try std.testing.expectEqualStrings("Line 3", std.mem.span(doc.fragments[1].unnamed_0.paragraph)); } test "empty parser creation/deletion" { var parser: c.gemtext_parser = undefined; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextParserCreate(&parser)); c.gemtextParserDestroy(&parser); } fn terminateWithCrLf(comptime input_literal: [:0]const u8) [:0]const u8 { @setEvalBranchQuota(20 * input_literal.len); comptime var result: [:0]const u8 = ""; comptime var iter = std.mem.split(u8, input_literal, "\n"); inline while (comptime iter.next()) |line| { result = result ++ line ++ "\r\n"; } return result; } test "basic parser invocation and document building, also rendering" { var parser: c.gemtext_parser = undefined; var document: c.gemtext_document = undefined; try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextParserCreate(&parser)); defer c.gemtextParserDestroy(&parser); try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentCreate(&document)); defer c.gemtextDocumentDestroy(&document); const document_text: []const u8 = terminateWithCrLf(@embedFile("../test-data/features.gemini")); var fragment: c.gemtext_fragment = undefined; var offset: usize = 0; while (offset < document_text.len) { var parsed_len: usize = undefined; var result = c.gemtextParserFeed( &parser, &fragment, &parsed_len, document_text.len - offset, document_text.ptr + offset, ); try std.testing.expect(result == c.GEMTEXT_SUCCESS or result == c.GEMTEXT_SUCCESS_FRAGMENT); offset += parsed_len; if (result == c.GEMTEXT_SUCCESS_FRAGMENT) { try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentAppend(&document, &fragment)); c.gemtextParserDestroyFragment(&parser, &fragment); } } { var result = c.gemtextParserFinalize(&parser, &fragment); try std.testing.expect(result == c.GEMTEXT_SUCCESS or result == c.GEMTEXT_SUCCESS_FRAGMENT); if (result == c.GEMTEXT_SUCCESS_FRAGMENT) { try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextDocumentAppend(&document, &fragment)); c.gemtextParserDestroyFragment(&parser, &fragment); } } var list = std.ArrayList(u8).init(std.testing.allocator); defer list.deinit(); try std.testing.expectEqual(c.GEMTEXT_SUCCESS, c.gemtextRender( c.GEMTEXT_RENDER_GEMTEXT, document.fragments, document.fragment_count, &list, struct { fn f(ctx: ?*c_void, text: [*c]const u8, len: usize) callconv(.C) void { var sublist = @ptrCast(*std.ArrayList(u8), @alignCast(@alignOf(std.ArrayList(u8)), ctx.?)); sublist.appendSlice(text[0..len]) catch unreachable; } }.f, )); try std.testing.expectEqualStrings(document_text, list.items); }
src/lib.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "platform/devicetree", .filter = .info, }).write; const assert = std.debug.assert; var parsed_dt: bool = false; pub fn parse_dt(dt_data: []u8) !void { if (parsed_dt) return; parsed_dt = true; var p = Parser{ .data = dt_data }; p.parse(); } const readBig = std.mem.readIntBig; const token = .{ .begin_node = 0x00000001, .end_node = 0x00000002, .prop = 0x00000003, .nop = 0x00000004, .end = 0x00000009, }; const Parser = struct { data: []const u8, curr_offset: u32 = 0, limit: u32 = undefined, fn readbytes(self: *Parser, comptime num_bytes: u32) *const [num_bytes]u8 { const old_offset = self.curr_offset; self.curr_offset += num_bytes; assert(self.curr_offset <= self.limit); return self.data[old_offset..][0..num_bytes]; } fn read(self: *Parser, comptime t: type) t { return readBig(t, self.readbytes(@sizeOf(t))); } fn readstring(self: *Parser) []const u8 { const stroff = self.curr_offset; while (read(u8) != 0) {} return self.data[stroff .. self.curr_offset - 1]; } pub fn parse(self: *Parser) void { assert(readBig(u32, self.data[0x00..0x04]) == 0xd00dfeed); // Magic self.limit = readBig(u32, self.data[0x04..0x08]); // Totalsize const off_dt_struct = readBig(u32, self.data[0x08..0x0C]); const off_mem_rsvmap = readBig(u32, self.data[0x10..0x14]); //self.curr_offset = off_mem_rsvmap; //self.parse_resrved_regions(); self.curr_offset = off_dt_struct; self.node(0); // const off_dt_strings = read(u32, dt_data[0x0C .. 0x10]); // const version = read(u32, dt_data[0x14 .. 0x18]); // const last_comp_version = read(u32, dt_data[0x18 .. 0x1C]); // const boot_cpuid_phys = read(u32, dt_data[0x1C .. 0x20]); // const size_dt_strings = read(u32, dt_data[0x20 .. 0x24]); // const size_dt_struct = read(u32, dt_data[0x24 .. 0x28]); } fn parse_resrved_regions(self: *Parser) void { log(.info, "Parsing reserved regions\n", .{}); while (true) { log(.info, "{}\n", .{self}); const addr = self.read(u64); const size = self.read(u64); if (addr == 0 and size == 0) continue; log(.info, "TODO: Reserved: {x} with size {x}", .{ addr, size }); } } fn node(self: *Parser, depth: usize) void { return; // We really don't care for now } pub fn format(self: *const Parser, fmt: anytype) !void { fmt("Parser{{.data={*}, .offset={X}, limit={X}}}", .{ self.data.ptr, self.curr_offset, self.limit }); } fn parse_node(self: *Parser) void {} };
subprojects/flork/src/platform/devicetree.zig
const std = @import("std"); const util = @import("util.zig"); const Allocator = std.mem.Allocator; const testing = std.testing; const Error = util.Error; const FUSE_ARITY = 3; const FUSE_SEGMENT_COUNT = 100; const FUSE_SLOTS = FUSE_SEGMENT_COUNT + FUSE_ARITY - 1; /// Fuse8 provides a fuse filter with 8-bit fingerprints. /// /// See `Fuse` for more details. pub const Fuse8 = Fuse(u8); /// DEPRECATED: Consider using binary fuse filters instead, they are less prone to creation failure /// (i.e. the algorithm works with small sets) and are generally all around better. /// /// Dietzfelbinger & Walzer's fuse filters, described in "Dense Peelable Random Uniform Hypergraphs", /// https://arxiv.org/abs/1907.04749, can accomodate fill factors up to 87.9% full, rather than /// 1 / 1.23 = 81.3%. In the 8-bit case, this reduces the memory usage from 9.84 bits per entry to /// 9.1 bits. /// /// We assume that you have a large set of 64-bit integers and you want a data structure to do /// membership tests using no more than ~8 or ~16 bits per key. If your initial set is made of /// strings or other types, you first need to hash them to a 64-bit integer. pub fn Fuse(comptime T: type) type { return struct { allocator: Allocator, seed: u64, segmentLength: u64, // == slotCount / FUSE_SLOTS fingerprints: []T, // has room for 3*segmentLength values /// probability of success should always be > 0.5 so 100 iterations is highly unlikely maxIterations: usize = 100, const Self = @This(); /// initializes a fuse filter with enough capacity for a set containing up to `size` elements. /// /// `deinit()` must be called by the caller to free the memory. pub fn init(allocator: Allocator, size: usize) !*Self { const self = try allocator.create(Self); var capacity = @floatToInt(usize, (1.0 / 0.879) * @intToFloat(f64, size)); capacity = capacity / FUSE_SLOTS * FUSE_SLOTS; self.* = Self{ .allocator = allocator, .seed = 0, .fingerprints = try allocator.alloc(T, capacity), .segmentLength = capacity / FUSE_SLOTS, }; return self; } pub inline fn deinit(self: *Self) void { self.allocator.destroy(self); } /// reports if the specified key is within the set with false-positive rate. pub inline fn contain(self: *Self, key: u64) bool { var hash = util.mixSplit(key, self.seed); var f = @truncate(T, util.fingerprint(hash)); var r0 = @truncate(u32, hash); var r1 = @truncate(u32, util.rotl64(hash, 21)); var r2 = @truncate(u32, util.rotl64(hash, 42)); var r3 = @truncate(u32, (0xBF58476D1CE4E5B9 *% hash) >> 32); var seg = util.reduce(r0, FUSE_SEGMENT_COUNT); var sl: u64 = self.segmentLength; var h0 = (seg + 0) * sl + util.reduce(r1, @truncate(u32, sl)); var h1 = (seg + 1) * sl + util.reduce(r2, @truncate(u32, sl)); var h2 = (seg + 2) * sl + util.reduce(r3, @truncate(u32, sl)); return f == (self.fingerprints[h0] ^ self.fingerprints[h1] ^ self.fingerprints[h2]); } /// reports the size in bytes of the filter. pub inline fn sizeInBytes(self: *Self) usize { return FUSE_SLOTS * self.segmentLength * @sizeOf(T) + @sizeOf(Self); } /// populates the filter with the given keys. /// /// The caller is responsible for ensuring that there are no duplicated keys. /// /// The inner loop will run up to maxIterations times (default 100) and will never fail, /// except if there are duplicated keys. /// /// The provided allocator will be used for creating temporary buffers that do not outlive the /// function call. pub fn populate(self: *Self, allocator: Allocator, keys: []u64) Error!void { const iter = try util.sliceIterator(u64).init(allocator, keys); defer iter.deinit(); return self.populateIter(allocator, iter); } /// Identical to populate, except it takes an iterator of keys so you need not store them /// in-memory. /// /// `keys.next()` must return `?u64`, the next key or none if the end of the list has been /// reached. The iterator must reset after hitting the end of the list, such that the `next()` /// call leads to the first element again. /// /// `keys.len()` must return the `usize` length. pub fn populateIter(self: *Self, allocator: Allocator, keys: anytype) Error!void { var rng_counter: u64 = 1; self.seed = util.rngSplitMix64(&rng_counter); var sets = try allocator.alloc(Set, self.segmentLength * FUSE_SLOTS); defer allocator.free(sets); var Q = try allocator.alloc(Keyindex, sets.len); defer allocator.free(Q); var stack = try allocator.alloc(Keyindex, keys.len()); defer allocator.free(stack); var loop: usize = 0; while (true) : (loop += 1) { if (loop + 1 > self.maxIterations) { return Error.KeysLikelyNotUnique; // too many iterations, keys are not unique. } for (sets[0..sets.len]) |*b| b.* = std.mem.zeroes(Set); while (keys.next()) |key| { var hs = getH0H1H2(self, key); sets[hs.h0].fusemask ^= hs.h; sets[hs.h0].count += 1; sets[hs.h1].fusemask ^= hs.h; sets[hs.h1].count += 1; sets[hs.h2].fusemask ^= hs.h; sets[hs.h2].count += 1; } // TODO(upstream): the flush should be sync with the detection that follows scan values // with a count of one. var Qsize: usize = 0; for (sets) |set, i| { if (set.count == 1) { Q[Qsize].index = @intCast(u32, i); Q[Qsize].hash = sets[i].fusemask; Qsize += 1; } } var stack_size: usize = 0; while (Qsize > 0) { Qsize -= 1; var keyindex = Q[Qsize]; var index = keyindex.index; if (sets[index].count == 0) { continue; // not actually possible after the initial scan. } var hash = keyindex.hash; var hs = getJustH0H1H2(self, hash); stack[stack_size] = keyindex; stack_size += 1; sets[hs.h0].fusemask ^= hash; sets[hs.h0].count -= 1; if (sets[hs.h0].count == 1) { Q[Qsize].index = hs.h0; Q[Qsize].hash = sets[hs.h0].fusemask; Qsize += 1; } sets[hs.h1].fusemask ^= hash; sets[hs.h1].count -= 1; if (sets[hs.h1].count == 1) { Q[Qsize].index = hs.h1; Q[Qsize].hash = sets[hs.h1].fusemask; Qsize += 1; } sets[hs.h2].fusemask ^= hash; sets[hs.h2].count -= 1; if (sets[hs.h2].count == 1) { Q[Qsize].index = hs.h2; Q[Qsize].hash = sets[hs.h2].fusemask; Qsize += 1; } } if (stack_size == keys.len()) { // success break; } self.seed = util.rngSplitMix64(&rng_counter); } var stack_size = keys.len(); while (stack_size > 0) { stack_size -= 1; var ki = stack[stack_size]; var hs = getJustH0H1H2(self, ki.hash); var hsh: T = @truncate(T, util.fingerprint(ki.hash)); if (ki.index == hs.h0) { hsh ^= self.fingerprints[hs.h1] ^ self.fingerprints[hs.h2]; } else if (ki.index == hs.h1) { hsh ^= self.fingerprints[hs.h0] ^ self.fingerprints[hs.h2]; } else { hsh ^= self.fingerprints[hs.h0] ^ self.fingerprints[hs.h1]; } self.fingerprints[ki.index] = hsh; } return; } inline fn getH0H1H2(self: *Self, k: u64) Hashes { var hash = util.mixSplit(k, self.seed); var r0 = @truncate(u32, hash); var r1 = @truncate(u32, util.rotl64(hash, 21)); var r2 = @truncate(u32, util.rotl64(hash, 42)); var r3 = @truncate(u32, (0xBF58476D1CE4E5B9 *% hash) >> 32); var seg = util.reduce(r0, FUSE_SEGMENT_COUNT); var sl = self.segmentLength; return Hashes{ .h = hash, .h0 = @truncate(u32, @intCast(u64, (seg + 0)) * sl + @intCast(u64, util.reduce(r1, @truncate(u32, sl)))), .h1 = @truncate(u32, @intCast(u64, (seg + 1)) * sl + @intCast(u64, util.reduce(r2, @truncate(u32, sl)))), .h2 = @truncate(u32, @intCast(u64, (seg + 2)) * sl + @intCast(u64, util.reduce(r3, @truncate(u32, sl)))), }; } inline fn getJustH0H1H2(self: *Self, hash: u64) H0h1h2 { var r0 = @truncate(u32, hash); var r1 = @truncate(u32, util.rotl64(hash, 21)); var r2 = @truncate(u32, util.rotl64(hash, 42)); var r3 = @truncate(u32, (0xBF58476D1CE4E5B9 *% hash) >> 32); var seg = util.reduce(r0, FUSE_SEGMENT_COUNT); var sl = self.segmentLength; return H0h1h2{ .h0 = @truncate(u32, @intCast(u64, (seg + 0)) * sl + @intCast(u64, util.reduce(r1, @truncate(u32, sl)))), .h1 = @truncate(u32, @intCast(u64, (seg + 1)) * sl + @intCast(u64, util.reduce(r2, @truncate(u32, sl)))), .h2 = @truncate(u32, @intCast(u64, (seg + 2)) * sl + @intCast(u64, util.reduce(r3, @truncate(u32, sl)))), }; } }; } const Set = struct { fusemask: u64, count: u32, }; const Hashes = struct { h: u64, h0: u32, h1: u32, h2: u32, }; const H0h1h2 = struct { h0: u32, h1: u32, h2: u32, }; const Keyindex = struct { hash: u64, index: u32, }; fn fuseTest(T: anytype, size: usize, size_in_bytes: usize) !void { const allocator = std.heap.page_allocator; const filter = try Fuse(T).init(allocator, size); comptime filter.maxIterations = 100; // proof we can modify maxIterations at comptime. defer filter.deinit(); var keys = try allocator.alloc(u64, size); defer allocator.free(keys); for (keys) |_, i| { keys[i] = i; } try filter.populate(allocator, keys[0..]); try testing.expect(filter.contain(1) == true); try testing.expect(filter.contain(5) == true); try testing.expect(filter.contain(9) == true); try testing.expect(filter.contain(1234) == true); try testing.expectEqual(@as(usize, size_in_bytes), filter.sizeInBytes()); for (keys) |key| { try testing.expect(filter.contain(key) == true); } var random_matches: u64 = 0; const trials = 10000000; var i: u64 = 0; var rng = std.rand.DefaultPrng.init(0); const random = rng.random(); while (i < trials) : (i += 1) { var random_key: u64 = random.uintAtMost(u64, std.math.maxInt(u64)); if (filter.contain(random_key)) { if (random_key >= keys.len) { random_matches += 1; } } } std.debug.print("fpp {d:3.10} (estimated) \n", .{@intToFloat(f64, random_matches) * 1.0 / trials}); std.debug.print("bits per entry {d:3.1}\n", .{@intToFloat(f64, filter.sizeInBytes()) * 8.0 / @intToFloat(f64, size)}); } test "fuse4" { try fuseTest(u4, 1000000 / 2, 568800); } test "fuse8" { try fuseTest(u8, 1000000, 1137654); } test "fuse16" { try fuseTest(u16, 1000000, 2275260); }
src/fusefilter.zig
comptime { asm ( \\.section .text.start \\.globl _start \\_start: \\ .long __stack_start \\ .long runtime_entry \\ .long nm_interrupt \\ .long hard_fault \\ .long rsvd4 \\ .long rsvd5 \\ .long rsvd6 \\ .long rsvd7 \\ .long rsvd8 \\ .long rsvd9 \\ .long rsvd10 \\ .long sv_call \\ .long rsvd12 \\ .long rsvd13 \\ .long pend_sv \\ .long sys_tick \\ .long irq0 \\ .long irq1 \\ .long irq2 \\ .long irq3 \\ .long irq4 \\ .long irq5 \\ .long irq6 \\ .long irq7 \\ .long irq8 \\ .long irq9 \\ .long irq10 \\ .long irq11 \\ .long irq12 \\ .long irq13 \\ .long irq14 \\ .long irq15 \\ .long irq16 \\ .long irq17 \\ .long irq18 \\ .long irq19 \\ .long irq20 \\ .long irq21 \\ .long irq22 \\ .long irq23 \\ .long irq24 \\ .long irq25 \\ .long irq26 \\ .long irq27 \\ .long irq28 \\ .long irq29 \\ .long irq30 \\ .long irq31 ); } extern var __bss_start: u8; extern var __bss_end: u8; export fn runtime_entry() noreturn { // zero-fill bss section @memset(@ptrCast(*volatile [1]u8, &__bss_start), 0, @ptrToInt(&__bss_end) - @ptrToInt(&__bss_start)); // call the main routine @import("main.zig").hako_main(); // do infinite loop //while(true) {} } // default interrupt handler fn default_handler() noreturn { while (true) {} } // interrupt handlers export fn nm_interrupt() noreturn { default_handler(); } export fn hard_fault() noreturn { default_handler(); } export fn rsvd4() noreturn { default_handler(); } export fn rsvd5() noreturn { default_handler(); } export fn rsvd6() noreturn { default_handler(); } export fn rsvd7() noreturn { default_handler(); } export fn rsvd8() noreturn { default_handler(); } export fn rsvd9() noreturn { default_handler(); } export fn rsvd10() noreturn { default_handler(); } export fn sv_call() noreturn { default_handler(); } export fn rsvd12() noreturn { default_handler(); } export fn rsvd13() noreturn { default_handler(); } export fn pend_sv() noreturn { default_handler(); } export fn sys_tick() noreturn { default_handler(); } export fn irq0() noreturn { default_handler(); } export fn irq1() noreturn { default_handler(); } export fn irq2() noreturn { default_handler(); } export fn irq3() noreturn { default_handler(); } export fn irq4() noreturn { default_handler(); } export fn irq5() noreturn { default_handler(); } export fn irq6() noreturn { default_handler(); } export fn irq7() noreturn { default_handler(); } export fn irq8() noreturn { default_handler(); } export fn irq9() noreturn { default_handler(); } export fn irq10() noreturn { default_handler(); } export fn irq11() noreturn { default_handler(); } export fn irq12() noreturn { default_handler(); } export fn irq13() noreturn { default_handler(); } export fn irq14() noreturn { default_handler(); } export fn irq15() noreturn { default_handler(); } export fn irq16() noreturn { default_handler(); } export fn irq17() noreturn { default_handler(); } export fn irq18() noreturn { default_handler(); } export fn irq19() noreturn { default_handler(); } export fn irq20() noreturn { default_handler(); } export fn irq21() noreturn { default_handler(); } export fn irq22() noreturn { default_handler(); } export fn irq23() noreturn { default_handler(); } export fn irq24() noreturn { default_handler(); } export fn irq25() noreturn { default_handler(); } export fn irq26() noreturn { default_handler(); } export fn irq27() noreturn { default_handler(); } export fn irq28() noreturn { default_handler(); } export fn irq29() noreturn { default_handler(); } export fn irq30() noreturn { default_handler(); } export fn irq31() noreturn { default_handler(); }
src/runtime.zig
const layout = @import("layout.zig"); const tty = @import("tty.zig"); const vmem = @import("vmem.zig"); const mem = @import("std").mem; const assert = @import("std").debug.assert; const Color = tty.Color; // Standard allocator interface. pub var allocator = mem.Allocator { .allocFn = alloc, .reallocFn = realloc, .freeFn = free, }; var heap: []u8 = undefined; // Global kernel heap. var free_list: ?*Block = undefined; // List of free blocks in the heap. // Structure representing a block in the heap. const Block = struct { free: bool, // Is the block free? prev: ?*Block, // Adjacent block to the left. next: ?*Block, // Adjacent block to the right. // Doubly linked list of free blocks. prev_free: ?*Block, next_free: ?*Block, //// // Initialize a free block as big as the heap. // // Returns: // The biggest possible free block. // pub fn init() Block { return Block { .free = true, .prev = null, .next = null, .prev_free = null, .next_free = null, }; } //// // Calculate the size of the block. // // Returns: // The size of the usable portion of the block. // pub fn size(self: *Block) usize { // Block can end at the beginning of the next block, or at the end of the heap. const end = if (self.next) |next_block| @ptrToInt(next_block) else @ptrToInt(heap.ptr) + heap.len; // End - Beginning - Metadata = the usable amount of memory. return end - @ptrToInt(self) - @sizeOf(Block); } //// // Return a slice of the usable portion of the block. // pub fn data(self: *Block) []u8 { return @intToPtr([*]u8, @ptrToInt(self) + @sizeOf(Block))[0..self.size()]; } //// // Get the block metadata from the associated slice of memory. // // Arguments: // bytes: The usable portion of the block. // // Returns: // The associated block strucutre. // pub fn fromData(bytes: [*]u8) *Block { return @intToPtr(*Block, @ptrToInt(bytes) - @sizeOf(Block)); } }; // Implement standard alloc function - see std.mem for reference. fn alloc(self: *mem.Allocator, size: usize, alignment: u29) ![]u8 { // TODO: align properly. // Find a block that's big enough. var block = searchFreeBlock(size) orelse return error.OutOfMemory; // If it's bigger than needed, split it. if (block.size() > size + @sizeOf(Block)) { splitBlock(block, size); } occupyBlock(block); // Remove the block from the free list. return block.data()[0..size]; } // Implement standard realloc function - see std.mem for reference. fn realloc(self: *mem.Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 { // Try to increase the size of the current block. var block = Block.fromData(old_mem.ptr); mergeRight(block); // If the enlargement succeeeded: if (block.size() >= new_size) { // If there's extra space we don't need, split the block. if (block.size() >= new_size + @sizeOf(Block)) { splitBlock(block, new_size); } return old_mem; // We can return the old pointer. } // If the enlargement failed: free(self, old_mem); // Free the current block. var new_mem = try alloc(self, new_size, alignment); // Allocate a bigger one. // Copy the data in the new location. mem.copy(u8, new_mem, old_mem); // FIXME: this should be @memmove. return new_mem; } // Implement standard free function - see std.mem for reference. fn free(self: *mem.Allocator, old_mem: []u8) void { var block = Block.fromData(old_mem.ptr); freeBlock(block); // Reinsert the block in the free list. // Try to merge the free block with adjacent ones. mergeRight(block); mergeLeft(block); } //// // Search for a free block that has at least the required size. // // Arguments: // size: The size of the usable portion of the block. // // Returns: // A suitable block, or null. // fn searchFreeBlock(size: usize) ?*Block { var i = free_list; while (i) |block| : (i = block.next_free) { if (block.size() >= size) return block; } return null; } //// // Flag a block as free and add it to the free list. // // Arguments: // block: The block to be freed. // fn freeBlock(block: *Block) void { assert (block.free == false); // Place the block at the front of the list. block.free = true; block.prev_free = null; block.next_free = free_list; if (free_list) |first| { first.prev_free = block; } free_list = block; } //// // Remove a block from the free list and flag it as busy. // // Arguments: // block: The block to be occupied. // fn occupyBlock(block: *Block) void { assert (block.free == true); if (block.prev_free) |prev_free| { // If there's a preceeding block, update it. prev_free.next_free = block.next_free; } else { // Otherwise, we are at the beginning of the list. free_list = block.next_free; } // If the block is not the last, we also need to update its successor. if (block.next_free) |next_free| { next_free.prev_free = block.prev_free; } block.free = false; } //// // Reduce the size of a block by splitting it in two. The second part is // marked free. The first part can be either free or busy (depending on // the original block). // // Arguments: // block: The block to be splitted. // fn splitBlock(block: *Block, left_sz: usize) void { // Check that there is enough space for a second block. assert (block.size() - left_sz > @sizeOf(Block)); // Setup the second block at the end of the first one. var right_block = @intToPtr(*Block, @ptrToInt(block) + @sizeOf(Block) + left_sz); right_block.* = Block { .free = false, // For consistency: not free until added to the free list. .prev = block, .next = block.next, .prev_free = null, .next_free = null, }; block.next = right_block; // Update the block that comes after. if (right_block.next) |next| { next.prev = right_block; } freeBlock(right_block); // Set the second block as free. } //// // Try to merge a block with a free one on the right. // // Arguments: // block: The block to merge (not necessarily free). // fn mergeRight(block: *Block) void { // If there's a block to the right... if (block.next) |next| { // ...and it's free: if (next.free) { // Remove it from the list of free blocks. occupyBlock(next); // Merge it with the previous one. block.next = next.next; if (next.next) |next_next| { next_next.prev = block; } } } } //// // Try to merge a block with a free one on the left. // // Arguments: // block: The block to merge (not necessarily free). // fn mergeLeft(block: *Block) void { if (block.prev) |prev| { if (prev.free) { mergeRight(prev); } } } //// // Initialize the dynamic memory allocation system. // // Arguments: // capacity: Maximum size of the kernel heap. // pub fn initialize(capacity: usize) void { tty.step("Initializing Dynamic Memory Allocation"); // Ensure the heap doesn't overflow into user space. assert ((layout.HEAP + capacity) < layout.USER_STACKS); // Map the required amount of virtual (and physical memory). vmem.mapZone(layout.HEAP, null, capacity, vmem.PAGE_WRITE | vmem.PAGE_GLOBAL); // TODO: on-demand mapping. // Initialize the heap with one big free block. heap = @intToPtr([*]u8, layout.HEAP)[0..capacity]; free_list = @ptrCast(*Block, @alignCast(@alignOf(Block), heap.ptr)); free_list.?.* = Block.init(); tty.colorPrint(Color.White, " {d} KB", capacity / 1024); tty.stepOK(); }
kernel/mem.zig
const std = @import("std"); const zwin32 = @import("zwin32"); const w32 = zwin32.base; const d3d12 = zwin32.d3d12; const hrPanic = zwin32.hrPanic; const hrPanicOnFail = zwin32.hrPanicOnFail; const zd3d12 = @import("zd3d12"); const common = @import("common"); const c = common.c; const vm = common.vectormath; const GuiRenderer = common.GuiRenderer; pub export const D3D12SDKVersion: u32 = 4; pub export const D3D12SDKPath: [*:0]const u8 = ".\\d3d12\\"; const content_dir = @import("build_options").content_dir; const window_name = "zig-gamedev: triangle"; const window_width = 900; const window_height = 900; pub fn main() !void { common.init(); defer common.deinit(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); var arena_allocator_state = std.heap.ArenaAllocator.init(allocator); defer arena_allocator_state.deinit(); const arena_allocator = arena_allocator_state.allocator(); const window = try common.initWindow(allocator, window_name, window_width, window_height); defer common.deinitWindow(allocator); var gctx = zd3d12.GraphicsContext.init(allocator, window); defer gctx.deinit(allocator); const pipeline = blk: { const input_layout_desc = [_]d3d12.INPUT_ELEMENT_DESC{ d3d12.INPUT_ELEMENT_DESC.init("POSITION", 0, .R32G32B32_FLOAT, 0, 0, .PER_VERTEX_DATA, 0), }; var pso_desc = d3d12.GRAPHICS_PIPELINE_STATE_DESC.initDefault(); pso_desc.DepthStencilState.DepthEnable = w32.FALSE; pso_desc.InputLayout = .{ .pInputElementDescs = &input_layout_desc, .NumElements = input_layout_desc.len, }; pso_desc.RTVFormats[0] = .R8G8B8A8_UNORM; pso_desc.NumRenderTargets = 1; pso_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = 0xf; pso_desc.PrimitiveTopologyType = .TRIANGLE; break :blk gctx.createGraphicsShaderPipeline( arena_allocator, &pso_desc, content_dir ++ "shaders/triangle.vs.cso", content_dir ++ "shaders/triangle.ps.cso", ); }; const vertex_buffer = gctx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &d3d12.RESOURCE_DESC.initBuffer(3 * @sizeOf(vm.Vec3)), d3d12.RESOURCE_STATE_COPY_DEST, null, ) catch |err| hrPanic(err); const index_buffer = gctx.createCommittedResource( .DEFAULT, d3d12.HEAP_FLAG_NONE, &d3d12.RESOURCE_DESC.initBuffer(3 * @sizeOf(u32)), d3d12.RESOURCE_STATE_COPY_DEST, null, ) catch |err| hrPanic(err); gctx.beginFrame(); var guir = GuiRenderer.init(arena_allocator, &gctx, 1, content_dir); defer guir.deinit(&gctx); const upload_verts = gctx.allocateUploadBufferRegion(vm.Vec3, 3); upload_verts.cpu_slice[0] = vm.Vec3.init(-0.7, -0.7, 0.0); upload_verts.cpu_slice[1] = vm.Vec3.init(0.0, 0.7, 0.0); upload_verts.cpu_slice[2] = vm.Vec3.init(0.7, -0.7, 0.0); gctx.cmdlist.CopyBufferRegion( gctx.lookupResource(vertex_buffer).?, 0, upload_verts.buffer, upload_verts.buffer_offset, upload_verts.cpu_slice.len * @sizeOf(vm.Vec3), ); const upload_indices = gctx.allocateUploadBufferRegion(u32, 3); upload_indices.cpu_slice[0] = 0; upload_indices.cpu_slice[1] = 1; upload_indices.cpu_slice[2] = 2; gctx.cmdlist.CopyBufferRegion( gctx.lookupResource(index_buffer).?, 0, upload_indices.buffer, upload_indices.buffer_offset, upload_indices.cpu_slice.len * @sizeOf(u32), ); gctx.addTransitionBarrier(vertex_buffer, d3d12.RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); gctx.addTransitionBarrier(index_buffer, d3d12.RESOURCE_STATE_INDEX_BUFFER); gctx.flushResourceBarriers(); gctx.endFrame(); gctx.finishGpuCommands(); var triangle_color = vm.Vec3.init(0.0, 1.0, 0.0); var stats = common.FrameStats.init(); while (common.handleWindowEvents()) { stats.update(window, window_name); common.newImGuiFrame(stats.delta_time); c.igSetNextWindowPos(.{ .x = 10.0, .y = 10.0 }, c.ImGuiCond_FirstUseEver, .{ .x = 0.0, .y = 0.0 }); c.igSetNextWindowSize(c.ImVec2{ .x = 600.0, .y = 0.0 }, c.ImGuiCond_FirstUseEver); _ = c.igBegin( "Demo Settings", null, c.ImGuiWindowFlags_NoMove | c.ImGuiWindowFlags_NoResize | c.ImGuiWindowFlags_NoSavedSettings, ); _ = c.igColorEdit3("Triangle color", &triangle_color.c, c.ImGuiColorEditFlags_None); c.igEnd(); gctx.beginFrame(); const back_buffer = gctx.getBackBuffer(); gctx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_RENDER_TARGET); gctx.flushResourceBarriers(); gctx.cmdlist.OMSetRenderTargets( 1, &[_]d3d12.CPU_DESCRIPTOR_HANDLE{back_buffer.descriptor_handle}, w32.TRUE, null, ); gctx.cmdlist.ClearRenderTargetView( back_buffer.descriptor_handle, &[4]f32{ 0.2, 0.4, 0.8, 1.0 }, 0, null, ); gctx.setCurrentPipeline(pipeline); gctx.cmdlist.IASetPrimitiveTopology(.TRIANGLELIST); gctx.cmdlist.IASetVertexBuffers(0, 1, &[_]d3d12.VERTEX_BUFFER_VIEW{.{ .BufferLocation = gctx.lookupResource(vertex_buffer).?.GetGPUVirtualAddress(), .SizeInBytes = 3 * @sizeOf(vm.Vec3), .StrideInBytes = @sizeOf(vm.Vec3), }}); gctx.cmdlist.IASetIndexBuffer(&.{ .BufferLocation = gctx.lookupResource(index_buffer).?.GetGPUVirtualAddress(), .SizeInBytes = 3 * @sizeOf(u32), .Format = .R32_UINT, }); gctx.cmdlist.SetGraphicsRoot32BitConstant( 0, c.igColorConvertFloat4ToU32(.{ .x = triangle_color.c[0], .y = triangle_color.c[1], .z = triangle_color.c[2], .w = 1.0, }), 0, ); gctx.cmdlist.DrawIndexedInstanced(3, 1, 0, 0, 0); guir.draw(&gctx); gctx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_PRESENT); gctx.flushResourceBarriers(); gctx.endFrame(); } gctx.finishGpuCommands(); }
samples/triangle/src/triangle.zig
const std = @import("std"); const c = @import("c.zig").c; const Error = @import("errors.zig").Error; const getError = @import("errors.zig").getError; const internal_debug = @import("internal_debug.zig"); /// Sets the clipboard to the specified string. /// /// This function sets the system clipboard to the specified, UTF-8 encoded string. /// /// @param[in] string A UTF-8 encoded string. /// /// Possible errors include glfw.Error.NotInitialized and glfw.Error.PlatformError. /// /// @pointer_lifetime The specified string is copied before this function returns. /// /// @thread_safety This function must only be called from the main thread. /// /// see also: clipboard, glfwGetClipboardString pub inline fn setClipboardString(value: [*:0]const u8) error{PlatformError}!void { internal_debug.assertInitialized(); c.glfwSetClipboardString(null, value); getError() catch |err| return switch (err) { Error.NotInitialized => unreachable, Error.PlatformError => |e| e, else => unreachable, }; } /// Returns the contents of the clipboard as a string. /// /// This function returns the contents of the system clipboard, if it contains or is convertible to /// a UTF-8 encoded string. If the clipboard is empty or if its contents cannot be converted, /// glfw.Error.FormatUnavailable is returned. /// /// @return The contents of the clipboard as a UTF-8 encoded string. /// /// Possible errors include glfw.Error.NotInitialized, glfw.Error.FormatUnavailable and glfw.Error.PlatformError. /// /// @pointer_lifetime The returned string is allocated and freed by GLFW. You should not free it /// yourself. It is valid until the next call to glfw.getClipboardString or glfw.setClipboardString /// or until the library is terminated. /// /// @thread_safety This function must only be called from the main thread. /// /// see also: clipboard, glfwSetClipboardString pub inline fn getClipboardString() error{ FormatUnavailable, PlatformError }![:0]const u8 { internal_debug.assertInitialized(); if (c.glfwGetClipboardString(null)) |c_str| return std.mem.span(c_str); getError() catch |err| return switch (err) { Error.NotInitialized => unreachable, Error.FormatUnavailable, Error.PlatformError => |e| e, else => unreachable, }; // `glfwGetClipboardString` returns `null` only for errors unreachable; } test "setClipboardString" { const glfw = @import("main.zig"); try glfw.init(.{}); defer glfw.terminate(); try glfw.setClipboardString("hello mach"); } test "getClipboardString" { const glfw = @import("main.zig"); try glfw.init(.{}); defer glfw.terminate(); _ = glfw.getClipboardString() catch |err| std.debug.print("can't get clipboard, not supported by OS? error={}\n", .{err}); }
glfw/src/clipboard.zig
const cfg = @import("cfg.zig"); const minify = @import("minify.zig"); const serde = @import("serde.zig"); const stb = @cImport({ @cInclude("stb/stb_image.h"); }); const std = @import("std"); const qoi = @import("qoi.zig"); pub const Shader = struct { bytes: []const u8, pub fn bake( allocator: std.mem.Allocator, bytes: []const u8, platform: cfg.Platform, opt_level: cfg.OptLevel, ) ![]u8 { const shader_bytes = try minify.shader( bytes, allocator, platform, opt_level, ); defer allocator.free(shader_bytes); return try serde.serialize(allocator, Shader{ .bytes = shader_bytes }); } }; pub const Texture = struct { width: u32, height: u32, data: []const u8, pub fn serialize(allocator: std.mem.Allocator, value: Texture) ![]const u8 { const qoi_image = qoi.Image{ .width = value.width, .height = value.height, .data = value.data, }; const result = try qoi.encode(qoi_image, allocator); return allocator.resize(result.bytes, result.len) orelse error.ResizeFailed; } pub fn deserialize(desc: serde.DeserializeDesc, bytes: []const u8) !Texture { const allocator = desc.allocator orelse return error.AllocatorRequired; const image = try qoi.decode(bytes, allocator); return Texture{ .width = image.width, .height = image.height, .data = image.data }; } pub fn bake( allocator: std.mem.Allocator, bytes: []const u8, _: cfg.Platform, _: cfg.OptLevel, ) ![]u8 { var width: c_int = undefined; var height: c_int = undefined; var channels: c_int = undefined; const texture_bytes = stb.stbi_load_from_memory( bytes.ptr, @intCast(c_int, bytes.len), &width, &height, &channels, 0, ); defer stb.stbi_image_free(texture_bytes); return try serde.serialize(allocator, Texture{ .width = @intCast(u32, width), .height = @intCast(u32, height), .data = texture_bytes[0..@intCast(usize, width * height * channels)], }); } }; const bake_list = @import("bake_list"); pub fn main() !void { var gpa: std.heap.GeneralPurposeAllocator(.{}) = .{}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); std.log.info("bake begin...", .{}); std.log.info("platform: {s}", .{@tagName(bake_list.platform)}); std.log.info("optimization level: {s}", .{@tagName(bake_list.opt_level)}); var in_dir = try std.fs.cwd().openDir(bake_list.in_dir, .{}); defer in_dir.close(); var out_dir = try std.fs.cwd().openDir(bake_list.out_dir, .{}); defer out_dir.close(); std.log.info("input dir: {s}", .{bake_list.in_dir}); std.log.info("output dir: {s}", .{bake_list.out_dir}); inline for (@typeInfo(bake_list).Struct.decls) |decl| { const Type = @field(bake_list, decl.name); if (@TypeOf(Type) == type and @hasDecl(Type, "bake")) { const var_name = comptime getVarName(decl.name, Type); std.log.info("{s} {s} -> {s}", .{ Type, decl.name, var_name }); const file = try in_dir.openFile(decl.name, .{}); defer file.close(); const file_stat = try file.stat(); const file_bytes = try file.readToEndAlloc(allocator, file_stat.size); defer allocator.free(file_bytes); const bake_bytes = try Type.bake( allocator, file_bytes, bake_list.platform, bake_list.opt_level, ); defer allocator.free(bake_bytes); try out_dir.writeFile(var_name, bake_bytes); } } std.log.info("bake complete!", .{}); } pub fn getVarName(comptime path: []const u8, comptime bake_type: type) []const u8 { comptime var var_name: []const u8 = &[_]u8{}; inline for (path) |char| { if (char == '.') { break; } if (std.fs.path.isSep(char)) { var_name = var_name ++ &[_]u8{'_'}; } else { var_name = var_name ++ &[_]u8{std.ascii.toLower(char)}; } } var_name = var_name ++ &[_]u8{'_'}; inline for (@typeName(bake_type)) |char| { var_name = var_name ++ &[_]u8{std.ascii.toLower(char)}; } return var_name; }
src/bake.zig
const std = @import("std"); const Version = std.builtin.Version; pub const log = std.log.scoped(.hzzp); pub const supported_versions = Version.Range{ .min = .{ .major = 1, .minor = 0, }, .max = .{ .major = 1, .minor = 1, }, }; pub const TransferEncoding = enum { content_length, chunked, unknown, }; // zig fmt: off pub const StatusCode = enum(u10) { // https://www.iana.org/assignments/http-status-codes/http-status-codes.txt (2018-09-21) info_continue = 100, // RFC7231, Section 6.2.1 info_switching_protocols = 101, // RFC7231, Section 6.2.2 info_processing = 102, // RFC2518 info_early_hints = 103, // RFC8297 // 104-199 Unassigned success_ok = 200, // RFC7231, Section 6.3.1 success_created = 201, // RFC7231, Section 6.3.2 success_accepted = 202, // RFC7231, Section 6.3.3 success_non_authoritative_information = 203, // RFC7231, Section 6.3.4 success_no_content = 204, // RFC7231, Section 6.3.5 success_reset_content = 205, // RFC7231, Section 6.3.6 success_partial_content = 206, // RFC7233, Section 4.1 success_multi_status = 207, // RFC4918 success_already_reported = 208, // RFC5842 // 209-225 Unassigned success_im_used = 226, // RFC3229 // 227-299 Unassigned redirect_multiple_choices = 300, // RFC7231, Section 6.4.1 redirect_moved_permanently = 301, // RFC7231, Section 6.4.2 redirect_found = 302, // RFC7231, Section 6.4.3 redirect_see_other = 303, // RFC7231, Section 6.4.4 redirect_not_modified = 304, // RFC7232, Section 4.1 redirect_use_proxy = 305, // RFC7231, Section 6.4.5 // 306 (Unused) redirect_temporary_redirect = 307, // RFC7231, Section 6.4.7 redirect_permanent_redirect = 308, // RFC7538 // 309-399 Unassigned client_bad_request = 400, // RFC7231, Section 6.5.1 client_unauthorized = 401, // RFC7235, Section 3.1 client_payment_required = 402, // RFC7231, Section 6.5.2 client_forbidden = 403, // RFC7231, Section 6.5.3 client_not_found = 404, // RFC7231, Section 6.5.4 client_method_not_allowed = 405, // RFC7231, Section 6.5.5 client_not_acceptable = 406, // RFC7231, Section 6.5.6 client_proxy_authentication_required = 407, // RFC7235, Section 3.2 client_request_timeout = 408, // RFC7231, Section 6.5.7 client_conflict = 409, // RFC7231, Section 6.5.8 client_gone = 410, // RFC7231, Section 6.5.9 client_length_required = 411, // RFC7231, Section 6.5.10 client_precondition_failed = 412, // RFC7232, Section 4.2][RFC8144, Section 3.2 client_payload_too_large = 413, // RFC7231, Section 6.5.11 client_uri_too_long = 414, // RFC7231, Section 6.5.12 client_unsupported_media_type = 415, // RFC7231, Section 6.5.13][RFC7694, Section 3 client_range_not_satisfiable = 416, // RFC7233, Section 4.4 client_expectation_failed = 417, // RFC7231, Section 6.5.14 // 418-420 Unassigned client_misdirected_request = 421, // RFC7540, Section 9.1.2 client_unprocessable_entity = 422, // RFC4918 client_locked = 423, // RFC4918 client_failed_dependency = 424, // RFC4918 client_too_early = 425, // RFC8470 client_upgrade_required = 426, // RFC7231, Section 6.5.15 // 427 Unassigned client_precondition_required = 428, // RFC6585 client_too_many_requests = 429, // RFC6585 // 430 Unassigned client_request_header_fields_too_large = 431, // RFC6585 // 432-450 Unassigned client_unavailable_for_legal_reasons = 451, // RFC7725 // 452-499 Unassigned server_internal_server_error = 500, // RFC7231, Section 6.6.1 server_not_implemented = 501, // RFC7231, Section 6.6.2 server_bad_gateway = 502, // RFC7231, Section 6.6.3 server_service_unavailable = 503, // RFC7231, Section 6.6.4 server_gateway_timeout = 504, // RFC7231, Section 6.6.5 server_http_version_not_supported = 505, // RFC7231, Section 6.6.6 server_variant_also_negotiates = 506, // RFC2295 server_insufficient_storage = 507, // RFC4918 server_loop_detected = 508, // RFC5842 // 509 Unassigned server_not_extended = 510, // RFC2774 server_network_authentication_required = 511, // RFC6585 // 512-599 Unassigned _, pub fn code(self: StatusCode) callconv(.Inline) @TagType(StatusCode) { return @enumToInt(self); } pub fn isValid(self: StatusCode) callconv(.Inline) bool { return @enumToInt(self) >= 100 and @enumToInt(self) < 600; } }; // zig fmt: on pub const Header = struct { name: []const u8, value: []const u8, }; pub const HeadersSlice = []const Header;
src/common.zig
const vk = @import("../../../vk.zig"); const std = @import("std"); const vkctxt = @import("../../../vulkan_wrapper/vulkan_context.zig"); const printError = @import("../../../application/print_error.zig").printError; const RGResource = @import("../render_graph_resource.zig").RGResource; const Application = @import("../../../application/application.zig"); pub const Swapchain = struct { rg_resource: RGResource, swapchain: vk.SwapchainKHR, image_format: vk.Format, image_extent: vk.Extent2D, image_count: u32, images: []vk.Image, image_views: []vk.ImageView, render_pass: vk.RenderPass, framebuffers: []vk.Framebuffer, pub fn init(self: *Swapchain, width: u32, height: u32, images_count: u32) !void { self.image_count = images_count; try self.createSwapchain(width, height); try self.createImageViews(); try self.createRenderPass(); try self.createSwapBuffers(); } pub fn deinit(self: *Swapchain) void { self.cleanup(); } pub fn recreate(self: *Swapchain, width: u32, height: u32) !void { self.cleanup(); try self.init(width, height, self.image_count); } pub fn recreateWithSameSize(self: *Swapchain) !void { try self.recreate(self.image_extent.width, self.image_extent.height); } fn cleanup(self: *Swapchain) void { for (self.image_views) |image_view| { vkctxt.vkd.destroyImageView(vkctxt.vkc.device, image_view, null); } for (self.framebuffers) |framebuffer| { vkctxt.vkd.destroyFramebuffer(vkctxt.vkc.device, framebuffer, null); } vkctxt.vkc.allocator.free(self.image_views); vkctxt.vkc.allocator.free(self.framebuffers); vkctxt.vkd.destroyRenderPass(vkctxt.vkc.device, self.render_pass, null); vkctxt.vkd.destroySwapchainKHR(vkctxt.vkc.device, self.swapchain, null); } fn createSwapchain(self: *Swapchain, width: u32, height: u32) !void { const swapchain_support: vkctxt.SwapchainSupportDetails = vkctxt.vkc.getSwapchainSupport(&vkctxt.vkc.physical_device) catch unreachable; defer vkctxt.vkc.allocator.free(swapchain_support.formats); defer vkctxt.vkc.allocator.free(swapchain_support.present_modes); const surface_format: vk.SurfaceFormatKHR = chooseSwapSurfaceFormat(swapchain_support.formats); const present_mode: vk.PresentModeKHR = chooseSwapPresentMode(swapchain_support.present_modes); const extent: vk.Extent2D = chooseSwapExtent(&swapchain_support.capabilities, width, height); var image_count: u32 = self.image_count; if (image_count < swapchain_support.capabilities.min_image_count) image_count = swapchain_support.capabilities.min_image_count; if (image_count < swapchain_support.capabilities.max_image_count) image_count = swapchain_support.capabilities.max_image_count; self.image_count = image_count; const queue_family_indices: [2]u32 = [_]u32{ vkctxt.vkc.family_indices.graphics_family, vkctxt.vkc.family_indices.present_family, }; const queue_concurrent: bool = queue_family_indices[0] != queue_family_indices[1]; const create_info: vk.SwapchainCreateInfoKHR = .{ .flags = .{}, .surface = vkctxt.vkc.surface, .min_image_count = self.image_count, .image_format = surface_format.format, .image_color_space = surface_format.color_space, .image_extent = extent, .image_array_layers = 1, .image_usage = .{ .color_attachment_bit = true, }, .pre_transform = swapchain_support.capabilities.current_transform, .composite_alpha = .{ .opaque_bit_khr = true, }, .present_mode = present_mode, .clipped = vk.TRUE, .old_swapchain = .null_handle, .image_sharing_mode = if (queue_concurrent) .concurrent else .exclusive, .queue_family_index_count = if (queue_concurrent) queue_family_indices.len else 0, .p_queue_family_indices = @ptrCast([*]const u32, &queue_family_indices), }; self.swapchain = vkctxt.vkd.createSwapchainKHR(vkctxt.vkc.device, create_info, null) catch |err| { vkctxt.printVulkanError("Can't create swapchain", err, vkctxt.vkc.allocator); return err; }; self.image_format = surface_format.format; self.image_extent = extent; _ = vkctxt.vkd.getSwapchainImagesKHR(vkctxt.vkc.device, self.swapchain, &self.image_count, null) catch |err| { vkctxt.printVulkanError("Can't get image count for swapchain", err, vkctxt.vkc.allocator); return err; }; self.images = vkctxt.vkc.allocator.alloc(vk.Image, self.image_count) catch { printError("Vulkan Wrapper", "Can't allocate images for swapchain on host"); return error.HostAllocationError; }; _ = vkctxt.vkd.getSwapchainImagesKHR(vkctxt.vkc.device, self.swapchain, &self.image_count, self.images.ptr) catch |err| { vkctxt.printVulkanError("Can't get images for swapchain", err, vkctxt.vkc.allocator); return err; }; } fn createImageViews(self: *Swapchain) !void { self.image_views = vkctxt.vkc.allocator.alloc(vk.ImageView, self.image_count) catch { printError("Vulkan Wrapper", "Can't allocate image views for swapchain on host"); return error.HostAllocationError; }; for (self.image_views) |*image_view, i| { const create_info: vk.ImageViewCreateInfo = .{ .flags = .{}, .image = self.images[i], .view_type = .@"2d", .format = self.image_format, .components = .{ .r = .identity, .g = .identity, .b = .identity, .a = .identity, }, .subresource_range = .{ .aspect_mask = .{ .color_bit = true, }, .base_mip_level = 0, .level_count = 1, .base_array_layer = 0, .layer_count = 1, }, }; image_view.* = vkctxt.vkd.createImageView(vkctxt.vkc.device, create_info, null) catch |err| { vkctxt.printVulkanError("Can't create image view", err, vkctxt.vkc.allocator); return err; }; } } fn createRenderPass(self: *Swapchain) !void { const color_attachment: vk.AttachmentDescription = .{ .flags = .{}, .format = self.image_format, .samples = .{ .@"1_bit" = true, }, .load_op = .clear, .store_op = .store, .stencil_load_op = .dont_care, .stencil_store_op = .dont_care, .initial_layout = .@"undefined", .final_layout = .present_src_khr, }; const color_attachment_ref: vk.AttachmentReference = .{ .attachment = 0, .layout = .color_attachment_optimal, }; const subpass: vk.SubpassDescription = .{ .flags = .{}, .pipeline_bind_point = .graphics, .color_attachment_count = 1, .p_color_attachments = @ptrCast([*]const vk.AttachmentReference, &color_attachment_ref), .input_attachment_count = 0, .p_input_attachments = undefined, .p_resolve_attachments = undefined, .p_depth_stencil_attachment = undefined, .preserve_attachment_count = 0, .p_preserve_attachments = undefined, }; const render_pass_create_info: vk.RenderPassCreateInfo = .{ .flags = .{}, .attachment_count = 1, .p_attachments = @ptrCast([*]const vk.AttachmentDescription, &color_attachment), .subpass_count = 1, .p_subpasses = @ptrCast([*]const vk.SubpassDescription, &subpass), .dependency_count = 0, .p_dependencies = undefined, }; self.render_pass = vkctxt.vkd.createRenderPass(vkctxt.vkc.device, render_pass_create_info, null) catch |err| { vkctxt.printVulkanError("Can't create render pass for swapchain", err, vkctxt.vkc.allocator); return err; }; } fn createSwapBuffers(self: *Swapchain) !void { self.framebuffers = vkctxt.vkc.allocator.alloc(vk.Framebuffer, self.image_count) catch { printError("Vulkan Wrapper", "Can't allocate framebuffers for swapchain in host"); return error.HostAllocationError; }; for (self.framebuffers) |*framebuffer, i| { const create_info: vk.FramebufferCreateInfo = .{ .flags = .{}, .render_pass = self.render_pass, .attachment_count = 1, .p_attachments = @ptrCast([*]const vk.ImageView, &self.image_views[i]), .width = self.image_extent.width, .height = self.image_extent.height, .layers = 1, }; framebuffer.* = vkctxt.vkd.createFramebuffer(vkctxt.vkc.device, create_info, null) catch |err| { vkctxt.printVulkanError("Can't create framebuffer for swapchain", err, vkctxt.vkc.allocator); return err; }; } } fn chooseSwapSurfaceFormat(available_formats: []vk.SurfaceFormatKHR) vk.SurfaceFormatKHR { for (available_formats) |format| { if (format.format == .r8g8b8a8_unorm and format.color_space == .srgb_nonlinear_khr) { return format; } } return available_formats[0]; } fn chooseSwapPresentMode(available_present_modes: []vk.PresentModeKHR) vk.PresentModeKHR { const vsync: bool = Application.app.config.getBool("swapchain_vsync", false); const prefered_modes: [1]vk.PresentModeKHR = [_]vk.PresentModeKHR{if (vsync) .mailbox_khr else .immediate_khr}; for (prefered_modes) |prefered_mode| { for (available_present_modes) |present_mode| { if (present_mode == prefered_mode) { return present_mode; } } } return .fifo_khr; } fn chooseSwapExtent(capabilities: *const vk.SurfaceCapabilitiesKHR, width: u32, height: u32) vk.Extent2D { if (capabilities.current_extent.width != comptime std.math.maxInt(u32)) { return capabilities.current_extent; } const actual_extent: vk.Extent2D = .{ .width = std.math.clamp(width, capabilities.min_image_extent.width, capabilities.max_image_extent.width), .height = std.math.clamp(height, capabilities.min_image_extent.height, capabilities.max_image_extent.height), }; return actual_extent; } };
src/renderer/render_graph/resources/swapchain.zig
const std = @import("std"); const ascii = std.ascii; const fmt = std.fmt; const io = std.io; const heap = std.heap; const mem = std.mem; const os = std.os; const _c = @cImport({ @cInclude("ctype.h"); @cInclude("limits.h"); @cInclude("sys/ioctl.h"); @cInclude("stdio.h"); @cInclude("stdlib.h"); @cInclude("termios.h"); @cInclude("unistd.h"); }); const kilo_version = "0.0.1"; pub fn main() anyerror!void { var gpa_allocator = gpa.allocator(); defer { const leaked = gpa.deinit(); if (leaked) panic("leaked memory", null); } var editor = try Editor.new(gpa_allocator); defer gpa_allocator.destroy(editor); const args = try std.process.argsAlloc(gpa_allocator); defer std.process.argsFree(gpa_allocator, args); if (args.len == 2) try editor.open(args[1]); try editor.enableRawMode(); defer editor.disableRawMode(); while (true) { try editor.refreshScreen(); try editor.processKeyPress(); if (editor.shutting_down) break; } editor.free(); try stdout.writeAll("\x1b[2J"); try stdout.writeAll("\x1b[H"); } pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { stdout.writeAll("\x1b[2J") catch {}; stdout.writeAll("\x1b[H") catch {}; std.builtin.default_panic(msg, error_return_trace); } var gpa = heap.GeneralPurposeAllocator(.{}){}; const StringArrayList = std.ArrayList([]u8); const Editor = struct { orig_termios: os.termios, screen_rows: u16, cols: u16, cx: i16, cy: i16, row_offset: usize, col_offset: usize, rows: StringArrayList, shutting_down: bool, allocator: mem.Allocator, const Self = @This(); fn new(allocator: mem.Allocator) !*Self { const ws = try getWindowSize(); var editor = try allocator.create(Self); editor.* = .{ .orig_termios = undefined, .screen_rows = ws.rows, .cols = ws.cols, .cx = 0, .cy = 0, .row_offset = 0, .col_offset = 0, .rows = StringArrayList.init(allocator), .shutting_down = false, .allocator = allocator, }; return editor; } fn free(self: *Self) void { for (self.rows.items) |row| self.allocator.free(row); self.rows.deinit(); } const max_size = 1 * 1024 * 1024; fn open(self: *Self, filename: []u8) !void { const file = try std.fs.cwd().openFile(filename, .{}); defer file.close(); while (try file.reader().readUntilDelimiterOrEofAlloc(self.allocator, '\n', max_size)) |line| { try self.rows.append(line); } } fn enableRawMode(self: *Self) !void { self.orig_termios = try os.tcgetattr(stdin_fd); var raw = self.orig_termios; raw.iflag &= ~@as(os.system.tcflag_t, os.system.BRKINT | os.system.ICRNL | os.system.INPCK | os.system.ISTRIP | os.system.IXON); raw.oflag &= ~@as(os.system.tcflag_t, os.system.OPOST); raw.cflag |= os.system.CS8; raw.lflag &= ~@as(os.system.tcflag_t, os.system.ECHO | os.system.ICANON | os.system.IEXTEN | os.system.ISIG); raw.cc[_c.VMIN] = 0; raw.cc[_c.VTIME] = 1; try os.tcsetattr(stdin_fd, os.TCSA.FLUSH, raw); } fn disableRawMode(self: *Self) void { os.tcsetattr(stdin_fd, os.TCSA.FLUSH, self.orig_termios) catch panic("tcsetattr", null); } fn moveCursor(self: *Self, movement: Movement) void { switch (movement) { .arrow_left => { if (self.cx > 0) self.cx -= 1; }, .arrow_right => { if (self.cx < self.cols - 1) self.cx += 1; }, .arrow_up => { if (self.cy > 0) self.cy -= 1; }, .arrow_down => { if (self.cy < self.rows.items.len - 1) self.cy += 1; }, .page_up, .page_down => { var n = self.screen_rows; while (n > 0) : (n -= 1) self.moveCursor(if (movement == .page_up) .arrow_up else .arrow_down); }, .home_key => self.cx = 0, .end_key => self.cx = @intCast(i16, self.cols) - 1, } } fn processKeyPress(self: *Self) !void { const key = try self.readKey(); switch (key) { .char => |ch| switch (ch) { ctrlKey('q') => self.shutting_down = true, else => {}, }, .movement => |m| self.moveCursor(m), .delete => {}, } } fn readKey(self: *Self) !Key { _ = self; const c = try readByte(); switch (c) { '\x1b' => { const c1 = readByte() catch return Key{ .char = '\x1b' }; if (c1 == '[') { const c2 = readByte() catch return Key{ .char = '\x1b' }; switch (c2) { 'A' => return Key{ .movement = .arrow_up }, 'B' => return Key{ .movement = .arrow_down }, 'C' => return Key{ .movement = .arrow_right }, 'D' => return Key{ .movement = .arrow_left }, 'F' => return Key{ .movement = .end_key }, 'H' => return Key{ .movement = .home_key }, '1' => { const c3 = readByte() catch return Key{ .char = '\x1b' }; if (c3 == '~') return Key{ .movement = .home_key }; }, '3' => { const c3 = readByte() catch return Key{ .char = '\x1b' }; if (c3 == '~') return Key.delete; }, '4' => { const c3 = readByte() catch return Key{ .char = '\x1b' }; if (c3 == '~') return Key{ .movement = .end_key }; }, '5' => { const c3 = readByte() catch return Key{ .char = '\x1b' }; if (c3 == '~') return Key{ .movement = .page_up }; }, '6' => { const c3 = readByte() catch return Key{ .char = '\x1b' }; if (c3 == '~') return Key{ .movement = .page_down }; }, else => {}, } } else if (c1 == 'O') { const c2 = readByte() catch return Key{ .char = '\x1b' }; switch (c2) { 'F' => return Key{ .movement = .end_key }, 'H' => return Key{ .movement = .home_key }, else => {}, } } }, ctrlKey('n') => return Key{ .movement = .arrow_down, }, ctrlKey('p') => return Key{ .movement = .arrow_up, }, ctrlKey('f') => return Key{ .movement = .arrow_right, }, ctrlKey('b') => return Key{ .movement = .arrow_left, }, else => {}, } return Key{ .char = c }; } fn drawRows(self: *Self, writer: anytype) !void { var y: usize = 0; while (y < self.screen_rows) : (y += 1) { const file_row = y + self.row_offset; if (file_row >= self.rows.items.len) { if (self.rows.items.len == 0 and y == self.screen_rows / 3) { var welcome = try fmt.allocPrint(self.allocator, "Kilo self -- version {s}", .{kilo_version}); defer self.allocator.free(welcome); if (welcome.len > self.cols) welcome = welcome[0..self.cols]; var padding = (self.cols - welcome.len) / 2; if (padding > 0) { try writer.writeAll("~"); padding -= 1; } while (padding > 0) : (padding -= 1) try writer.writeAll(" "); try writer.writeAll(welcome); } else { try writer.writeAll("~"); } } else { const row = self.rows.items[file_row]; var len = row.len; if (len > self.cols) len = self.cols; try writer.writeAll(row[0..len]); } try writer.writeAll("\x1b[K"); if (y < self.screen_rows - 1) try writer.writeAll("\r\n"); } } fn scroll(self: *Self) void { if (self.cy < self.row_offset) { self.row_offset = @intCast(usize, self.cy); } if (self.cy >= self.row_offset + self.screen_rows) { self.row_offset = @intCast(usize, self.cy - @intCast(i16, self.screen_rows) + 1); } } fn refreshScreen(self: *Self) !void { self.scroll(); var buf = std.ArrayList(u8).init(self.allocator); defer buf.deinit(); var writer = buf.writer(); try writer.writeAll("\x1b[?25l"); try writer.writeAll("\x1b[H"); try self.drawRows(writer); try writer.print("\x1b[{d};{d}H", .{ (self.cy - @intCast(i16, self.row_offset)) + 1, self.cx + 1 }); try writer.writeAll("\x1b[?25h"); try stdout.writeAll(buf.items); } }; inline fn ctrlKey(comptime ch: u8) u8 { return ch & 0x1f; } const stdin = io.getStdIn().reader(); const stdout = io.getStdOut().writer(); fn readByte() !u8 { var buf: [1]u8 = undefined; // const n = try stdin.read(buf[0..]); return buf[0]; } const Movement = enum { arrow_left, arrow_right, arrow_up, arrow_down, page_up, page_down, home_key, end_key, }; const Key = union(enum) { char: u8, movement: Movement, delete: void, }; const WindowSize = struct { rows: u16, cols: u16, }; fn getWindowSize() !WindowSize { var ws: os.system.winsize = undefined; switch (os.errno(os.system.ioctl(stdin_fd, _c.TIOCGWINSZ, &ws))) { std.c.E.SUCCESS => return WindowSize{ .rows = ws.ws_row, .cols = ws.ws_col }, // EBADF => return error.BadFileDescriptor, // EINVAL => return error.InvalidRequest, // ENOTTY => return error.NotATerminal, else => |err| return os.unexpectedErrno(err), } } const stdin_fd = io.getStdIn().handle;
.save/ff.zig
const PORTC_PIN7: u32 = 7; // USER GREEN LED on GPIO A Bus, Pin 5 const LED_GRN: u32 = PORTC_PIN7; // USER GREEN LED on GPIO A Bus, Pin 5 const PORTB_PIN7: u32 = 7; // USER BLUE LED on GPIO B Bus, Pin 7 const LED_BLU: u32 = PORTB_PIN7; // USER BLUE LED on GPIO B Bus, Pin 7 const PORTA_PIN9: u32 = 9; // USER RED LED on GPIO 9 Bus, Pin 9 const LED_RED: u32 = PORTA_PIN9; // USER RED LED on GPIO 9 Bus, Pin 9 // GPIO Port A REGISTERS const GPIOA_BASE: u32 = 0x42020000; // GPIO Port A base address const GPIOA_MODER = @intToPtr(*volatile u32, GPIOA_BASE + 0x00); // Port A Mode register const GPIOA_OTYPER = @intToPtr(*volatile u32, GPIOA_BASE + 0x04); // Port A Output Type Register const GPIOA_BSRR = @intToPtr(*volatile u32, GPIOA_BASE + 0x18); // Output Data Set And Reset Register // GPIO Port B REGISTERS const GPIOB_BASE: u32 = 0x42020400; // GPIO Port A base address const GPIOB_MODER = @intToPtr(*volatile u32, GPIOB_BASE + 0x00); // Port A Mode register const GPIOB_OTYPER = @intToPtr(*volatile u32, GPIOB_BASE + 0x04); // Port A Output Type Register const GPIOB_BSRR = @intToPtr(*volatile u32, GPIOB_BASE + 0x18); // Output Data Set And Reset Register // GPIO Port B REGISTERS const GPIOC_BASE: u32 = 0x42020800; // GPIO Port C base address const GPIOC_MODER = @intToPtr(*volatile u32, GPIOC_BASE + 0x00); // Port C Mode register const GPIOC_OTYPER = @intToPtr(*volatile u32, GPIOC_BASE + 0x04); // Port C Output Type Register const GPIOC_BSRR = @intToPtr(*volatile u32, GPIOC_BASE + 0x18); // Output Data Set And Reset Register const PORTA_AHBEN: u32 = 0; // GPIOA Enable is located on AHB2 Board Bit 0 const PORTB_AHBEN: u32 = 1; // GPIOB Enable is located on AHB2 Board Bit 1 const PORTC_AHBEN: u32 = 2; // GPIOC Enable is located on AHB2 Board Bit 2 // Reset and Clock Control (RCC) const RCC_BASE: u32 = 0x40021000; // RCC base address const RCC_CR = @intToPtr(*volatile u32, RCC_BASE + 0x00); // Clock Control Register const RCC_AHB2ENR = @intToPtr(*volatile u32, RCC_BASE + 0x4C); // AHB2 Enable Register // User required const MASK_2_BIT: u32 = 0x00000003; export fn _system_init() void { // RCC SHOULD ALWAYS BE IN THE SYSTEM INIT TRYING TO OPERATE THE GPIO PINS EVEN ACTIVATING WILL CAUSE ISSUES AS THERE IS NO CLOCK TO RUN RCC_AHB2ENR.* |= (1<<PORTA_AHBEN); RCC_AHB2ENR.* |= (1<<PORTB_AHBEN); RCC_AHB2ENR.* |= (1<<PORTC_AHBEN); } export fn _start() void { // Initialize the LED on L432KC board // Form a Pointer Via Register Address And Write Volitile To That Address // From Page 267 0x01 = General Output As The Output For The USER LED is at 3 it is x 2 GPIOA_MODER.* &= ~@as(u32, (MASK_2_BIT<<(LED_RED * 2))); GPIOA_MODER.* |= (1<<(LED_RED * 2)); GPIOB_MODER.* &= ~@as(u32, (MASK_2_BIT<<(LED_BLU * 2))); GPIOB_MODER.* |= (1<<(LED_BLU * 2)); GPIOC_MODER.* &= ~@as(u32, (MASK_2_BIT<<(LED_GRN * 2))); GPIOC_MODER.* |= (1<<(LED_GRN * 2)); // From Page 268 0x0 = Push Pull From Board Docs, LED is Push Pull so we ensure the bit is not set by inverting // In Practice this would set all others to open drain but since we are running only 1 output here we can get away with it GPIOA_OTYPER.* &= ~@as(u32, (1<<LED_RED)); GPIOB_OTYPER.* &= ~@as(u32, (1<<LED_BLU)); GPIOC_OTYPER.* &= ~@as(u32, (1<<LED_GRN)); var i :u32= 0; while(true) { while (i <= 1200000) : (i += 1) { if (i == 300000) { // From Page 270 0x1 turns on the output and offset + 16 will reset the output when set GPIOC_BSRR.* |= (1 << LED_GRN); } else if (i == 0) { // From Page 270 0x1 turns on the output and offset + 16 will reset the output when set GPIOC_BSRR.* |= (1<<(LED_GRN + 16)); } if (i == 600000) { // From Page 270 0x1 turns on the output and offset + 16 will reset the output when set GPIOB_BSRR.* |= (1<<LED_BLU); } else if (i == 0) { // From Page 270 0x1 turns on the output and offset + 16 will reset the output when set GPIOB_BSRR.* |= (1<<(LED_BLU + 16)); } if (i == 900000) { // From Page 270 0x1 turns on the output and offset + 16 will reset the output when set GPIOA_BSRR.* |= (1<<LED_RED); } else if (i == 0) { // From Page 270 0x1 turns on the output and offset + 16 will reset the output when set GPIOA_BSRR.* |= (1<<(LED_RED + 16)); } } i = 0; } } export fn __aeabi_unwind_cpp_pr0() void {}
src/main.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); } const gsize = 100; const Grid = [gsize * gsize]u1; fn readgrid(g: Grid, x: i32, y: i32) u32 { if (x < 0 or x >= gsize) return 0; if (y < 0 or y >= gsize) return 0; return g[@intCast(usize, y * gsize + x)]; } fn compute_next(init: Grid) Grid { var g: Grid = undefined; var y: i32 = 0; while (y < gsize) : (y += 1) { var x: i32 = 0; while (x < gsize) : (x += 1) { const neib: u32 = readgrid(init, x - 1, y - 1) + readgrid(init, x, y - 1) + readgrid(init, x + 1, y - 1) + readgrid(init, x - 1, y) + readgrid(init, x + 1, y) + readgrid(init, x - 1, y + 1) + readgrid(init, x, y + 1) + readgrid(init, x + 1, y + 1); const wason = readgrid(init, x, y) != 0; g[@intCast(usize, y * gsize + x)] = if ((wason and (neib == 2 or neib == 3)) or (!wason and neib == 3)) 1 else 0; } } g[@intCast(usize, 0 * gsize + 0)] = 1; g[@intCast(usize, (gsize - 1) * gsize + 0)] = 1; g[@intCast(usize, (gsize - 1) * gsize + (gsize - 1))] = 1; g[@intCast(usize, 0 * gsize + (gsize - 1))] = 1; return g; } fn parse_line(line: []const u8) ?u32 { const trimmed = std.mem.trim(u8, line, " \n\r\t"); if (trimmed.len == 0) return null; return std.fmt.parseInt(u32, trimmed, 10) catch unreachable; } 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, "day18.txt", limit); const init_grid = blk: { var g: Grid = undefined; var i: u32 = 0; for (text) |c| { switch (c) { '#' => { g[i] = 1; i += 1; }, '.' => { g[i] = 0; i += 1; }, else => continue, } } break :blk g; }; var steps: [100]Grid = undefined; for (steps) |s, i| { s = compute_next(if (i == 0) init_grid else steps[i - 1]); } var nlights: u32 = 0; for (steps[99]) |l| { if (l != 0) nlights += 1; } const out = std.io.getStdOut().writer(); try out.print("ans = {}\n", nlights); // return error.SolutionNotFound; }
2015/day18.zig
const sf = @import("../sfml.zig"); pub const Music = struct { const Self = @This(); // Constructor/destructor /// Loads music from a file pub fn initFromFile(path: [:0]const u8) !Self { var music = sf.c.sfMusic_createFromFile(path); if (music == null) return sf.Error.resourceLoadingError; return Self{ .ptr = music.? }; } pub const initFromMemory = @compileError("Function is not implemented yet."); pub const initFromStream = @compileError("Function is not implemented yet."); /// Destroys this music object pub fn deinit(self: Self) void { sf.c.sfMusic_destroy(self.ptr); } // Music control functions /// Plays the music pub fn play(self: Self) void { sf.c.sfMusic_play(self.ptr); } /// Pauses the music pub fn pause(self: Self) void { sf.c.sfMusic_pause(self.ptr); } /// Stops the music and resets the player position pub fn stop(self: Self) void { sf.c.sfMusic_stop(self.ptr); } // Getters / Setters /// Gets the total duration of the music pub fn getDuration(self: Self) sf.Time { return sf.Time.fromCSFML(sf.c.sfMusic_getDuration(self.ptr)); } /// Gets the current stream position of the music pub fn getPlayingOffset(self: Self) sf.Time { return sf.Time.fromCSFML(sf.c.sfMusic_getPlayingOffset(self.ptr)); } /// Sets the current stream position of the music pub fn setPlayingOffset(self: Self, offset: sf.Time) void { sf.c.sfMusic_setPlayingOffset(self.ptr, offset.toCSFML()); } /// Gets the loop points of the music pub fn getLoopPoints(self: Self) sf.TimeSpan { return sf.TimeSpan.fromCSFML(sf.c.sfMusic_getLoopPoints(self.ptr)); } /// Gets the loop points of the music pub fn setLoopPoints(self: Self, span: sf.TimeSpan) void { sf.c.sfMusic_setLoopPoints(self.ptr, span.toCSFML()); } /// Tells whether or not this stream is in loop mode pub fn getLoop(self: Self) bool { return sf.c.sfMusic_getLoop(self.ptr) != 0; } /// Enable or disable auto loop pub fn setLoop(self: Self, loop: bool) void { sf.c.sfMusic_setLoop(self.ptr, if (loop) 1 else 0); } /// Sets the pitch of the music pub fn getPitch(self: Self) f32 { return sf.c.sfMusic_getPitch(self.ptr); } /// Gets the pitch of the music pub fn setPitch(self: Self, pitch: f32) void { sf.c.sfMusic_setPitch(self.ptr, pitch); } /// Sets the volume of the music pub fn getVolume(self: Self) f32 { return sf.c.sfMusic_getVolume(self.ptr); } /// Gets the volume of the music pub fn setVolume(self: Self, volume: f32) void { sf.c.sfMusic_setVolume(self.ptr, volume); } /// Gets the sample rate of this music pub fn getSampleRate(self: Self) usize { return @intCast(usize, sf.c.sfMusic_getSampleRate(self.ptr)); } /// Gets the channel count of the music pub fn getChannelCount(self: Self) usize { return @intCast(usize, sf.c.sfMusic_getChannelCount(self.ptr)); } pub const getStatus = @compileError("Function is not implemented yet."); pub const setRelativeToListener = @compileError("Function is not implemented yet."); pub const isRelativeToListener = @compileError("Function is not implemented yet."); pub const setMinDistance = @compileError("Function is not implemented yet."); pub const setAttenuation = @compileError("Function is not implemented yet."); pub const getMinDistance = @compileError("Function is not implemented yet."); pub const getAttenuation = @compileError("Function is not implemented yet."); /// Pointer to the csfml music ptr: *sf.c.sfMusic, };
src/sfml/audio/music.zig
pub const DXC_HASHFLAG_INCLUDES_SOURCE = @as(u32, 1); pub const DxcValidatorFlags_Default = @as(u32, 0); pub const DxcValidatorFlags_InPlaceEdit = @as(u32, 1); pub const DxcValidatorFlags_RootSignatureOnly = @as(u32, 2); pub const DxcValidatorFlags_ModuleOnly = @as(u32, 4); pub const DxcValidatorFlags_ValidMask = @as(u32, 7); pub const DxcVersionInfoFlags_None = @as(u32, 0); pub const DxcVersionInfoFlags_Debug = @as(u32, 1); pub const DxcVersionInfoFlags_Internal = @as(u32, 2); pub const CLSID_DxcCompiler = Guid.initString("73e22d93-e6ce-47f3-b5bf-f0664f39c1b0"); pub const CLSID_DxcLinker = Guid.initString("ef6a8087-b0ea-4d56-9e45-d07e1a8b7806"); pub const CLSID_DxcDiaDataSource = Guid.initString("cd1f6b73-2ab0-484d-8edc-ebe7a43ca09f"); pub const CLSID_DxcCompilerArgs = Guid.initString("3e56ae82-224d-470f-a1a1-fe3016ee9f9d"); pub const CLSID_DxcLibrary = Guid.initString("6245d6af-66e0-48fd-80b4-4d271796748c"); pub const CLSID_DxcValidator = Guid.initString("8ca3e215-f728-4cf3-8cdd-88af917587a1"); pub const CLSID_DxcAssembler = Guid.initString("d728db68-f903-4f80-94cd-dccf76ec7151"); pub const CLSID_DxcContainerReflection = Guid.initString("b9f54489-55b8-400c-ba3a-1675e4728b91"); pub const CLSID_DxcOptimizer = Guid.initString("ae2cd79f-cc22-453f-9b6b-b124e7a5204c"); pub const CLSID_DxcContainerBuilder = Guid.initString("94134294-411f-4574-b4d0-8741e25240d2"); pub const CLSID_DxcPdbUtils = Guid.initString("54621dfb-f2ce-457e-ae8c-ec355faeec7c"); //-------------------------------------------------------------------------------- // Section: Types (34) //-------------------------------------------------------------------------------- pub const DXC_CP = enum(u32) { ACP = 0, UTF16 = 1200, UTF8 = 65001, }; pub const DXC_CP_ACP = DXC_CP.ACP; pub const DXC_CP_UTF16 = DXC_CP.UTF16; pub const DXC_CP_UTF8 = DXC_CP.UTF8; pub const DxcCreateInstanceProc = fn( rclsid: ?*const Guid, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const DxcCreateInstance2Proc = fn( pMalloc: ?*IMalloc, rclsid: ?*const Guid, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const DxcShaderHash = extern struct { Flags: u32, HashDigest: [16]u8, }; const IID_IDxcBlob_Value = @import("../../zig.zig").Guid.initString("8ba5fb08-5195-40e2-ac58-0d989c3a0102"); pub const IID_IDxcBlob = &IID_IDxcBlob_Value; pub const IDxcBlob = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBufferPointer: fn( self: *const IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, GetBufferSize: fn( self: *const IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) usize, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlob_GetBufferPointer(self: *const T) callconv(.Inline) ?*anyopaque { return @ptrCast(*const IDxcBlob.VTable, self.vtable).GetBufferPointer(@ptrCast(*const IDxcBlob, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlob_GetBufferSize(self: *const T) callconv(.Inline) usize { return @ptrCast(*const IDxcBlob.VTable, self.vtable).GetBufferSize(@ptrCast(*const IDxcBlob, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcBlobEncoding_Value = @import("../../zig.zig").Guid.initString("7241d424-2646-4191-97c0-98e96e42fc68"); pub const IID_IDxcBlobEncoding = &IID_IDxcBlobEncoding_Value; pub const IDxcBlobEncoding = extern struct { pub const VTable = extern struct { base: IDxcBlob.VTable, GetEncoding: fn( self: *const IDxcBlobEncoding, pKnown: ?*BOOL, pCodePage: ?*DXC_CP, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcBlob.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlobEncoding_GetEncoding(self: *const T, pKnown: ?*BOOL, pCodePage: ?*DXC_CP) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcBlobEncoding.VTable, self.vtable).GetEncoding(@ptrCast(*const IDxcBlobEncoding, self), pKnown, pCodePage); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcBlobUtf16_Value = @import("../../zig.zig").Guid.initString("a3f84eab-0faa-497e-a39c-ee6ed60b2d84"); pub const IID_IDxcBlobUtf16 = &IID_IDxcBlobUtf16_Value; pub const IDxcBlobUtf16 = extern struct { pub const VTable = extern struct { base: IDxcBlobEncoding.VTable, GetStringPointer: fn( self: *const IDxcBlobUtf16, ) callconv(@import("std").os.windows.WINAPI) ?PWSTR, GetStringLength: fn( self: *const IDxcBlobUtf16, ) callconv(@import("std").os.windows.WINAPI) usize, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcBlobEncoding.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlobUtf16_GetStringPointer(self: *const T) callconv(.Inline) ?PWSTR { return @ptrCast(*const IDxcBlobUtf16.VTable, self.vtable).GetStringPointer(@ptrCast(*const IDxcBlobUtf16, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlobUtf16_GetStringLength(self: *const T) callconv(.Inline) usize { return @ptrCast(*const IDxcBlobUtf16.VTable, self.vtable).GetStringLength(@ptrCast(*const IDxcBlobUtf16, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcBlobUtf8_Value = @import("../../zig.zig").Guid.initString("3da636c9-ba71-4024-a301-30cbf125305b"); pub const IID_IDxcBlobUtf8 = &IID_IDxcBlobUtf8_Value; pub const IDxcBlobUtf8 = extern struct { pub const VTable = extern struct { base: IDxcBlobEncoding.VTable, GetStringPointer: fn( self: *const IDxcBlobUtf8, ) callconv(@import("std").os.windows.WINAPI) ?PSTR, GetStringLength: fn( self: *const IDxcBlobUtf8, ) callconv(@import("std").os.windows.WINAPI) usize, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcBlobEncoding.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlobUtf8_GetStringPointer(self: *const T) callconv(.Inline) ?PSTR { return @ptrCast(*const IDxcBlobUtf8.VTable, self.vtable).GetStringPointer(@ptrCast(*const IDxcBlobUtf8, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcBlobUtf8_GetStringLength(self: *const T) callconv(.Inline) usize { return @ptrCast(*const IDxcBlobUtf8.VTable, self.vtable).GetStringLength(@ptrCast(*const IDxcBlobUtf8, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcIncludeHandler_Value = @import("../../zig.zig").Guid.initString("7f61fc7d-950d-467f-b3e3-3c02fb49187c"); pub const IID_IDxcIncludeHandler = &IID_IDxcIncludeHandler_Value; pub const IDxcIncludeHandler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, LoadSource: fn( self: *const IDxcIncludeHandler, pFilename: ?[*:0]const u16, ppIncludeSource: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcIncludeHandler_LoadSource(self: *const T, pFilename: ?[*:0]const u16, ppIncludeSource: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcIncludeHandler.VTable, self.vtable).LoadSource(@ptrCast(*const IDxcIncludeHandler, self), pFilename, ppIncludeSource); } };} pub usingnamespace MethodMixin(@This()); }; pub const DxcBuffer = extern struct { Ptr: ?*const anyopaque, Size: usize, Encoding: u32, }; pub const DxcDefine = extern struct { Name: ?[*:0]const u16, Value: ?[*:0]const u16, }; const IID_IDxcCompilerArgs_Value = @import("../../zig.zig").Guid.initString("73effe2a-70dc-45f8-9690-eff64c02429d"); pub const IID_IDxcCompilerArgs = &IID_IDxcCompilerArgs_Value; pub const IDxcCompilerArgs = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetArguments: fn( self: *const IDxcCompilerArgs, ) callconv(@import("std").os.windows.WINAPI) ?*?PWSTR, GetCount: fn( self: *const IDxcCompilerArgs, ) callconv(@import("std").os.windows.WINAPI) u32, AddArguments: fn( self: *const IDxcCompilerArgs, pArguments: ?[*]?PWSTR, argCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddArgumentsUTF8: fn( self: *const IDxcCompilerArgs, pArguments: ?[*]?PSTR, argCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddDefines: fn( self: *const IDxcCompilerArgs, pDefines: [*]const DxcDefine, defineCount: 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 IDxcCompilerArgs_GetArguments(self: *const T) callconv(.Inline) ?*?PWSTR { return @ptrCast(*const IDxcCompilerArgs.VTable, self.vtable).GetArguments(@ptrCast(*const IDxcCompilerArgs, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompilerArgs_GetCount(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IDxcCompilerArgs.VTable, self.vtable).GetCount(@ptrCast(*const IDxcCompilerArgs, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompilerArgs_AddArguments(self: *const T, pArguments: ?[*]?PWSTR, argCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompilerArgs.VTable, self.vtable).AddArguments(@ptrCast(*const IDxcCompilerArgs, self), pArguments, argCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompilerArgs_AddArgumentsUTF8(self: *const T, pArguments: ?[*]?PSTR, argCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompilerArgs.VTable, self.vtable).AddArgumentsUTF8(@ptrCast(*const IDxcCompilerArgs, self), pArguments, argCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompilerArgs_AddDefines(self: *const T, pDefines: [*]const DxcDefine, defineCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompilerArgs.VTable, self.vtable).AddDefines(@ptrCast(*const IDxcCompilerArgs, self), pDefines, defineCount); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcLibrary_Value = @import("../../zig.zig").Guid.initString("e5204dc7-d18c-4c3c-bdfb-851673980fe7"); pub const IID_IDxcLibrary = &IID_IDxcLibrary_Value; pub const IDxcLibrary = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetMalloc: fn( self: *const IDxcLibrary, pMalloc: ?*IMalloc, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlobFromBlob: fn( self: *const IDxcLibrary, pBlob: ?*IDxcBlob, offset: u32, length: u32, ppResult: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlobFromFile: fn( self: *const IDxcLibrary, pFileName: ?[*:0]const u16, codePage: ?*DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlobWithEncodingFromPinned: fn( self: *const IDxcLibrary, // TODO: what to do with BytesParamIndex 1? pText: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlobWithEncodingOnHeapCopy: fn( self: *const IDxcLibrary, // TODO: what to do with BytesParamIndex 1? pText: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlobWithEncodingOnMalloc: fn( self: *const IDxcLibrary, // TODO: what to do with BytesParamIndex 2? pText: ?*const anyopaque, pIMalloc: ?*IMalloc, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateIncludeHandler: fn( self: *const IDxcLibrary, ppResult: ?*?*IDxcIncludeHandler, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateStreamFromBlobReadOnly: fn( self: *const IDxcLibrary, pBlob: ?*IDxcBlob, ppStream: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBlobAsUtf8: fn( self: *const IDxcLibrary, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBlobAsUtf16: fn( self: *const IDxcLibrary, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_SetMalloc(self: *const T, pMalloc: ?*IMalloc) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).SetMalloc(@ptrCast(*const IDxcLibrary, self), pMalloc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateBlobFromBlob(self: *const T, pBlob: ?*IDxcBlob, offset: u32, length: u32, ppResult: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateBlobFromBlob(@ptrCast(*const IDxcLibrary, self), pBlob, offset, length, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateBlobFromFile(self: *const T, pFileName: ?[*:0]const u16, codePage: ?*DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateBlobFromFile(@ptrCast(*const IDxcLibrary, self), pFileName, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateBlobWithEncodingFromPinned(self: *const T, pText: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateBlobWithEncodingFromPinned(@ptrCast(*const IDxcLibrary, self), pText, size, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateBlobWithEncodingOnHeapCopy(self: *const T, pText: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateBlobWithEncodingOnHeapCopy(@ptrCast(*const IDxcLibrary, self), pText, size, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateBlobWithEncodingOnMalloc(self: *const T, pText: ?*const anyopaque, pIMalloc: ?*IMalloc, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateBlobWithEncodingOnMalloc(@ptrCast(*const IDxcLibrary, self), pText, pIMalloc, size, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateIncludeHandler(self: *const T, ppResult: ?*?*IDxcIncludeHandler) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateIncludeHandler(@ptrCast(*const IDxcLibrary, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_CreateStreamFromBlobReadOnly(self: *const T, pBlob: ?*IDxcBlob, ppStream: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).CreateStreamFromBlobReadOnly(@ptrCast(*const IDxcLibrary, self), pBlob, ppStream); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_GetBlobAsUtf8(self: *const T, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).GetBlobAsUtf8(@ptrCast(*const IDxcLibrary, self), pBlob, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLibrary_GetBlobAsUtf16(self: *const T, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLibrary.VTable, self.vtable).GetBlobAsUtf16(@ptrCast(*const IDxcLibrary, self), pBlob, pBlobEncoding); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcOperationResult_Value = @import("../../zig.zig").Guid.initString("cedb484a-d4e9-445a-b991-ca21ca157dc2"); pub const IID_IDxcOperationResult = &IID_IDxcOperationResult_Value; pub const IDxcOperationResult = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetStatus: fn( self: *const IDxcOperationResult, pStatus: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetResult: fn( self: *const IDxcOperationResult, ppResult: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetErrorBuffer: fn( self: *const IDxcOperationResult, ppErrors: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOperationResult_GetStatus(self: *const T, pStatus: ?*HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOperationResult.VTable, self.vtable).GetStatus(@ptrCast(*const IDxcOperationResult, self), pStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOperationResult_GetResult(self: *const T, ppResult: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOperationResult.VTable, self.vtable).GetResult(@ptrCast(*const IDxcOperationResult, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOperationResult_GetErrorBuffer(self: *const T, ppErrors: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOperationResult.VTable, self.vtable).GetErrorBuffer(@ptrCast(*const IDxcOperationResult, self), ppErrors); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcCompiler_Value = @import("../../zig.zig").Guid.initString("8c210bf3-011f-4422-8d70-6f9acb8db617"); pub const IID_IDxcCompiler = &IID_IDxcCompiler_Value; pub const IDxcCompiler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Compile: fn( self: *const IDxcCompiler, pSource: ?*IDxcBlob, pSourceName: ?[*:0]const u16, pEntryPoint: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Preprocess: fn( self: *const IDxcCompiler, pSource: ?*IDxcBlob, pSourceName: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disassemble: fn( self: *const IDxcCompiler, pSource: ?*IDxcBlob, ppDisassembly: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompiler_Compile(self: *const T, pSource: ?*IDxcBlob, pSourceName: ?[*:0]const u16, pEntryPoint: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompiler.VTable, self.vtable).Compile(@ptrCast(*const IDxcCompiler, self), pSource, pSourceName, pEntryPoint, pTargetProfile, pArguments, argCount, pDefines, defineCount, pIncludeHandler, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompiler_Preprocess(self: *const T, pSource: ?*IDxcBlob, pSourceName: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompiler.VTable, self.vtable).Preprocess(@ptrCast(*const IDxcCompiler, self), pSource, pSourceName, pArguments, argCount, pDefines, defineCount, pIncludeHandler, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompiler_Disassemble(self: *const T, pSource: ?*IDxcBlob, ppDisassembly: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompiler.VTable, self.vtable).Disassemble(@ptrCast(*const IDxcCompiler, self), pSource, ppDisassembly); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcCompiler2_Value = @import("../../zig.zig").Guid.initString("a005a9d9-b8bb-4594-b5c9-0e633bec4d37"); pub const IID_IDxcCompiler2 = &IID_IDxcCompiler2_Value; pub const IDxcCompiler2 = extern struct { pub const VTable = extern struct { base: IDxcCompiler.VTable, CompileWithDebug: fn( self: *const IDxcCompiler2, pSource: ?*IDxcBlob, pSourceName: ?[*:0]const u16, pEntryPoint: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, ppResult: ?*?*IDxcOperationResult, ppDebugBlobName: ?*?PWSTR, ppDebugBlob: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcCompiler.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompiler2_CompileWithDebug(self: *const T, pSource: ?*IDxcBlob, pSourceName: ?[*:0]const u16, pEntryPoint: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, ppResult: ?*?*IDxcOperationResult, ppDebugBlobName: ?*?PWSTR, ppDebugBlob: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompiler2.VTable, self.vtable).CompileWithDebug(@ptrCast(*const IDxcCompiler2, self), pSource, pSourceName, pEntryPoint, pTargetProfile, pArguments, argCount, pDefines, defineCount, pIncludeHandler, ppResult, ppDebugBlobName, ppDebugBlob); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcLinker_Value = @import("../../zig.zig").Guid.initString("f1b5be2a-62dd-4327-a1c2-42ac1e1e78e6"); pub const IID_IDxcLinker = &IID_IDxcLinker_Value; pub const IDxcLinker = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterLibrary: fn( self: *const IDxcLinker, pLibName: ?[*:0]const u16, pLib: ?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Link: fn( self: *const IDxcLinker, pEntryName: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pLibNames: [*]const ?[*:0]const u16, libCount: u32, pArguments: ?[*]const ?[*:0]const u16, argCount: u32, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLinker_RegisterLibrary(self: *const T, pLibName: ?[*:0]const u16, pLib: ?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLinker.VTable, self.vtable).RegisterLibrary(@ptrCast(*const IDxcLinker, self), pLibName, pLib); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcLinker_Link(self: *const T, pEntryName: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pLibNames: [*]const ?[*:0]const u16, libCount: u32, pArguments: ?[*]const ?[*:0]const u16, argCount: u32, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcLinker.VTable, self.vtable).Link(@ptrCast(*const IDxcLinker, self), pEntryName, pTargetProfile, pLibNames, libCount, pArguments, argCount, ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcUtils_Value = @import("../../zig.zig").Guid.initString("4605c4cb-2019-492a-ada4-65f20bb7d67f"); pub const IID_IDxcUtils = &IID_IDxcUtils_Value; pub const IDxcUtils = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateBlobFromBlob: fn( self: *const IDxcUtils, pBlob: ?*IDxcBlob, offset: u32, length: u32, ppResult: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlobFromPinned: fn( self: *const IDxcUtils, // TODO: what to do with BytesParamIndex 1? pData: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MoveToBlob: fn( self: *const IDxcUtils, // TODO: what to do with BytesParamIndex 2? pData: ?*const anyopaque, pIMalloc: ?*IMalloc, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlob: fn( self: *const IDxcUtils, // TODO: what to do with BytesParamIndex 1? pData: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadFile: fn( self: *const IDxcUtils, pFileName: ?[*:0]const u16, pCodePage: ?*DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateReadOnlyStreamFromBlob: fn( self: *const IDxcUtils, pBlob: ?*IDxcBlob, ppStream: ?*?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateDefaultIncludeHandler: fn( self: *const IDxcUtils, ppResult: ?*?*IDxcIncludeHandler, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBlobAsUtf8: fn( self: *const IDxcUtils, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobUtf8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBlobAsUtf16: fn( self: *const IDxcUtils, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobUtf16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDxilContainerPart: fn( self: *const IDxcUtils, pShader: ?*const DxcBuffer, DxcPart: u32, ppPartData: ?*?*anyopaque, pPartSizeInBytes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateReflection: fn( self: *const IDxcUtils, pData: ?*const DxcBuffer, iid: ?*const Guid, ppvReflection: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BuildArguments: fn( self: *const IDxcUtils, pSourceName: ?[*:0]const u16, pEntryPoint: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, ppArgs: ?*?*IDxcCompilerArgs, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPDBContents: fn( self: *const IDxcUtils, pPDBBlob: ?*IDxcBlob, ppHash: ?*?*IDxcBlob, ppContainer: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_CreateBlobFromBlob(self: *const T, pBlob: ?*IDxcBlob, offset: u32, length: u32, ppResult: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).CreateBlobFromBlob(@ptrCast(*const IDxcUtils, self), pBlob, offset, length, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_CreateBlobFromPinned(self: *const T, pData: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).CreateBlobFromPinned(@ptrCast(*const IDxcUtils, self), pData, size, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_MoveToBlob(self: *const T, pData: ?*const anyopaque, pIMalloc: ?*IMalloc, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).MoveToBlob(@ptrCast(*const IDxcUtils, self), pData, pIMalloc, size, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_CreateBlob(self: *const T, pData: ?*const anyopaque, size: u32, codePage: DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).CreateBlob(@ptrCast(*const IDxcUtils, self), pData, size, codePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_LoadFile(self: *const T, pFileName: ?[*:0]const u16, pCodePage: ?*DXC_CP, pBlobEncoding: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).LoadFile(@ptrCast(*const IDxcUtils, self), pFileName, pCodePage, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_CreateReadOnlyStreamFromBlob(self: *const T, pBlob: ?*IDxcBlob, ppStream: ?*?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).CreateReadOnlyStreamFromBlob(@ptrCast(*const IDxcUtils, self), pBlob, ppStream); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_CreateDefaultIncludeHandler(self: *const T, ppResult: ?*?*IDxcIncludeHandler) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).CreateDefaultIncludeHandler(@ptrCast(*const IDxcUtils, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_GetBlobAsUtf8(self: *const T, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobUtf8) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).GetBlobAsUtf8(@ptrCast(*const IDxcUtils, self), pBlob, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_GetBlobAsUtf16(self: *const T, pBlob: ?*IDxcBlob, pBlobEncoding: ?*?*IDxcBlobUtf16) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).GetBlobAsUtf16(@ptrCast(*const IDxcUtils, self), pBlob, pBlobEncoding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_GetDxilContainerPart(self: *const T, pShader: ?*const DxcBuffer, DxcPart: u32, ppPartData: ?*?*anyopaque, pPartSizeInBytes: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).GetDxilContainerPart(@ptrCast(*const IDxcUtils, self), pShader, DxcPart, ppPartData, pPartSizeInBytes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_CreateReflection(self: *const T, pData: ?*const DxcBuffer, iid: ?*const Guid, ppvReflection: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).CreateReflection(@ptrCast(*const IDxcUtils, self), pData, iid, ppvReflection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_BuildArguments(self: *const T, pSourceName: ?[*:0]const u16, pEntryPoint: ?[*:0]const u16, pTargetProfile: ?[*:0]const u16, pArguments: ?[*]?PWSTR, argCount: u32, pDefines: [*]const DxcDefine, defineCount: u32, ppArgs: ?*?*IDxcCompilerArgs) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).BuildArguments(@ptrCast(*const IDxcUtils, self), pSourceName, pEntryPoint, pTargetProfile, pArguments, argCount, pDefines, defineCount, ppArgs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcUtils_GetPDBContents(self: *const T, pPDBBlob: ?*IDxcBlob, ppHash: ?*?*IDxcBlob, ppContainer: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcUtils.VTable, self.vtable).GetPDBContents(@ptrCast(*const IDxcUtils, self), pPDBBlob, ppHash, ppContainer); } };} pub usingnamespace MethodMixin(@This()); }; pub const DXC_OUT_KIND = enum(i32) { NONE = 0, OBJECT = 1, ERRORS = 2, PDB = 3, SHADER_HASH = 4, DISASSEMBLY = 5, HLSL = 6, TEXT = 7, REFLECTION = 8, ROOT_SIGNATURE = 9, EXTRA_OUTPUTS = 10, FORCE_DWORD = -1, }; pub const DXC_OUT_NONE = DXC_OUT_KIND.NONE; pub const DXC_OUT_OBJECT = DXC_OUT_KIND.OBJECT; pub const DXC_OUT_ERRORS = DXC_OUT_KIND.ERRORS; pub const DXC_OUT_PDB = DXC_OUT_KIND.PDB; pub const DXC_OUT_SHADER_HASH = DXC_OUT_KIND.SHADER_HASH; pub const DXC_OUT_DISASSEMBLY = DXC_OUT_KIND.DISASSEMBLY; pub const DXC_OUT_HLSL = DXC_OUT_KIND.HLSL; pub const DXC_OUT_TEXT = DXC_OUT_KIND.TEXT; pub const DXC_OUT_REFLECTION = DXC_OUT_KIND.REFLECTION; pub const DXC_OUT_ROOT_SIGNATURE = DXC_OUT_KIND.ROOT_SIGNATURE; pub const DXC_OUT_EXTRA_OUTPUTS = DXC_OUT_KIND.EXTRA_OUTPUTS; pub const DXC_OUT_FORCE_DWORD = DXC_OUT_KIND.FORCE_DWORD; const IID_IDxcResult_Value = @import("../../zig.zig").Guid.initString("58346cda-dde7-4497-9461-6f87af5e0659"); pub const IID_IDxcResult = &IID_IDxcResult_Value; pub const IDxcResult = extern struct { pub const VTable = extern struct { base: IDxcOperationResult.VTable, HasOutput: fn( self: *const IDxcResult, dxcOutKind: DXC_OUT_KIND, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetOutput: fn( self: *const IDxcResult, dxcOutKind: DXC_OUT_KIND, iid: ?*const Guid, ppvObject: ?*?*anyopaque, ppOutputName: ?*?*IDxcBlobUtf16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNumOutputs: fn( self: *const IDxcResult, ) callconv(@import("std").os.windows.WINAPI) u32, GetOutputByIndex: fn( self: *const IDxcResult, Index: u32, ) callconv(@import("std").os.windows.WINAPI) DXC_OUT_KIND, PrimaryOutput: fn( self: *const IDxcResult, ) callconv(@import("std").os.windows.WINAPI) DXC_OUT_KIND, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcOperationResult.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcResult_HasOutput(self: *const T, dxcOutKind: DXC_OUT_KIND) callconv(.Inline) BOOL { return @ptrCast(*const IDxcResult.VTable, self.vtable).HasOutput(@ptrCast(*const IDxcResult, self), dxcOutKind); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcResult_GetOutput(self: *const T, dxcOutKind: DXC_OUT_KIND, iid: ?*const Guid, ppvObject: ?*?*anyopaque, ppOutputName: ?*?*IDxcBlobUtf16) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcResult.VTable, self.vtable).GetOutput(@ptrCast(*const IDxcResult, self), dxcOutKind, iid, ppvObject, ppOutputName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcResult_GetNumOutputs(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IDxcResult.VTable, self.vtable).GetNumOutputs(@ptrCast(*const IDxcResult, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcResult_GetOutputByIndex(self: *const T, Index: u32) callconv(.Inline) DXC_OUT_KIND { return @ptrCast(*const IDxcResult.VTable, self.vtable).GetOutputByIndex(@ptrCast(*const IDxcResult, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcResult_PrimaryOutput(self: *const T) callconv(.Inline) DXC_OUT_KIND { return @ptrCast(*const IDxcResult.VTable, self.vtable).PrimaryOutput(@ptrCast(*const IDxcResult, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcExtraOutputs_Value = @import("../../zig.zig").Guid.initString("319b37a2-a5c2-494a-a5de-4801b2faf989"); pub const IID_IDxcExtraOutputs = &IID_IDxcExtraOutputs_Value; pub const IDxcExtraOutputs = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetOutputCount: fn( self: *const IDxcExtraOutputs, ) callconv(@import("std").os.windows.WINAPI) u32, GetOutput: fn( self: *const IDxcExtraOutputs, uIndex: u32, iid: ?*const Guid, ppvObject: ?*?*anyopaque, ppOutputType: ?*?*IDxcBlobUtf16, ppOutputName: ?*?*IDxcBlobUtf16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcExtraOutputs_GetOutputCount(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IDxcExtraOutputs.VTable, self.vtable).GetOutputCount(@ptrCast(*const IDxcExtraOutputs, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcExtraOutputs_GetOutput(self: *const T, uIndex: u32, iid: ?*const Guid, ppvObject: ?*?*anyopaque, ppOutputType: ?*?*IDxcBlobUtf16, ppOutputName: ?*?*IDxcBlobUtf16) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcExtraOutputs.VTable, self.vtable).GetOutput(@ptrCast(*const IDxcExtraOutputs, self), uIndex, iid, ppvObject, ppOutputType, ppOutputName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcCompiler3_Value = @import("../../zig.zig").Guid.initString("228b4687-5a6a-4730-900c-9702b2203f54"); pub const IID_IDxcCompiler3 = &IID_IDxcCompiler3_Value; pub const IDxcCompiler3 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Compile: fn( self: *const IDxcCompiler3, pSource: ?*const DxcBuffer, pArguments: ?[*]?PWSTR, argCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, riid: ?*const Guid, ppResult: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disassemble: fn( self: *const IDxcCompiler3, pObject: ?*const DxcBuffer, riid: ?*const Guid, ppResult: ?*?*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 IDxcCompiler3_Compile(self: *const T, pSource: ?*const DxcBuffer, pArguments: ?[*]?PWSTR, argCount: u32, pIncludeHandler: ?*IDxcIncludeHandler, riid: ?*const Guid, ppResult: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompiler3.VTable, self.vtable).Compile(@ptrCast(*const IDxcCompiler3, self), pSource, pArguments, argCount, pIncludeHandler, riid, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcCompiler3_Disassemble(self: *const T, pObject: ?*const DxcBuffer, riid: ?*const Guid, ppResult: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcCompiler3.VTable, self.vtable).Disassemble(@ptrCast(*const IDxcCompiler3, self), pObject, riid, ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcValidator_Value = @import("../../zig.zig").Guid.initString("a6e82bd2-1fd7-4826-9811-2857e797f49a"); pub const IID_IDxcValidator = &IID_IDxcValidator_Value; pub const IDxcValidator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Validate: fn( self: *const IDxcValidator, pShader: ?*IDxcBlob, Flags: u32, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcValidator_Validate(self: *const T, pShader: ?*IDxcBlob, Flags: u32, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcValidator.VTable, self.vtable).Validate(@ptrCast(*const IDxcValidator, self), pShader, Flags, ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcValidator2_Value = @import("../../zig.zig").Guid.initString("458e1fd1-b1b2-4750-a6e1-9c10f03bed92"); pub const IID_IDxcValidator2 = &IID_IDxcValidator2_Value; pub const IDxcValidator2 = extern struct { pub const VTable = extern struct { base: IDxcValidator.VTable, ValidateWithDebug: fn( self: *const IDxcValidator2, pShader: ?*IDxcBlob, Flags: u32, pOptDebugBitcode: ?*DxcBuffer, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcValidator.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcValidator2_ValidateWithDebug(self: *const T, pShader: ?*IDxcBlob, Flags: u32, pOptDebugBitcode: ?*DxcBuffer, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcValidator2.VTable, self.vtable).ValidateWithDebug(@ptrCast(*const IDxcValidator2, self), pShader, Flags, pOptDebugBitcode, ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcContainerBuilder_Value = @import("../../zig.zig").Guid.initString("334b1f50-2292-4b35-99a1-25588d8c17fe"); pub const IID_IDxcContainerBuilder = &IID_IDxcContainerBuilder_Value; pub const IDxcContainerBuilder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Load: fn( self: *const IDxcContainerBuilder, pDxilContainerHeader: ?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddPart: fn( self: *const IDxcContainerBuilder, fourCC: u32, pSource: ?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemovePart: fn( self: *const IDxcContainerBuilder, fourCC: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SerializeContainer: fn( self: *const IDxcContainerBuilder, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerBuilder_Load(self: *const T, pDxilContainerHeader: ?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerBuilder.VTable, self.vtable).Load(@ptrCast(*const IDxcContainerBuilder, self), pDxilContainerHeader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerBuilder_AddPart(self: *const T, fourCC: u32, pSource: ?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerBuilder.VTable, self.vtable).AddPart(@ptrCast(*const IDxcContainerBuilder, self), fourCC, pSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerBuilder_RemovePart(self: *const T, fourCC: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerBuilder.VTable, self.vtable).RemovePart(@ptrCast(*const IDxcContainerBuilder, self), fourCC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerBuilder_SerializeContainer(self: *const T, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerBuilder.VTable, self.vtable).SerializeContainer(@ptrCast(*const IDxcContainerBuilder, self), ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcAssembler_Value = @import("../../zig.zig").Guid.initString("091f7a26-1c1f-4948-904b-e6e3a8a771d5"); pub const IID_IDxcAssembler = &IID_IDxcAssembler_Value; pub const IDxcAssembler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AssembleToContainer: fn( self: *const IDxcAssembler, pShader: ?*IDxcBlob, ppResult: ?*?*IDxcOperationResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcAssembler_AssembleToContainer(self: *const T, pShader: ?*IDxcBlob, ppResult: ?*?*IDxcOperationResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcAssembler.VTable, self.vtable).AssembleToContainer(@ptrCast(*const IDxcAssembler, self), pShader, ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcContainerReflection_Value = @import("../../zig.zig").Guid.initString("d2c21b26-8350-4bdc-976a-331ce6f4c54c"); pub const IID_IDxcContainerReflection = &IID_IDxcContainerReflection_Value; pub const IDxcContainerReflection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Load: fn( self: *const IDxcContainerReflection, pContainer: ?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPartCount: fn( self: *const IDxcContainerReflection, pResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPartKind: fn( self: *const IDxcContainerReflection, idx: u32, pResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPartContent: fn( self: *const IDxcContainerReflection, idx: u32, ppResult: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindFirstPartKind: fn( self: *const IDxcContainerReflection, kind: u32, pResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPartReflection: fn( self: *const IDxcContainerReflection, idx: u32, iid: ?*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 IDxcContainerReflection_Load(self: *const T, pContainer: ?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerReflection.VTable, self.vtable).Load(@ptrCast(*const IDxcContainerReflection, self), pContainer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerReflection_GetPartCount(self: *const T, pResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerReflection.VTable, self.vtable).GetPartCount(@ptrCast(*const IDxcContainerReflection, self), pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerReflection_GetPartKind(self: *const T, idx: u32, pResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerReflection.VTable, self.vtable).GetPartKind(@ptrCast(*const IDxcContainerReflection, self), idx, pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerReflection_GetPartContent(self: *const T, idx: u32, ppResult: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerReflection.VTable, self.vtable).GetPartContent(@ptrCast(*const IDxcContainerReflection, self), idx, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerReflection_FindFirstPartKind(self: *const T, kind: u32, pResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerReflection.VTable, self.vtable).FindFirstPartKind(@ptrCast(*const IDxcContainerReflection, self), kind, pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcContainerReflection_GetPartReflection(self: *const T, idx: u32, iid: ?*const Guid, ppvObject: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcContainerReflection.VTable, self.vtable).GetPartReflection(@ptrCast(*const IDxcContainerReflection, self), idx, iid, ppvObject); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcOptimizerPass_Value = @import("../../zig.zig").Guid.initString("ae2cd79f-cc22-453f-9b6b-b124e7a5204c"); pub const IID_IDxcOptimizerPass = &IID_IDxcOptimizerPass_Value; pub const IDxcOptimizerPass = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetOptionName: fn( self: *const IDxcOptimizerPass, ppResult: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescription: fn( self: *const IDxcOptimizerPass, ppResult: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionArgCount: fn( self: *const IDxcOptimizerPass, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionArgName: fn( self: *const IDxcOptimizerPass, argIndex: u32, ppResult: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOptionArgDescription: fn( self: *const IDxcOptimizerPass, argIndex: u32, ppResult: ?*?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 IDxcOptimizerPass_GetOptionName(self: *const T, ppResult: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizerPass.VTable, self.vtable).GetOptionName(@ptrCast(*const IDxcOptimizerPass, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizerPass_GetDescription(self: *const T, ppResult: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizerPass.VTable, self.vtable).GetDescription(@ptrCast(*const IDxcOptimizerPass, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizerPass_GetOptionArgCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizerPass.VTable, self.vtable).GetOptionArgCount(@ptrCast(*const IDxcOptimizerPass, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizerPass_GetOptionArgName(self: *const T, argIndex: u32, ppResult: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizerPass.VTable, self.vtable).GetOptionArgName(@ptrCast(*const IDxcOptimizerPass, self), argIndex, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizerPass_GetOptionArgDescription(self: *const T, argIndex: u32, ppResult: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizerPass.VTable, self.vtable).GetOptionArgDescription(@ptrCast(*const IDxcOptimizerPass, self), argIndex, ppResult); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcOptimizer_Value = @import("../../zig.zig").Guid.initString("25740e2e-9cba-401b-9119-4fb42f39f270"); pub const IID_IDxcOptimizer = &IID_IDxcOptimizer_Value; pub const IDxcOptimizer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAvailablePassCount: fn( self: *const IDxcOptimizer, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAvailablePass: fn( self: *const IDxcOptimizer, index: u32, ppResult: ?*?*IDxcOptimizerPass, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunOptimizer: fn( self: *const IDxcOptimizer, pBlob: ?*IDxcBlob, ppOptions: [*]?PWSTR, optionCount: u32, pOutputModule: ?*?*IDxcBlob, ppOutputText: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizer_GetAvailablePassCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizer.VTable, self.vtable).GetAvailablePassCount(@ptrCast(*const IDxcOptimizer, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizer_GetAvailablePass(self: *const T, index: u32, ppResult: ?*?*IDxcOptimizerPass) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizer.VTable, self.vtable).GetAvailablePass(@ptrCast(*const IDxcOptimizer, self), index, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcOptimizer_RunOptimizer(self: *const T, pBlob: ?*IDxcBlob, ppOptions: [*]?PWSTR, optionCount: u32, pOutputModule: ?*?*IDxcBlob, ppOutputText: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcOptimizer.VTable, self.vtable).RunOptimizer(@ptrCast(*const IDxcOptimizer, self), pBlob, ppOptions, optionCount, pOutputModule, ppOutputText); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcVersionInfo_Value = @import("../../zig.zig").Guid.initString("b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e"); pub const IID_IDxcVersionInfo = &IID_IDxcVersionInfo_Value; pub const IDxcVersionInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetVersion: fn( self: *const IDxcVersionInfo, pMajor: ?*u32, pMinor: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFlags: fn( self: *const IDxcVersionInfo, pFlags: ?*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 IDxcVersionInfo_GetVersion(self: *const T, pMajor: ?*u32, pMinor: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcVersionInfo.VTable, self.vtable).GetVersion(@ptrCast(*const IDxcVersionInfo, self), pMajor, pMinor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcVersionInfo_GetFlags(self: *const T, pFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcVersionInfo.VTable, self.vtable).GetFlags(@ptrCast(*const IDxcVersionInfo, self), pFlags); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcVersionInfo2_Value = @import("../../zig.zig").Guid.initString("fb6904c4-42f0-4b62-9c46-983af7da7c83"); pub const IID_IDxcVersionInfo2 = &IID_IDxcVersionInfo2_Value; pub const IDxcVersionInfo2 = extern struct { pub const VTable = extern struct { base: IDxcVersionInfo.VTable, GetCommitInfo: fn( self: *const IDxcVersionInfo2, pCommitCount: ?*u32, pCommitHash: ?*?*i8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDxcVersionInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcVersionInfo2_GetCommitInfo(self: *const T, pCommitCount: ?*u32, pCommitHash: ?*?*i8) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcVersionInfo2.VTable, self.vtable).GetCommitInfo(@ptrCast(*const IDxcVersionInfo2, self), pCommitCount, pCommitHash); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDxcVersionInfo3_Value = @import("../../zig.zig").Guid.initString("5e13e843-9d25-473c-9ad2-03b2d0b44b1e"); pub const IID_IDxcVersionInfo3 = &IID_IDxcVersionInfo3_Value; pub const IDxcVersionInfo3 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCustomVersionString: fn( self: *const IDxcVersionInfo3, pVersionString: ?*?*i8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcVersionInfo3_GetCustomVersionString(self: *const T, pVersionString: ?*?*i8) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcVersionInfo3.VTable, self.vtable).GetCustomVersionString(@ptrCast(*const IDxcVersionInfo3, self), pVersionString); } };} pub usingnamespace MethodMixin(@This()); }; pub const DxcArgPair = extern struct { pName: ?[*:0]const u16, pValue: ?[*:0]const u16, }; const IID_IDxcPdbUtils_Value = @import("../../zig.zig").Guid.initString("e6c9647e-9d6a-4c3b-b94c-524b5a6c343d"); pub const IID_IDxcPdbUtils = &IID_IDxcPdbUtils_Value; pub const IDxcPdbUtils = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Load: fn( self: *const IDxcPdbUtils, pPdbOrDxil: ?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceCount: fn( self: *const IDxcPdbUtils, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSource: fn( self: *const IDxcPdbUtils, uIndex: u32, ppResult: ?*?*IDxcBlobEncoding, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceName: fn( self: *const IDxcPdbUtils, uIndex: u32, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFlagCount: fn( self: *const IDxcPdbUtils, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFlag: fn( self: *const IDxcPdbUtils, uIndex: u32, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetArgCount: fn( self: *const IDxcPdbUtils, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetArg: fn( self: *const IDxcPdbUtils, uIndex: u32, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetArgPairCount: fn( self: *const IDxcPdbUtils, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetArgPair: fn( self: *const IDxcPdbUtils, uIndex: u32, pName: ?*?BSTR, pValue: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefineCount: fn( self: *const IDxcPdbUtils, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefine: fn( self: *const IDxcPdbUtils, uIndex: u32, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTargetProfile: fn( self: *const IDxcPdbUtils, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEntryPoint: fn( self: *const IDxcPdbUtils, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMainFileName: fn( self: *const IDxcPdbUtils, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHash: fn( self: *const IDxcPdbUtils, ppResult: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetName: fn( self: *const IDxcPdbUtils, pResult: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsFullPDB: fn( self: *const IDxcPdbUtils, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetFullPDB: fn( self: *const IDxcPdbUtils, ppFullPDB: ?*?*IDxcBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVersionInfo: fn( self: *const IDxcPdbUtils, ppVersionInfo: ?*?*IDxcVersionInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCompiler: fn( self: *const IDxcPdbUtils, pCompiler: ?*IDxcCompiler3, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CompileForFullPDB: fn( self: *const IDxcPdbUtils, ppResult: ?*?*IDxcResult, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OverrideArgs: fn( self: *const IDxcPdbUtils, pArgPairs: ?*DxcArgPair, uNumArgPairs: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OverrideRootSignature: fn( self: *const IDxcPdbUtils, pRootSignature: ?[*: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 IDxcPdbUtils_Load(self: *const T, pPdbOrDxil: ?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).Load(@ptrCast(*const IDxcPdbUtils, self), pPdbOrDxil); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetSourceCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetSourceCount(@ptrCast(*const IDxcPdbUtils, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetSource(self: *const T, uIndex: u32, ppResult: ?*?*IDxcBlobEncoding) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetSource(@ptrCast(*const IDxcPdbUtils, self), uIndex, ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetSourceName(self: *const T, uIndex: u32, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetSourceName(@ptrCast(*const IDxcPdbUtils, self), uIndex, pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetFlagCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetFlagCount(@ptrCast(*const IDxcPdbUtils, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetFlag(self: *const T, uIndex: u32, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetFlag(@ptrCast(*const IDxcPdbUtils, self), uIndex, pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetArgCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetArgCount(@ptrCast(*const IDxcPdbUtils, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetArg(self: *const T, uIndex: u32, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetArg(@ptrCast(*const IDxcPdbUtils, self), uIndex, pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetArgPairCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetArgPairCount(@ptrCast(*const IDxcPdbUtils, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetArgPair(self: *const T, uIndex: u32, pName: ?*?BSTR, pValue: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetArgPair(@ptrCast(*const IDxcPdbUtils, self), uIndex, pName, pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetDefineCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetDefineCount(@ptrCast(*const IDxcPdbUtils, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetDefine(self: *const T, uIndex: u32, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetDefine(@ptrCast(*const IDxcPdbUtils, self), uIndex, pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetTargetProfile(self: *const T, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetTargetProfile(@ptrCast(*const IDxcPdbUtils, self), pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetEntryPoint(self: *const T, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetEntryPoint(@ptrCast(*const IDxcPdbUtils, self), pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetMainFileName(self: *const T, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetMainFileName(@ptrCast(*const IDxcPdbUtils, self), pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetHash(self: *const T, ppResult: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetHash(@ptrCast(*const IDxcPdbUtils, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetName(self: *const T, pResult: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetName(@ptrCast(*const IDxcPdbUtils, self), pResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_IsFullPDB(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).IsFullPDB(@ptrCast(*const IDxcPdbUtils, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetFullPDB(self: *const T, ppFullPDB: ?*?*IDxcBlob) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetFullPDB(@ptrCast(*const IDxcPdbUtils, self), ppFullPDB); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_GetVersionInfo(self: *const T, ppVersionInfo: ?*?*IDxcVersionInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).GetVersionInfo(@ptrCast(*const IDxcPdbUtils, self), ppVersionInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_SetCompiler(self: *const T, pCompiler: ?*IDxcCompiler3) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).SetCompiler(@ptrCast(*const IDxcPdbUtils, self), pCompiler); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_CompileForFullPDB(self: *const T, ppResult: ?*?*IDxcResult) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).CompileForFullPDB(@ptrCast(*const IDxcPdbUtils, self), ppResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_OverrideArgs(self: *const T, pArgPairs: ?*DxcArgPair, uNumArgPairs: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).OverrideArgs(@ptrCast(*const IDxcPdbUtils, self), pArgPairs, uNumArgPairs); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDxcPdbUtils_OverrideRootSignature(self: *const T, pRootSignature: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IDxcPdbUtils.VTable, self.vtable).OverrideRootSignature(@ptrCast(*const IDxcPdbUtils, self), pRootSignature); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (2) //-------------------------------------------------------------------------------- pub extern "dxcompiler" fn DxcCreateInstance( rclsid: ?*const Guid, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "dxcompiler" fn DxcCreateInstance2( pMalloc: ?*IMalloc, rclsid: ?*const Guid, riid: ?*const Guid, ppv: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (9) //-------------------------------------------------------------------------------- const Guid = @import("../../zig.zig").Guid; const BOOL = @import("../../foundation.zig").BOOL; const BSTR = @import("../../foundation.zig").BSTR; const HRESULT = @import("../../foundation.zig").HRESULT; const IMalloc = @import("../../system/com.zig").IMalloc; const IStream = @import("../../system/com.zig").IStream; const IUnknown = @import("../../system/com.zig").IUnknown; 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(), "DxcCreateInstanceProc")) { _ = DxcCreateInstanceProc; } if (@hasDecl(@This(), "DxcCreateInstance2Proc")) { _ = DxcCreateInstance2Proc; } @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/direct3d/dxc.zig
const std = @import("std"); const cstr = std.cstr; pub const Flag = struct { name: [*:0]const u8, kind: enum { boolean, arg }, }; pub fn ParseResult(comptime flags: []const Flag) type { return struct { const Self = @This(); const FlagData = struct { name: [*:0]const u8, value: union { boolean: bool, arg: ?[*:0]const u8, }, }; /// Remaining args after the recognized flags args: [][*:0]const u8, /// Data obtained from parsed flags flag_data: [flags.len]FlagData = blk: { // Init all flags to false/null var flag_data: [flags.len]FlagData = undefined; inline for (flags) |flag, i| { flag_data[i] = switch (flag.kind) { .boolean => .{ .name = flag.name, .value = .{ .boolean = false }, }, .arg => .{ .name = flag.name, .value = .{ .arg = null }, }, }; } break :blk flag_data; }, pub fn boolFlag(self: Self, flag_name: [*:0]const u8) bool { for (self.flag_data) |flag_data| { if (cstr.cmp(flag_data.name, flag_name) == 0) return flag_data.value.boolean; } unreachable; // Invalid flag_name } pub fn argFlag(self: Self, flag_name: [*:0]const u8) ?[*:0]const u8 { for (self.flag_data) |flag_data| { if (cstr.cmp(flag_data.name, flag_name) == 0) return flag_data.value.arg; } unreachable; // Invalid flag_name } }; } pub fn parse(args: [][*:0]const u8, comptime flags: []const Flag) !ParseResult(flags) { var ret: ParseResult(flags) = .{ .args = undefined }; var arg_idx: usize = 0; while (arg_idx < args.len) : (arg_idx += 1) { var parsed_flag = false; inline for (flags) |flag, flag_idx| { if (cstr.cmp(flag.name, args[arg_idx]) == 0) { switch (flag.kind) { .boolean => ret.flag_data[flag_idx].value.boolean = true, .arg => { arg_idx += 1; if (arg_idx == args.len) { std.log.err("option '" ++ flag.name ++ "' requires an argument but none was provided!", .{}); return error.MissingFlagArgument; } ret.flag_data[flag_idx].value.arg = args[arg_idx]; }, } parsed_flag = true; } } if (!parsed_flag) break; } ret.args = args[arg_idx..]; return ret; }
source/river-0.1.0/common/flags.zig
const std = @import("std"); const print = std.debug.print; const Map = std.AutoHashMap(u8, u8); const Set = std.StaticBitSet(7); const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day08.txt"); fn mask(pattern: []const u8) Set { var set = Set.initEmpty(); for (pattern) |l| { set.set(l - 'a'); } return set; } fn count(a: Set, b: Set, expected: u8) bool { var t = a; t.setIntersection(b); return t.count() == expected; } fn createMap(patterns: [][]const u8) !Map { var map = Map.init(gpa); var four: Set = undefined; var seven: Set = undefined; // find the easy ones 1, 4, 7, 8 for (patterns) |pattern| { var m = mask(pattern); switch (pattern.len) { 2 => try map.put(m.mask, 1), 3 => { try map.put(m.mask, 7); seven = mask(pattern); }, 4 => { try map.put(m.mask, 4); four = mask(pattern); }, 7 => try map.put(m.mask, 8), else => {}, } } // now we know the rest based on 4 and 7 and number of set bits for (patterns) |pattern| { var m = mask(pattern); if (m.count() == 6 and count(m, four, 3) and count(m, seven, 3)) try map.put(m.mask, 0); if (m.count() == 5 and count(m, four, 2) and count(m, seven, 2)) try map.put(m.mask, 2); if (m.count() == 5 and count(m, four, 3) and count(m, seven, 3)) try map.put(m.mask, 3); if (m.count() == 5 and count(m, four, 3) and count(m, seven, 2)) try map.put(m.mask, 5); if (m.count() == 6 and count(m, four, 3) and count(m, seven, 2)) try map.put(m.mask, 6); if (m.count() == 6 and count(m, four, 4) and count(m, seven, 3)) try map.put(m.mask, 9); } return map; } pub fn main() !void { var t = std.StaticBitSet(7).initEmpty(); var counts = [_]u8{0} ** 10; var notes = try util.toStrSlice(data, "\n"); for (notes) |note| { var split = try util.toStrSlice(note, "|"); for (try util.toStrSlice(split[1], " ")) |out| { switch (out.len) { 2 => counts[1] += 1, 3 => counts[7] += 1, 4 => counts[4] += 1, 7 => counts[8] += 1, else => {}, } } } var sum: usize = 0; for (counts) |c| { sum += c; } print("{}\n", .{sum}); sum = 0; for (notes) |note| { var split = try util.toStrSlice(note, "|"); var map = try createMap(try util.toStrSlice(split[0], " ")); var out_val: usize = 0; for (try util.toStrSlice(split[1], " ")) |output, i| { var m = mask(output).mask; out_val = 10 * out_val + map.get(m).?; } sum += out_val; } print("{}\n", .{sum}); }
2021/src/day08.zig
const std = @import("std"); var a: *std.mem.Allocator = undefined; const stdout = std.io.getStdOut().writer(); //prepare stdout to write in //const LENGTH = 5; // testing const LENGTH = 12; // prod fn run(input: [:0]u8) u32 { // Stores the current bit position var bit_pos: u8 = 0; // Stores the number of set bits for the current bit position var bit_count: u32 = 0; // Stores all lines. 1000 lines should be enough (input is 999 lines) var all_lines = [_][LENGTH]u8{[_]u8{0} ** LENGTH} ** 1000; // Stores all "valid" indexes (i.e. that match the criteria defined by the puzzle) // Let's use 1001 as SKIP and 1002 as END var valid_line_idx = [_]u16{1002} ** 1000; // Initialize as "empty" (only END) // Stores the number of "valid" lines var line_count: u16 = 0; for (input) |char| { // std.debug.print("char: {c}\n", .{char}); // Check if we are at the end of a line if (bit_pos == LENGTH) { bit_pos = 0; // reset bit_pos line_count += 1; // count new line continue; // skip over tests } // Build the first bit count (for all valid lines) so we don't have to re-walk the entire array if (bit_pos == 0 and char == '1') { bit_count += 1; // } // Store the line all_lines[line_count][bit_pos] = char; bit_pos += 1; } line_count += 1; // don't forget the final line var full_line_count = line_count; // store full line count to rebuild valid_line_idx afterwards var full_bit_count = bit_count; // also store bit count for first iteration // Stores if the current valid value for a bit is 1 var bit_choice: bool = false; // Stores both target values indexes var oxygen_idx: u16 = 0; var co2_idx: u16 = 0; // Used to unroll the processing loop. // Iteration 0 sets o2, and iteration 1 sets co2 comptime var iterations: u2 = 0; inline while (iterations < 2) : (iterations += 1) { // (re)build valid_line_idx var _i: u16 = 0; while (_i < full_line_count) : (_i += 1) { valid_line_idx[_i] = _i; } // Reset bit_pos bit_pos = 0; // Reset bit count to first version bit_count = full_bit_count; // Reset line count line_count = full_line_count; main: while (bit_pos < LENGTH) : (bit_pos += 1) { //std.debug.print("bit pos {}: {} bits for {} lines\n", .{bit_pos, bit_count, line_count}); bit_choice = bit_count * 2 >= line_count; if (iterations == 0) { // Flip bit_choice to select least bit. bit_choice = !bit_choice; } //std.debug.print("Now working on bit_pos {} (choice {})\n", .{bit_pos, bit_choice}); // Reset bit count (look-ahead) bit_count = 0; // If there's only one valid line left, pick it if (line_count == 1) { if (iterations == 0) { oxygen_idx = valid_line_idx[0]; } else { co2_idx = valid_line_idx[0]; } // Break out of the main loop break :main; } line_count = 0; for (valid_line_idx) |idx| { //std.debug.print("Got index {}\n", .{idx}); // Check if we're on a valid index if (idx == 1001) { continue; // skip on 1001 } if (idx == 1002) { break; // end on 1002 } //std.debug.print("\tUsing index {}\n", .{idx}); //std.debug.print("\tProcessing line {s}\n", .{all_lines[idx]}); if (bit_choice != (all_lines[idx][bit_pos] == '1')) { //std.debug.print("\t\tCurrent line count {}\n", .{line_count}); valid_line_idx[line_count] = idx; line_count += 1; //std.debug.print("\t\t{s} ([{}]): bit {c} pos {} is valid\n", .{all_lines[idx], idx, all_lines[idx][bit_pos], bit_pos}); // If we're at bit_pos == LENGTH, this is the final bit to check. // We return the current line, as, if the puzzle is well built, we know it is unique. if (bit_pos == LENGTH - 1) { if (iterations == 0) { oxygen_idx = idx; } else { co2_idx = idx; } break; } // If we're not done yet, actualize the next bit_count if (all_lines[idx][bit_pos + 1] == '1'){ bit_count += 1; } } } valid_line_idx[line_count] = 1002; } } // Actually parse both values. This is faster than moving // these parse operations in while loop, as it allows better unrolling. var oxygen = std.fmt.parseUnsigned(u16, all_lines[oxygen_idx][0..], 2) catch unreachable; var co2 = std.fmt.parseUnsigned(u16, all_lines[co2_idx][0..], 2) catch unreachable; return @as(u32, oxygen) * co2; // Cast as u32 to get some more room } pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); // create memory allocator for strings defer arena.deinit(); // clear memory var arg_it = std.process.args(); _ = arg_it.skip(); // skip over exe name a = &arena.allocator; // get ref to allocator const input: [:0]u8 = try (arg_it.next(a)).?; // get the first argument const start: i128 = std.time.nanoTimestamp(); // start time const answer = run(input); // compute answer const elapsed_nano: f128 = @intToFloat(f128, std.time.nanoTimestamp() - start); const elapsed_milli: f64 = @floatCast(f64, @divFloor(elapsed_nano, 1_000_000)); try stdout.print("_duration:{d}\n{}\n", .{ elapsed_milli, answer }); // emit actual lines parsed by AOC } test "ez" { const input = \\00100 \\11110 \\10110 \\10111 \\10101 \\01111 \\00111 \\11100 \\10000 \\11001 \\00010 \\01010 ; var buf = input.*; try std.testing.expect(run(&buf) == 230); }
day-03/part-2/lelithium.zig
const std = @import("std"); const testing = std.testing; const Token = @import("Token.zig"); //! The `Lexer` parses the source code into Tokens. //! The definition of all tokens can be found in token.zig /// Lexer reads the source code and turns it into tokens const Lexer = @This(); /// Source code that is being tokenized source: []const u8, /// Current position in the source position: usize = 0, /// The position last read read_position: usize = 0, /// The current character that is being read char: u8 = 0, /// Creates a new lexer using the given source code pub fn init(source: []const u8) Lexer { var lexer = Lexer{ .source = source }; lexer.readChar(); return lexer; } /// Parses the source and returns the next token found pub fn next(self: *Lexer) Token { self.skipWhitespace(); const token_type: Token.TokenType = switch (self.char) { '=' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); // So we don't read '=' token again return Token{ .token_type = .equal, .start = start, .end = self.position }; } else .assign, '(' => .left_parenthesis, ')' => .right_parenthesis, ',' => .comma, '+' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_add, .start = start, .end = self.position }; } else .plus, '-' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_sub, .start = start, .end = self.position }; } else .minus, '!' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); // So we don't read '=' token again return Token{ .token_type = .not_equal, .start = start, .end = self.position }; } else .bang, '/' => if (self.peekChar() == '/') { const start = self.position; self.readLine(); return Token{ .token_type = .comment, .start = start + 2, .end = self.position }; } else if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_div, .start = start, .end = self.position }; } else .slash, '*' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_mul, .start = start, .end = self.position }; } else .asterisk, '^' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_caret, .start = start, .end = self.position }; } else .caret, '&' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_ampersand, .start = start, .end = self.position }; } else .ampersand, '|' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .equal_pipe, .start = start, .end = self.position }; } else .pipe, '<' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .less_than_equal, .start = start, .end = self.position }; } else if (self.peekChar() == '<') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .shift_left, .start = start, .end = self.position }; } else .less_than, '>' => if (self.peekChar() == '=') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .greater_than_equal, .start = start, .end = self.position }; } else if (self.peekChar() == '>') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .shift_right, .start = start, .end = self.position }; } else .greater_than, '{' => .left_brace, '}' => .right_brace, '.' => if (self.peekChar() == '.') { const start = self.position; self.readChar(); self.readChar(); return Token{ .token_type = .double_period, .start = start, .end = self.position }; } else .period, '[' => .left_bracket, ']' => .right_bracket, ':' => .colon, '"' => { self.readChar(); const start = self.position; self.readString(); defer self.readChar(); return Token{ .token_type = .string, .start = start, .end = self.position }; }, '%' => .percent, '~' => .tilde, '?' => .query, 0 => .eof, else => |c| if (isLetter(c)) { const start = self.position; const ident = self.readIdentifier(); return Token{ .token_type = Token.findType(ident), .start = start, .end = self.position }; } else if (isDigit(c)) { const start = self.position; self.readNumber(); return Token{ .token_type = .integer, .start = start, .end = self.position }; } else .illegal, }; // read the next character so we don't read our last character // again when nexToken is called. defer self.readChar(); return Token{ .token_type = token_type, .start = self.position, .end = self.read_position, }; } /// Tokenizes all tokens found in the input source and returns a list of tokens. /// Memory is owned by the caller. pub fn tokenize(self: *Lexer, allocator: *std.mem.Allocator) ![]const Token { var token_list = std.ArrayList(Token).init(allocator); while (true) { const tok: *Token = try token_list.addOne(); tok.* = self.next(); if (tok.token_type == .eof) { return token_list.toOwnedSlice(); } } } /// Reads exactly one character fn readChar(self: *Lexer) void { self.char = if (self.read_position >= self.source.len) 0 else self.source[self.read_position]; self.position = self.read_position; self.read_position += 1; } /// Returns the next character but does not increase the Lexer's position fn peekChar(self: Lexer) u8 { return if (self.read_position >= self.source.len) 0 else self.source[self.read_position]; } /// Skips whitespace until a non-whitespace character is found fn skipWhitespace(self: *Lexer) void { while (isWhitespace(self.char)) { self.readChar(); } } /// Reads the next characters as identifier and returns the identifier fn readIdentifier(self: *Lexer) []const u8 { const pos = self.position; while (isLetter(self.char) or isDigit(self.char)) { self.readChar(); } return self.source[pos..self.position]; } /// Reads the next characters as number fn readNumber(self: *Lexer) void { while (isDigit(self.char)) self.readChar(); } /// Reads a string from the current character fn readString(self: *Lexer) void { while (self.char != '"' and self.char != 0) self.readChar(); } /// Reads until the end of the line or EOF fn readLine(self: *Lexer) void { while (self.char != '\n' and self.char != 0) self.readChar(); } /// Returns true if the given character is considered whitespace fn isWhitespace(char: u8) bool { return switch (char) { ' ', '\t', '\n', '\r' => true, else => false, }; } /// Returns true if the given character is a digit fn isDigit(char: u8) bool { return switch (char) { '0'...'9' => true, else => false, }; } /// Returns true if the given character is a letter fn isLetter(char: u8) bool { return switch (char) { 'a'...'z', 'A'...'Z', '_' => true, else => false, }; } test "All supported tokens" { const input = \\const five = 5 \\const ten = 10 \\const add = fn(x, y) { \\ x + y \\} \\ \\const result = add(five, ten) \\!-/*5 \\5 < 10 > 5 \\ \\if (5 < 10) { \\ return true \\} else { \\ return false \\} \\ \\10 == 10 \\10 != 9 \\"foo" \\"foo bar" \\"foo".len \\[1, 2] \\{"key":1} \\//this is a comment \\nil ; const tests = &[_]Token{ .{ .token_type = .constant, .start = 0, .end = 5 }, .{ .token_type = .identifier, .start = 6, .end = 10 }, .{ .token_type = .assign, .start = 11, .end = 12 }, .{ .token_type = .integer, .start = 13, .end = 14 }, .{ .token_type = .constant, .start = 15, .end = 20 }, .{ .token_type = .identifier, .start = 21, .end = 24 }, .{ .token_type = .assign, .start = 25, .end = 26 }, .{ .token_type = .integer, .start = 27, .end = 29 }, .{ .token_type = .constant, .start = 30, .end = 35 }, .{ .token_type = .identifier, .start = 36, .end = 39 }, .{ .token_type = .assign, .start = 40, .end = 41 }, .{ .token_type = .function, .start = 42, .end = 44 }, .{ .token_type = .left_parenthesis, .start = 44, .end = 45 }, .{ .token_type = .identifier, .start = 45, .end = 46 }, .{ .token_type = .comma, .start = 46, .end = 47 }, .{ .token_type = .identifier, .start = 48, .end = 49 }, .{ .token_type = .right_parenthesis, .start = 49, .end = 50 }, .{ .token_type = .left_brace, .start = 51, .end = 52 }, .{ .token_type = .identifier, .start = 55, .end = 56 }, .{ .token_type = .plus, .start = 57, .end = 58 }, .{ .token_type = .identifier, .start = 59, .end = 60 }, .{ .token_type = .right_brace, .start = 65, .end = 66 }, .{ .token_type = .constant, .start = 68, .end = 73 }, .{ .token_type = .identifier, .start = 74, .end = 80 }, .{ .token_type = .assign, .start = 81, .end = 82 }, .{ .token_type = .identifier, .start = 83, .end = 86 }, .{ .token_type = .left_parenthesis, .start = 86, .end = 87 }, .{ .token_type = .identifier, .start = 87, .end = 91 }, .{ .token_type = .comma, .start = 91, .end = 92 }, .{ .token_type = .identifier, .start = 93, .end = 96 }, .{ .token_type = .right_parenthesis, .start = 96, .end = 97 }, .{ .token_type = .bang, .start = 98, .end = 99 }, .{ .token_type = .minus, .start = 99, .end = 100 }, .{ .token_type = .slash, .start = 100, .end = 101 }, .{ .token_type = .asterisk, .start = 101, .end = 102 }, .{ .token_type = .integer, .start = 102, .end = 103 }, .{ .token_type = .integer, .start = 104, .end = 105 }, .{ .token_type = .less_than, .start = 106, .end = 107 }, .{ .token_type = .integer, .start = 108, .end = 110 }, .{ .token_type = .greater_than, .start = 111, .end = 112 }, .{ .token_type = .integer, .start = 113, .end = 114 }, .{ .token_type = .@"if", .start = 116, .end = 118 }, .{ .token_type = .left_parenthesis, .start = 119, .end = 120 }, .{ .token_type = .integer, .start = 120, .end = 121 }, .{ .token_type = .less_than, .start = 122, .end = 123 }, .{ .token_type = .integer, .start = 124, .end = 126 }, .{ .token_type = .right_parenthesis, .start = 126, .end = 127 }, .{ .token_type = .left_brace, .start = 128, .end = 129 }, .{ .token_type = .@"return", .start = 132, .end = 138 }, .{ .token_type = .@"true", .start = 139, .end = 143 }, .{ .token_type = .right_brace, .start = 144, .end = 145 }, .{ .token_type = .@"else", .start = 146, .end = 150 }, .{ .token_type = .left_brace, .start = 151, .end = 152 }, .{ .token_type = .@"return", .start = 155, .end = 161 }, .{ .token_type = .@"false", .start = 162, .end = 167 }, .{ .token_type = .right_brace, .start = 168, .end = 169 }, .{ .token_type = .integer, .start = 171, .end = 173 }, .{ .token_type = .equal, .start = 174, .end = 176 }, .{ .token_type = .integer, .start = 177, .end = 179 }, .{ .token_type = .integer, .start = 180, .end = 182 }, .{ .token_type = .not_equal, .start = 183, .end = 185 }, .{ .token_type = .integer, .start = 186, .end = 187 }, .{ .token_type = .string, .start = 189, .end = 192 }, .{ .token_type = .string, .start = 195, .end = 202 }, .{ .token_type = .string, .start = 205, .end = 208 }, .{ .token_type = .period, .start = 209, .end = 210 }, .{ .token_type = .identifier, .start = 210, .end = 213 }, .{ .token_type = .left_bracket, .start = 214, .end = 215 }, .{ .token_type = .integer, .start = 215, .end = 216 }, .{ .token_type = .comma, .start = 216, .end = 217 }, .{ .token_type = .integer, .start = 218, .end = 219 }, .{ .token_type = .right_bracket, .start = 219, .end = 220 }, .{ .token_type = .left_brace, .start = 221, .end = 222 }, .{ .token_type = .string, .start = 223, .end = 226 }, .{ .token_type = .colon, .start = 227, .end = 228 }, .{ .token_type = .integer, .start = 228, .end = 229 }, .{ .token_type = .right_brace, .start = 229, .end = 230 }, .{ .token_type = .comment, .start = 233, .end = 250 }, .{ .token_type = .nil, .start = 251, .end = 254 }, .{ .token_type = .eof, .start = 254, .end = 255 }, }; var lexer = Lexer.init(input); for (tests) |unit| { const current_token = lexer.next(); try testing.expectEqual(unit.start, current_token.start); try testing.expectEqual(unit.end, current_token.end); try testing.expectEqual(unit.token_type, current_token.token_type); } }
src/Lexer.zig
const std = @import("std"); const real_input = @embedFile("day-16_real-input"); pub fn main() !void { std.debug.print("--- Day 16 ---\n", .{}); const version_sum = try sumVersions(real_input); std.debug.print("sum of all versions is {}\n", .{ version_sum }); const expression_value = try evaluate(real_input); std.debug.print("value of expression is {}\n", .{ expression_value }); } fn evaluate(input: []const u8) !u64 { var buffer: [1024 * 1024]u8 = undefined; const binary = hexToBinary(input, buffer[0..]); var reader = Reader { .string = binary }; return try evaluateRecursive(&reader); } fn evaluateRecursive(reader: *Reader) std.fmt.ParseIntError!u64 { _ = try reader.readVersion(); const packet_type = try reader.readType(); if (packet_type == .Literal) return try reader.readLiteral(); const length_type = reader.readLengthType(); var params_it = ParameterIterator { .reader = reader, .length_type = length_type }; switch (length_type) { .Bits => { const bits = try reader.readBitLength(); params_it.remaining = .{ .bits = bits }; }, .Packets => { const packets = try reader.readPacketCount(); params_it.remaining = .{ .packets = packets }; } } const first_param = (try params_it.next()) orelse unreachable; switch (packet_type) { .Sum => { var sum = first_param; while (try params_it.next()) |param| sum += param; return sum; }, .Product => { var product = first_param; while (try params_it.next()) |param| product *= param; return product; }, .Minimum => { var minimum = first_param; while (try params_it.next()) |param| minimum = @minimum(minimum, param); return minimum; }, .Maximum => { var maximum = first_param; while (try params_it.next()) |param| maximum = @maximum(maximum, param); return maximum; }, .GreaterThan => { const second_param = (try params_it.next()) orelse unreachable; return if (first_param > second_param) 1 else 0; }, .LessThan => { const second_param = (try params_it.next()) orelse unreachable; return if (first_param < second_param) 1 else 0; }, .EqualTo => { const second_param = (try params_it.next()) orelse unreachable; return if (first_param == second_param) 1 else 0; }, .Literal => unreachable, } } const ParameterIterator = struct { remaining: union { bits: u15, packets: u11, } = undefined, reader: *Reader, length_type: LengthType, pub fn next(it: *ParameterIterator) !?u64 { switch (it.length_type) { .Bits => if (it.remaining.bits <= 0) return null, .Packets => if (it.remaining.packets <= 0) return null } const before = it.reader.current; const result = try evaluateRecursive(it.reader); switch (it.length_type) { .Bits => it.remaining.bits -= @intCast(u15, it.reader.current - before), .Packets => it.remaining.packets -= 1 } return result; } }; test "evaluate" { const data = [_]struct { input: []const u8, expected: u64, } { .{ .input = "C200B40A82", .expected = 3 }, .{ .input = "04005AC33890", .expected = 54 }, .{ .input = "880086C3E88112", .expected = 7 }, .{ .input = "CE00C43D881120", .expected = 9 }, .{ .input = "D8005AC2A8F0", .expected = 1 }, .{ .input = "F600BC2D8F", .expected = 0 }, .{ .input = "9C005AC2F8F0", .expected = 0 }, .{ .input = "9C0141080250320F1802104A08", .expected = 1 }, }; for (data) |pair| { const result = try evaluate(pair.input); try std.testing.expectEqual(pair.expected, result); } } fn sumVersions(input: []const u8) !u32 { var buffer: [1024 * 1024]u8 = undefined; const binary = hexToBinary(input, buffer[0..]); var reader = Reader { .string = binary }; return try sumVersionsRecursive(&reader); } fn sumVersionsRecursive(reader: *Reader) std.fmt.ParseIntError!u32 { var version_sum: u32 = try reader.readVersion(); const packet_type = try reader.readType(); switch (packet_type) { .Literal => { _ = try reader.readLiteral(); }, else => { const length_type = reader.readLengthType(); switch (length_type) { .Bits => { const length = try reader.readBitLength(); const start = reader.current; while (reader.current < start + length) { version_sum += try sumVersionsRecursive(reader); } }, .Packets => { var packet_count = try reader.readPacketCount(); while (packet_count > 0):(packet_count -= 1) { version_sum += try sumVersionsRecursive(reader); } } } } } return version_sum; } test "sumVersions" { const data = [_]struct { in: []const u8, out: u32, } { .{ .in = "D2FE28", .out = 6 }, .{ .in = "8A004A801A8002F478", .out = 16 }, .{ .in = "620080001611562C8802118E34", .out = 12 }, .{ .in = "C0015000016115A2E0802F182340", .out = 23 }, .{ .in = "A0016C880162017C3686B18A3D4780", .out = 31 }, }; for (data) |pair| { const result = try sumVersions(pair.in); try std.testing.expectEqual(pair.out, result); } } const Reader = struct { string: []const u8, current: usize = 0, pub fn readVersion(reader: *@This()) !u3 { return try parseVersion(reader.read(3)); } pub fn readType(reader: *@This()) !PacketType { return try parseType(reader.read(3)); } pub fn readLengthType(reader: *@This()) LengthType { return parseLengthType(reader.read(1)); } pub fn readBitLength(reader: *@This()) !u15 { return try parseBitLength(reader.read(15)); } pub fn readPacketCount(reader: *@This()) !u11 { return try parsePacketCount(reader.read(11)); } pub fn readLiteral(reader: *@This()) !u64 { var buffer: [1024]u8 = undefined; var length: u32 = 0; while (true) { const current = reader.read(5); std.mem.copy(u8, buffer[length..], current[1..]); length += 4; if (current[0] == '0') break; } return try std.fmt.parseInt(u64, buffer[0..length], 2); } fn read(reader: *@This(), length: usize) []const u8 { const start = reader.current; const end = start + length; reader.current = end; return reader.string[start..end]; } }; test "integration: literal" { const input = "D2FE28"; var buffer: [1024]u8 = undefined; const binary = hexToBinary(input, buffer[0..]); var reader = Reader { .string = binary }; const version = try reader.readVersion(); try std.testing.expectEqual(@as(u3, 6), version); const packet_type = try reader.readType(); try std.testing.expectEqual(PacketType.Literal, packet_type); const literal_value = try reader.readLiteral(); try std.testing.expectEqual(@as(u64, 2021), literal_value); } fn parsePacketCount(string: []const u8) !u11 { return try std.fmt.parseInt(u11, string, 2); } test "parsePacketCount" { const input: []const u8 = "00000000011"; const expected: u11 = 3; const result = try parsePacketCount(input); try std.testing.expectEqual(expected, result); } fn parseBitLength(string: []const u8) !u15 { return try std.fmt.parseInt(u15, string, 2); } test "parseBitLength" { const data = [_]struct { in: []const u8, out: u15, } { .{ .in = "000000000011011", .out = 27 }, }; for (data) |pair| { const result = try parseBitLength(pair.in); try std.testing.expectEqual(pair.out, result); } } const LengthType = enum { Bits, Packets, }; fn parseLengthType(string: []const u8) LengthType { return switch (string[0]) { '0' => .Bits, '1' => .Packets, else => unreachable }; } test "parseLengthType" { const data = [_]struct { in: []const u8, out: LengthType, } { .{ .in = "0", .out = .Bits }, .{ .in = "1", .out = .Packets }, }; for (data) |pair| { const result = parseLengthType(pair.in); try std.testing.expectEqual(pair.out, result); } } test "parse literal" { var reader = Reader { .string = "101111111000101000" }; const value = try reader.readLiteral(); try std.testing.expectEqual(@as(u64, 2021), value); } const PacketType = enum(u3) { Sum = 0, Product = 1, Minimum = 2, Maximum = 3, Literal = 4, GreaterThan = 5, LessThan = 6, EqualTo = 7, }; fn parseType(string: []const u8) !PacketType { const typeInt = try std.fmt.parseInt(u3, string, 2); return @intToEnum(PacketType, typeInt); } test "parseType" { const data = [_]struct { in: []const u8, out: PacketType, } { .{ .in = "100", .out = .Literal }, .{ .in = "110", .out = .LessThan }, .{ .in = "011", .out = .Maximum }, }; for (data) |pair| { const result = try parseType(pair.in); try std.testing.expectEqual(pair.out, result); } } fn parseVersion(string: []const u8) !u3 { return try std.fmt.parseInt(u3, string, 2); } test "parseVersion" { const data = [_]struct { in: []const u8, out: u3, } { .{ .in = "110", .out = 6 }, .{ .in = "001", .out = 1 }, .{ .in = "111", .out = 7 }, }; for (data) |pair| { const result = try parseVersion(pair.in); try std.testing.expectEqual(pair.out, result); } } fn hexToBinary(hex: []const u8, buffer: []u8) []const u8 { var count: u32 = 0; for (hex) |char| { const string = switch (char) { '0' => "0000", '1' => "0001", '2' => "0010", '3' => "0011", '4' => "0100", '5' => "0101", '6' => "0110", '7' => "0111", '8' => "1000", '9' => "1001", 'A' => "1010", 'B' => "1011", 'C' => "1100", 'D' => "1101", 'E' => "1110", 'F' => "1111", else => "" }; std.mem.copy(u8, buffer[count..], string); count += 4; } return buffer[0..count]; } test "hexToBinary" { const data = [_]struct { in: []const u8, out: []const u8, } { .{ .in = "D2FE28", .out = "110100101111111000101000" }, .{ .in = "38006F45291200", .out = "00111000000000000110111101000101001010010001001000000000" }, .{ .in = "EE00D40C823060", .out = "11101110000000001101010000001100100000100011000001100000" }, }; for (data) |pair| { var buffer: [1024]u8 = undefined; const result = hexToBinary(pair.in, buffer[0..]); try std.testing.expectEqualStrings(pair.out, result); } }
day-16.zig
const stdx = @import("stdx.zig"); const t = stdx.testing; const Closure = stdx.Closure; const ClosureIface = stdx.ClosureIface; const ClosureSimple = stdx.ClosureSimple; const ClosureSimpleIface = stdx.ClosureSimpleIface; /// An interface for a free function or a closure. pub fn Function(comptime Fn: type) type { stdx.meta.assertFunctionType(Fn); // The compiler crashes when a created @Type is not used. Declaring a dummy var somehow makes the compiler aware of it. var dummy: stdx.meta.FnParamsTuple(Fn) = undefined; _ = dummy; return struct { const Self = @This(); ctx: *anyopaque, call_fn: fn (*const anyopaque, *anyopaque, stdx.meta.FnParamsTuple(Fn)) stdx.meta.FnReturn(Fn), // For closures. user_fn: *const anyopaque, pub fn initClosure(closure: anytype) Self { return initClosureIface(closure.iface()); } pub fn initClosureIface(iface: ClosureIface(Fn)) Self { return .{ .ctx = iface.capture_ptr, .call_fn = iface.call_fn, .user_fn = iface.user_fn, }; } pub fn initContext(ctx_ptr: anytype, comptime func: anytype) Self { const ContextPtr = @TypeOf(ctx_ptr); stdx.meta.assertPointerType(ContextPtr); const gen = struct { fn call(_: *const anyopaque, ptr: *anyopaque, args: stdx.meta.FnParamsTuple(Fn)) stdx.meta.FnReturn(Fn) { const ctx = stdx.mem.ptrCastAlign(ContextPtr, ptr); return @call(.{}, func, .{ctx} ++ args); } }; return .{ .ctx = ctx_ptr, .call_fn = gen.call, .user_fn = func, }; } pub fn init(comptime func: anytype) Self { const gen = struct { fn call(_: *const anyopaque, _: *anyopaque, args: stdx.meta.FnParamsTuple(Fn)) stdx.meta.FnReturn(Fn) { return @call(.{}, func, args); } }; return .{ .ctx = undefined, .call_fn = gen.call, .user_fn = func, }; } pub fn call(self: Self, args: stdx.meta.FnParamsTuple(Fn)) stdx.meta.FnReturn(Fn) { return self.call_fn(self.user_fn, self.ctx, args); } }; } test "Function" { var foo: u32 = 123; const S = struct { fn bar(foo_: *u32, num1: u32, num2: u32) u32 { return foo_.* + num1 + num2; } }; const func = Function(fn (u32, u32) u32).initContext(&foo, S.bar); const res = func.call(.{ 1, 2 }); try t.eq(res, 126); const c = Closure(*u32, fn (u32, u32) u32).init(t.alloc, &foo, S.bar); defer c.deinit(t.alloc); const fc1 = Function(fn (u32, u32) u32).initClosure(c); try t.eq(fc1.call(.{ 1, 2 }), 126); const fc2 = Function(fn (u32, u32) u32).initClosureIface(c.iface()); try t.eq(fc2.call(.{ 1, 2 }), 126); } /// Prefer Function, keeping this in case using the FnParamsTuple method breaks. pub fn FunctionSimple(comptime Param: type) type { return struct { const Self = @This(); ctx: *anyopaque, call_fn: fn (*const anyopaque, *anyopaque, Param) void, // For closures. user_fn: *const anyopaque, pub fn initClosure(closure: anytype) Self { return initClosureIface(closure.iface()); } pub fn initClosureIface(iface: ClosureSimpleIface(Param)) Self { return .{ .ctx = iface.capture_ptr, .call_fn = iface.call_fn, .user_fn = iface.user_fn, }; } pub fn initContext(ctx_ptr: anytype, comptime func: anytype) Self { const ContextPtr = @TypeOf(ctx_ptr); stdx.meta.assertPointerType(ContextPtr); const gen = struct { fn call(_: *const anyopaque, ptr: *anyopaque, arg: Param) void { const ctx = stdx.mem.ptrCastAlign(ContextPtr, ptr); func(ctx, arg); } }; return .{ .ctx = ctx_ptr, .call_fn = gen.call, .user_fn = func, }; } pub fn init(comptime func: anytype) Self { const gen = struct { fn call(_: *const anyopaque, _: *anyopaque, arg: Param) void { func(arg); } }; return .{ .ctx = undefined, .call_fn = gen.call, .user_fn = func, }; } pub fn call(self: Self, arg: Param) void { self.call_fn(self.user_fn, self.ctx, arg); } }; } test "FunctionSimple" { const S = struct { fn inc(res: *u32) void { res.* += 1; } fn closureInc(ctx: u32, res: *u32) void { res.* += ctx; } }; const f = FunctionSimple(*u32).init(S.inc); var res: u32 = 10; f.call(&res); try t.eq(res, 11); const c = ClosureSimple(u32, *u32).init(t.alloc, 20, S.closureInc); defer c.deinit(t.alloc); const fc1 = FunctionSimple(*u32).initClosure(c); fc1.call(&res); try t.eq(res, 31); const fc2 = FunctionSimple(*u32).initClosureIface(c.iface()); fc2.call(&res); try t.eq(res, 51); }
stdx/function.zig
const std = @import("std"); const expect = std.testing.expect; const assert = std.debug.assert; pub const Color = packed enum(u8) { white, red, blue, orange, green, yellow, pub fn toStr(self: Color) []const u8 { return switch (self) { .white => "\x1B[37mw\x1B[m", .red => "\x1B[91mr\x1B[m", .blue => "\x1B[94mb\x1B[m", .orange => "\x1B[38;5;208mo\x1B[m", .green => "\x1B[32mg\x1B[m", .yellow => "\x1B[93my\x1B[m", }; } }; pub const Edge = struct { a: Color, b: Color, pub fn m2name(edge: Edge, first: bool) u8 { switch (edge.a) { .white => return switch (edge.b) { .green => 'a', .orange => 'b', .blue => return if (first) 'c' else 'w', .red => 'd', else => unreachable, }, .red => return switch (edge.b) { .white => 'e', .blue => 'f', .yellow => 'g', .green => 'h', else => unreachable, }, .blue => return switch (edge.b) { .white => return if (first) 'i' else 's', .orange => 'j', .yellow => 'k', .red => 'l', else => unreachable, }, .orange => return switch (edge.b) { .white => 'm', .green => 'n', .yellow => 'o', .blue => 'p', else => unreachable, }, .green => return switch (edge.b) { .white => 'q', .red => 'r', .yellow => return if (first) 's' else 'i', .orange => 't', else => unreachable, }, .yellow => return switch (edge.b) { .blue => 'u', .orange => 'v', .green => return if (first) 'w' else 'c', .red => 'x', else => unreachable, }, } } /// Normalize edge so that `a` is white, yellow, green or blue pub fn normalize(edge: Edge) Edge { if (edge.a == .white or edge.a == .yellow) { return edge; } else if (edge.b == .white or edge.b == .yellow or edge.b == .blue or edge.b == .green) { var new = Edge{ .a = edge.b, .b = edge.a, }; return new; } else { return edge; } } pub fn eql(a: Edge, b: Edge) bool { return a.a == b.a and a.b == b.b; } }; pub const Corner = struct { a: Color, b: Color, c: Color, pub fn opName(corner: Corner) u8 { switch (corner.a) { .white => switch (corner.b) { .green => return switch (corner.c) { .red => 'A', .orange => 'B', else => unreachable, }, .orange => return switch (corner.c) { .green => 'B', .blue => 'C', else => unreachable, }, .blue => return switch (corner.c) { .orange => 'C', .red => 'D', else => unreachable, }, .red => return switch (corner.c) { .blue => 'D', .green => 'A', else => unreachable, }, else => unreachable, }, .red => switch (corner.b) { .green => return switch (corner.c) { .white => 'E', .yellow => 'H', else => unreachable, }, .white => return switch (corner.c) { .green => 'E', .blue => 'F', else => unreachable, }, .blue => return switch (corner.c) { .white => 'F', .yellow => 'G', else => unreachable, }, .yellow => return switch (corner.c) { .blue => 'G', .green => 'H', else => unreachable, }, else => unreachable, }, .blue => switch (corner.b) { .red => return switch (corner.c) { .white => 'I', .yellow => 'L', else => unreachable, }, .white => return switch (corner.c) { .red => 'I', .orange => 'J', else => unreachable, }, .orange => return switch (corner.c) { .white => 'J', .yellow => 'K', else => unreachable, }, .yellow => return switch (corner.c) { .orange => 'K', .red => 'L', else => unreachable, }, else => unreachable, }, .orange => switch (corner.b) { .blue => return switch (corner.c) { .white => 'M', .yellow => 'P', else => unreachable, }, .white => return switch (corner.c) { .blue => 'M', .green => 'N', else => unreachable, }, .green => return switch (corner.c) { .white => 'N', .yellow => 'O', else => unreachable, }, .yellow => return switch (corner.c) { .green => 'O', .blue => 'P', else => unreachable, }, else => unreachable, }, .green => switch (corner.b) { .orange => return switch (corner.c) { .white => 'Q', .yellow => 'T', else => unreachable, }, .white => return switch (corner.c) { .orange => 'Q', .red => 'R', else => unreachable, }, .red => return switch (corner.c) { .white => 'R', .yellow => 'S', else => unreachable, }, .yellow => return switch (corner.c) { .red => 'S', .orange => 'I', else => unreachable, }, else => unreachable, }, .yellow => switch (corner.b) { .red => return switch (corner.c) { .blue => 'U', .green => 'X', else => unreachable, }, .blue => return switch (corner.c) { .red => 'U', .orange => 'V', else => unreachable, }, .orange => return switch (corner.c) { .blue => 'V', .green => 'W', else => unreachable, }, .green => return switch (corner.c) { .orange => 'W', .red => 'X', else => unreachable, }, else => unreachable, }, } } /// Normalize the corner so that `a` is white or yellow, `b` is green or blue and `c` is red or orange. pub fn normalize(corner: Corner) Corner { var res = corner; switch (corner.a) { .white, .yellow => res.a = corner.a, .green, .blue => res.b = corner.a, .red, .orange => res.c = corner.a, } switch (corner.b) { .white, .yellow => res.a = corner.b, .green, .blue => res.b = corner.b, .red, .orange => res.c = corner.b, } switch (corner.c) { .white, .yellow => res.a = corner.c, .green, .blue => res.b = corner.c, .red, .orange => res.c = corner.c, } return res; } pub fn eql(a: Corner, b: Corner) bool { return a.a == b.a and a.b == b.b and a.c == b.c; } }; pub const Cube = struct { u: [8]Color = [_]Color{.white} ** 8, l: [8]Color = [_]Color{.red} ** 8, f: [8]Color = [_]Color{.blue} ** 8, r: [8]Color = [_]Color{.orange} ** 8, b: [8]Color = [_]Color{.green} ** 8, d: [8]Color = [_]Color{.yellow} ** 8, pub fn format( self: Cube, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) !void { // up try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.u[0].toStr(), self.u[1].toStr(), self.u[2].toStr() }); try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.u[7].toStr(), Color.white.toStr(), self.u[3].toStr() }); try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.u[6].toStr(), self.u[5].toStr(), self.u[4].toStr() }); // left - front - right try writer.print( \\+-+-+-+-+-+-+-+-+-+ \\|{s}|{s}|{s}|{s}|{s}|{s}|{s}|{s}|{s}| \\ , .{ self.l[0].toStr(), self.l[1].toStr(), self.l[2].toStr(), self.f[0].toStr(), self.f[1].toStr(), self.f[2].toStr(), self.r[0].toStr(), self.r[1].toStr(), self.r[2].toStr(), }); try writer.print( \\+-+-+-+-+-+-+-+-+-+ \\|{s}|{s}|{s}|{s}|{s}|{s}|{s}|{s}|{s}| \\ , .{ self.l[7].toStr(), Color.red.toStr(), self.l[3].toStr(), self.f[7].toStr(), Color.blue.toStr(), self.f[3].toStr(), self.r[7].toStr(), Color.orange.toStr(), self.r[3].toStr(), }); try writer.print( \\+-+-+-+-+-+-+-+-+-+ \\|{s}|{s}|{s}|{s}|{s}|{s}|{s}|{s}|{s}| \\ , .{ self.l[6].toStr(), self.l[5].toStr(), self.l[4].toStr(), self.f[6].toStr(), self.f[5].toStr(), self.f[4].toStr(), self.r[6].toStr(), self.r[5].toStr(), self.r[4].toStr(), }); // down try writer.print( \\+-+-+-+-+-+-+-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.d[0].toStr(), self.d[1].toStr(), self.d[2].toStr() }); try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.d[7].toStr(), Color.yellow.toStr(), self.d[3].toStr() }); try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.d[6].toStr(), self.d[5].toStr(), self.d[4].toStr() }); // back try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.b[4].toStr(), self.b[5].toStr(), self.b[6].toStr() }); try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ , .{ self.b[3].toStr(), Color.green.toStr(), self.b[7].toStr() }); try writer.print( \\ +-+-+-+ \\ |{s}|{s}|{s}| \\ +-+-+-+ , .{ self.b[2].toStr(), self.b[1].toStr(), self.b[0].toStr() }); } pub fn eql(a: Cube, b: Cube) bool { return (@as(u8, @boolToInt(@bitCast(u64, a.u) == @bitCast(u64, b.u))) + @boolToInt(@bitCast(u64, a.l) == @bitCast(u64, b.l)) + @boolToInt(@bitCast(u64, a.f) == @bitCast(u64, b.f)) + @boolToInt(@bitCast(u64, a.r) == @bitCast(u64, b.r)) + @boolToInt(@bitCast(u64, a.b) == @bitCast(u64, b.b)) + @boolToInt(@bitCast(u64, a.d) == @bitCast(u64, b.d))) == 6; } pub fn isSolved(self: Cube) bool { return self.eql(.{}); } pub fn rotU(self: *Cube) void { self.u = @bitCast([8]Color, std.math.rotl(u64, @bitCast(u64, self.u), 2 * 8)); // sides const tmp: [3]Color = self.r[0..3].*; self.r[0..3].* = self.b[0..3].*; self.b[0..3].* = self.l[0..3].*; self.l[0..3].* = self.f[0..3].*; self.f[0..3].* = tmp; } pub fn rotUPrime(self: *Cube) void { self.u = @bitCast([8]Color, std.math.rotr(u64, @bitCast(u64, self.u), 2 * 8)); // sides const tmp: [3]Color = self.r[0..3].*; self.r[0..3].* = self.f[0..3].*; self.f[0..3].* = self.l[0..3].*; self.l[0..3].* = self.b[0..3].*; self.b[0..3].* = tmp; } pub fn rotL(self: *Cube) void { self.l = @bitCast([8]Color, std.math.rotl(u64, @bitCast(u64, self.l), 2 * 8)); // faces const tmp: [3]Color = self.b[2..5].*; self.b[2..4].* = self.d[6..8].*; self.b[4] = self.d[0]; self.d[6..8].* = self.f[6..8].*; self.d[0] = self.f[0]; self.f[6..8].* = self.u[6..8].*; self.f[0] = self.u[0]; self.u[6..8].* = tmp[0..2].*; self.u[0] = tmp[2]; } pub fn rotLPrime(self: *Cube) void { self.l = @bitCast([8]Color, std.math.rotr(u64, @bitCast(u64, self.l), 2 * 8)); // faces const tmp: [3]Color = self.b[2..5].*; self.b[2..4].* = self.u[6..8].*; self.b[4] = self.u[0]; self.u[6..8].* = self.f[6..8].*; self.u[0] = self.f[0]; self.f[6..8].* = self.d[6..8].*; self.f[0] = self.d[0]; self.d[6..8].* = tmp[0..2].*; self.d[0] = tmp[2]; } pub fn rotF(self: *Cube) void { self.f = @bitCast([8]Color, std.math.rotl(u64, @bitCast(u64, self.f), 2 * 8)); // faces const tmp: [3]Color = self.l[2..5].*; self.l[2..5].* = self.d[0..3].*; self.d[0..2].* = self.r[6..8].*; self.d[2] = self.r[0]; self.r[6..8].* = self.u[4..6].*; self.r[0] = self.u[6]; self.u[4..7].* = tmp; } pub fn rotFPrime(self: *Cube) void { self.f = @bitCast([8]Color, std.math.rotr(u64, @bitCast(u64, self.f), 2 * 8)); // faces const tmp: [3]Color = self.l[2..5].*; self.l[2..5].* = self.u[4..7].*; self.u[4..6].* = self.r[6..8].*; self.u[6] = self.r[0]; self.r[6..8].* = self.d[0..2].*; self.r[0] = self.d[2]; self.d[0..3].* = tmp; } pub fn rotR(self: *Cube) void { self.r = @bitCast([8]Color, std.math.rotl(u64, @bitCast(u64, self.r), 2 * 8)); // faces const tmp: [3]Color = self.f[2..5].*; self.f[2..5].* = self.d[2..5].*; self.d[2..4].* = self.b[6..8].*; self.d[4] = self.b[0]; self.b[6..8].* = self.u[2..4].*; self.b[0] = self.u[4]; self.u[2..5].* = tmp; } pub fn rotRPrime(self: *Cube) void { self.r = @bitCast([8]Color, std.math.rotr(u64, @bitCast(u64, self.r), 2 * 8)); // faces const tmp: [3]Color = self.f[2..5].*; self.f[2..5].* = self.u[2..5].*; self.u[2..4].* = self.b[6..8].*; self.u[4] = self.b[0]; self.b[6..8].* = self.d[2..4].*; self.b[0] = self.d[4]; self.d[2..5].* = tmp; } pub fn rotB(self: *Cube) void { self.b = @bitCast([8]Color, std.math.rotl(u64, @bitCast(u64, self.b), 2 * 8)); // faces const tmp: [3]Color = self.r[2..5].*; self.r[2..5].* = self.d[4..7].*; self.d[4..6].* = self.l[6..8].*; self.d[6] = self.l[0]; self.l[6..8].* = self.u[0..2].*; self.l[0] = self.u[2]; self.u[0..3].* = tmp; } pub fn rotBPrime(self: *Cube) void { self.b = @bitCast([8]Color, std.math.rotr(u64, @bitCast(u64, self.b), 2 * 8)); // faces const tmp: [3]Color = self.r[2..5].*; self.r[2..5].* = self.u[0..3].*; self.u[0..2].* = self.l[6..8].*; self.u[2] = self.l[0]; self.l[6..8].* = self.d[4..6].*; self.l[0] = self.d[6]; self.d[4..7].* = tmp; } pub fn rotD(self: *Cube) void { self.d = @bitCast([8]Color, std.math.rotl(u64, @bitCast(u64, self.d), 2 * 8)); // sides const tmp: [3]Color = self.r[4..7].*; self.r[4..7].* = self.f[4..7].*; self.f[4..7].* = self.l[4..7].*; self.l[4..7].* = self.b[4..7].*; self.b[4..7].* = tmp; } pub fn rotDPrime(self: *Cube) void { self.d = @bitCast([8]Color, std.math.rotr(u64, @bitCast(u64, self.d), 2 * 8)); // sides const tmp: [3]Color = self.r[4..7].*; self.r[4..7].* = self.b[4..7].*; self.b[4..7].* = self.l[4..7].*; self.l[4..7].* = self.f[4..7].*; self.f[4..7].* = tmp; } pub fn shuffleLog(self: *Cube, seed: u64, buf: *[32][]const u8) [][]const u8 { const move_strs: [18][]const u8 = .{ "U", "L", "F", "R", "B", "D", "U'", "L'", "F'", "R'", "B'", "D'", "U2", "L2", "F2", "R2", "B2", "D2", }; var prng = std.rand.DefaultPrng.init(seed); const moves = prng.random.intRangeAtMost(u8, 10, 32); var i: u8 = 0; var prev: u8 = 99; var double = false; while (i < moves) { const next = prng.random.intRangeAtMost(u8, 0, 11); if ((next + 6) % 12 == prev) { double = false; continue; } else if (next == prev) { if (double) { continue; } double = true; buf[i - 1] = move_strs[(next % 6) + 12]; } else { double = false; buf[i] = move_strs[next]; i += 1; } prev = next; switch (next) { 0 => self.rotU(), 1 => self.rotL(), 2 => self.rotF(), 3 => self.rotR(), 4 => self.rotB(), 5 => self.rotD(), 6 => self.rotUPrime(), 7 => self.rotLPrime(), 8 => self.rotFPrime(), 9 => self.rotRPrime(), 10 => self.rotBPrime(), 11 => self.rotDPrime(), else => unreachable, } } return buf[0..i]; } pub fn shuffle(self: *Cube, seed: u64) void { var buf: [32][]const u8 = undefined; _ = self.shuffleLog(seed, &buf); } pub fn edgeAt(self: Cube, edge: Edge) Edge { switch (edge.a) { .white => return switch (edge.b) { .green => .{ .a = self.u[1], .b = self.b[1], }, .orange => .{ .a = self.u[3], .b = self.r[1], }, .blue => .{ .a = self.u[5], .b = self.f[1], }, .red => .{ .a = self.u[7], .b = self.l[1], }, else => unreachable, }, .red => return switch (edge.b) { .white => .{ .a = self.l[1], .b = self.u[7], }, .blue => .{ .a = self.l[3], .b = self.f[7], }, .yellow => .{ .a = self.l[5], .b = self.d[7], }, .green => .{ .a = self.l[7], .b = self.b[3], }, else => unreachable, }, .blue => return switch (edge.b) { .white => .{ .a = self.f[1], .b = self.u[5], }, .orange => .{ .a = self.f[3], .b = self.r[7], }, .yellow => .{ .a = self.f[5], .b = self.d[1], }, .red => .{ .a = self.f[7], .b = self.l[3], }, else => unreachable, }, .orange => return switch (edge.b) { .white => .{ .a = self.r[1], .b = self.u[3], }, .green => .{ .a = self.r[3], .b = self.b[7], }, .yellow => .{ .a = self.r[5], .b = self.d[3], }, .blue => .{ .a = self.r[7], .b = self.f[3], }, else => unreachable, }, .green => return switch (edge.b) { .white => .{ .a = self.b[1], .b = self.u[1], }, .red => .{ .a = self.b[3], .b = self.l[7], }, .yellow => .{ .a = self.b[5], .b = self.d[5], }, .orange => .{ .a = self.b[7], .b = self.r[3], }, else => unreachable, }, .yellow => return switch (edge.b) { .blue => .{ .a = self.d[1], .b = self.f[5], }, .orange => .{ .a = self.d[3], .b = self.r[5], }, .green => .{ .a = self.d[5], .b = self.b[5], }, .red => .{ .a = self.d[7], .b = self.l[5], }, else => unreachable, }, } } pub fn getM2Pairs(self: Cube, buf: []u8) []const u8 { assert(buf.len > 42); var seen: [12]bool = [_]bool{false} ** 12; var prev: Edge = .{ .a = self.d[1], .b = self.f[5], }; markEdge(&seen, prev); var end: Edge = .{ .a = .yellow, .b = .blue, }; var first_letter: ?u8 = null; var i: u8 = 0; while (true) { if (prev.normalize().eql(end)) { if (prev.m2name(true) != 'u' and prev.m2name(true) != 'k') { // 'u' and 'k' should never be printed if (first_letter) |some| { buf[i] = some; buf[i + 1] = prev.m2name(false); buf[i + 2] = '\n'; i += 3; first_letter = null; } else { first_letter = prev.m2name(true); } } if (self.findUnsolvedEdge(&seen)) |some| { prev = some; markEdge(&seen, prev); end = prev.normalize(); } else { if (first_letter) |some| { buf[i] = some; buf[i + 1 ..][0..8].* = " parity\n".*; i += 9; } return buf[0..i]; } } if (first_letter) |some| { buf[i] = some; buf[i + 1] = prev.m2name(false); buf[i + 2] = '\n'; i += 3; first_letter = null; } else { first_letter = prev.m2name(true); } prev = self.edgeAt(prev); markEdge(&seen, prev); } unreachable; } fn markEdge(edges: *[12]bool, edge: Edge) void { const norm = edge.normalize(); var index: u8 = undefined; switch (norm.a) { .white => index = switch (norm.b) { .green => 0, .orange => 1, .blue => 2, .red => 3, else => unreachable, }, .blue => index = switch (norm.b) { .orange => 4, .red => 5, else => unreachable, }, .green => index = switch (norm.b) { .red => 6, .orange => 7, else => unreachable, }, .yellow => index = switch (norm.b) { .blue => 8, .orange => 9, .green => 10, .red => 11, else => unreachable, }, else => unreachable, } edges[index] = true; } fn findUnsolvedEdge(cube: Cube, edges: *[12]bool) ?Edge { for (edges) |s, i| { if (s) continue; const e: Edge = switch (i) { 0 => .{ .a = .white, .b = .green }, 1 => .{ .a = .white, .b = .orange }, 2 => .{ .a = .white, .b = .blue }, 3 => .{ .a = .white, .b = .red }, 4 => .{ .a = .blue, .b = .orange }, 5 => .{ .a = .blue, .b = .red }, 6 => .{ .a = .green, .b = .red }, 7 => .{ .a = .green, .b = .orange }, 8 => continue, 9 => .{ .a = .yellow, .b = .orange }, 10 => .{ .a = .yellow, .b = .green }, 11 => .{ .a = .yellow, .b = .red }, else => unreachable, }; if (e.eql(cube.edgeAt(e))) { markEdge(edges, e); // already solved } else { return e; } } return null; } pub fn cornerAt(self: Cube, corner: Corner) Corner { switch (corner.a) { .white => switch (corner.b) { .green => return switch (corner.c) { .red => .{ .a = self.u[0], .b = self.b[2], .c = self.l[0] }, .orange => .{ .a = self.u[2], .b = self.b[0], .c = self.r[2] }, else => unreachable, }, .orange => return switch (corner.c) { .green => .{ .a = self.u[2], .b = self.r[2], .c = self.b[0] }, .blue => .{ .a = self.u[4], .b = self.r[0], .c = self.f[2] }, else => unreachable, }, .blue => return switch (corner.c) { .orange => .{ .a = self.u[4], .b = self.f[2], .c = self.r[0] }, .red => .{ .a = self.u[6], .b = self.f[0], .c = self.l[2] }, else => unreachable, }, .red => return switch (corner.c) { .blue => .{ .a = self.u[6], .b = self.l[2], .c = self.f[0] }, .green => .{ .a = self.u[0], .b = self.l[0], .c = self.b[2] }, else => unreachable, }, else => unreachable, }, .red => switch (corner.b) { .white => return switch (corner.c) { .green => .{ .a = self.l[0], .b = self.u[0], .c = self.b[2] }, .blue => .{ .a = self.l[2], .b = self.u[6], .c = self.f[0] }, else => unreachable, }, .blue => return switch (corner.c) { .white => .{ .a = self.l[2], .b = self.f[0], .c = self.u[6] }, .yellow => .{ .a = self.l[4], .b = self.f[6], .c = self.d[0] }, else => unreachable, }, .yellow => return switch (corner.c) { .blue => .{ .a = self.l[4], .b = self.d[0], .c = self.f[6] }, .green => .{ .a = self.l[6], .b = self.d[6], .c = self.b[4] }, else => unreachable, }, .green => return switch (corner.c) { .yellow => .{ .a = self.l[6], .b = self.b[4], .c = self.d[6] }, .white => .{ .a = self.l[0], .b = self.b[2], .c = self.u[0] }, else => unreachable, }, else => unreachable, }, .blue => switch (corner.b) { .white => return switch (corner.c) { .red => .{ .a = self.f[0], .b = self.u[6], .c = self.l[2] }, .orange => .{ .a = self.f[2], .b = self.u[4], .c = self.r[0] }, else => unreachable, }, .orange => return switch (corner.c) { .white => .{ .a = self.f[2], .b = self.r[0], .c = self.u[4] }, .yellow => .{ .a = self.f[4], .b = self.r[6], .c = self.d[2] }, else => unreachable, }, .yellow => return switch (corner.c) { .orange => .{ .a = self.f[4], .b = self.d[2], .c = self.r[6] }, .red => .{ .a = self.f[6], .b = self.d[0], .c = self.l[4] }, else => unreachable, }, .red => return switch (corner.c) { .yellow => .{ .a = self.f[6], .b = self.l[4], .c = self.d[0] }, .white => .{ .a = self.f[0], .b = self.l[2], .c = self.u[6] }, else => unreachable, }, else => unreachable, }, .orange => switch (corner.b) { .white => return switch (corner.c) { .blue => .{ .a = self.r[0], .b = self.u[4], .c = self.f[2] }, .green => .{ .a = self.r[2], .b = self.u[2], .c = self.b[6] }, else => unreachable, }, .green => return switch (corner.c) { .white => .{ .a = self.r[2], .b = self.b[0], .c = self.u[2] }, .yellow => .{ .a = self.r[4], .b = self.b[6], .c = self.d[4] }, else => unreachable, }, .yellow => return switch (corner.c) { .green => .{ .a = self.r[4], .b = self.d[4], .c = self.b[6] }, .blue => .{ .a = self.r[6], .b = self.d[2], .c = self.f[4] }, else => unreachable, }, .blue => return switch (corner.c) { .yellow => .{ .a = self.r[6], .b = self.f[4], .c = self.d[2] }, .white => .{ .a = self.r[0], .b = self.f[2], .c = self.u[4] }, else => unreachable, }, else => unreachable, }, .green => switch (corner.b) { .white => return switch (corner.c) { .orange => .{ .a = self.b[0], .b = self.u[2], .c = self.r[2] }, .red => .{ .a = self.b[2], .b = self.u[0], .c = self.l[0] }, else => unreachable, }, .red => return switch (corner.c) { .white => .{ .a = self.b[2], .b = self.l[0], .c = self.u[0] }, .yellow => .{ .a = self.b[4], .b = self.l[6], .c = self.d[6] }, else => unreachable, }, .yellow => return switch (corner.c) { .red => .{ .a = self.b[4], .b = self.d[6], .c = self.l[6] }, .orange => .{ .a = self.b[6], .b = self.d[4], .c = self.r[4] }, else => unreachable, }, .orange => return switch (corner.c) { .yellow => .{ .a = self.b[6], .b = self.r[4], .c = self.d[4] }, .white => .{ .a = self.b[0], .b = self.r[2], .c = self.u[2] }, else => unreachable, }, else => unreachable, }, .yellow => switch (corner.b) { .blue => return switch (corner.c) { .red => .{ .a = self.d[0], .b = self.f[6], .c = self.l[4] }, .orange => .{ .a = self.d[2], .b = self.f[4], .c = self.r[6] }, else => unreachable, }, .orange => return switch (corner.c) { .blue => .{ .a = self.d[2], .b = self.r[6], .c = self.f[4] }, .green => .{ .a = self.d[4], .b = self.r[4], .c = self.b[6] }, else => unreachable, }, .green => return switch (corner.c) { .orange => .{ .a = self.d[4], .b = self.b[6], .c = self.r[4] }, .red => .{ .a = self.d[6], .b = self.b[4], .c = self.l[6] }, else => unreachable, }, .red => return switch (corner.c) { .green => .{ .a = self.d[6], .b = self.l[6], .c = self.b[4] }, .blue => .{ .a = self.d[0], .b = self.l[4], .c = self.f[6] }, else => unreachable, }, else => unreachable, }, } } pub fn getOpPairs(self: Cube, buf: []u8) []const u8 { assert(buf.len > 8 * 3); var seen: [8]bool = [_]bool{false} ** 8; var prev: Corner = .{ .a = self.l[0], .b = self.u[0], .c = self.b[2], }; markCorner(&seen, prev); var end: Corner = .{ .a = .white, .b = .green, .c = .red, }; var first_letter: ?u8 = null; var i: u8 = 0; while (true) { if (prev.normalize().eql(end)) { switch (prev.opName()) { 'A', 'E', 'R' => {}, else => if (first_letter) |some| { buf[i] = some; buf[i + 1] = prev.opName(); buf[i + 2] = '\n'; i += 3; first_letter = null; } else { first_letter = prev.opName(); }, } if (self.findUnsolvedCorner(&seen)) |some| { prev = some; markCorner(&seen, prev); end = prev.normalize(); } else { if (first_letter) |some| { buf[i] = some; buf[i + 1] = '\n'; i += 2; } return buf[0..i]; } } if (first_letter) |some| { buf[i] = some; buf[i + 1] = prev.opName(); buf[i + 2] = '\n'; i += 3; first_letter = null; } else { first_letter = prev.opName(); } prev = self.cornerAt(prev); markCorner(&seen, prev); } unreachable; } fn markCorner(corners: *[8]bool, corner: Corner) void { const norm = corner.normalize(); var index: u8 = undefined; switch (norm.a) { .white => switch (norm.b) { .green => index = switch (norm.c) { .red => 0, .orange => 1, else => unreachable, }, .blue => index = switch (norm.c) { .orange => 2, .red => 3, else => unreachable, }, else => unreachable, }, .yellow => switch (norm.b) { .blue => index = switch (norm.c) { .red => 4, .orange => 5, else => unreachable, }, .green => index = switch (norm.c) { .orange => 6, .red => 7, else => unreachable, }, else => unreachable, }, else => unreachable, } corners[index] = true; } fn findUnsolvedCorner(cube: Cube, corners: *[8]bool) ?Corner { for (corners) |s, i| { if (s) continue; const c: Corner = switch (i) { 0 => continue, 1 => .{ .a = .white, .b = .green, .c = .orange }, 2 => .{ .a = .white, .b = .blue, .c = .orange }, 3 => .{ .a = .white, .b = .blue, .c = .red }, 4 => .{ .a = .yellow, .b = .blue, .c = .red }, 5 => .{ .a = .yellow, .b = .blue, .c = .orange }, 6 => .{ .a = .yellow, .b = .green, .c = .orange }, 7 => .{ .a = .yellow, .b = .green, .c = .red }, else => unreachable, }; if (c.eql(cube.cornerAt(c))) { markCorner(corners, c); // already solved } else { return c; } } return null; } pub fn doMoves(self: *Cube, moves: []const u8) error{InvalidCharacter}!void { var it = std.mem.tokenize(moves, " "); while (it.next()) |move| { assert(move.len != 0); // guaranteed by mem.tokenize var inverse = false; var double = false; if (move.len > 1) { switch (move[1]) { '0' => continue, '1' => {}, '2' => double = true, '3' => inverse = true, '4' => continue, '\'' => inverse = true, else => return error.InvalidCharacter, } if (move.len > 2) return error.InvalidCharacter; } switch (move[0]) { 'u', 'U' => if (inverse) { self.rotUPrime(); } else if (double) { self.rotU(); self.rotU(); } else { self.rotU(); }, 'l', 'L' => if (inverse) { self.rotLPrime(); } else if (double) { self.rotL(); self.rotL(); } else { self.rotL(); }, 'f', 'F' => if (inverse) { self.rotFPrime(); } else if (double) { self.rotF(); self.rotF(); } else { self.rotF(); }, 'r', 'R' => if (inverse) { self.rotRPrime(); } else if (double) { self.rotR(); self.rotR(); } else { self.rotR(); }, 'b', 'B' => if (inverse) { self.rotBPrime(); } else if (double) { self.rotB(); self.rotB(); } else { self.rotB(); }, 'd', 'D' => if (inverse) { self.rotDPrime(); } else if (double) { self.rotD(); self.rotD(); } else { self.rotD(); }, else => return error.InvalidCharacter, } } } }; test "isSolved" { var c: Cube = .{}; expect(c.isSolved()); c.rotU(); expect(!c.isSolved()); c.rotU(); c.rotU(); c.rotU(); expect(c.isSolved()); } test "cross" { var clockwise: Cube = .{}; clockwise.rotU(); clockwise.rotU(); clockwise.rotD(); clockwise.rotD(); clockwise.rotL(); clockwise.rotL(); clockwise.rotR(); clockwise.rotR(); clockwise.rotF(); clockwise.rotF(); clockwise.rotB(); clockwise.rotB(); var counterclockwise: Cube = .{}; counterclockwise.rotUPrime(); counterclockwise.rotUPrime(); counterclockwise.rotDPrime(); counterclockwise.rotDPrime(); counterclockwise.rotLPrime(); counterclockwise.rotLPrime(); counterclockwise.rotRPrime(); counterclockwise.rotRPrime(); counterclockwise.rotFPrime(); counterclockwise.rotFPrime(); counterclockwise.rotBPrime(); counterclockwise.rotBPrime(); expect(clockwise.eql(counterclockwise)); } test "shuffle" { var log_buf: [32][]const u8 = undefined; var buf: [32 * 3]u8 = undefined; var c: Cube = .{}; const log = c.shuffleLog(420, &log_buf); var fib = std.io.fixedBufferStream(&buf); const writer = fib.writer(); for (log) |l| { try writer.print("{} ", .{l}); } expect(!c.isSolved()); var res: Cube = .{}; try res.doMoves(fib.getWritten()); expect(c.eql(res)); } test "edge.eql" { var a: Edge = .{ .a = .white, .b = .blue, }; var b: Edge = .{ .a = .blue, .b = .white, }; expect(!a.eql(b)); expect(a.eql(b.normalize())); } test "m2 pairs" { var buf: [64]u8 = undefined; var c: Cube = .{}; c.shuffle(6666); var res = c.getM2Pairs(&buf); std.testing.expectEqualStrings("th\nox\ndq\nws\nbm\njl\np parity\n", res); // superflip c = .{}; c.rotU(); c.rotR(); c.rotR(); c.rotF(); c.rotB(); c.rotR(); c.rotB(); c.rotB(); c.rotR(); c.rotU(); c.rotU(); c.rotL(); c.rotB(); c.rotB(); c.rotR(); c.rotUPrime(); c.rotDPrime(); c.rotR(); c.rotR(); c.rotF(); c.rotRPrime(); c.rotL(); c.rotB(); c.rotB(); c.rotU(); c.rotU(); c.rotF(); c.rotF(); res = c.getM2Pairs(&buf); std.testing.expectEqualStrings("aq\nbm\ncs\nde\njp\nlf\nrh\ntn\nvo\nwi\nxg\n", res); } test "old pochmann corners" { var buf: [64]u8 = undefined; var c: Cube = .{}; c.shuffle(6666); var res = c.getOpPairs(&buf); std.testing.expectEqualStrings("BW\nLN\nCV\nMD\nF\n", res); // superflip c = .{}; c.rotU(); c.rotR(); c.rotR(); c.rotF(); c.rotB(); c.rotR(); c.rotB(); c.rotB(); c.rotR(); c.rotU(); c.rotU(); c.rotL(); c.rotB(); c.rotB(); c.rotR(); c.rotUPrime(); c.rotDPrime(); c.rotR(); c.rotR(); c.rotF(); c.rotRPrime(); c.rotL(); c.rotB(); c.rotB(); c.rotU(); c.rotU(); c.rotF(); c.rotF(); res = c.getOpPairs(&buf); std.testing.expectEqualStrings("", res); } test "full blind solve" { var buf: [128]u8 = undefined; var c: Cube = .{}; c.doMoves("R B' U' R' U' B2 U R2 B L' F2 D' B2 U2 F2 D B2 R2 D' L2 U'") catch unreachable; var edges = c.getM2Pairs(&buf); std.testing.expectEqualStrings("lh\ngo\nap\nqb\nmw\ndn\nws\n", edges); var corners = c.getOpPairs(buf[edges.len..]); std.testing.expectEqualStrings("IS\nPG\nMQ\n", corners); c = .{}; c.doMoves("D R' U' F2 R2 F2 L2 F2 R' D2 F' R' F R2 B' U' L2 D2 B U' F2 U R F D2") catch unreachable; edges = c.getM2Pairs(&buf); std.testing.expectEqualStrings("md\npc\nat\nxl\nho\nia\n", edges); corners = c.getOpPairs(buf[edges.len..]); std.testing.expectEqualStrings("KB\nMX\nOD\nUG\n", corners); c = .{}; c.doMoves("R' U2 F' B R L R L' R' U L' R") catch unreachable; edges = c.getM2Pairs(&buf); std.testing.expectEqualStrings("fg\nca\nto\nea\nbj\nsr\nm parity\n", edges); corners = c.getOpPairs(buf[edges.len..]); std.testing.expectEqualStrings("GQ\nCH\nDW\nDV\nP\n", corners); } test "doMoves" { var a: Cube = .{}; a.rotR(); a.rotBPrime(); a.rotUPrime(); a.rotRPrime(); a.rotUPrime(); a.rotB(); a.rotB(); a.rotU(); a.rotR(); a.rotR(); a.rotB(); a.rotLPrime(); a.rotF(); a.rotF(); a.rotDPrime(); a.rotB(); a.rotB(); a.rotU(); a.rotU(); a.rotF(); a.rotF(); a.rotD(); a.rotB(); a.rotB(); a.rotR(); a.rotR(); a.rotDPrime(); a.rotL(); a.rotL(); a.rotUPrime(); var b: Cube = .{}; b.doMoves("R B' U' R' U' B2 U R2 B L' F2 D' B2 U2 F2 D B2 R2 D' L2 U'") catch unreachable; expect(a.eql(b)); } pub fn fatal(comptime format: []const u8, args: anytype) noreturn { std.debug.print(format ++ "\n", args); std.process.exit(1); } const usage = \\Usage: rubik [command] [args] \\ \\Commands: \\ \\ do [moves] Do the given moves and print the result \\ help Print this help and exit \\ scramble Generate a scramble \\ solve-blind [moves] Solve the m2 and Old Pochmann pairs for this scramble \\ version Print version number and exit \\ ; var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){}; const gpa = &general_purpose_allocator.allocator; pub fn main() !void { const stdout = std.io.getStdOut().writer(); defer _ = general_purpose_allocator.deinit(); var arena_instance = std.heap.ArenaAllocator.init(gpa); defer arena_instance.deinit(); const args = try std.process.argsAlloc(&arena_instance.allocator); if (args.len <= 1) { std.debug.print("{}", .{usage}); fatal("expected command argument", .{}); } if (std.mem.eql(u8, args[1], "do")) { if (args.len != 3) { fatal("expected exactly one scramble argument", .{}); } var cube: Cube = .{}; cube.doMoves(args[2]) catch { fatal("invalid scramble: \"{}\"", .{args[2]}); }; try stdout.print("{}\n", .{cube}); } else if (std.mem.eql(u8, args[1], "help")) { try stdout.writeAll(usage); } else if (std.mem.eql(u8, args[1], "scramble")) { var seed_buf: [8]u8 = undefined; try std.crypto.randomBytes(&seed_buf); const seed = std.mem.readIntLittle(u64, &seed_buf); var buf: [32][]const u8 = undefined; var cube: Cube = .{}; const log = cube.shuffleLog(seed, &buf); for (log) |l| { try stdout.print("{} ", .{l}); } try stdout.writeByte('\n'); } else if (std.mem.eql(u8, args[1], "solve-blind")) { if (args.len != 3) { fatal("expected exactly one scramble argument", .{}); } var cube: Cube = .{}; cube.doMoves(args[2]) catch { fatal("invalid scramble: \"{}\"", .{args[2]}); }; var buf: [128]u8 = undefined; const edges = cube.getM2Pairs(&buf); const corners = cube.getOpPairs(buf[edges.len..]); if (edges.len == 0) { try stdout.writeAll("edges solved\n"); } else { try stdout.print("edges:\n{s}", .{edges}); } if (corners.len == 0) { try stdout.writeAll("corners solved\n"); } else { try stdout.print("corners:\n{s}", .{corners}); } } else if (std.mem.eql(u8, args[1], "version")) { try stdout.print("{}", .{@import("build_options").rubik_version}); } else { std.debug.print("{}", .{usage}); fatal("unknown command: {}", .{args[1]}); } }
src/rubik.zig
const testing = @import("std").testing; const freetype = @import("freetype"); const firasnas_font_path = "upstream/assets/FiraSans-Regular.ttf"; const firasnas_font_data = @embedFile("../upstream/assets/FiraSans-Regular.ttf"); test "new face from file" { const lib = try freetype.Library.init(); _ = try lib.newFace(firasnas_font_path, 0); } test "new face from memory" { const lib = try freetype.Library.init(); _ = try lib.newFaceMemory(firasnas_font_data, 0); } test "new stroker" { const lib = try freetype.Library.init(); _ = try lib.newStroker(); } test "set lcd filter" { if (@hasDecl(freetype.c, "FT_CONFIG_OPTION_SUBPIXEL_RENDERING")) { const lib = try freetype.Library.init(); try lib.setLcdFilter(.default); } else { return error.SkipZigTest; } } test "load glyph" { const lib = try freetype.Library.init(); const face = try lib.newFace(firasnas_font_path, 0); try face.setPixelSizes(100, 100); try face.setCharSize(10 * 10, 0, 72, 0); try face.loadGlyph(205, .{}); try face.loadChar('A', .{}); face.deinit(); } test "attach file" { const lib = try freetype.Library.init(); const face = try lib.newFace("upstream/assets/DejaVuSans.pfb", 0); try face.attachFile("upstream/assets/DejaVuSans.pfm"); } test "attach from memory" { const lib = try freetype.Library.init(); const face = try lib.newFace("upstream/assets/DejaVuSans.pfb", 0); const file = @embedFile("../upstream/assets/DejaVuSans.pfm"); try face.attachMemory(file); } test "charmap iterator" { const lib = try freetype.Library.init(); const face = try lib.newFace(firasnas_font_path, 0); var iterator = face.getCharmapIterator(); var old_char: usize = 0; while (iterator.next()) |c| { try testing.expect(old_char != c); old_char = c; } } test "get name index" { const lib = try freetype.Library.init(); const face = try lib.newFace(firasnas_font_path, 0); try testing.expectEqual(@as(u32, 1120), face.getNameIndex("summation").?); } test "get index name" { const lib = try freetype.Library.init(); const face = try lib.newFace(firasnas_font_path, 0); try testing.expectEqualStrings("summation", try face.getGlyphName(1120)); }
freetype/test/main.zig
const std = @import("std"); const mem = std.mem; const SoftDotted = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 105, hi: u21 = 120467, pub fn init(allocator: *mem.Allocator) !SoftDotted { var instance = SoftDotted{ .allocator = allocator, .array = try allocator.alloc(bool, 120363), }; mem.set(bool, instance.array, false); var index: u21 = 0; index = 0; while (index <= 1) : (index += 1) { instance.array[index] = true; } instance.array[198] = true; instance.array[480] = true; instance.array[511] = true; instance.array[564] = true; instance.array[585] = true; instance.array[906] = true; instance.array[1005] = true; instance.array[1007] = true; instance.array[7417] = true; instance.array[7469] = true; instance.array[7483] = true; instance.array[7487] = true; instance.array[7620] = true; instance.array[7778] = true; instance.array[8200] = true; index = 8415; while (index <= 8416) : (index += 1) { instance.array[index] = true; } instance.array[11283] = true; index = 119737; while (index <= 119738) : (index += 1) { instance.array[index] = true; } index = 119789; while (index <= 119790) : (index += 1) { instance.array[index] = true; } index = 119841; while (index <= 119842) : (index += 1) { instance.array[index] = true; } index = 119893; while (index <= 119894) : (index += 1) { instance.array[index] = true; } index = 119945; while (index <= 119946) : (index += 1) { instance.array[index] = true; } index = 119997; while (index <= 119998) : (index += 1) { instance.array[index] = true; } index = 120049; while (index <= 120050) : (index += 1) { instance.array[index] = true; } index = 120101; while (index <= 120102) : (index += 1) { instance.array[index] = true; } index = 120153; while (index <= 120154) : (index += 1) { instance.array[index] = true; } index = 120205; while (index <= 120206) : (index += 1) { instance.array[index] = true; } index = 120257; while (index <= 120258) : (index += 1) { instance.array[index] = true; } index = 120309; while (index <= 120310) : (index += 1) { instance.array[index] = true; } index = 120361; while (index <= 120362) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *SoftDotted) void { self.allocator.free(self.array); } // isSoftDotted checks if cp is of the kind Soft_Dotted. pub fn isSoftDotted(self: SoftDotted, cp: u21) bool { if (cp < self.lo or cp > self.hi) return false; const index = cp - self.lo; return if (index >= self.array.len) false else self.array[index]; }
src/components/autogen/PropList/SoftDotted.zig
const std = @import("std"); const print = std.debug.print; const Allocator = std.mem.Allocator; // We are brave with our reading. const u32_max = 4294967295; pub const LineDef = struct { // Represents a line with [start..end] start : usize, end : usize, }; pub const Lines = struct { backing: []const u8, lines: std.ArrayList(LineDef), backing_owned : bool, pub fn init(allocator: Allocator, backing: []const u8) !Lines { var line_defs = std.ArrayList(LineDef).init(allocator); var line_start : usize = 0; for (backing) |c, i| { var found_end = false; if (c == @intCast(u8, '\r')) { if (i + 1 < backing.len and backing[i+1] == @intCast(u8, '\n')) { found_end = true; } } else if (c == @intCast(u8, '\n')) { found_end = true; } if (found_end) { if (i > line_start) { try line_defs.append(.{.start = line_start, .end = i}); } line_start = i+1; } } if (backing.len > line_start) { try line_defs.append(.{.start = line_start, .end = backing.len}); } return Lines{.backing = backing, .lines = line_defs, .backing_owned = false}; } pub fn deinit(self: Lines, allocator: Allocator) void { if (self.backing_owned) { allocator.free(self.backing); } self.lines.deinit(); } pub fn get(self : Lines, i: usize) ?[]const u8 { if (i >= self.lines.items.len) { return null; } const line_def = self.lines.items[i]; return self.backing[line_def.start..line_def.end]; } pub fn len(self : Lines) usize { return self.lines.items.len; } pub const Iterator = struct { lines : Lines, pos : ?usize, pub fn init(lines : Lines) Iterator { return .{.lines = lines, .pos = null}; } pub fn next(self : *Iterator) ?[] const u8 { if (self.pos == null) { self.pos = 0; } const str = self.lines.get(self.pos.?); self.pos.? += 1; return str; } }; };
src/dan/lines.zig
const std = @import("std"); const assert = std.debug.assert; pub const Computer = struct { mem: [1024]u32, pos: usize, const OP = enum(u32) { ADD = 1, MUL = 2, STOP = 99, }; pub fn init(str: []const u8) Computer { var self = Computer{ .mem = undefined, .pos = 0, }; var it = std.mem.split(u8, str, ","); while (it.next()) |what| { const instr = std.fmt.parseInt(u32, what, 10) catch unreachable; self.mem[self.pos] = instr; self.pos += 1; } return self; } pub fn get(self: Computer, pos: usize) u32 { return self.mem[pos]; } pub fn set(self: *Computer, pos: usize, val: u32) void { self.mem[pos] = val; } pub fn run(self: *Computer) void { var pc: usize = 0; while (true) : (pc += 4) { const op = @intToEnum(OP, self.mem[pc + 0]); const p1 = self.mem[pc + 1]; const p2 = self.mem[pc + 2]; const p3 = self.mem[pc + 3]; switch (op) { OP.STOP => break, OP.ADD => self.mem[p3] = self.mem[p1] + self.mem[p2], OP.MUL => self.mem[p3] = self.mem[p1] * self.mem[p2], } } } }; test "simple - pos 0 becomes 3500" { const data: []const u8 = "1,9,10,3,2,3,11,0,99,30,40,50"; var computer = Computer.init(data[0..]); computer.run(); assert(computer.get(0) == 3500); } test "simple - pos 0 becomes 2" { const data: []const u8 = "1,0,0,0,99"; var computer = Computer.init(data[0..]); computer.run(); assert(computer.get(0) == 2); } test "simple - pos 3 becomes 6" { const data: []const u8 = "2,3,0,3,99"; var computer = Computer.init(data[0..]); computer.run(); assert(computer.get(3) == 6); } test "simple - pos 5 becomes 9801" { const data: []const u8 = "2,4,4,5,99,0"; var computer = Computer.init(data[0..]); computer.run(); assert(computer.get(5) == 9801); } test "simple - pos 0 becomes 30" { const data: []const u8 = "1,1,1,4,99,5,6,0,99"; var computer = Computer.init(data[0..]); computer.run(); assert(computer.get(0) == 30); }
2019/p02/computer.zig