code
stringlengths 38
801k
| repo_path
stringlengths 6
263
|
---|---|
const std = @import("std");
pub const Scanner = struct {
const Self = @This();
source: []const u8,
start: usize = 0,
current: usize = 0,
line: usize = 1,
pub fn init(source: []const u8) Self {
return Self{ .source = source };
}
pub fn hasNextToken(self: *Self) bool {
self.skipWhiteSpace();
return !self.isAtEnd();
}
pub fn nextToken(self: *Self) ?Token {
self.skipWhiteSpace();
if (self.isAtEnd()) return null;
self.start = self.current;
const c = self.advance();
if (isAlpha(c)) return self.handleIdentifier();
if (isDigit(c)) return self.handleNumber();
return switch (c) {
'(' => self.makeToken(.LEFT_PAREN),
')' => self.makeToken(.RIGHT_PAREN),
'{' => self.makeToken(.LEFT_BRACE),
'}' => self.makeToken(.RIGHT_BRACE),
';' => self.makeToken(.SEMICOLON),
',' => self.makeToken(.COMMA),
'.' => self.makeToken(.DOT),
'-' => self.makeToken(.MINUS),
'+' => self.makeToken(.PLUS),
'/' => self.makeToken(.SLASH),
'*' => self.makeToken(.STAR),
'!' => if (self.match('=')) self.makeToken(.BANG_EQUAL) else self.makeToken(.BANG),
'=' => if (self.match('=')) self.makeToken(.EQUAL_EQUAL) else self.makeToken(.EQUAL),
'<' => if (self.match('=')) self.makeToken(.LESS_EQUAL) else self.makeToken(.LESS),
'>' => if (self.match('=')) self.makeToken(.GREATER_EQUAL) else self.makeToken(.GREATER),
'"' => self.handleString(),
else => return self.errorToken("Unexpected character."),
};
}
fn handleIdentifier(self: *Self) Token {
while (isAlpha(self.peek()) or isDigit(self.peek())) {
self.current += 1;
}
return self.makeToken(self.identifierType());
}
fn handleNumber(self: *Self) Token {
while (isDigit(self.peek())) {
self.current += 1;
}
if (self.peek() == '.' and isDigit(self.peekNext())) {
// consume the dot
self.current += 1;
while (isDigit(self.peek())) {
self.current += 1;
}
}
return self.makeToken(.NUMBER);
}
fn handleString(self: *Self) Token {
while (self.peek() != '"' and !self.isAtEnd()) {
if (self.peek() == '\n') {
self.line += 1;
}
self.current += 1;
}
if (self.isAtEnd()) return self.errorToken("Unterminated string.");
// For the closing quote
self.current += 1;
return self.makeToken(.STRING);
}
fn skipWhiteSpace(self: *Self) void {
while (true) {
switch (self.peek()) {
' ', '\r', '\t' => self.current += 1,
'\n' => {
self.line += 1;
self.current += 1;
},
'/' => {
if (self.peekNext() == '/') {
while (self.peek() != '\n' and !self.isAtEnd()) {
self.current += 1;
}
} else {
return;
}
},
else => return,
}
}
}
inline fn peek(self: *Self) u8 {
if (self.isAtEnd()) return 0;
return self.source[self.current];
}
inline fn peekNext(self: *Self) u8 {
if (self.isAtEnd()) return 0;
return self.source[self.current + 1];
}
fn advance(self: *Self) u8 {
self.current += 1;
return self.source[self.current - 1];
}
fn match(self: *Self, expected: u8) bool {
if (self.isAtEnd()) return false;
if (self.source[self.current] != expected) return false;
self.current += 1;
return true;
}
fn isAtEnd(self: *Self) bool {
return self.current >= self.source.len;
}
fn makeToken(self: *Self, tokenType: TokenType) Token {
return Token{
.ty = tokenType,
.lexeme = self.source[self.start..self.current],
.line = self.line,
};
}
fn errorToken(self: *Self, message: []const u8) Token {
return Token{
.ty = .ERROR,
.lexeme = message,
.line = self.line,
};
}
fn identifierType(self: *Self) TokenType {
return switch (self.source[self.start]) {
'a' => self.checkKeyword("and", .AND),
'c' => self.checkKeyword("class", .CLASS),
'e' => self.checkKeyword("else", .ELSE),
'f' => switch (self.source[self.start + 1]) {
'a' => self.checkKeyword("false", .FALSE),
'o' => self.checkKeyword("for", .FOR),
'u' => self.checkKeyword("fun", .FUN),
else => .IDENTIFIER,
},
'i' => self.checkKeyword("if", .IF),
'n' => self.checkKeyword("nil", .NIL),
'o' => self.checkKeyword("or", .OR),
'p' => self.checkKeyword("print", .PRINT),
'r' => self.checkKeyword("return", .RETURN),
's' => self.checkKeyword("super", .SUPER),
't' => switch (self.source[self.start + 1]) {
'h' => self.checkKeyword("this", .THIS),
'r' => self.checkKeyword("true", .TRUE),
else => .IDENTIFIER,
},
'v' => self.checkKeyword("var", .VAR),
'w' => self.checkKeyword("while", .WHILE),
else => return .IDENTIFIER,
};
}
fn checkKeyword(self: *Self, keyword: []const u8, ty: TokenType) TokenType {
if (std.mem.eql(u8, keyword, self.source[self.start..self.current])) {
return ty;
}
return .IDENTIFIER;
}
};
fn isDigit(char: u8) bool {
return char >= '0' and char <= '9';
}
fn isAlpha(char: u8) bool {
return (char >= 'a' and char <= 'z') or (char >= 'A' and char <= 'Z') or (char == '_');
}
pub const Token = struct {
ty: TokenType,
lexeme: []const u8,
line: u64,
};
pub const TokenType = enum {
// Single-character tokens.
LEFT_PAREN,
RIGHT_PAREN,
LEFT_BRACE,
RIGHT_BRACE,
COMMA,
DOT,
MINUS,
PLUS,
SEMICOLON,
SLASH,
STAR,
// One or two character tokens.
BANG,
BANG_EQUAL,
EQUAL,
EQUAL_EQUAL,
GREATER,
GREATER_EQUAL,
LESS,
LESS_EQUAL,
// Literals.
IDENTIFIER,
STRING,
NUMBER,
// Keywords.
AND,
CLASS,
ELSE,
FALSE,
FOR,
FUN,
IF,
NIL,
OR,
PRINT,
RETURN,
SUPER,
THIS,
TRUE,
VAR,
WHILE,
// Other
ERROR,
EOF,
}; | src/scanner.zig |
const std = @import("std");
const builtin = @import("builtin");
const os = std.os;
const math = std.math;
pub usingnamespace if (!@hasDecl(std.os, "SHUT_RD") and !@hasDecl(std.os, "SHUT_WR") and !@hasDecl(std.os, "SHUT_RDWR"))
struct {
pub const SHUT_RD = 0;
pub const SHUT_WR = 1;
pub const SHUT_RDWR = 2;
}
else
struct {};
pub const LINGER = extern struct {
l_onoff: c_int, // Whether or not a socket should remain open to send queued dataa after closesocket() is called.
l_linger: c_int, // Number of seconds on how long a socket should remain open after closesocket() is called.
};
const funcs = struct {
pub extern "c" fn shutdown(sock: os.socket_t, how: c_int) c_int;
};
pub fn shutdown_(sock: os.socket_t, how: c_int) !void {
const rc = if (builtin.link_libc) funcs.shutdown(sock, how) else os.system.shutdown(sock, @intCast(i32, how));
return switch (os.errno(rc)) {
.SUCCESS => {},
.BADF => error.BadFileDescriptor,
.INVAL => error.BadArgument,
.NOTCONN => error.SocketNotConnected,
.NOTSOCK => error.NotASocket,
else => |err| os.unexpectedErrno(err),
};
}
pub fn sendto_(
/// The file descriptor of the sending socket.
sockfd: os.socket_t,
/// Message to send.
buf: []const u8,
flags: u32,
dest_addr: ?*const os.sockaddr,
addrlen: os.socklen_t,
) !usize {
while (true) {
const rc = os.system.sendto(sockfd, buf.ptr, buf.len, flags, dest_addr, addrlen);
switch (os.errno(rc)) {
.SUCCESS => return @intCast(usize, rc),
.ACCES => return error.AccessDenied,
.AGAIN, .PROTOTYPE => return error.WouldBlock,
.ALREADY => return error.FastOpenAlreadyInProgress,
.BADF => unreachable, // always a race condition
.CONNRESET => return error.ConnectionResetByPeer,
.DESTADDRREQ => unreachable, // The socket is not connection-mode, and no peer address is set.
.FAULT => unreachable, // An invalid user space address was specified for an argument.
.INTR => continue,
.INVAL => unreachable, // Invalid argument passed.
.ISCONN => unreachable, // connection-mode socket was connected already but a recipient was specified
.MSGSIZE => return error.MessageTooBig,
.NOBUFS => return error.SystemResources,
.NOMEM => return error.SystemResources,
.NOTCONN => unreachable, // The socket is not connected, and no target has been given.
.NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket.
.OPNOTSUPP => unreachable, // Some bit in the flags argument is inappropriate for the socket type.
.PIPE => return error.BrokenPipe,
else => |err| return os.unexpectedErrno(err),
}
}
}
pub fn read_(fd: os.fd_t, buf: []u8) !usize {
const max_count = switch (builtin.os.tag) {
.linux => 0x7ffff000,
.macos, .ios, .watchos, .tvos => math.maxInt(i32),
else => math.maxInt(isize),
};
const adjusted_len = math.min(max_count, buf.len);
while (true) {
const rc = os.system.read(fd, buf.ptr, adjusted_len);
switch (os.errno(rc)) {
.SUCCESS => return @intCast(usize, rc),
.INTR => continue,
.INVAL => unreachable,
.FAULT => unreachable,
.AGAIN => return error.WouldBlock,
.BADF => return error.NotOpenForReading, // Can be a race condition.
.IO => return error.InputOutput,
.ISDIR => return error.IsDir,
.NOBUFS => return error.SystemResources,
.NOMEM => return error.SystemResources,
.NOTCONN => return error.SocketNotConnected,
.CONNRESET => return error.ConnectionResetByPeer,
.TIMEDOUT => return error.ConnectionTimedOut,
else => |err| return os.unexpectedErrno(err),
}
}
return os.index;
}
pub fn connect_(sock: os.socket_t, sock_addr: *const os.sockaddr, len: os.socklen_t) !void {
while (true) {
return switch (os.errno(os.system.connect(sock, sock_addr, len))) {
.SUCCESS => {},
.ACCES => error.PermissionDenied,
.PERM => error.PermissionDenied,
.ADDRINUSE => error.AddressInUse,
.ADDRNOTAVAIL => error.AddressNotAvailable,
.AFNOSUPPORT => error.AddressFamilyNotSupported,
.AGAIN, .INPROGRESS => error.WouldBlock,
.ALREADY => unreachable, // The socket is nonblocking and a previous connection attempt has not yet been completed.
.BADF => unreachable, // sockfd is not a valid open file descriptor.
.CONNREFUSED => error.ConnectionRefused,
.FAULT => unreachable, // The socket structure address is outside the user's address space.
.INTR => continue,
.ISCONN => error.AlreadyConnected, // The socket is already connected.
.NETUNREACH => error.NetworkUnreachable,
.NOTSOCK => unreachable, // The file descriptor sockfd does not refer to a socket.
.PROTOTYPE => unreachable, // The socket type does not support the requested communications protocol.
.TIMEDOUT => error.ConnectionTimedOut,
.NOENT => error.FileNotFound, // Returned when socket is AF_UNIX and the given path does not exist.
else => |err| os.unexpectedErrno(err),
};
}
}
pub fn accept_(sock: os.socket_t, addr: ?*os.sockaddr, addr_size: ?*os.socklen_t, flags: u32) !os.socket_t {
const have_accept4 = comptime !(builtin.target.isDarwin() or builtin.os.tag == .windows);
const accepted_sock = while (true) {
const rc = if (have_accept4)
os.system.accept4(sock, addr, addr_size, flags)
else if (builtin.os.tag == .windows)
os.windows.accept(sock, addr, addr_size)
else
os.system.accept(sock, addr, addr_size);
if (builtin.os.tag == .windows) {
if (rc == os.windows.ws2_32.INVALID_SOCKET) {
switch (os.windows.ws2_32.WSAGetLastError()) {
.WSANOTINITIALISED => unreachable, // not initialized WSA
.WSAECONNRESET => return error.ConnectionResetByPeer,
.WSAEFAULT => unreachable,
.WSAEINVAL => return error.SocketNotListening,
.WSAEMFILE => return error.ProcessFdQuotaExceeded,
.WSAENETDOWN => return error.NetworkSubsystemFailed,
.WSAENOBUFS => return error.FileDescriptorNotASocket,
.WSAEOPNOTSUPP => return error.OperationNotSupported,
.WSAEWOULDBLOCK => return error.WouldBlock,
else => |err| return os.windows.unexpectedWSAError(err),
}
} else {
break rc;
}
} else {
switch (os.errno(rc)) {
.SUCCESS => {
break @intCast(os.socket_t, rc);
},
.INTR => continue,
.AGAIN => return error.WouldBlock,
.CONNABORTED => return error.ConnectionAborted,
.FAULT => unreachable,
.INVAL, .BADF => return error.SocketNotListening,
.NOTSOCK => return error.NotASocket,
.MFILE => return error.ProcessFdQuotaExceeded,
.NFILE => return error.SystemFdQuotaExceeded,
.NOBUFS => return error.SystemResources,
.NOMEM => return error.SystemResources,
.OPNOTSUPP => unreachable,
.PROTO => return error.ProtocolFailure,
.PERM => return error.BlockedByFirewall,
else => |err| return os.unexpectedErrno(err),
}
}
} else unreachable;
if (!have_accept4) {
try setSockFlags(accepted_sock, flags);
}
return accepted_sock;
}
fn setSockFlags(sock: os.socket_t, flags: u32) !void {
if ((flags & os.SOCK.CLOEXEC) != 0) {
if (builtin.os.tag == .windows) {
// TODO: Find out if this is supported for sockets
} else {
var fd_flags = os.fcntl(sock, os.F_GETFD, 0) catch |err| switch (err) {
error.FileBusy => unreachable,
error.Locked => unreachable,
else => |e| return e,
};
fd_flags |= os.FD_CLOEXEC;
_ = os.fcntl(sock, os.F_SETFD, fd_flags) catch |err| switch (err) {
error.FileBusy => unreachable,
error.Locked => unreachable,
else => |e| return e,
};
}
}
if ((flags & os.SOCK.NONBLOCK) != 0) {
if (builtin.os.tag == .windows) {
var mode: c_ulong = 1;
if (os.windows.ws2_32.ioctlsocket(sock, os.windows.ws2_32.FIONBIO, &mode) == os.windows.ws2_32.SOCKET_ERROR) {
switch (os.windows.ws2_32.WSAGetLastError()) {
.WSANOTINITIALISED => unreachable,
.WSAENETDOWN => return error.NetworkSubsystemFailed,
.WSAENOTSOCK => return error.FileDescriptorNotASocket,
// TODO: handle more errors
else => |err| return os.windows.unexpectedWSAError(err),
}
}
} else {
var fl_flags = os.fcntl(sock, os.F_GETFL, 0) catch |err| switch (err) {
error.FileBusy => unreachable,
error.Locked => unreachable,
else => |e| return e,
};
fl_flags |= os.O_NONBLOCK;
_ = os.fcntl(sock, os.F_SETFL, fl_flags) catch |err| switch (err) {
error.FileBusy => unreachable,
error.Locked => unreachable,
else => |e| return e,
};
}
}
}
pub fn getsockopt(comptime T: type, handle: os.socket_t, level: u32, opt: u32) !T {
var val: T = undefined;
var val_len: u32 = @sizeOf(T);
const rc = os.system.getsockopt(handle, level, opt, @ptrCast([*]u8, &val), &val_len);
return switch (std.os.linux.getErrno(rc)) {
.SUCCESS => val,
.BADF => error.BadFileDescriptor, // The argument sockfd is not a valid file descriptor.
.FAULT => error.InvalidParameter, // The address pointed to by optval or optlen is not in a valid part of the process address space.
.NOPROTOOPT => error.UnsupportedOption, // The option is unknown at the level indicated.
.NOTSOCK => error.NotASocket, // The file descriptor sockfd does not refer to a socket.
else => |err| os.unexpectedErrno(err),
};
}
pub fn sigprocmask(flags: anytype, noalias set: ?*const os.sigset_t, noalias oldset: ?*os.sigset_t) !void {
const rc = os.system.sigprocmask(flags, set, oldset);
return switch (os.errno(rc)) {
.SUCCESS => {},
.FAULT => error.InvalidParameter,
.INVAL => error.BadSignalSet,
else => |err| os.unexpectedErrno(err),
};
} | os/posix.zig |
const std = @import("std");
const Target = std.Target;
const Version = std.builtin.Version;
const mem = std.mem;
const log = std.log;
const fs = std.fs;
const fmt = std.fmt;
const assert = std.debug.assert;
// Example abilist path:
// ./sysdeps/unix/sysv/linux/aarch64/libc.abilist
const AbiList = struct {
targets: []const ZigTarget,
path: []const u8,
};
const ZigTarget = struct {
arch: std.Target.Cpu.Arch,
abi: std.Target.Abi,
fn getIndex(zt: ZigTarget) u16 {
for (zig_targets) |other, i| {
if (zt.eql(other)) {
return @intCast(u16, i);
}
}
unreachable;
}
fn eql(zt: ZigTarget, other: ZigTarget) bool {
return zt.arch == other.arch and zt.abi == other.abi;
}
};
const lib_names = [_][]const u8{
"m",
"pthread",
"c",
"dl",
"rt",
"ld",
"util",
};
/// This is organized by grouping together at the beginning,
/// targets most likely to share the same symbol information.
const zig_targets = [_]ZigTarget{
// zig fmt: off
.{ .arch = .arm , .abi = .gnueabi },
.{ .arch = .armeb , .abi = .gnueabi },
.{ .arch = .arm , .abi = .gnueabihf },
.{ .arch = .armeb , .abi = .gnueabihf },
.{ .arch = .mipsel , .abi = .gnueabihf },
.{ .arch = .mips , .abi = .gnueabihf },
.{ .arch = .mipsel , .abi = .gnueabi },
.{ .arch = .mips , .abi = .gnueabi },
.{ .arch = .i386 , .abi = .gnu },
.{ .arch = .riscv32 , .abi = .gnu },
.{ .arch = .sparc , .abi = .gnu },
.{ .arch = .sparcel , .abi = .gnu },
.{ .arch = .powerpc , .abi = .gnueabi },
.{ .arch = .powerpc , .abi = .gnueabihf },
.{ .arch = .powerpc64le, .abi = .gnu },
.{ .arch = .powerpc64 , .abi = .gnu },
.{ .arch = .mips64el , .abi = .gnuabi64 },
.{ .arch = .mips64 , .abi = .gnuabi64 },
.{ .arch = .mips64el , .abi = .gnuabin32 },
.{ .arch = .mips64 , .abi = .gnuabin32 },
.{ .arch = .aarch64 , .abi = .gnu },
.{ .arch = .aarch64_be , .abi = .gnu },
.{ .arch = .x86_64 , .abi = .gnu },
.{ .arch = .x86_64 , .abi = .gnux32 },
.{ .arch = .riscv64 , .abi = .gnu },
.{ .arch = .sparcv9 , .abi = .gnu },
.{ .arch = .s390x , .abi = .gnu },
// zig fmt: on
};
const versions = [_]Version{
.{.major = 2, .minor = 0},
.{.major = 2, .minor = 1},
.{.major = 2, .minor = 1, .patch = 1},
.{.major = 2, .minor = 1, .patch = 2},
.{.major = 2, .minor = 1, .patch = 3},
.{.major = 2, .minor = 2},
.{.major = 2, .minor = 2, .patch = 1},
.{.major = 2, .minor = 2, .patch = 2},
.{.major = 2, .minor = 2, .patch = 3},
.{.major = 2, .minor = 2, .patch = 4},
.{.major = 2, .minor = 2, .patch = 5},
.{.major = 2, .minor = 2, .patch = 6},
.{.major = 2, .minor = 3},
.{.major = 2, .minor = 3, .patch = 2},
.{.major = 2, .minor = 3, .patch = 3},
.{.major = 2, .minor = 3, .patch = 4},
.{.major = 2, .minor = 4},
.{.major = 2, .minor = 5},
.{.major = 2, .minor = 6},
.{.major = 2, .minor = 7},
.{.major = 2, .minor = 8},
.{.major = 2, .minor = 9},
.{.major = 2, .minor = 10},
.{.major = 2, .minor = 11},
.{.major = 2, .minor = 12},
.{.major = 2, .minor = 13},
.{.major = 2, .minor = 14},
.{.major = 2, .minor = 15},
.{.major = 2, .minor = 16},
.{.major = 2, .minor = 17},
.{.major = 2, .minor = 18},
.{.major = 2, .minor = 19},
.{.major = 2, .minor = 20},
.{.major = 2, .minor = 21},
.{.major = 2, .minor = 22},
.{.major = 2, .minor = 23},
.{.major = 2, .minor = 24},
.{.major = 2, .minor = 25},
.{.major = 2, .minor = 26},
.{.major = 2, .minor = 27},
.{.major = 2, .minor = 28},
.{.major = 2, .minor = 29},
.{.major = 2, .minor = 30},
.{.major = 2, .minor = 31},
.{.major = 2, .minor = 32},
.{.major = 2, .minor = 33},
.{.major = 2, .minor = 34},
};
// fpu/nofpu are hardcoded elsewhere, based on .gnueabi/.gnueabihf with an exception for .arm
// n64/n32 are hardcoded elsewhere, based on .gnuabi64/.gnuabin32
const abi_lists = [_]AbiList{
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .aarch64, .abi = .gnu },
ZigTarget{ .arch = .aarch64_be, .abi = .gnu },
},
.path = "aarch64",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .s390x, .abi = .gnu }},
.path = "s390/s390-64",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .arm, .abi = .gnueabi },
ZigTarget{ .arch = .armeb, .abi = .gnueabi },
ZigTarget{ .arch = .arm, .abi = .gnueabihf },
ZigTarget{ .arch = .armeb, .abi = .gnueabihf },
},
.path = "arm",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .sparc, .abi = .gnu },
ZigTarget{ .arch = .sparcel, .abi = .gnu },
},
.path = "sparc/sparc32",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .sparcv9, .abi = .gnu }},
.path = "sparc/sparc64",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .mips64el, .abi = .gnuabi64 },
ZigTarget{ .arch = .mips64, .abi = .gnuabi64 },
},
.path = "mips/mips64",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .mips64el, .abi = .gnuabin32 },
ZigTarget{ .arch = .mips64, .abi = .gnuabin32 },
},
.path = "mips/mips64",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .mipsel, .abi = .gnueabihf },
ZigTarget{ .arch = .mips, .abi = .gnueabihf },
},
.path = "mips/mips32",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .mipsel, .abi = .gnueabi },
ZigTarget{ .arch = .mips, .abi = .gnueabi },
},
.path = "mips/mips32",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .x86_64, .abi = .gnu }},
.path = "x86_64/64",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .x86_64, .abi = .gnux32 }},
.path = "x86_64/x32",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .i386, .abi = .gnu }},
.path = "i386",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .powerpc64le, .abi = .gnu }},
.path = "powerpc/powerpc64",
},
AbiList{
.targets = &[_]ZigTarget{ZigTarget{ .arch = .powerpc64, .abi = .gnu }},
.path = "powerpc/powerpc64",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .powerpc, .abi = .gnueabi },
ZigTarget{ .arch = .powerpc, .abi = .gnueabihf },
},
.path = "powerpc/powerpc32",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .riscv32, .abi = .gnu },
},
.path = "riscv/rv32",
},
AbiList{
.targets = &[_]ZigTarget{
ZigTarget{ .arch = .riscv64, .abi = .gnu },
},
.path = "riscv/rv64",
},
};
/// After glibc 2.33, mips64 put some files inside n64 and n32 directories.
/// This is also the first version that has riscv32 support.
const ver33 = std.builtin.Version{
.major = 2,
.minor = 33,
};
/// glibc 2.31 added sysdeps/unix/sysv/linux/arm/le and sysdeps/unix/sysv/linux/arm/be
/// Before these directories did not exist.
const ver30 = std.builtin.Version{
.major = 2,
.minor = 30,
};
/// Similarly, powerpc64 le and be were introduced in glibc 2.29
const ver28 = std.builtin.Version{
.major = 2,
.minor = 28,
};
/// This is the first version that has riscv64 support.
const ver27 = std.builtin.Version{
.major = 2,
.minor = 27,
};
/// Before this version the abilist files had a different structure.
const ver23 = std.builtin.Version{
.major = 2,
.minor = 23,
};
const Symbol = struct {
type: [lib_names.len][zig_targets.len][versions.len]Type = empty_type,
is_fn: bool = undefined,
const empty_row = [1]Type{.absent} ** versions.len;
const empty_row2 = [1]@TypeOf(empty_row){empty_row} ** zig_targets.len;
const empty_type = [1]@TypeOf(empty_row2){empty_row2} ** lib_names.len;
const Type = union(enum) {
absent,
function,
object: u16,
fn eql(ty: Type, other: Type) bool {
return switch (ty) {
.absent => unreachable,
.function => other == .function,
.object => |ty_size| switch (other) {
.absent => unreachable,
.function => false,
.object => |other_size| ty_size == other_size,
},
};
}
};
/// Return true if and only if the inclusion has no false positives.
fn testInclusion(symbol: Symbol, inc: Inclusion, lib_i: u8) bool {
for (symbol.type[lib_i]) |versions_row, targets_i| {
for (versions_row) |ty, versions_i| {
switch (ty) {
.absent => {
if ((inc.targets & (@as(u32, 1) << @intCast(u5, targets_i)) ) != 0 and
(inc.versions & (@as(u64, 1) << @intCast(u6, versions_i)) ) != 0)
{
return false;
}
},
.function, .object => continue,
}
}
}
return true;
}
};
const Inclusion = struct {
versions: u64,
targets: u32,
lib: u8,
size: u16,
};
const NamedInclusion = struct {
name: []const u8,
inc: Inclusion,
};
pub fn main() !void {
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);
const arena = arena_instance.allocator();
//const args = try std.process.argsAlloc(arena);
var version_dir = try fs.cwd().openDir("glibc", .{ .iterate = true });
defer version_dir.close();
const fs_versions = v: {
var fs_versions = std.ArrayList(Version).init(arena);
var version_dir_it = version_dir.iterate();
while (try version_dir_it.next()) |entry| {
if (mem.eql(u8, entry.name, "COPYING")) continue;
try fs_versions.append(try Version.parse(entry.name));
}
break :v fs_versions.items;
};
std.sort.sort(Version, fs_versions, {}, versionAscending);
var symbols = std.StringHashMap(Symbol).init(arena);
// Before this version the abilist files had a different structure.
const first_fs_ver = std.builtin.Version{
.major = 2,
.minor = 23,
};
for (fs_versions) |fs_ver| {
if (fs_ver.order(first_fs_ver) == .lt) {
log.warn("skipping glibc version {} because the abilist files have a different format", .{fs_ver});
continue;
}
log.info("scanning abilist files for glibc version: {}", .{fs_ver});
const prefix = try fmt.allocPrint(arena, "{d}.{d}/sysdeps/unix/sysv/linux", .{
fs_ver.major, fs_ver.minor,
});
for (abi_lists) |*abi_list| {
if (abi_list.targets[0].arch == .riscv64 and fs_ver.order(ver27) == .lt) {
continue;
}
if (abi_list.targets[0].arch == .riscv32 and fs_ver.order(ver33) == .lt) {
continue;
}
for (lib_names) |lib_name, lib_i| {
const lib_prefix = if (std.mem.eql(u8, lib_name, "ld")) "" else "lib";
const basename = try fmt.allocPrint(arena, "{s}{s}.abilist", .{ lib_prefix, lib_name });
const abi_list_filename = blk: {
const is_c = std.mem.eql(u8, lib_name, "c");
const is_m = std.mem.eql(u8, lib_name, "m");
const is_ld = std.mem.eql(u8, lib_name, "ld");
const is_rt = std.mem.eql(u8, lib_name, "rt");
if ((abi_list.targets[0].arch == .mips64 or
abi_list.targets[0].arch == .mips64el) and
fs_ver.order(ver33) == .gt and (is_rt or is_c or is_ld))
{
if (abi_list.targets[0].abi == .gnuabi64) {
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, "n64", basename,
});
} else if (abi_list.targets[0].abi == .gnuabin32) {
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, "n32", basename,
});
} else {
unreachable;
}
} else if (abi_list.targets[0].abi == .gnuabi64 and (is_c or is_ld)) {
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, "n64", basename,
});
} else if (abi_list.targets[0].abi == .gnuabin32 and (is_c or is_ld)) {
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, "n32", basename,
});
} else if (abi_list.targets[0].arch != .arm and
abi_list.targets[0].abi == .gnueabihf and
(is_c or (is_m and abi_list.targets[0].arch == .powerpc)))
{
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, "fpu", basename,
});
} else if (abi_list.targets[0].arch != .arm and
abi_list.targets[0].abi == .gnueabi and
(is_c or (is_m and abi_list.targets[0].arch == .powerpc)))
{
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, "nofpu", basename,
});
} else if ((abi_list.targets[0].arch == .armeb or
abi_list.targets[0].arch == .arm) and fs_ver.order(ver30) == .gt)
{
const endian_suffix = switch (abi_list.targets[0].arch) {
.armeb => "be",
else => "le",
};
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, endian_suffix, basename,
});
} else if ((abi_list.targets[0].arch == .powerpc64le or
abi_list.targets[0].arch == .powerpc64)) {
if (fs_ver.order(ver28) == .gt) {
const endian_suffix = switch (abi_list.targets[0].arch) {
.powerpc64le => "le",
else => "be",
};
break :blk try fs.path.join(arena, &.{
prefix, abi_list.path, endian_suffix, basename,
});
}
// 2.28 and earlier, the files looked like this:
// libc.abilist
// libc-le.abilist
const endian_suffix = switch (abi_list.targets[0].arch) {
.powerpc64le => "-le",
else => "",
};
break :blk try fmt.allocPrint(arena, "{s}/{s}/{s}{s}{s}.abilist", .{
prefix, abi_list.path, lib_prefix, lib_name, endian_suffix,
});
}
break :blk try fs.path.join(arena, &.{ prefix, abi_list.path, basename });
};
const max_bytes = 10 * 1024 * 1024;
const contents = version_dir.readFileAlloc(arena, abi_list_filename, max_bytes) catch |err| {
fatal("unable to open glibc/{s}: {}", .{ abi_list_filename, err });
};
var lines_it = std.mem.tokenize(u8, contents, "\n");
while (lines_it.next()) |line| {
var tok_it = std.mem.tokenize(u8, line, " ");
const ver_text = tok_it.next().?;
if (mem.startsWith(u8, ver_text, "GCC_")) continue;
if (mem.startsWith(u8, ver_text, "_gp_disp")) continue;
if (!mem.startsWith(u8, ver_text, "GLIBC_")) {
fatal("line did not start with 'GLIBC_': '{s}'", .{line});
}
const ver = try Version.parse(ver_text["GLIBC_".len..]);
const name = tok_it.next() orelse {
fatal("symbol name not found in glibc/{s} on line '{s}'", .{
abi_list_filename, line,
});
};
const category = tok_it.next().?;
const ty: Symbol.Type = if (mem.eql(u8, category, "F"))
.{ .function = {} }
else if (mem.eql(u8, category, "D"))
.{ .object = try fmt.parseInt(u16, tok_it.next().?, 0) }
else if (mem.eql(u8, category, "A"))
continue
else
fatal("unrecognized symbol type '{s}' on line '{s}'", .{category, line});
// Detect incorrect information when a symbol migrates from one library
// to another.
if (ver.order(fs_ver) == .lt and fs_ver.order(first_fs_ver) != .eq) {
// This abilist is claiming that this version is found in this
// library. However if that was true, we would have already
// noted it in the previous set of abilists.
continue;
}
const gop = try symbols.getOrPut(name);
if (!gop.found_existing) {
gop.value_ptr.* = .{};
}
for (abi_list.targets) |t| {
gop.value_ptr.type[lib_i][t.getIndex()][verIndex(ver)] = ty;
}
}
}
}
}
// Our data format depends on the type of a symbol being consistently a function or an object
// and not switching depending on target or version. Here we verify that premise.
{
var it = symbols.iterator();
while (it.next()) |entry| {
const name = entry.key_ptr.*;
var prev_ty: @typeInfo(Symbol.Type).Union.tag_type.? = .absent;
for (entry.value_ptr.type) |targets_row| {
for (targets_row) |versions_row| {
for (versions_row) |ty| {
switch (ty) {
.absent => continue,
.function => switch (prev_ty) {
.absent => prev_ty = ty,
.function => continue,
.object => fatal("symbol {s} switches types", .{name}),
},
.object => switch (prev_ty) {
.absent => prev_ty = ty,
.function => fatal("symbol {s} switches types", .{name}),
.object => continue,
},
}
}
}
}
entry.value_ptr.is_fn = switch (prev_ty) {
.absent => unreachable,
.function => true,
.object => false,
};
}
log.info("confirmed that every symbol is consistently either an object or a function", .{});
}
// Now we have all the data and we want to emit the fewest number of inclusions as possible.
// The first split is functions vs objects.
// For functions, the only type possibilities are `absent` or `function`.
// We use a greedy algorithm, "spreading" the inclusion from a single point to
// as many targets as possible, then to as many versions as possible.
var fn_inclusions = std.ArrayList(NamedInclusion).init(arena);
var fn_count: usize = 0;
var fn_version_popcount: usize = 0;
const none_handled = blk: {
const empty_row = [1]bool{false} ** versions.len;
const empty_row2 = [1]@TypeOf(empty_row){empty_row} ** zig_targets.len;
const empty_row3 = [1]@TypeOf(empty_row2){empty_row2} ** lib_names.len;
break :blk empty_row3;
};
{
var it = symbols.iterator();
while (it.next()) |entry| {
if (!entry.value_ptr.is_fn) continue;
fn_count += 1;
// Find missing inclusions. We can't move on from this symbol until
// all the present symbols have been handled.
var handled = none_handled;
var libs_handled = [1]bool{false} ** lib_names.len;
var lib_i: u8 = 0;
while (lib_i < lib_names.len) {
if (libs_handled[lib_i]) {
lib_i += 1;
continue;
}
const targets_row = entry.value_ptr.type[lib_i];
var wanted_targets: u32 = 0;
var wanted_versions_multi = [1]u64{0} ** zig_targets.len;
for (targets_row) |versions_row, targets_i| {
for (versions_row) |ty, versions_i| {
if (handled[lib_i][targets_i][versions_i]) continue;
switch (ty) {
.absent => continue,
.function => {
wanted_targets |= @as(u32, 1) << @intCast(u5, targets_i);
wanted_versions_multi[targets_i] |=
@as(u64, 1) << @intCast(u6, versions_i);
},
.object => unreachable,
}
}
}
if (wanted_targets == 0) {
// This library is done.
libs_handled[lib_i] = true;
continue;
}
// Put one target and one version into the inclusion.
const first_targ_index = @ctz(u32, wanted_targets);
var wanted_versions = wanted_versions_multi[first_targ_index];
const first_ver_index = @ctz(u64, wanted_versions);
var inc: Inclusion = .{
.versions = @as(u64, 1) << @intCast(u6, first_ver_index),
.targets = @as(u32, 1) << @intCast(u5, first_targ_index),
.lib = @intCast(u8, lib_i),
.size = 0,
};
wanted_targets &= ~(@as(u32, 1) << @intCast(u5, first_targ_index));
wanted_versions &= ~(@as(u64, 1) << @intCast(u6, first_ver_index));
assert(entry.value_ptr.testInclusion(inc, lib_i));
// Expand the inclusion one at a time to include as many
// of the rest of the versions as possible.
while (wanted_versions != 0) {
const test_ver_index = @ctz(u64, wanted_versions);
const new_inc = .{
.versions = inc.versions | (@as(u64, 1) << @intCast(u6, test_ver_index)),
.targets = inc.targets,
.lib = inc.lib,
.size = 0,
};
if (entry.value_ptr.testInclusion(new_inc, lib_i)) {
inc = new_inc;
}
wanted_versions &= ~(@as(u64, 1) << @intCast(u6, test_ver_index));
}
// Expand the inclusion one at a time to include as many
// of the rest of the targets as possible.
while (wanted_targets != 0) {
const test_targ_index = @ctz(u64, wanted_targets);
const new_inc = .{
.versions = inc.versions,
.targets = inc.targets | (@as(u32, 1) << @intCast(u5,test_targ_index)),
.lib = inc.lib,
.size = 0,
};
if (entry.value_ptr.testInclusion(new_inc, lib_i)) {
inc = new_inc;
}
wanted_targets &= ~(@as(u32, 1) << @intCast(u5, test_targ_index));
}
fn_version_popcount += @popCount(u64, inc.versions);
try fn_inclusions.append(.{
.name = entry.key_ptr.*,
.inc = inc,
});
// Mark stuff as handled by this inclusion.
for (targets_row) |versions_row, targets_i| {
for (versions_row) |_, versions_i| {
if (handled[lib_i][targets_i][versions_i]) continue;
if ((inc.targets & (@as(u32, 1) << @intCast(u5, targets_i)) ) != 0 and
(inc.versions & (@as(u64, 1) << @intCast(u6, versions_i)) ) != 0)
{
handled[lib_i][targets_i][versions_i] = true;
}
}
}
}
}
}
log.info("total function inclusions: {d}", .{fn_inclusions.items.len});
log.info("average inclusions per function: {d}", .{
@intToFloat(f64, fn_inclusions.items.len) / @intToFloat(f64, fn_count),
});
log.info("average function versions bits set: {d}", .{
@intToFloat(f64, fn_version_popcount) / @intToFloat(f64, fn_inclusions.items.len),
});
var obj_inclusions = std.ArrayList(NamedInclusion).init(arena);
var obj_count: usize = 0;
var obj_version_popcount: usize = 0;
{
var it = symbols.iterator();
while (it.next()) |entry| {
if (entry.value_ptr.is_fn) continue;
obj_count += 1;
// Find missing inclusions. We can't move on from this symbol until
// all the present symbols have been handled.
var handled = none_handled;
var libs_handled = [1]bool{false} ** lib_names.len;
var lib_i: u8 = 0;
while (lib_i < lib_names.len) {
if (libs_handled[lib_i]) {
lib_i += 1;
continue;
}
const targets_row = entry.value_ptr.type[lib_i];
var wanted_targets: u32 = 0;
var wanted_versions_multi = [1]u64{0} ** zig_targets.len;
var wanted_sizes_multi = [1]u16{0} ** zig_targets.len;
for (targets_row) |versions_row, targets_i| {
for (versions_row) |ty, versions_i| {
if (handled[lib_i][targets_i][versions_i]) continue;
switch (ty) {
.absent => continue,
.object => |size| {
wanted_targets |= @as(u32, 1) << @intCast(u5, targets_i);
var ok = false;
if (wanted_sizes_multi[targets_i] == 0) {
wanted_sizes_multi[targets_i] = size;
ok = true;
} else if (wanted_sizes_multi[targets_i] == size) {
ok = true;
}
if (ok) {
wanted_versions_multi[targets_i] |=
@as(u64, 1) << @intCast(u6, versions_i);
}
},
.function => unreachable,
}
}
}
if (wanted_targets == 0) {
// This library is done.
libs_handled[lib_i] = true;
continue;
}
// Put one target and one version into the inclusion.
const first_targ_index = @ctz(u32, wanted_targets);
var wanted_versions = wanted_versions_multi[first_targ_index];
const wanted_size = wanted_sizes_multi[first_targ_index];
const first_ver_index = @ctz(u64, wanted_versions);
var inc: Inclusion = .{
.versions = @as(u64, 1) << @intCast(u6, first_ver_index),
.targets = @as(u32, 1) << @intCast(u5, first_targ_index),
.lib = @intCast(u8, lib_i),
.size = wanted_size,
};
wanted_targets &= ~(@as(u32, 1) << @intCast(u5, first_targ_index));
wanted_versions &= ~(@as(u64, 1) << @intCast(u6, first_ver_index));
assert(entry.value_ptr.testInclusion(inc, lib_i));
// Expand the inclusion one at a time to include as many
// of the rest of the versions as possible.
while (wanted_versions != 0) {
const test_ver_index = @ctz(u64, wanted_versions);
const new_inc = .{
.versions = inc.versions | (@as(u64, 1) << @intCast(u6, test_ver_index)),
.targets = inc.targets,
.lib = inc.lib,
.size = wanted_size,
};
if (entry.value_ptr.testInclusion(new_inc, lib_i)) {
inc = new_inc;
}
wanted_versions &= ~(@as(u64, 1) << @intCast(u6, test_ver_index));
}
// Expand the inclusion one at a time to include as many
// of the rest of the targets as possible.
while (wanted_targets != 0) {
const test_targ_index = @ctz(u64, wanted_targets);
if (wanted_sizes_multi[test_targ_index] == wanted_size) {
const new_inc = .{
.versions = inc.versions,
.targets = inc.targets | (@as(u32, 1) << @intCast(u5,test_targ_index)),
.lib = inc.lib,
.size = wanted_size,
};
if (entry.value_ptr.testInclusion(new_inc, lib_i)) {
inc = new_inc;
}
}
wanted_targets &= ~(@as(u32, 1) << @intCast(u5, test_targ_index));
}
obj_version_popcount += @popCount(u64, inc.versions);
try obj_inclusions.append(.{
.name = entry.key_ptr.*,
.inc = inc,
});
// Mark stuff as handled by this inclusion.
for (targets_row) |versions_row, targets_i| {
for (versions_row) |_, versions_i| {
if (handled[lib_i][targets_i][versions_i]) continue;
if ((inc.targets & (@as(u32, 1) << @intCast(u5, targets_i)) ) != 0 and
(inc.versions & (@as(u64, 1) << @intCast(u6, versions_i)) ) != 0)
{
handled[lib_i][targets_i][versions_i] = true;
}
}
}
}
}
}
log.info("total object inclusions: {d}", .{obj_inclusions.items.len});
log.info("average inclusions per object: {d}", .{
@intToFloat(f32, obj_inclusions.items.len) / @intToFloat(f32, obj_count),
});
log.info("average objects versions bits set: {d}", .{
@intToFloat(f64, obj_version_popcount) / @intToFloat(f64, obj_inclusions.items.len),
});
// Serialize to the output file.
var af = try fs.cwd().atomicFile("abilists", .{});
defer af.deinit();
var bw = std.io.bufferedWriter(af.file.writer());
const w = bw.writer();
// Libraries
try w.writeByte(lib_names.len);
for (lib_names) |lib_name| {
try w.writeAll(lib_name);
try w.writeByte(0);
}
// Versions
try w.writeByte(versions.len);
for (versions) |ver| {
try w.writeByte(@intCast(u8, ver.major));
try w.writeByte(@intCast(u8, ver.minor));
try w.writeByte(@intCast(u8, ver.patch));
}
// Targets
try w.writeByte(zig_targets.len);
for (zig_targets) |zt| {
try w.print("{s}-linux-{s}\x00", .{@tagName(zt.arch), @tagName(zt.abi)});
}
{
// Function Inclusions
try w.writeIntLittle(u16, @intCast(u16, fn_inclusions.items.len));
var i: usize = 0;
while (i < fn_inclusions.items.len) {
const name = fn_inclusions.items[i].name;
try w.writeAll(name);
try w.writeByte(0);
while (true) {
const inc = fn_inclusions.items[i].inc;
i += 1;
const set_terminal_bit = i >= fn_inclusions.items.len or
!mem.eql(u8, name, fn_inclusions.items[i].name);
var target_bitset = inc.targets;
if (set_terminal_bit) {
target_bitset |= 1 << 31;
}
try w.writeIntLittle(u32, target_bitset);
try w.writeByte(inc.lib);
var buf: [versions.len]u8 = undefined;
var buf_index: usize = 0;
for (versions) |_, ver_i| {
if ((inc.versions & (@as(u64, 1) << @intCast(u6, ver_i))) != 0) {
buf[buf_index] = @intCast(u8, ver_i);
buf_index += 1;
}
}
buf[buf_index - 1] |= 0b1000_0000;
try w.writeAll(buf[0..buf_index]);
if (set_terminal_bit) break;
}
}
}
{
// Object Inclusions
try w.writeIntLittle(u16, @intCast(u16, obj_inclusions.items.len));
var i: usize = 0;
while (i < obj_inclusions.items.len) {
const name = obj_inclusions.items[i].name;
try w.writeAll(name);
try w.writeByte(0);
while (true) {
const inc = obj_inclusions.items[i].inc;
i += 1;
const set_terminal_bit = i >= obj_inclusions.items.len or
!mem.eql(u8, name, obj_inclusions.items[i].name);
var target_bitset = inc.targets;
if (set_terminal_bit) {
target_bitset |= 1 << 31;
}
try w.writeIntLittle(u32, target_bitset);
try w.writeIntLittle(u16, inc.size);
try w.writeByte(inc.lib);
var buf: [versions.len]u8 = undefined;
var buf_index: usize = 0;
for (versions) |_, ver_i| {
if ((inc.versions & (@as(u64, 1) << @intCast(u6, ver_i))) != 0) {
buf[buf_index] = @intCast(u8, ver_i);
buf_index += 1;
}
}
buf[buf_index - 1] |= 0b1000_0000;
try w.writeAll(buf[0..buf_index]);
if (set_terminal_bit) break;
}
}
}
try bw.flush();
try af.finish();
}
fn versionAscending(context: void, a: Version, b: Version) bool {
_ = context;
return a.order(b) == .lt;
}
fn fatal(comptime format: []const u8, args: anytype) noreturn {
log.err(format, args);
std.process.exit(1);
}
fn verIndex(ver: Version) u6 {
for (versions) |v, i| {
if (v.order(ver) == .eq) {
return @intCast(u6, i);
}
}
unreachable;
} | consolidate.zig |
const builtin = @import("builtin");
const std = @import("std");
const math = std.math;
const expect = std.testing.expect;
/// Returns the sine of the radian value x.
///
/// Special Cases:
/// - sin(+-0) = +-0
/// - sin(+-inf) = nan
/// - sin(nan) = nan
pub fn sin(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
return switch (T) {
f32 => sin_(T, x),
f64 => sin_(T, x),
else => @compileError("sin not implemented for " ++ @typeName(T)),
};
}
// sin polynomial coefficients
const S0 = 1.58962301576546568060E-10;
const S1 = -2.50507477628578072866E-8;
const S2 = 2.75573136213857245213E-6;
const S3 = -1.98412698295895385996E-4;
const S4 = 8.33333333332211858878E-3;
const S5 = -1.66666666666666307295E-1;
// cos polynomial coeffiecients
const C0 = -1.13585365213876817300E-11;
const C1 = 2.08757008419747316778E-9;
const C2 = -2.75573141792967388112E-7;
const C3 = 2.48015872888517045348E-5;
const C4 = -1.38888888888730564116E-3;
const C5 = 4.16666666666665929218E-2;
const pi4a = 7.85398125648498535156e-1;
const pi4b = 3.77489470793079817668E-8;
const pi4c = 2.69515142907905952645E-15;
const m4pi = 1.273239544735162542821171882678754627704620361328125;
fn sin_(comptime T: type, x_: T) T {
@setRuntimeSafety(false);
const I = std.meta.Int(.signed, @typeInfo(T).Float.bits);
var x = x_;
if (x == 0 or math.isNan(x)) {
return x;
}
if (math.isInf(x)) {
return math.nan(T);
}
var sign = x < 0;
x = math.fabs(x);
var y = math.floor(x * m4pi);
var j = @floatToInt(I, y);
if (j & 1 == 1) {
j += 1;
y += 1;
}
j &= 7;
if (j > 3) {
j -= 4;
sign = !sign;
}
const z = ((x - y * pi4a) - y * pi4b) - y * pi4c;
const w = z * z;
const r = if (j == 1 or j == 2)
1.0 - 0.5 * w + w * w * (C5 + w * (C4 + w * (C3 + w * (C2 + w * (C1 + w * C0)))))
else
z + z * w * (S5 + w * (S4 + w * (S3 + w * (S2 + w * (S1 + w * S0)))));
return if (sign) -r else r;
} | src/psp/sdk/sin.zig |
const allocator = @import("memory.zig").allocator;
const contexts = @import("contexts.zig");
const enums = @import("enums.zig");
const hostcalls = @import("hostcalls.zig");
const std = @import("std");
pub var current_state: State = .{
.new_root_context = null,
.root_contexts = std.AutoHashMap(u32, *contexts.RootContext).init(allocator),
.stream_contexts = std.AutoHashMap(u32, *contexts.TcpContext).init(allocator),
.http_contexts = std.AutoHashMap(u32, *contexts.HttpContext).init(allocator),
.callout_id_to_context_ids = std.AutoHashMap(u32, u32).init(allocator),
.active_id = 0,
};
pub const State = struct {
const Self = @This();
new_root_context: ?fn (context_id: usize) *contexts.RootContext,
root_contexts: std.AutoHashMap(u32, *contexts.RootContext),
stream_contexts: std.AutoHashMap(u32, *contexts.TcpContext),
http_contexts: std.AutoHashMap(u32, *contexts.HttpContext),
callout_id_to_context_ids: std.AutoHashMap(u32, u32),
active_id: u32,
pub fn registerCalloutId(self: *Self, callout_id: u32) void {
self.callout_id_to_context_ids.put(callout_id, self.active_id) catch unreachable;
}
};
export fn proxy_on_context_create(context_id: u32, root_context_id: u32) void {
if (root_context_id == 0) {
var context = current_state.new_root_context.?(context_id);
current_state.root_contexts.put(context_id, context) catch unreachable;
return;
}
// We should exist with unreachable when the root contexts do not exist.
const root = current_state.root_contexts.get(root_context_id).?;
// Try to create a stream context.
if (root.newTcpContext(context_id)) |stream_contex| {
current_state.stream_contexts.put(context_id, stream_contex) catch unreachable;
return;
}
// Try to create a http context.
// If we fail to create, then the state is stale.
var http_context = root.newHttpContext(context_id).?;
current_state.http_contexts.put(context_id, http_context) catch unreachable;
}
export fn proxy_on_done(context_id: u32) bool {
if (current_state.root_contexts.get(context_id)) |root_context| {
current_state.active_id = context_id;
return root_context.onPluginDone();
}
return true;
}
export fn proxy_on_log(context_id: u32) void {
if (current_state.stream_contexts.get(context_id)) |stream_context| {
current_state.active_id = context_id;
stream_context.onLog();
return;
} else if (current_state.http_contexts.get(context_id)) |http_context| {
current_state.active_id = context_id;
http_context.onLog();
}
}
export fn proxy_on_delete(context_id: u32) void {
if (current_state.root_contexts.get(context_id)) |root_context| {
root_context.onDelete();
return;
} else if (current_state.stream_contexts.get(context_id)) |stream_context| {
stream_context.onDelete();
return;
}
// Must fail with unreachable when the target context does not exist.
var http_context = current_state.http_contexts.get(context_id).?;
http_context.onDelete();
}
export fn proxy_on_vm_start(context_id: u32, configuration_size: usize) bool {
var vm_context = current_state.root_contexts.get(context_id).?;
current_state.active_id = context_id;
return vm_context.onVmStart(configuration_size);
}
export fn proxy_on_configure(context_id: u32, configuration_size: usize) bool {
var root_context = current_state.root_contexts.get(context_id).?;
current_state.active_id = context_id;
return root_context.onPluginStart(configuration_size);
}
export fn proxy_on_tick(context_id: u32) void {
var root_context = current_state.root_contexts.get(context_id).?;
current_state.active_id = context_id;
root_context.onTick();
}
export fn proxy_on_queue_ready(context_id: u32, queue_id: u32) void {
var root_context = current_state.root_contexts.get(context_id).?;
current_state.active_id = context_id;
root_context.onQueueReady(queue_id);
}
export fn proxy_on_new_connection(context_id: u32) enums.Action {
var stream_context = current_state.stream_contexts.get(context_id).?;
current_state.active_id = context_id;
return stream_context.onNewConnection();
}
export fn proxy_on_downstream_data(context_id: u32, data_size: usize, end_of_stream: bool) enums.Action {
var stream_context = current_state.stream_contexts.get(context_id).?;
current_state.active_id = context_id;
return stream_context.onDownstreamData(data_size, end_of_stream);
}
export fn proxy_on_downstream_connection_close(context_id: u32, peer_type: enums.PeerType) void {
var stream_context = current_state.stream_contexts.get(context_id).?;
current_state.active_id = context_id;
stream_context.onDownstreamClose(peer_type);
}
export fn proxy_on_upstream_data(context_id: u32, data_size: usize, end_of_stream: bool) enums.Action {
var stream_context = current_state.stream_contexts.get(context_id).?;
current_state.active_id = context_id;
return stream_context.onUpstreamData(data_size, end_of_stream);
}
export fn proxy_on_upstream_connection_close(context_id: u32, peer_type: enums.PeerType) void {
var stream_context = current_state.stream_contexts.get(context_id).?;
current_state.active_id = context_id;
stream_context.onUpstreamClose(peer_type);
}
export fn proxy_on_request_headers(context_id: u32, num_headers: usize, end_of_stream: bool) enums.Action {
var http_context = current_state.http_contexts.get(context_id).?;
current_state.active_id = context_id;
return http_context.onHttpRequestHeaders(num_headers, end_of_stream);
}
export fn proxy_on_request_body(context_id: u32, body_size: usize, end_of_stream: bool) enums.Action {
var http_context = current_state.http_contexts.get(context_id).?;
current_state.active_id = context_id;
return http_context.onHttpRequestBody(body_size, end_of_stream);
}
export fn proxy_on_request_trailers(context_id: u32, num_trailers: usize) enums.Action {
var http_context = current_state.http_contexts.get(context_id).?;
current_state.active_id = context_id;
return http_context.onHttpRequestTrailers(num_trailers);
}
export fn proxy_on_response_headers(context_id: u32, num_headers: usize, end_of_stream: bool) enums.Action {
var http_context = current_state.http_contexts.get(context_id).?;
current_state.active_id = context_id;
return http_context.onHttpResponseHeaders(num_headers, end_of_stream);
}
export fn proxy_on_response_body(context_id: u32, body_size: usize, end_of_stream: bool) enums.Action {
var http_context = current_state.http_contexts.get(context_id).?;
current_state.active_id = context_id;
return http_context.onHttpResponseBody(body_size, end_of_stream);
}
export fn proxy_on_response_trailers(context_id: u32, num_trailers: usize) enums.Action {
var http_context = current_state.http_contexts.get(context_id).?;
current_state.active_id = context_id;
return http_context.onHttpResponseTrailers(num_trailers);
}
export fn proxy_on_http_call_response(_: u32, callout_id: u32, num_headers: usize, body_size: usize, num_trailers: usize) void {
const context_id: u32 = current_state.callout_id_to_context_ids.get(callout_id).?;
if (current_state.root_contexts.get(context_id)) |context| {
hostcalls.setEffectiveContext(context_id);
current_state.active_id = context_id;
context.onHttpCalloutResponse(callout_id, num_headers, body_size, num_trailers);
} else if (current_state.stream_contexts.get(context_id)) |context| {
hostcalls.setEffectiveContext(context_id);
current_state.active_id = context_id;
context.onHttpCalloutResponse(callout_id, num_headers, body_size, num_trailers);
} else if (current_state.http_contexts.get(context_id)) |context| {
hostcalls.setEffectiveContext(context_id);
current_state.active_id = context_id;
context.onHttpCalloutResponse(callout_id, num_headers, body_size, num_trailers);
} else {
unreachable;
}
} | lib/state.zig |
const std = @import("index.zig");
const debug = std.debug;
const assert = debug.assert;
const mem = std.mem;
const os = std.os;
const builtin = @import("builtin");
const Os = builtin.Os;
const c = std.c;
const Allocator = mem.Allocator;
pub const c_allocator = &c_allocator_state;
var c_allocator_state = Allocator{
.allocFn = cAlloc,
.reallocFn = cRealloc,
.freeFn = cFree,
};
fn cAlloc(self: *Allocator, n: usize, alignment: u29) ![]u8 {
assert(alignment <= @alignOf(c_longdouble));
return if (c.malloc(n)) |buf| @ptrCast([*]u8, buf)[0..n] else error.OutOfMemory;
}
fn cRealloc(self: *Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 {
const old_ptr = @ptrCast(*c_void, old_mem.ptr);
if (c.realloc(old_ptr, new_size)) |buf| {
return @ptrCast([*]u8, buf)[0..new_size];
} else if (new_size <= old_mem.len) {
return old_mem[0..new_size];
} else {
return error.OutOfMemory;
}
}
fn cFree(self: *Allocator, old_mem: []u8) void {
const old_ptr = @ptrCast(*c_void, old_mem.ptr);
c.free(old_ptr);
}
/// This allocator makes a syscall directly for every allocation and free.
pub const DirectAllocator = struct {
allocator: Allocator,
heap_handle: ?HeapHandle,
const HeapHandle = if (builtin.os == Os.windows) os.windows.HANDLE else void;
pub fn init() DirectAllocator {
return DirectAllocator{
.allocator = Allocator{
.allocFn = alloc,
.reallocFn = realloc,
.freeFn = free,
},
.heap_handle = if (builtin.os == Os.windows) null else {},
};
}
pub fn deinit(self: *DirectAllocator) void {
switch (builtin.os) {
Os.windows => if (self.heap_handle) |heap_handle| {
_ = os.windows.HeapDestroy(heap_handle);
},
else => {},
}
}
fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 {
const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
switch (builtin.os) {
Os.linux, Os.macosx, Os.ios => {
const p = os.posix;
const alloc_size = if (alignment <= os.page_size) n else n + alignment;
const addr = p.mmap(null, alloc_size, p.PROT_READ | p.PROT_WRITE, p.MAP_PRIVATE | p.MAP_ANONYMOUS, -1, 0);
if (addr == p.MAP_FAILED) return error.OutOfMemory;
if (alloc_size == n) return @intToPtr([*]u8, addr)[0..n];
var aligned_addr = addr & ~usize(alignment - 1);
aligned_addr += alignment;
//We can unmap the unused portions of our mmap, but we must only
// pass munmap bytes that exist outside our allocated pages or it
// will happily eat us too
//Since alignment > page_size, we are by definition on a page boundry
const unused_start = addr;
const unused_len = aligned_addr - 1 - unused_start;
var err = p.munmap(unused_start, unused_len);
debug.assert(p.getErrno(err) == 0);
//It is impossible that there is an unoccupied page at the top of our
// mmap.
return @intToPtr([*]u8, aligned_addr)[0..n];
},
Os.windows => {
const amt = n + alignment + @sizeOf(usize);
const heap_handle = self.heap_handle orelse blk: {
const hh = os.windows.HeapCreate(os.windows.HEAP_NO_SERIALIZE, amt, 0) orelse return error.OutOfMemory;
self.heap_handle = hh;
break :blk hh;
};
const ptr = os.windows.HeapAlloc(heap_handle, 0, amt) orelse return error.OutOfMemory;
const root_addr = @ptrToInt(ptr);
const rem = @rem(root_addr, alignment);
const march_forward_bytes = if (rem == 0) 0 else (alignment - rem);
const adjusted_addr = root_addr + march_forward_bytes;
const record_addr = adjusted_addr + n;
@intToPtr(*align(1) usize, record_addr).* = root_addr;
return @intToPtr([*]u8, adjusted_addr)[0..n];
},
else => @compileError("Unsupported OS"),
}
}
fn realloc(allocator: *Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 {
const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
switch (builtin.os) {
Os.linux, Os.macosx, Os.ios => {
if (new_size <= old_mem.len) {
const base_addr = @ptrToInt(old_mem.ptr);
const old_addr_end = base_addr + old_mem.len;
const new_addr_end = base_addr + new_size;
const rem = @rem(new_addr_end, os.page_size);
const new_addr_end_rounded = new_addr_end + if (rem == 0) 0 else (os.page_size - rem);
if (old_addr_end > new_addr_end_rounded) {
_ = os.posix.munmap(new_addr_end_rounded, old_addr_end - new_addr_end_rounded);
}
return old_mem[0..new_size];
}
const result = try alloc(allocator, new_size, alignment);
mem.copy(u8, result, old_mem);
return result;
},
Os.windows => {
const old_adjusted_addr = @ptrToInt(old_mem.ptr);
const old_record_addr = old_adjusted_addr + old_mem.len;
const root_addr = @intToPtr(*align(1) usize, old_record_addr).*;
const old_ptr = @intToPtr(*c_void, root_addr);
const amt = new_size + alignment + @sizeOf(usize);
const new_ptr = os.windows.HeapReAlloc(self.heap_handle.?, 0, old_ptr, amt) orelse blk: {
if (new_size > old_mem.len) return error.OutOfMemory;
const new_record_addr = old_record_addr - new_size + old_mem.len;
@intToPtr(*align(1) usize, new_record_addr).* = root_addr;
return old_mem[0..new_size];
};
const offset = old_adjusted_addr - root_addr;
const new_root_addr = @ptrToInt(new_ptr);
const new_adjusted_addr = new_root_addr + offset;
assert(new_adjusted_addr % alignment == 0);
const new_record_addr = new_adjusted_addr + new_size;
@intToPtr(*align(1) usize, new_record_addr).* = new_root_addr;
return @intToPtr([*]u8, new_adjusted_addr)[0..new_size];
},
else => @compileError("Unsupported OS"),
}
}
fn free(allocator: *Allocator, bytes: []u8) void {
const self = @fieldParentPtr(DirectAllocator, "allocator", allocator);
switch (builtin.os) {
Os.linux, Os.macosx, Os.ios => {
_ = os.posix.munmap(@ptrToInt(bytes.ptr), bytes.len);
},
Os.windows => {
const record_addr = @ptrToInt(bytes.ptr) + bytes.len;
const root_addr = @intToPtr(*align(1) usize, record_addr).*;
const ptr = @intToPtr(*c_void, root_addr);
_ = os.windows.HeapFree(self.heap_handle.?, 0, ptr);
},
else => @compileError("Unsupported OS"),
}
}
};
/// This allocator takes an existing allocator, wraps it, and provides an interface
/// where you can allocate without freeing, and then free it all together.
pub const ArenaAllocator = struct {
pub allocator: Allocator,
child_allocator: *Allocator,
buffer_list: std.LinkedList([]u8),
end_index: usize,
const BufNode = std.LinkedList([]u8).Node;
pub fn init(child_allocator: *Allocator) ArenaAllocator {
return ArenaAllocator{
.allocator = Allocator{
.allocFn = alloc,
.reallocFn = realloc,
.freeFn = free,
},
.child_allocator = child_allocator,
.buffer_list = std.LinkedList([]u8).init(),
.end_index = 0,
};
}
pub fn deinit(self: *ArenaAllocator) void {
var it = self.buffer_list.first;
while (it) |node| {
// this has to occur before the free because the free frees node
it = node.next;
self.child_allocator.free(node.data);
}
}
fn createNode(self: *ArenaAllocator, prev_len: usize, minimum_size: usize) !*BufNode {
const actual_min_size = minimum_size + @sizeOf(BufNode);
var len = prev_len;
while (true) {
len += len / 2;
len += os.page_size - @rem(len, os.page_size);
if (len >= actual_min_size) break;
}
const buf = try self.child_allocator.alignedAlloc(u8, @alignOf(BufNode), len);
const buf_node_slice = @bytesToSlice(BufNode, buf[0..@sizeOf(BufNode)]);
const buf_node = &buf_node_slice[0];
buf_node.* = BufNode{
.data = buf,
.prev = null,
.next = null,
};
self.buffer_list.append(buf_node);
self.end_index = 0;
return buf_node;
}
fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 {
const self = @fieldParentPtr(ArenaAllocator, "allocator", allocator);
var cur_node = if (self.buffer_list.last) |last_node| last_node else try self.createNode(0, n + alignment);
while (true) {
const cur_buf = cur_node.data[@sizeOf(BufNode)..];
const addr = @ptrToInt(cur_buf.ptr) + self.end_index;
const rem = @rem(addr, alignment);
const march_forward_bytes = if (rem == 0) 0 else (alignment - rem);
const adjusted_index = self.end_index + march_forward_bytes;
const new_end_index = adjusted_index + n;
if (new_end_index > cur_buf.len) {
cur_node = try self.createNode(cur_buf.len, n + alignment);
continue;
}
const result = cur_buf[adjusted_index..new_end_index];
self.end_index = new_end_index;
return result;
}
}
fn realloc(allocator: *Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 {
if (new_size <= old_mem.len) {
return old_mem[0..new_size];
} else {
const result = try alloc(allocator, new_size, alignment);
mem.copy(u8, result, old_mem);
return result;
}
}
fn free(allocator: *Allocator, bytes: []u8) void {}
};
pub const FixedBufferAllocator = struct {
allocator: Allocator,
end_index: usize,
buffer: []u8,
pub fn init(buffer: []u8) FixedBufferAllocator {
return FixedBufferAllocator{
.allocator = Allocator{
.allocFn = alloc,
.reallocFn = realloc,
.freeFn = free,
},
.buffer = buffer,
.end_index = 0,
};
}
fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 {
const self = @fieldParentPtr(FixedBufferAllocator, "allocator", allocator);
const addr = @ptrToInt(self.buffer.ptr) + self.end_index;
const rem = @rem(addr, alignment);
const march_forward_bytes = if (rem == 0) 0 else (alignment - rem);
const adjusted_index = self.end_index + march_forward_bytes;
const new_end_index = adjusted_index + n;
if (new_end_index > self.buffer.len) {
return error.OutOfMemory;
}
const result = self.buffer[adjusted_index..new_end_index];
self.end_index = new_end_index;
return result;
}
fn realloc(allocator: *Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 {
if (new_size <= old_mem.len) {
return old_mem[0..new_size];
} else {
const result = try alloc(allocator, new_size, alignment);
mem.copy(u8, result, old_mem);
return result;
}
}
fn free(allocator: *Allocator, bytes: []u8) void {}
};
/// lock free
pub const ThreadSafeFixedBufferAllocator = struct {
allocator: Allocator,
end_index: usize,
buffer: []u8,
pub fn init(buffer: []u8) ThreadSafeFixedBufferAllocator {
return ThreadSafeFixedBufferAllocator{
.allocator = Allocator{
.allocFn = alloc,
.reallocFn = realloc,
.freeFn = free,
},
.buffer = buffer,
.end_index = 0,
};
}
fn alloc(allocator: *Allocator, n: usize, alignment: u29) ![]u8 {
const self = @fieldParentPtr(ThreadSafeFixedBufferAllocator, "allocator", allocator);
var end_index = @atomicLoad(usize, &self.end_index, builtin.AtomicOrder.SeqCst);
while (true) {
const addr = @ptrToInt(self.buffer.ptr) + end_index;
const rem = @rem(addr, alignment);
const march_forward_bytes = if (rem == 0) 0 else (alignment - rem);
const adjusted_index = end_index + march_forward_bytes;
const new_end_index = adjusted_index + n;
if (new_end_index > self.buffer.len) {
return error.OutOfMemory;
}
end_index = @cmpxchgWeak(usize, &self.end_index, end_index, new_end_index, builtin.AtomicOrder.SeqCst, builtin.AtomicOrder.SeqCst) orelse return self.buffer[adjusted_index..new_end_index];
}
}
fn realloc(allocator: *Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 {
if (new_size <= old_mem.len) {
return old_mem[0..new_size];
} else {
const result = try alloc(allocator, new_size, alignment);
mem.copy(u8, result, old_mem);
return result;
}
}
fn free(allocator: *Allocator, bytes: []u8) void {}
};
test "c_allocator" {
if (builtin.link_libc) {
var slice = c_allocator.alloc(u8, 50) catch return;
defer c_allocator.free(slice);
slice = c_allocator.realloc(u8, slice, 100) catch return;
}
}
test "DirectAllocator" {
var direct_allocator = DirectAllocator.init();
defer direct_allocator.deinit();
const allocator = &direct_allocator.allocator;
try testAllocator(allocator);
try testAllocatorLargeAlignment(allocator);
}
test "ArenaAllocator" {
var direct_allocator = DirectAllocator.init();
defer direct_allocator.deinit();
var arena_allocator = ArenaAllocator.init(&direct_allocator.allocator);
defer arena_allocator.deinit();
try testAllocator(&arena_allocator.allocator);
try testAllocatorLargeAlignment(&arena_allocator.allocator);
}
var test_fixed_buffer_allocator_memory: [30000 * @sizeOf(usize)]u8 = undefined;
test "FixedBufferAllocator" {
var fixed_buffer_allocator = FixedBufferAllocator.init(test_fixed_buffer_allocator_memory[0..]);
try testAllocator(&fixed_buffer_allocator.allocator);
try testAllocatorLargeAlignment(&fixed_buffer_allocator.allocator);
}
test "ThreadSafeFixedBufferAllocator" {
var fixed_buffer_allocator = ThreadSafeFixedBufferAllocator.init(test_fixed_buffer_allocator_memory[0..]);
try testAllocator(&fixed_buffer_allocator.allocator);
try testAllocatorLargeAlignment(&fixed_buffer_allocator.allocator);
}
fn testAllocator(allocator: *mem.Allocator) !void {
var slice = try allocator.alloc(*i32, 100);
for (slice) |*item, i| {
item.* = try allocator.create(@intCast(i32, i));
}
for (slice) |item, i| {
allocator.destroy(item);
}
slice = try allocator.realloc(*i32, slice, 20000);
slice = try allocator.realloc(*i32, slice, 50);
slice = try allocator.realloc(*i32, slice, 25);
slice = try allocator.realloc(*i32, slice, 10);
allocator.free(slice);
}
fn testAllocatorLargeAlignment(allocator: *mem.Allocator) mem.Allocator.Error!void {
//Maybe a platform's page_size is actually the same as or
// very near usize?
if (os.page_size << 2 > @maxValue(usize)) return;
const USizeShift = @IntType(false, std.math.log2(usize.bit_count));
const large_align = u29(os.page_size << 2);
var align_mask: usize = undefined;
_ = @shlWithOverflow(usize, ~usize(0), USizeShift(@ctz(large_align)), &align_mask);
var slice = try allocator.allocFn(allocator, 500, large_align);
debug.assert(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr));
slice = try allocator.reallocFn(allocator, slice, 100, large_align);
debug.assert(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr));
slice = try allocator.reallocFn(allocator, slice, 5000, large_align);
debug.assert(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr));
slice = try allocator.reallocFn(allocator, slice, 10, large_align);
debug.assert(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr));
slice = try allocator.reallocFn(allocator, slice, 20000, large_align);
debug.assert(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr));
allocator.free(slice);
} | std/heap.zig |
const std = @import("std");
pub const TokenType = enum {
// Single char tokens
OpenParen,
CloseParen,
OpenBrace,
CloseBrace,
OpenBracket,
CloseBracket,
Comma,
Dot,
Semicolon,
// One or two char tokens
Equal,
EqualEqual,
BangEqual,
Less,
LessEqual,
Greater,
GreaterEqual,
Minus,
MinusEqual,
Plus,
PlusEqual,
Slash,
SlashEqual,
Star,
StarEqual,
// Literals
Identifier,
String,
Number,
// Keywords
And,
Class,
Else,
False,
For,
Fn,
If,
Let,
Nil,
Not,
Or,
Return,
Super,
Switch,
This,
True,
While,
Xor,
// Temp
Print,
// Special cases
// TODO: At some point, we might want to use zig's error type again.
// But for now, since it does not allow adding info to the errors,
// we will need to deal with this special "error token".
Error,
EOF,
};
const Location = struct {
line: u32 = 0,
};
pub const Token = struct {
token_type: TokenType = .Error,
lexeme: []const u8 = "",
location: Location = Location{},
};
const keywords_map = std.ComptimeStringMap(TokenType, .{
.{ "and", .And },
.{ "class", .Class },
.{ "else", .Else },
.{ "false", .False },
.{ "for", .For },
.{ "fn", .Fn },
.{ "if", .If },
.{ "let", .Let },
.{ "nil", .Nil },
.{ "not", .Not },
.{ "or", .Or },
.{ "return", .Return },
.{ "super", .Super },
.{ "switch", .Switch },
.{ "this", .This },
.{ "true", .True },
.{ "while", .While },
.{ "xor", .Xor },
.{ "print", .Print },
});
fn isDigit(c: u8) bool {
return (c >= '0' and c <= '9');
}
fn isAlpha(c: u8) bool {
return (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z') or c == '_';
}
fn isAlphanum(c: u8) bool {
return isAlpha(c) or isDigit(c);
}
pub const Scanner = struct {
buffer: []const u8,
current: usize = 0,
start: usize = 0,
line: u32 = 1,
const Self = @This();
pub fn init(source: []const u8) Self {
return Scanner{ .buffer = source };
}
pub fn next(self: *Self) Token {
self.skipIgnored();
self.start = self.current;
if (self.start == self.buffer.len) {
return self.makeToken(TokenType.EOF);
}
var c = self.advance();
switch (c) {
// Single char tokens
'(' => return self.makeToken(TokenType.OpenParen),
')' => return self.makeToken(TokenType.CloseParen),
'{' => return self.makeToken(TokenType.OpenBrace),
'}' => return self.makeToken(TokenType.CloseBrace),
'[' => return self.makeToken(TokenType.OpenBracket),
']' => return self.makeToken(TokenType.CloseBracket),
';' => return self.makeToken(TokenType.Semicolon),
',' => return self.makeToken(TokenType.Comma),
'.' => return self.makeToken(TokenType.Dot),
// One or two char tokens
'=' => if (self.match('=')) return self.makeToken(TokenType.EqualEqual) else return self.makeToken(TokenType.Equal),
'<' => if (self.match('=')) return self.makeToken(TokenType.LessEqual) else return self.makeToken(TokenType.Less),
'>' => if (self.match('=')) return self.makeToken(TokenType.GreaterEqual) else return self.makeToken(TokenType.Greater),
'+' => if (self.match('=')) return self.makeToken(TokenType.PlusEqual) else return self.makeToken(TokenType.Plus),
'-' => if (self.match('=')) return self.makeToken(TokenType.MinusEqual) else return self.makeToken(TokenType.Minus),
'*' => if (self.match('=')) return self.makeToken(TokenType.StarEqual) else return self.makeToken(TokenType.Star),
'/' => if (self.match('=')) return self.makeToken(TokenType.SlashEqual) else return self.makeToken(TokenType.Slash),
'!' => if (self.match('=')) return self.makeToken(TokenType.BangEqual) else return self.errorToken("`!` is not a valid token. Maybe you were meaning `not` ?"),
// String literals
'"' => return self.string(),
else => {
if (isDigit(c)) return self.number();
if (isAlpha(c)) return self.identifier();
},
}
return self.errorToken("Unexpected character.");
}
/// Skip whitespaces and comments.
fn skipIgnored(self: *Self) void {
while (true) {
var c = self.peek();
switch (c) {
' ', '\t', '\r' => _ = self.advance(),
'\n' => {
self.line += 1;
_ = self.advance();
},
'/' => {
if (self.peekNext() == '/') {
// This is a comment
while (!self.done() and self.peek() != '\n') _ = self.advance();
} else {
return;
}
},
else => return,
}
}
}
fn advance(self: *Self) u8 {
self.current += 1;
return self.buffer[self.current - 1];
}
fn peek(self: *Self) u8 {
if (self.current == self.buffer.len) {
return 0;
}
return self.buffer[self.current];
}
fn done(self: Self) bool {
return self.current >= self.buffer.len;
}
fn peekNext(self: *Self) u8 {
if (self.current + 1 == self.buffer.len) {
return 0;
}
return self.buffer[self.current + 1];
}
fn match(self: *Self, char: u8) bool {
if (self.current == self.buffer.len) return false;
if (self.buffer[self.current] != char) return false;
self.current += 1;
return true;
}
fn makeToken(self: *Self, token_type: TokenType) Token {
return Token{
.token_type = token_type,
.lexeme = self.buffer[self.start..self.current],
};
}
fn errorToken(self: *Self, message: []const u8) Token {
_ = self;
return Token{
.token_type = .Error,
.lexeme = message,
.location = Location{ .line = 42 },
};
}
fn string(self: *Self) Token {
while (true) {
var c = self.peek();
if (c == 0) {
return self.errorToken("Unexpected end of file.");
}
if (c == '\n') {
self.line += 1;
}
if (c == '"') {
// Did we escape a " ?
if (self.buffer[self.current - 1] != '\\') {
// Nah
self.start += 1;
const token = self.makeToken(TokenType.String);
_ = self.advance();
return token;
}
}
_ = self.advance();
}
return self.errorToken("Unexpected end of file.");
}
fn number(self: *Self) Token {
while (isDigit(self.peek())) {
_ = self.advance();
}
if ((self.peek()) == '.') {
if (!isDigit(self.peekNext())) {
return self.errorToken("A number cannot end with a `.` character.");
}
_ = self.advance();
}
while (isDigit(self.peek())) {
_ = self.advance();
}
return self.makeToken(TokenType.Number);
}
fn identifier(self: *Self) Token {
while (isAlphanum(self.peek())) _ = self.advance();
// TODO: Check a trie dumb implementation (aka clox)
const identifier_str = self.buffer[self.start..self.current];
const keyword = keywords_map.get(identifier_str) orelse return self.makeToken(TokenType.Identifier);
return self.makeToken(keyword);
}
}; | src/scanner.zig |
const std = @import("std");
const c = @cImport({
@cInclude("SDL2/SDL.h");
});
/// the size of the view; pixels
const size_view = [2]comptime_int { 640, 480, };
/// the title of the view window
const window_title = "zig_ray";
/// how sensetive the mouse is; ratio between pixels and radians
const mouse_sensitivity: comptime_float = 0.001;
/// the maximum distance for a hit; less is more precise; space units
const epsilon: f32 = 0.01;
/// the delta for the normal estimation; less is more precise; space units
const normal_delta: f32 = 0.01;
/// error when initialising SDL2
const sdl_init = error.Failed;
/// error when creating an SDL2 window
const sdl_window = error.Failed;
/// error when creating an SDL2 renderer
const sdl_renderer = error.Failed;
/// error when creating an SDL2 texture
const sdl_texture_create = error.Failed;
/// error when updating an SDL2 texture
const sdl_texture_update = error.Failed;
/// error when clearing an SDL2 renderer
const sdl_render_clear = error.Failed;
/// error when copying an SDL2 texture
const sdl_render_copy = error.Failed;
/// error when waiting for an SDL2 event
const sdl_wait_event = error.Failed;
/// error when changing the SDL2 mouse mode
const sdl_mouse_mode = error.Failed;
/// a type for all the objects in space
const space_t = struct {
/// a list of all the objects to render
objects: [3]object_t, //TODO do not specify a no. here, this should be dynamic!
/// the camera location
camera: camera_t,
/// the colour of the boundries
colour_boundries: colour_t = colour_t { 0, 0, 0, },
/// the furthest point to render; the size of the rendered cube; space units
dis_boundries: f32 = 20,
};
/// an B.G.R. colour type
const colour_t = std.meta.Vector(3, u8,);
/// a floating, 2D vector type
const couple_t = std.meta.Vector(2, f32,);
/// a floating, 3D vector type
const triple_t = std.meta.Vector(3, f32,);
/// a pixel buffer type with the size of the view
const buffer_t = [size_view[0] * size_view[1]]colour_t;
/// an individual ray type
const ray_t = struct {
/// the current position of the ray; space units
origin: triple_t,
/// the direction of the ray; unit vector //TODO maybe Quaternions are better suited than unit vectors?
direction: triple_t,
};
/// an matireal type; for handling rays that hit objects with it
const matireal_t = struct {
/// the colour of the object
colour: colour_t,
};
/// a type for objects in space
const object_t = struct {
/// the object's signed distance function; space units
sdf: fn (triple_t) f32,
/// the normal of the surface; coordinates on a unit sphere
normal: fn (triple_t) triple_t,
/// the object's matireal
matireal: matireal_t,
};
/// a type for camera location
const camera_t = struct {
/// the position of the camera; space units
position: triple_t = @splat(3, @as(f16, 0,),),
/// the rotation of the camera; radians // TODO are Euler angles really the best for this?
rotation: couple_t = @splat(2, @as(f16, 0,),),
/// how wide the view is; ratio between pixels and radians
scale: f32 = 0.004,
};
// TODO state that all the vectors are Cartesian
/// calculates the norm of a vector
///
/// a: the vector to calculate the norm of; space units
///
/// returns the norm of the vector; space units
fn norm(a: triple_t) f32 {
return std.math.hypot(f32, a[0], std.math.hypot(f32, a[1], a[2]));
}
// /// estimates the normal of an object given an S.D.F. and a position
// ///
// /// origin: the position to calculate the normal of
// /// object: the object to calculate the normal of
// ///
// /// returns the normal as coordinates on a unit sphere
// fn estimate_normal(origin: triple_t, sdf: fn(triple_t) triple_t) triple_t {
// const a = object.sdf(origin);
//
// var n = triple_t {
// sdf(triple_t { origin[0] + normal_delta, origin[1], origin[2] }) - a,
// sdf(triple_t { origin[0], origin[1] + normal_delta, origin[2] }) - a,
// sdf(triple_t { origin[0], origin[1], origin[2] + normal_delta }) - a,
// };
// n = n / @splat(3, norm(n,),);
//
// return n;
// }
/// estimates the normal of an object given an S.D.F. and a position
///
/// origin: the position to calculate the normal of
/// object: the object to calculate the normal of
///
/// returns the normal as coordinates on a unit sphere
fn estimate_normal(comptime sdf: fn(triple_t) f32) fn (origin: triple_t) triple_t {
return struct {
fn f(origin: triple_t) triple_t {
const a = sdf(origin);
var n = triple_t {
sdf(triple_t { origin[0] + normal_delta, origin[1], origin[2] }) - a,
sdf(triple_t { origin[0], origin[1] + normal_delta, origin[2] }) - a,
sdf(triple_t { origin[0], origin[1], origin[2] + normal_delta }) - a,
};
n = n / @splat(3, norm(n,),);
return n;
}
}.f;
}
/// converts Euler angles to unit vectors
///
/// a: the x and y Euler angles to represent; radians
//TODO add assertions
fn unit_vector(a: couple_t) triple_t {
var xy = @sin(a,);
var z = @reduce(.Mul, @cos(a,),);
return triple_t { xy[0], xy[1], z, };
}
// TODO pre-calculate the space-SDF around specific points in 3D space, for use as a "cache"
// TODO profiling, just profile everything
/// marches a ray with its direction until an object is hit, or the boundries are reached
///
/// ray: the ray to march, the function will update its origin
/// space: the space to march the ray in
///
/// returns a pointer to the object that was hit, or null in case the boundries were reached
fn march_ray(ray: *ray_t, space: *space_t) ?*object_t {
// while the ray is within the boundries
while (@reduce(.Max, @fabs(ray.origin)) < space.dis_boundries) {
// calculate the SDF for all the objects in space
var distances: [space.objects.len]f32 = undefined;
for (space.objects) |obj, i| {
distances[i] = obj.sdf(ray.origin);
}
var distance_min: f32 = std.math.inf(f32);
for (distances) |distance| {
distance_min = std.math.min(distance_min, distance);
}
// check for a hit
if (distance_min < epsilon) {
for (distances) |distance, i| {
if (distance == distance_min) {
return &space.objects[i];
}
}
}
// step
ray.origin += @splat(3, distance_min) * ray.direction;
}
return null;
}
// TODO document...
// TODO rename to direction
fn sphere_angles(coordinates: triple_t,) couple_t {
return couple_t {
std.math.asin(coordinates[0],),
std.math.asin(coordinates[1],),
};
}
/// traces a single ray through space and returns its colour
///
/// ray: the ray to trace
/// space: the space to trace the ray i
///
/// the resulting colour of the ray
fn trace_ray(ray: ray_t, space: *space_t) colour_t {
const max_hits = 4;
var ray_ = ray;
var no_hits: u8 = 0;
var sum_colour = space.colour_boundries;
while (no_hits < max_hits) {
no_hits += 1;
const obj = march_ray(&ray_, space) orelse break;
sum_colour += obj.matireal.colour / @splat(3, @as(u8, 4));
ray_.direction = unit_vector(
sphere_angles(ray_.direction) - sphere_angles(obj.normal(ray_.origin))
);
ray_.origin += @splat(3, epsilon) * ray_.direction;
}
return sum_colour;
}
/// renders a scene into a buffer
///
/// buffer: the output buffer
/// camera: the location of the camera in space
/// space: all the objects to consider
fn ray_march(
buffer: *buffer_t,
camera: camera_t,
space: *space_t,
) void {
// calculate a ray for every pixel in the view
var y: usize = 0;
while (y < size_view[1]) {
var x: usize = 0;
while (x < size_view[0]) {
// determine the direction of the ray
var ray_angles = @splat(2, @as(f32, space.camera.scale,),) * couple_t {
@intToFloat(f32, x,) - @as(f32, size_view[0] >> 1),
@intToFloat(f32, y) - @as(f32, size_view[1] >> 1),
} + camera.rotation;
var ray = ray_t {
.origin = camera.position,
.direction = unit_vector(ray_angles),
};
buffer[size_view[0] * y + x] = trace_ray(ray, space,);
x += 1;
}
y += 1;
}
}
// TODO organise the order of the funcions and such...
//TODO add comma (,) after each parameter in every function..
/// creates an interactive view window using SDL2
///
/// space: the space to present
pub fn view_interactive(space: *space_t,) !void {
//TODO special config option for tracy
const t = tracy.trace(@src());
defer t.end();
// initialise SDL
if (c.SDL_Init(c.SDL_INIT_VIDEO,) != 0) {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_init;
}
defer c.SDL_Quit();
// create a window
const window = c.SDL_CreateWindow(
window_title,
c.SDL_WINDOWPOS_UNDEFINED,
c.SDL_WINDOWPOS_UNDEFINED,
size_view[0],
size_view[1],
c.SDL_WINDOW_OPENGL,
) orelse {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_window;
};
defer c.SDL_DestroyWindow(window,);
// make the cursor stay hidden and inside the window
if (c.SDL_SetRelativeMouseMode(c.SDL_TRUE,) != 0) {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_mouse_mode;
}
c.SDL_WarpMouseInWindow(window, size_view[0] >> 1, size_view[1] >> 1);
// create a renderer
const renderer = c.SDL_CreateRenderer(
window,
0,
c.SDL_RENDERER_ACCELERATED | c.SDL_RENDERER_PRESENTVSYNC,
) orelse {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_renderer;
};
defer c.SDL_DestroyRenderer(renderer,);
// create a texture
const texture = c.SDL_CreateTexture(
renderer,
c.SDL_PIXELFORMAT_RGB888,
c.SDL_TEXTUREACCESS_STATIC,
size_view[0],
size_view[1],
) orelse {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_texture_create;
};
defer c.SDL_DestroyTexture(texture,);
// declare a pixels buffer
var buffer: buffer_t = undefined;
// mouse movement, relative to the last frame; pixels
var mouse_motion: couple_t = undefined;
// camera state
var camera: camera_t = camera_t {};
var event: c.SDL_Event = undefined;
// main rendering loop
frames: while (true) {
// reset the relative mouse position
mouse_motion = @splat(2, @as(f32, 0));
// update the state as needed
while (c.SDL_PollEvent(&event) > 0) {
switch (event.type) {
c.SDL_QUIT => {
break :frames;
},
c.SDL_KEYDOWN => {
if (event.key.keysym.scancode == c.SDL_SCANCODE_Q) {
break :frames;
}
},
c.SDL_MOUSEMOTION => {
mouse_motion[0] += @intToFloat(f32, event.motion.xrel,);
mouse_motion[1] += @intToFloat(f32, event.motion.yrel,);
},
else => undefined,
}
}
// move the camera
var state_keys = c.SDL_GetKeyboardState(null);
if (state_keys[c.SDL_SCANCODE_W] == 1) {
camera.position += unit_vector(camera.rotation,);
} else if (state_keys[c.SDL_SCANCODE_A] == 1) {
var a = camera.rotation;
a[0] -= std.math.pi / 2.0;
camera.position += unit_vector(a,);
} else if (state_keys[c.SDL_SCANCODE_S] == 1) {
camera.position -= unit_vector(camera.rotation,);
} else if (state_keys[c.SDL_SCANCODE_D] == 1) {
var a = camera.rotation;
a[0] += std.math.pi / 2.0;
camera.position += unit_vector(a,);
}
// rotate the camera
camera.rotation += @splat(2, @as(f32, mouse_sensitivity)) * mouse_motion;
// render the view
ray_march(&buffer, camera, space);
// apply the buffer to the window
if (c.SDL_UpdateTexture(
texture,
null,
&buffer,
size_view[0] * @sizeOf(colour_t),
) != 0) {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.texture_update;
}
if (c.SDL_RenderClear(renderer,) != 0) {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_render_clear;
}
if (c.SDL_RenderCopy(renderer, texture, null, null,) != 0) {
std.log.err("{s}", .{ c.SDL_GetError(), },);
return error.sdl_render_copy;
}
c.SDL_RenderPresent(renderer,);
}
}
//TODO
fn foo(origin: triple_t) f32 {
var a = origin;
a[2] -= 3;
var b = std.math.hypot(f32, a[0], a[1]) - 1;
return std.math.hypot(f32, b, a[2]) - 0.5;
}
pub fn main() anyerror!void {
var obj_a = object_t {
.sdf = struct {
fn f(origin: triple_t,) f32 {
var a = origin;
a[0] += 3;
a[1] += 1.5;
a[2] -= 5;
return norm(a,) - 1;
}
}.f,
.normal = struct {
fn f(origin: triple_t,) triple_t {
var a = origin;
a[0] -= 3;
a[1] -= 1.5;
a[2] += 5;
return a / @splat(3, norm(a,),);
}
}.f,
.matireal = matireal_t {
.colour = colour_t { 0x00, 0x00, 0xFF, },
},
};
var obj_b = object_t {
.sdf = struct {
fn f(origin: triple_t) f32 {
var a = origin;
a[0] -= 5;
var q = @fabs(a) - @splat(3, @as(f32, 1.5));
return norm(triple_t {
std.math.max(0, q[0],),
std.math.max(0, q[1],),
std.math.max(0, q[2],),
}) + std.math.min(@reduce(.Max, q), 0);
}
}.f,
.normal = struct {
fn f(origin: triple_t) triple_t {
var a = [_]f32 { origin[0], origin[1], origin[2], };
a[0] -= 5;
var b: triple_t = triple_t { 0, 0, 0 };
for (a) |v, i| {
if (v <= -1.5) {
b[i] = -1;
} else if (v >= 1.5) {
b[i] = 1;
}
}
return b / @splat(3, norm(b,),);
}
}.f,
.matireal = matireal_t {
.colour = colour_t { 0x00, 0xFF, 0x00, },
},
};
var obj_c = object_t {
.sdf = foo,
.normal = estimate_normal(foo),
.matireal = matireal_t {
.colour = colour_t { 0x80, 0x10, 0xF0, },
},
};
var my_space = space_t {
.camera = camera_t {},
.objects = [3]object_t { obj_a, obj_b, obj_c, },
.colour_boundries = colour_t { 0, 0, 0, },
};
try view_interactive(&my_space);
} | src/main.zig |
const std = @import("std");
const assert = std.debug.assert;
pub const Gonzo = struct {
const allocator = std.heap.direct_allocator;
pub const Data = struct {
id: usize,
map: std.AutoHashMap(usize, usize),
pub fn init(id: usize) Data {
std.debug.warn("Data init {}\n", id);
return Data{
.id = id,
.map = std.AutoHashMap(usize, usize).init(allocator),
};
}
pub fn deinit(self: *Data) void {
self.map.deinit();
std.debug.warn("Data {} deinit\n", self.id);
}
pub fn show(self: *Data) void {
// std.debug.warn("Data {}: {} entries\n", self.id, self.map.count());
var it = self.map.iterator();
while (it.next()) |data| {
std.debug.warn("data {} = {}\n", data.key, data.value);
}
}
pub fn add_entry(self: *Data, k: usize, v: usize) void {
_ = self.map.put(k, v) catch unreachable;
std.debug.warn("Data {}: add_entry {} {}\n", self.id, k, v);
}
};
pub const Meta = struct {
id: usize,
map: std.AutoHashMap(usize, Data),
pub fn init(id: usize) Data {
std.debug.warn("Meta init {}\n", id);
return Meta{
.id = id,
.map = std.AutoHashMap(usize, Data).init(allocator),
};
}
pub fn deinit(self: *Meta) void {
var it = self.map.iterator();
while (it.next()) |data| {
data.value.deinit();
}
self.map.deinit();
std.debug.warn("Meta {} deinit\n", self.id);
}
pub fn show(self: *Meta) void {
// std.debug.warn("Meta {}: {} entries\n", self.id, self.map.count());
var it = self.map.iterator();
while (it.next()) |data| {
std.debug.warn("data {} =\n", data.key);
data.value.show();
}
}
pub fn add_entry(self: *Meta, m: usize, k: usize, v: usize) void {
var d: Data = undefined;
if (self.map.contains(m)) {
d = self.map.get(m).?.value;
} else {
d = Data.init(m);
_ = self.map.put(m, d) catch unreachable;
std.debug.warn("Meta created data for {}\n", m);
}
_ = d.put(k, v) catch unreachable;
std.debug.warn("Meta {}: add_entry {} {}\n", m, k, v);
}
};
blurb: Data,
pub fn init() Gonzo {
std.debug.warn("Gonzo init\n");
return Gonzo{
.blurb = Meta.init(11),
};
}
pub fn deinit(self: *Gonzo) void {
self.blurb.deinit();
std.debug.warn("Gonzo deinit\n");
}
pub fn show(self: *Gonzo) void {
self.blurb.show();
}
// map: std.AutoHashMap(usize, Meta),
// pub fn init() Data {
// std.debug.warn("Gonzo init\n");
// return Gonzo{
// .map = std.AutoHashMap(usize, Meta).init(allocator),
// };
// }
// pub fn deinit(self: *Gonzo) void {
// var it = self.map.iterator();
// while (it.next()) |data| {
// data.value.deinit();
// }
// self.map.deinit();
// std.debug.warn("Gonzo {} deinit\n", self.id);
// }
// pub fn show(self: *Gonzo) void {
// std.debug.warn("Gonzo: {} entries\n", self.map.cont());
// var it = self.map.iterator();
// while (it.next()) |data| {
// std.debug.warn("meta {} =\n", data.key);
// data.value.show();
// }
// }
};
test "simple" {
@breakpoint();
std.debug.warn("\n");
var g = Gonzo.init();
defer g.deinit();
g.show();
} | 2018/p04/gonzo.zig |
const std = @import("std");
const testing = std.testing;
pub const Map = struct {
rows: usize,
cols: usize,
cells: std.AutoHashMap(Pos, Tile),
pub const Tile = enum(u8) {
Empty = 0,
Tree = 1,
};
pub const Pos = struct {
x: usize,
y: usize,
pub fn init(x: usize, y: usize) Pos {
return Pos{
.x = x,
.y = y,
};
}
};
pub fn init() Map {
const allocator = std.heap.page_allocator;
var self = Map{
.rows = 0,
.cols = 0,
.cells = std.AutoHashMap(Pos, Tile).init(allocator),
};
return self;
}
pub fn deinit(self: *Map) void {
self.cells.deinit();
}
pub fn add_line(self: *Map, line: []const u8) void {
if (self.cols == 0) {
self.cols = line.len;
}
if (self.cols != line.len) {
@panic("jagged map");
}
var x: usize = 0;
while (x < self.cols) : (x += 1) {
if (line[x] != '#') continue;
const pos = Pos.init(x, self.rows);
_ = self.cells.put(pos, Map.Tile.Tree) catch unreachable;
}
self.rows += 1;
}
pub fn traverse(self: Map, right: usize, down: usize) usize {
var pos = Pos.init(0, 0);
var count: usize = 0;
while (pos.y < self.rows) {
const found = self.cells.get(pos);
if (found) |t| {
if (t == Tile.Tree) {
// std.debug.warn("TREE {}x{}\n", .{ pos.x, pos.y });
count += 1;
}
}
// TODO: can zig do the add and mod in one go?
pos.x += right;
pos.x %= self.cols;
pos.y += down;
}
return count;
}
pub fn traverse_several(self: Map, specs: []const [2]usize) usize {
var product: usize = 1;
for (specs) |spec| {
product *= self.traverse(spec[0], spec[1]);
}
return product;
}
pub fn show(self: Map) void {
std.debug.warn("MAP: {} x {}\n", .{ self.rows, self.cols });
var y: usize = 0;
while (y < self.rows) : (y += 1) {
std.debug.warn("{:4} | ", .{y});
var x: usize = 0;
while (x < self.cols) : (x += 1) {
var tile: u8 = '.';
const pos = Pos.init(x, y);
const found = self.cells.get(pos);
if (found) |t| {
switch (t) {
Tile.Empty => tile = '.',
Tile.Tree => tile = '#',
}
}
std.debug.warn("{c}", .{tile});
}
std.debug.warn("\n", .{});
}
}
};
test "sample single" {
const data: []const u8 =
\\..##.......
\\#...#...#..
\\.#....#..#.
\\..#.#...#.#
\\.#...##..#.
\\..#.##.....
\\.#.#.#....#
\\.#........#
\\#.##...#...
\\#...##....#
\\.#..#...#.#
;
var map = Map.init();
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
map.add_line(line);
}
// map.show();
const count = map.traverse(3, 1);
try testing.expect(count == 7);
}
test "sample several" {
const data: []const u8 =
\\..##.......
\\#...#...#..
\\.#....#..#.
\\..#.#...#.#
\\.#...##..#.
\\..#.##.....
\\.#.#.#....#
\\.#........#
\\#.##...#...
\\#...##....#
\\.#..#...#.#
;
var map = Map.init();
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
map.add_line(line);
}
// map.show();
const specs = [_][2]usize{
[_]usize{ 1, 1 },
[_]usize{ 3, 1 },
[_]usize{ 5, 1 },
[_]usize{ 7, 1 },
[_]usize{ 1, 2 },
};
const product = map.traverse_several(specs[0..]);
try testing.expect(product == 336);
} | 2020/p03/map.zig |
const std = @import("std");
const testing = std.testing;
const f128math = @import("f128math");
const math = f128math;
const inf_f32 = math.inf_f32;
const nan_f32 = math.qnan_f32;
const inf_f64 = math.inf_f64;
const nan_f64 = math.qnan_f64;
const inf_f128 = math.inf_f128;
const nan_f128 = math.qnan_f128;
const test_util = @import("util.zig");
const TestcaseExp2_32 = test_util.Testcase(math.exp2, "exp2", f32);
const TestcaseExp2_64 = test_util.Testcase(math.exp2, "exp2", f64);
const TestcaseExp2_128 = test_util.Testcase(math.exp2, "exp2", f128);
fn tc32(input: f32, exp_output: f32) TestcaseExp2_32 {
return .{ .input = input, .exp_output = exp_output };
}
fn tc64(input: f64, exp_output: f64) TestcaseExp2_64 {
return .{ .input = input, .exp_output = exp_output };
}
fn tc128(input: f128, exp_output: f128) TestcaseExp2_128 {
return .{ .input = input, .exp_output = exp_output };
}
const testcases32 = [_]TestcaseExp2_32{
// zig fmt: off
// Special cases
tc32( 0, 1 ),
tc32(-0, 1 ),
tc32( 1, 2 ),
tc32(-1, 0.5 ),
tc32( inf_f32, inf_f32 ),
tc32(-inf_f32, 0 ),
tc32( nan_f32, nan_f32 ),
tc32(-nan_f32, nan_f32 ),
tc32( @bitCast(f32, @as(u32, 0x7ff01234)), nan_f32 ),
tc32( @bitCast(f32, @as(u32, 0xfff01234)), nan_f32 ),
// Sanity cases
tc32(-0x1.0223a0p+3, 0x1.e8d134p-9 ),
tc32( 0x1.161868p+2, 0x1.453672p+4 ),
tc32(-0x1.0c34b4p+3, 0x1.890ca0p-9 ),
tc32(-0x1.a206f0p+2, 0x1.622d4ep-7 ),
tc32( 0x1.288bbcp+3, 0x1.340ecep+9 ),
tc32( 0x1.52efd0p-1, 0x1.950eeep+0 ),
tc32(-0x1.a05cc8p-2, 0x1.824056p-1 ),
tc32( 0x1.1f9efap-1, 0x1.79dfa2p+0 ),
tc32( 0x1.8c5db0p-1, 0x1.b5ceacp+0 ),
tc32(-0x1.5b86eap-1, 0x1.3fd8bap-1 ),
// Boundary cases
tc32( 0x1.fffffep+6, 0x1.ffff4ep+127 ), // The last value before the exp gets infinite
tc32( 0x1.ff999ap+6, 0x1.ddb6a2p+127 ),
tc32( 0x1p+7, inf_f32 ), // The first value that gives infinite exp
tc32( 0x1.003334p+7, inf_f32 ),
tc32(-0x1.2bccccp+7, 0x1p-149 ), // The last value before the exp flushes to zero
tc32(-0x1.2ap+7, 0x1p-149 ),
tc32(-0x1.2cp+7, 0 ), // The first value at which the exp flushes to zero
tc32(-0x1.2c3334p+7, 0 ),
tc32(-0x1.f8p+6, 0x1p-126 ), // The last value before the exp flushes to subnormal
tc32(-0x1.f80002p+6, 0x1.ffff5p-127 ), // The first value for which exp flushes to subnormal
tc32(-0x1.fcp+6, 0x1p-127 ),
// zig fmt: on
};
const testcases64 = [_]TestcaseExp2_64{
// zig fmt: off
// Special cases
tc64( 0, 1 ),
tc64(-0, 1 ),
tc64( 1, 2 ),
tc64(-1, 0.5 ),
tc64( inf_f64, inf_f64 ),
tc64(-inf_f64, 0 ),
tc64( nan_f64, nan_f64 ),
tc64(-nan_f64, nan_f64 ),
tc64( @bitCast(f64, @as(u64, 0x7ff0123400000000)), nan_f64 ),
tc64( @bitCast(f64, @as(u64, 0xfff0123400000000)), nan_f64 ),
// Sanity cases
tc64(-0x1.02239f3c6a8f1p+3, 0x1.e8d13c396f452p-9 ),
tc64( 0x1.161868e18bc67p+2, 0x1.4536746bb6f12p+4 ),
tc64(-0x1.0c34b3e01e6e7p+3, 0x1.890ca0c00b9a2p-9 ),
tc64(-0x1.a206f0a19dcc4p+2, 0x1.622d4b0ebc6c1p-7 ),
tc64( 0x1.288bbb0d6a1e6p+3, 0x1.340ec7f3e607ep+9 ),
tc64( 0x1.52efd0cd80497p-1, 0x1.950eef4bc5451p+0 ),
tc64(-0x1.a05cc754481d1p-2, 0x1.824056efc687cp-1 ),
tc64( 0x1.1f9ef934745cbp-1, 0x1.79dfa14ab121ep+0 ),
tc64( 0x1.8c5db097f7442p-1, 0x1.b5cead2247372p+0 ),
tc64(-0x1.5b86ea8118a0ep-1, 0x1.3fd8ba33216b9p-1 ),
// Boundary cases
tc64( 0x1.fffffffffffffp+9, 0x1.ffffffffffd3ap+1023 ), // The last value before the exp gets infinite
tc64( 0x1.fff3333333333p+9, 0x1.ddb680117aa8ep+1023 ),
tc64( 0x1p+10, inf_f64 ), // The first value that gives infinite exp
tc64( 0x1.0006666666666p+10, inf_f64 ),
tc64(-0x1.0cbffffffffffp+10, 0x1p-1074 ), // The last value before the exp flushes to zero
tc64(-0x1.0c8p+10, 0x1p-1074 ),
tc64(-0x1.0cap+10, 0x1p-1074 ),
tc64(-0x1.0ccp+10, 0 ), // The first value at which the exp flushes to zero
tc64(-0x1p+11, 0 ),
tc64(-0x1.ffp+9, 0x1p-1022 ), // The last value before the exp flushes to subnormal
tc64(-0x1.fef3333333333p+9, 0x1.125fbee2506b0p-1022 ),
tc64(-0x1.ff00000000001p+9, 0x1.ffffffffffd3ap-1023 ), // The first value for which exp flushes to subnormal
tc64(-0x1.ff0cccccccccdp+9, 0x1.ddb680117aa8ep-1023 ),
tc64(-0x1.ff4p+9, 0x1.6a09e667f3bccp-1023 ),
tc64(-0x1.ff8p+9, 0x1p-1023 ),
tc64(-0x1.ffcp+9, 0x1.6a09e667f3bccp-1024 ),
tc64(-0x1p+10, 0x1p-1024 ),
// zig fmt: on
};
const testcases128 = [_]TestcaseExp2_128{
// zig fmt: off
// Special cases
tc128( 0, 1 ),
tc128(-0, 1 ),
tc128( 1, 2 ),
tc128(-1, 0.5 ),
tc128( inf_f128, inf_f128 ),
tc128(-inf_f128, 0 ),
tc128( nan_f128, nan_f128 ),
tc128(-nan_f128, nan_f128 ),
tc128( @bitCast(f128, @as(u128, 0x7fff1234000000000000000000000000)), nan_f128 ),
tc128( @bitCast(f128, @as(u128, 0xffff1234000000000000000000000000)), nan_f128 ),
// Sanity cases
tc128(-0x1.02239f3c6a8f13dep+3, 0x1.e8d13c396f44f500bfc7cefe1304p-9 ),
tc128( 0x1.161868e18bc67782p+2, 0x1.4536746bb6f139f3c05f40f3758dp+4 ),
tc128(-0x1.0c34b3e01e6e682cp+3, 0x1.890ca0c00b9a679b66a1cc43e168p-9 ),
tc128(-0x1.a206f0a19dcc3948p+2, 0x1.622d4b0ebc6c2e5980cda14724e4p-7 ),
tc128( 0x1.288bbb0d6a1e5bdap+3, 0x1.340ec7f3e607c5bd584d33ade9aep+9 ),
tc128( 0x1.52efd0cd80496a5ap-1, 0x1.950eef4bc5450eeabc992d9ba86ap+0 ),
tc128(-0x1.a05cc754481d0bd0p-2, 0x1.824056efc687c4f8b3c7e1f4f9fbp-1 ),
tc128( 0x1.1f9ef934745cad60p-1, 0x1.79dfa14ab121da4f38057c8f9f2ep+0 ),
tc128( 0x1.8c5db097f744257ep-1, 0x1.b5cead22473723958363b617f84ep+0 ),
tc128(-0x1.5b86ea8118a0e2bcp-1, 0x1.3fd8ba33216b93ceab3a5697c480p-1 ),
// Boundary cases
tc128( 0x1p+14 - 0x1p-99, 0x1.ffffffffffffffffffffffffd3a3p+16383 ), // The last value before the exp gets infinite
tc128( 0x1.ffff333333333334p+13, 0x1.ddb680117ab141f6da98f76d6b72p+16383 ),
tc128( 0x1p+14, inf_f128 ), // The first value that gives infinite exp
tc128( 0x1.0000666666666666p+14, inf_f128 ),
tc128(-0x1.01bcp+14 + 0x1p-98, 0x1p-16494 ), // The last value before the exp flushes to zero
tc128(-0x1.00f799999999999ap+14, 0x1.125fbee25066p-16446 ),
tc128(-0x1.01bcp+14, 0 ), // The first value at which the exp flushes to zero
tc128(-0x1.fffp+13, 0x1p-16382 ), // The last value before the exp flushes to subnormal
tc128(-0x1.fffp+13 - 0x1p-99, 0x0.ffffffffffffffffffffffffe9d2p-16382 ), // The first value for which exp flushes to subnormal
tc128(-0x1.fff4p+13, 0x1.6a09e667f3bcc908b2fb1366ea94p-16383 ),
tc128(-0x1.fff8p+13, 0x1p-16383 ),
tc128(-0x1.fffcp+13, 0x1.6a09e667f3bcc908b2fb1366ea94p-16384 ),
tc128(-0x1p+14, 0x1p-16384 ),
tc128( 0x1p-16384, 1 ), // Very close to zero
// zig fmt: on
};
test "exp2_32()" {
try test_util.runTests(testcases32);
}
test "exp2_64()" {
try test_util.runTests(testcases64);
}
test "exp2_128()" {
try test_util.runTests(testcases128);
} | tests/exp2.zig |
const Header = @This();
/// Magic number
pub const magic: u32 = 0x55aa1234;
/// Versions 1 and 2 are supported
version: u32,
/// Size of the directory tree in bytes
///
/// Versions: 1, 2
tree_size: u32,
/// Size of the section containing files saved internally in this VPK
///
/// Versions: 2
file_data_section_size: u32 = 0,
/// Size of the section containing MD5 checksums for files saved
/// outside of this VPK
///
/// Versions: 2
archive_md5_section_size: u32 = 0,
/// Size of the section containing MD5 checksums for files saved
/// internally in this VPK
///
/// Versions: 2
other_md5_section_size: u32 = 0,
/// Size of the section containing a cryptographic signature of the
/// file content
///
/// Versions: 2
signature_section_size: u32 = 0,
pub fn size(self: Header) usize {
return switch (self.version) {
1 => 4 + 8, // magic number + fields
2 => 4 + 24,
else => unreachable, // unsupported version
};
}
pub fn read(reader: anytype) !Header {
const signature = try reader.readIntLittle(u32);
if (signature != magic) return error.InvalidSignature;
const version = try reader.readIntLittle(u32);
switch (version) {
1 => return Header{
.version = 1,
.tree_size = try reader.readIntLittle(u32),
},
2 => return Header{
.version = 2,
.tree_size = try reader.readIntLittle(u32),
.file_data_section_size = try reader.readIntLittle(u32),
.archive_md5_section_size = try reader.readIntLittle(u32),
.other_md5_section_size = try reader.readIntLittle(u32),
.signature_section_size = try reader.readIntLittle(u32),
},
else => return error.UnsupportedVersion,
}
}
pub fn write(writer: anytype, header: Header) !void {
try writer.writeIntLittle(u32, magic);
try writer.writeIntLittle(u32, header.version);
try writer.writeIntLittle(u32, header.tree_size);
// Version 2 exclusive fields
if (header.version == 2) {
try writer.writeIntLittle(u32, header.file_data_section_size);
try writer.writeIntLittle(u32, header.archive_md5_section_size);
try writer.writeIntLittle(u32, header.other_md5_section_size);
try writer.writeIntLittle(u32, header.signature_section_size);
}
} | src/vpk/Header.zig |
const std = @import("std");
pub const WindowFind = struct {
distance: u16,
// NOTE: Maximum length is 258.
length: u16
};
pub fn windowInjectByteDefault(self: anytype, byte: u8) void {
var tmp = [_]u8{ byte };
self.inject(tmp[0..1]);
}
// -- Implementations --
pub fn MemoryOptimizedWindow(comptime windowSize: u16) type {
// Past this window size, unrepresentable distances may occur,
// integer overflows may occur...
// Larger than this is also not supported decoding-wise
std.debug.assert(windowSize <= 0x8000);
return struct {
// Window ring
data: [windowSize]u8,
// Amount of the ring which is valid
valid: u16,
// Write position in the ring
ptr: u16,
const Self = @This();
pub fn init() Self {
return Self {
.data = undefined,
.valid = 0,
.ptr = 0,
};
}
fn ptrBack(self: *Self, ptr: u16) u16 {
_ = self;
if (ptr == 0)
return windowSize - 1;
return ptr - 1;
}
fn ptrFwd(self: *Self, ptr: u16) u16 {
_ = self;
if (ptr == (windowSize - 1))
return 0;
return ptr + 1;
}
// Finds as much as it can of the given data slice within the window.
// Note that it may return a length of 0 - this means you must use a literal.
// Note that it will NOT return a length above the length of the input data.
// Nor will it return a length above 258 (the maximum length).
// Note that it may return 'extended' (off the end of the window) finds, this is normal and allowed in DEFLATE.
pub fn find(self: *Self, dataC: []const u8) WindowFind {
var bestDistance: u16 = 0;
var bestLength: u16 = 0;
if (dataC.len != 0) {
// Truncate slice to ensure that length cannot exceed maximum
const data = if (dataC.len < 258) dataC else dataC[0..258];
// Honestly shouldn't be possible that length is zero, but just in case.
var ptr = self.ptrBack(self.ptr);
// Note that distance can only ever get up to 0x8000
var distance: u16 = 1;
while (distance < self.valid) {
var subPtr = ptr;
var subDataAdv: u16 = 0;
var subLength: u16 = 0;
// Move forward until end
while (subLength < data.len) {
var gob: u8 = undefined;
if (subPtr == self.ptr) {
// ran out of window, start from start of written data
// it can be assumed we will run out of outer-loop input before we run out of inner-loop input
gob = data[subDataAdv];
subDataAdv += 1;
} else {
// inside window
gob = self.data[subPtr];
subPtr = self.ptrFwd(subPtr);
}
if (gob != data[subLength])
break;
// success, increase length
subLength += 1;
}
// Check length
if (subLength > bestLength) {
bestDistance = distance;
bestLength = subLength;
}
// Continue backwards
ptr = self.ptrBack(ptr);
distance += 1;
}
}
return WindowFind {
.distance = bestDistance,
.length = bestLength,
};
}
// Injects a byte into the window.
// This covers situations where some known activity was performed on the DEFLATE stream.
pub const injectByte = windowInjectByteDefault;
// Injects a slice into the window.
// This covers situations where some known activity was performed on the DEFLATE stream.
pub fn inject(self: *Self, data: []const u8) void {
// Mostly naive method for now, with some slight adjustments
if (data.len > windowSize) {
self.inject(data[(data.len - windowSize)..data.len]);
return;
}
for (data) |b| {
self.data[self.ptr] = b;
self.ptr = self.ptrFwd(self.ptr);
}
if ((windowSize - self.valid) < data.len) {
self.valid = windowSize;
} else {
// It's important to note that the data.len vs. windowSize check above prevents this from triggering UB.
self.valid += @intCast(u16, data.len);
}
}
// Resets window validity.
// This covers situations where some unknown activity was performed on the DEFLATE stream.
pub fn reset(self: *Self) void {
self.valid = 0;
self.ptr = 0;
}
};
} | src/window.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const print = std.debug.print;
const ArrayList = std.ArrayList;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const data = @embedFile("../inputs/day_03");
const StuffToReach = enum {
OxygenGenerator,
CO2Scruber,
};
pub fn main() !void {
var gammaRate: [12]u8 = mem.zeroes([12]u8);
var epsilonRate: [12]u8 = mem.zeroes([12]u8);
var lines = ArrayList([]const u8).init(&gpa.allocator);
defer lines.deinit();
var iter = mem.tokenize(u8, data, "\n");
while (iter.next()) |line| try lines.append(line);
var currentBit: usize = 0;
while (currentBit < 12) : (currentBit += 1) {
var numberOf_0: i32 = 0;
var numberOf_1: i32 = 0;
for (lines.items) |row, index| {
const digit = try fmt.charToDigit(row[currentBit], 10);
if (digit == 0) {
numberOf_0 += 1;
} else {
numberOf_1 += 1;
}
}
if (numberOf_0 > numberOf_1) {
gammaRate[currentBit] = '0';
epsilonRate[currentBit] = '1';
} else {
gammaRate[currentBit] = '1';
epsilonRate[currentBit] = '0';
}
}
const gammaRateInt = try fmt.parseInt(i32, &gammaRate, 2);
const epsilonRateInt = try fmt.parseInt(i32, &epsilonRate, 2);
const oxygenRating = try cmp(lines.items, 0, .OxygenGenerator);
const co2Rating = try cmp(lines.items, 0, .CO2Scruber);
print("PART 1: {}\n", .{gammaRateInt * epsilonRateInt});
print("PART 2: {}\n", .{oxygenRating * co2Rating});
}
fn cmp(mainData: [][]const u8, currentBit: usize, stuffToReach: StuffToReach) !i32 {
var currentBucket = ArrayList([]const u8).init(&gpa.allocator);
defer currentBucket.deinit();
var numberOf_0: i32 = 0;
var numberOf_1: i32 = 0;
for (mainData) |row, index| {
const digit = try fmt.charToDigit(row[currentBit], 10);
if (digit == 0) {
numberOf_0 += 1;
} else {
numberOf_1 += 1;
}
}
if (numberOf_0 == numberOf_1) {
if (stuffToReach == .OxygenGenerator) {
for (mainData) |row| {
if (row[currentBit] == '1') {
try currentBucket.append(row);
}
}
} else {
for (mainData) |row| {
if (row[currentBit] == '0') {
try currentBucket.append(row);
}
}
}
} else {
if (stuffToReach == .OxygenGenerator) {
if (numberOf_0 > numberOf_1) {
for (mainData) |row| {
if (row[currentBit] == '0') {
try currentBucket.append(row);
}
}
} else {
for (mainData) |row| {
if (row[currentBit] == '1') {
try currentBucket.append(row);
}
}
}
} else {
if (numberOf_0 > numberOf_1) {
for (mainData) |row| {
if (row[currentBit] == '1') {
try currentBucket.append(row);
}
}
} else {
for (mainData) |row| {
if (row[currentBit] == '0') {
try currentBucket.append(row);
}
}
}
}
}
if (currentBucket.items.len == 1) {
return try fmt.parseInt(i32, currentBucket.items[0], 2);
}
return cmp(currentBucket.items, currentBit + 1, stuffToReach);
} | src/03.zig |
const std = @import("std");
pub const c = @import("src/c.zig");
const builtin = std.builtin;
const debug = std.debug;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const nk = @This();
pub const atlas = @import("src/atlas.zig");
pub const bar = @import("src/bar.zig");
pub const button = @import("src/button.zig");
pub const chart = @import("src/chart.zig");
pub const checkbox = @import("src/checkbox.zig");
pub const check = @import("src/check.zig");
pub const color = @import("src/color.zig");
pub const combo = @import("src/combo.zig");
pub const contextual = @import("src/contextual.zig");
pub const edit = @import("src/edit.zig");
pub const group = @import("src/group.zig");
pub const input = @import("src/input.zig");
pub const layout = @import("src/layout.zig");
pub const list = @import("src/list.zig");
pub const menubar = @import("src/menubar.zig");
pub const menu = @import("src/menu.zig");
pub const option = @import("src/option.zig");
pub const popup = @import("src/popup.zig");
pub const property = @import("src/property.zig");
pub const radio = @import("src/radio.zig");
pub const selectable = @import("src/selectable.zig");
pub const select = @import("src/select.zig");
pub const slide = @import("src/slide.zig");
pub const slider = @import("src/slider.zig");
pub const stroke = @import("src/stroke.zig");
pub const style = @import("src/style.zig");
pub const testing = @import("src/testing.zig");
pub const Text = @import("src/TextEdit.zig");
pub const text = @import("src/text.zig");
pub const tooltip = @import("src/tooltip.zig");
pub const tree = @import("src/tree.zig");
pub const vertex = @import("src/vertex.zig");
pub const widget = @import("src/widget.zig");
pub const window = @import("src/window.zig");
pub const Buffer = @import("src/Buffer.zig");
pub const Str = @import("src/Str.zig");
pub const utf_size = c.NK_UTF_SIZE;
pub const rest = struct {
test {
std.testing.refAllDecls(@This());
}
pub fn nkRgbIv(_rgb: [*c]const c_int) nk.Color {
return c.nk_rgb_iv(_rgb);
}
pub fn nkRgbBv(_rgb: [*c]const u8) nk.Color {
return c.nk_rgb_bv(_rgb);
}
pub fn nkRgbFv(_rgb: [*c]const f32) nk.Color {
return c.nk_rgb_fv(_rgb);
}
pub fn nkRgbCf(y: nk.Colorf) nk.Color {
return c.nk_rgb_cf(y);
}
pub fn nkRgbHex(_rgb: []const u8) nk.Color {
return c.nk_rgb_hex(nk.slice(_rgb));
}
pub fn nkRgbaU32(i: c_uint) nk.Color {
return c.nk_rgba_u32(i);
}
pub fn nkRgbaIv(_rgba: [*c]const c_int) nk.Color {
return c.nk_rgba_iv(_rgba);
}
pub fn nkRgbaBv(_rgba: [*c]const u8) nk.Color {
return c.nk_rgba_bv(_rgba);
}
pub fn nkRgbaF(r: f32, g: f32, b: f32, a: f32) nk.Color {
return c.nk_rgba_f(r, g, b, a);
}
pub fn nkRgbaFv(_rgba: [*c]const f32) nk.Color {
return c.nk_rgba_fv(_rgba);
}
pub fn nkRgbaCf(y: nk.Colorf) nk.Color {
return c.nk_rgba_cf(y);
}
pub fn nkRgbaHex(_rgb: []const u8) nk.Color {
return c.nk_rgba_hex(nk.slice(_rgb));
}
pub fn nkHsvaColorf(h: f32, s: f32, v: f32, a: f32) nk.Colorf {
return c.nk_hsva_colorf(h, s, v, a);
}
pub fn nkHsvaColorfv(y: [*c]f32) nk.Colorf {
return c.nk_hsva_colorfv(y);
}
pub fn nkColorfHsvaF(out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32, out_a: [*c]f32, in: nk.Colorf) void {
return c.nk_colorf_hsva_f(out_h, out_s, out_v, out_a, in);
}
pub fn nkColorfHsvaFv(_hsva: [*c]f32, in: nk.Colorf) void {
return c.nk_colorf_hsva_fv(_hsva, in);
}
pub fn nkHsvIv(_hsv: [*c]const c_int) nk.Color {
return c.nk_hsv_iv(_hsv);
}
pub fn nkHsvBv(_hsv: [*c]const u8) nk.Color {
return c.nk_hsv_bv(_hsv);
}
pub fn nkHsvFv(_hsv: [*c]const f32) nk.Color {
return c.nk_hsv_fv(_hsv);
}
pub fn nkHsvaIv(_hsva: [*c]const c_int) nk.Color {
return c.nk_hsva_iv(_hsva);
}
pub fn nkHsvaBv(_hsva: [*c]const u8) nk.Color {
return c.nk_hsva_bv(_hsva);
}
pub fn nkHsvaFv(_hsva: [*c]const f32) nk.Color {
return c.nk_hsva_fv(_hsva);
}
pub fn nkColorF(r: [*c]f32, g: [*c]f32, b: [*c]f32, a: [*c]f32, u: nk.Color) void {
return c.nk_color_f(r, g, b, a, u);
}
pub fn nkColorFv(rgba_out: [*c]f32, u: nk.Color) void {
return c.nk_color_fv(rgba_out, u);
}
pub fn nkColorCf(y: nk.Color) nk.Colorf {
return c.nk_color_cf(y);
}
pub fn nkColorD(r: [*c]f64, g: [*c]f64, b: [*c]f64, a: [*c]f64, u: nk.Color) void {
return c.nk_color_d(r, g, b, a, u);
}
pub fn nkColorDv(rgba_out: [*c]f64, u: nk.Color) void {
return c.nk_color_dv(rgba_out, u);
}
pub fn nkColorHexRgba(output: [*c]u8, u: nk.Color) void {
return c.nk_color_hex_rgba(output, u);
}
pub fn nkColorHexRgb(output: [*c]u8, u: nk.Color) void {
return c.nk_color_hex_rgb(output, u);
}
pub fn nkColorHsvI(out_h: [*c]c_int, out_s: [*c]c_int, out_v: [*c]c_int, u: nk.Color) void {
return c.nk_color_hsv_i(out_h, out_s, out_v, u);
}
pub fn nkColorHsvB(out_h: [*c]u8, out_s: [*c]u8, out_v: [*c]u8, u: nk.Color) void {
return c.nk_color_hsv_b(out_h, out_s, out_v, u);
}
pub fn nkColorHsvIv(hsv_out: [*c]c_int, u: nk.Color) void {
return c.nk_color_hsv_iv(hsv_out, u);
}
pub fn nkColorHsvBv(hsv_out: [*c]u8, u: nk.Color) void {
return c.nk_color_hsv_bv(hsv_out, u);
}
pub fn nkColorHsvF(out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32, u: nk.Color) void {
return c.nk_color_hsv_f(out_h, out_s, out_v, u);
}
pub fn nkColorHsvFv(hsv_out: [*c]f32, u: nk.Color) void {
return c.nk_color_hsv_fv(hsv_out, u);
}
pub fn nkColorHsvaI(h: [*c]c_int, s: [*c]c_int, v: [*c]c_int, a: [*c]c_int, u: nk.Color) void {
return c.nk_color_hsva_i(h, s, v, a, u);
}
pub fn nkColorHsvaB(h: [*c]u8, s: [*c]u8, v: [*c]u8, a: [*c]u8, u: nk.Color) void {
return c.nk_color_hsva_b(h, s, v, a, u);
}
pub fn nkColorHsvaIv(hsva_out: [*c]c_int, u: nk.Color) void {
return c.nk_color_hsva_iv(hsva_out, u);
}
pub fn nkColorHsvaBv(hsva_out: [*c]u8, u: nk.Color) void {
return c.nk_color_hsva_bv(hsva_out, u);
}
pub fn nkColorHsvaF(out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32, out_a: [*c]f32, u: nk.Color) void {
return c.nk_color_hsva_f(out_h, out_s, out_v, out_a, u);
}
pub fn nkColorHsvaFv(hsva_out: [*c]f32, u: nk.Color) void {
return c.nk_color_hsva_fv(hsva_out, u);
}
//
pub fn nkHandlePtr(ptr: ?*c_void) nk.Handle {
return c.nk_handle_ptr(ptr);
}
pub fn nkHandleId(h: c_int) nk.Handle {
return c.nk_handle_id(h);
}
pub fn nkImageHandle(h: nk.Handle) nk.Image {
return c.nk_image_handle(h);
}
pub fn nkImagePtr(ptr: ?*c_void) nk.Image {
return c.nk_image_ptr(ptr);
}
pub fn nkImageId(_id: c_int) nk.Image {
return c.nk_image_id(_id);
}
pub fn nkImageIsSubimage(img: [*c]const nk.Image) bool {
return c.nk_image_is_subimage(img) != 0;
}
pub fn nkSubimagePtr(ptr: ?*c_void, w: c_ushort, h: c_ushort, sub_region: nk.Rect) nk.Image {
return c.nk_subimage_ptr(ptr, w, h, sub_region);
}
pub fn nkSubimageId(_id: c_int, w: c_ushort, h: c_ushort, sub_region: nk.Rect) nk.Image {
return c.nk_subimage_id(_id, w, h, sub_region);
}
pub fn nkSubimageHandle(h: nk.Handle, w: c_ushort, q: c_ushort, sub_region: nk.Rect) nk.Image {
return c.nk_subimage_handle(h, w, q, sub_region);
}
pub fn nkMurmurHash(key: []const u8, seed: nk.Hash) nk.Hash {
return c.nk_murmur_hash(nk.slice(key), seed);
}
pub fn nkTriangleFromDirection(result: [*c]nk.Vec2, r: nk.Rect, pad_x: f32, pad_y: f32, u: nk.Heading) void {
return c.nk_triangle_from_direction(result, r, pad_x, pad_y, u);
}
pub fn nkGetNullRect() nk.Rect {
return c.nk_get_null_rect();
}
//
pub fn nkFontDefaultGlyphRanges() [*c]const nk.Rune {
return c.nk_font_default_glyph_ranges();
}
pub fn nkFontChineseGlyphRanges() [*c]const nk.Rune {
return c.nk_font_chinese_glyph_ranges();
}
pub fn nkFontCyrillicGlyphRanges() [*c]const nk.Rune {
return c.nk_font_cyrillic_glyph_ranges();
}
pub fn nkFontKoreanGlyphRanges() [*c]const nk.Rune {
return c.nk_font_korean_glyph_ranges();
}
//
// pub fn nkFilterDefault(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_default(t, unicode) != 0;
// }
// pub fn nkFilterAscii(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_ascii(t, unicode) != 0;
// }
// pub fn nkFilterFloat(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_float(t, unicode) != 0;
// }
// pub fn nkFilterDecimal(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_decimal(t, unicode) != 0;
// }
// pub fn nkFilterHex(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_hex(t, unicode) != 0;
// }
// pub fn nkFilterOct(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_oct(t, unicode) != 0;
// }
// pub fn nkFilterBinary(t: [*c]const nk.TextEdit, unicode: nk.Rune) bool {
// return c.nk_filter_binary(t, unicode) != 0;
// }
//
pub fn nkFillRect(b: [*c]nk.CommandBuffer, r: nk.Rect, rounding: f32, u: nk.Color) void {
return c.nk_fill_rect(b, r, rounding, u);
}
pub fn nkFillRectMultiColor(b: [*c]nk.CommandBuffer, r: nk.Rect, left: nk.Color, top: nk.Color, right: nk.Color, bottom: nk.Color) void {
return c.nk_fill_rect_multi_color(b, r, left, top, right, bottom);
}
pub fn nkFillCircle(b: [*c]nk.CommandBuffer, r: nk.Rect, a: nk.Color) void {
return c.nk_fill_circle(b, r, a);
}
pub fn nkFillArc(b: [*c]nk.CommandBuffer, cx: f32, cy: f32, radius: f32, a_min: f32, a_max: f32, u: nk.Color) void {
return c.nk_fill_arc(b, cx, cy, radius, a_min, a_max, u);
}
pub fn nkFillTriangle(b: [*c]nk.CommandBuffer, x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32, u: nk.Color) void {
return c.nk_fill_triangle(b, x0, y0, x1, y1, x2, y2, u);
}
pub fn nkFillPolygon(b: [*c]nk.CommandBuffer, a: [*c]f32, point_count: c_int, u: nk.Color) void {
return c.nk_fill_polygon(b, a, point_count, u);
}
//
pub fn nkDrawImage(b: [*c]nk.CommandBuffer, r: nk.Rect, y: [*c]const nk.Image, a: nk.Color) void {
return c.nk_draw_image(b, r, y, a);
}
pub fn nkDrawText(b: [*c]nk.CommandBuffer, r: nk.Rect, t: []const u8, d: [*c]const nk.UserFont, y: nk.Color, q: nk.Color) void {
return c.nk_draw_text(b, r, nk.slice(t), d, y, q);
}
//
pub fn nkPushScissor(b: [*c]nk.CommandBuffer, r: nk.Rect) void {
return c.nk_push_scissor(b, r);
}
pub fn nkPushCustom(b: [*c]nk.CommandBuffer, r: nk.Rect, a: nk.CustomCallback, usr: nk.Handle) void {
return c.nk_push_custom(b, r, a, usr);
}
//
};
pub const Allocator = c.struct_nk_allocator;
pub const BufferAllocatorType = c.enum_nk_buffer_allocation_type;
pub const Buttons = c.nk_buttons;
pub const ChartType = c.enum_nk_chart_type;
pub const CollapseStates = c.nk_collapse_states;
pub const Color = c.struct_nk_color;
pub const Colorf = c.struct_nk_colorf;
pub const CommandBuffer = c.struct_nk_command_buffer;
pub const Context = c.struct_nk_context;
pub const ConvertConfig = c.struct_nk_convert_config;
pub const Cursor = c.struct_nk_cursor;
pub const CustomCallback = c.nk_command_custom_callback;
pub const DrawCommand = c.struct_nk_draw_command;
pub const DrawIndex = c.nk_draw_index;
pub const DrawNullTexture = c.struct_nk_draw_null_texture;
pub const DrawVertexLayoutElement = c.struct_nk_draw_vertex_layout_element;
pub const Filter = c.nk_plugin_filter;
pub const Flags = c.nk_flags;
pub const FontAtlas = c.struct_nk_font_atlas;
pub const Handle = c.nk_handle;
pub const Hash = c.nk_hash;
pub const Heading = c.enum_nk_heading;
pub const Image = c.struct_nk_image;
pub const Input = c.struct_nk_input;
pub const Keys = c.nk_keys;
pub const MemoryStatus = c.struct_nk_memory_status;
pub const PopupType = c.enum_nk_popup_type;
pub const Rect = c.struct_nk_rect;
pub const Rune = c.nk_rune;
pub const Scroll = c.struct_nk_scroll;
pub const Slice = c.struct_nk_slice;
pub const StyleButton = c.struct_nk_style_button;
pub const StyleCursor = c.enum_nk_style_cursor;
pub const StyleItem = c.struct_nk_style_item;
pub const UserFont = c.struct_nk_user_font;
pub const Vec2 = c.struct_nk_vec2;
pub const Window = c.struct_nk_window;
pub const Command = union(enum) {
scissor: *const c.struct_nk_command_scissor,
line: *const c.struct_nk_command_line,
curve: *const c.struct_nk_command_curve,
rect: *const c.struct_nk_command_rect,
rect_filled: *const c.struct_nk_command_rect_filled,
rect_multi_color: *const c.struct_nk_command_rect_multi_color,
circle: *const c.struct_nk_command_circle,
circle_filled: *const c.struct_nk_command_circle_filled,
arc: *const c.struct_nk_command_arc,
arc_filled: *const c.struct_nk_command_arc_filled,
triangle: *const c.struct_nk_command_triangle,
triangle_filled: *const c.struct_nk_command_triangle_filled,
polygon: *const c.struct_nk_command_polygon,
polygon_filled: *const c.struct_nk_command_polygon_filled,
polyline: *const c.struct_nk_command_polyline,
text: *const c.struct_nk_command_text,
image: *const c.struct_nk_command_image,
custom: *const c.struct_nk_command,
pub fn fromNuklear(cmd: *const c.struct_nk_command) Command {
switch (cmd.type) {
.NK_COMMAND_SCISSOR => return .{ .scissor = @ptrCast(*const c.struct_nk_command_scissor, cmd) },
.NK_COMMAND_LINE => return .{ .line = @ptrCast(*const c.struct_nk_command_line, cmd) },
.NK_COMMAND_CURVE => return .{ .curve = @ptrCast(*const c.struct_nk_command_curve, cmd) },
.NK_COMMAND_RECT => return .{ .rect = @ptrCast(*const c.struct_nk_command_rect, cmd) },
.NK_COMMAND_RECT_FILLED => return .{ .rect_filled = @ptrCast(*const c.struct_nk_command_rect_filled, cmd) },
.NK_COMMAND_RECT_MULTI_COLOR => return .{ .rect_multi_color = @ptrCast(*const c.struct_nk_command_rect_multi_color, cmd) },
.NK_COMMAND_CIRCLE => return .{ .circle = @ptrCast(*const c.struct_nk_command_circle, cmd) },
.NK_COMMAND_CIRCLE_FILLED => return .{ .circle_filled = @ptrCast(*const c.struct_nk_command_circle_filled, cmd) },
.NK_COMMAND_ARC => return .{ .arc = @ptrCast(*const c.struct_nk_command_arc, cmd) },
.NK_COMMAND_ARC_FILLED => return .{ .arc_filled = @ptrCast(*const c.struct_nk_command_arc_filled, cmd) },
.NK_COMMAND_TRIANGLE => return .{ .triangle = @ptrCast(*const c.struct_nk_command_triangle, cmd) },
.NK_COMMAND_TRIANGLE_FILLED => return .{ .triangle_filled = @ptrCast(*const c.struct_nk_command_triangle_filled, cmd) },
.NK_COMMAND_POLYGON => return .{ .polygon = @ptrCast(*const c.struct_nk_command_polygon, cmd) },
.NK_COMMAND_POLYGON_FILLED => return .{ .polygon_filled = @ptrCast(*const c.struct_nk_command_polygon_filled, cmd) },
.NK_COMMAND_POLYLINE => return .{ .polyline = @ptrCast(*const c.struct_nk_command_polyline, cmd) },
.NK_COMMAND_TEXT => return .{ .text = @ptrCast(*const c.struct_nk_command_text, cmd) },
.NK_COMMAND_IMAGE => return .{ .image = @ptrCast(*const c.struct_nk_command_image, cmd) },
.NK_COMMAND_CUSTOM => return .{ .custom = cmd },
.NK_COMMAND_NOP => unreachable,
else => unreachable,
}
}
};
pub const PanelFlags = struct {
title: ?[]const u8 = null,
border: bool = false,
moveable: bool = false,
scalable: bool = false,
closable: bool = false,
minimizable: bool = false,
scrollbar: bool = true,
scroll_auto_hide: bool = false,
background: bool = false,
input: bool = true,
pub fn toNuklear(flags: PanelFlags) nk.Flags {
return @intCast(nk.Flags, (if (flags.title) |_| c.NK_WINDOW_TITLE else 0) |
(if (flags.border) c.NK_WINDOW_BORDER else 0) |
(if (flags.moveable) c.NK_WINDOW_MOVABLE else 0) |
(if (flags.scalable) c.NK_WINDOW_SCALABLE else 0) |
(if (flags.closable) c.NK_WINDOW_CLOSABLE else 0) |
(if (flags.minimizable) c.NK_WINDOW_MINIMIZABLE else 0) |
(if (!flags.scrollbar) c.NK_WINDOW_NO_SCROLLBAR else 0) |
(if (flags.scroll_auto_hide) c.NK_WINDOW_SCROLL_AUTO_HIDE else 0) |
(if (flags.background) c.NK_WINDOW_BACKGROUND else 0) |
(if (!flags.input) c.NK_WINDOW_NO_INPUT else 0));
}
};
pub const SymbolType = enum(u8) {
none = c.NK_SYMBOL_NONE,
x = c.NK_SYMBOL_X,
underscore = c.NK_SYMBOL_UNDERSCORE,
circle_solid = c.NK_SYMBOL_CIRCLE_SOLID,
circle_outline = c.NK_SYMBOL_CIRCLE_OUTLINE,
rect_solid = c.NK_SYMBOL_RECT_SOLID,
rect_outline = c.NK_SYMBOL_RECT_OUTLINE,
triangle_up = c.NK_SYMBOL_TRIANGLE_UP,
triangle_down = c.NK_SYMBOL_TRIANGLE_DOWN,
triangle_left = c.NK_SYMBOL_TRIANGLE_LEFT,
triangle_right = c.NK_SYMBOL_TRIANGLE_RIGHT,
plus = c.NK_SYMBOL_PLUS,
minus = c.NK_SYMBOL_MINUS,
pub fn toNuklear(sym: SymbolType) c.enum_nk_symbol_type {
return @intToEnum(c.enum_nk_symbol_type, @enumToInt(sym));
}
};
pub const ScrollOffset = struct {
x: usize,
y: usize,
};
pub fn init(alloc: *mem.Allocator, font: ?*const UserFont) Context {
var res: Context = undefined;
const status = c.nk_init(&res, &allocator(alloc), font);
// init only returns `0` if we pass `null` as the allocator.
debug.assert(status != 0);
return res;
}
pub fn initFixed(buf: []u8, font: *const UserFont) Context {
var res: Context = undefined;
const status = c.nk_init_fixed(&res, buf.ptr, buf.len, font);
// init only returns `0` if we pass `null` as the buffer.
debug.assert(status != 0);
return res;
}
// pub fn initCustom(cmds: *Buffer, pool: *Buffer, font: Font) Context {}
pub fn clear(ctx: *Context) void {
c.nk_clear(ctx);
}
pub fn free(ctx: *Context) void {
c.nk_free(ctx);
}
pub fn iterator(ctx: *Context) Iterator {
return .{ .ctx = ctx };
}
pub const Iterator = struct {
ctx: *Context,
prev: ?*const c.struct_nk_command = null,
pub fn next(it: *Iterator) ?Command {
const res = (if (it.prev) |p|
c.nk__next(it.ctx, p)
else
c.nk__begin(it.ctx)) orelse return null;
defer it.prev = res;
return Command.fromNuklear(res);
}
};
pub fn slice(s: []const u8) Slice {
return .{
.ptr = s.ptr,
.len = s.len,
._pad = undefined,
};
}
pub fn rect(x: f32, y: f32, w: f32, h: f32) Rect {
return .{ .x = x, .y = y, .w = w, .h = h, ._pad = undefined };
}
pub fn vec2(x: f32, y: f32) Vec2 {
return .{ .x = x, .y = y, ._pad = undefined, ._pad2 = undefined };
}
pub fn rgb(r: u8, g: u8, b: u8) nk.Color {
return rgba(r, g, b, 255);
}
pub fn rgba(r: u8, g: u8, b: u8, a: u8) nk.Color {
return c.nk_rgba(r, g, b, a);
}
pub fn rgbf(r: f32, g: f32, b: f32) nk.Color {
return c.nk_rgb_f(r, g, b);
}
pub fn rgbaf(r: f32, g: f32, b: f32, a: f32) nk.Color {
return c.nk_rgba_f(r, g, b, a);
}
pub fn hsv(h: u8, s: u8, v: u8) nk.Color {
return hsva(h, s, v, 255);
}
pub fn hsva(h: u8, s: u8, v: u8, a: u8) nk.Color {
return c.nk_hsva(h, s, v, a);
}
pub fn hsvf(h: f32, s: f32, v: f32) nk.Color {
return c.nk_hsv_f(h, s, v);
}
pub fn hsvaf(h: f32, s: f32, v: f32, a: f32) nk.Color {
return c.nk_hsva_f(h, s, v, a);
}
pub fn colorToU32(y: nk.Color) u32 {
return @intCast(u32, c.nk_color_u32(y));
}
pub fn typeId(comptime T: type) usize {
_ = T;
// We generate a completly unique id by declaring a global variable `id` and taking
// the address of that variable.
const Id = struct {
var addr: u8 = 0;
};
return @ptrToInt(&Id.addr);
}
pub fn id(comptime T: type) [@sizeOf(usize)]u8 {
return @bitCast([@sizeOf(usize)]u8, typeId(T));
}
pub fn allocator(alloc: *mem.Allocator) Allocator {
return .{
.userdata = .{ .ptr = @ptrCast(*c_void, alloc) },
.alloc = heap.alloc,
.free = heap.free,
};
}
fn DiscardConst(comptime Ptr: type) type {
var info = @typeInfo(Ptr);
info.Pointer.is_const = false;
return @Type(info);
}
pub fn discardConst(ptr: anytype) DiscardConst(@TypeOf(ptr)) {
const Res = DiscardConst(@TypeOf(ptr));
switch (@typeInfo(Res).Pointer.size) {
.Slice => {
const res = discardConst(ptr.ptr);
return res[0..ptr.len];
},
else => return @intToPtr(Res, @ptrToInt(ptr)),
}
}
const heap = struct {
// Nuklears allocator interface does not send back and forth the size of the allocation.
// This is a problem, as zigs interface really wants you to pass back the size when
// reallocating and freeing. To solve this, we store the size in a header block that is
// stored in the memory before the pointer we return to nuklear.
const header_align = @alignOf(Header);
const header_size = @sizeOf(Header);
const Header = struct {
size: usize,
};
fn alloc(handle: Handle, m_old: ?*c_void, n: c.nk_size) callconv(.C) ?*c_void {
const al = alignPtrCast(*mem.Allocator, handle.ptr);
const res = if (@ptrCast(?[*]u8, m_old)) |old| blk: {
const old_with_header = old - header_size;
const header = alignPtrCast([*]Header, old_with_header)[0];
const old_mem = old_with_header[0 .. header_size + header.size];
if (al.resize(old_mem, n + header_size)) |resized| {
break :blk resized;
} else |_| {}
// Resize failed. Give the caller new memory instead
break :blk al.allocAdvanced(u8, header_align, n + header_size, .exact) catch
return null;
} else blk: {
break :blk al.allocAdvanced(u8, header_align, n + header_size, .exact) catch
return null;
};
// Store the size of the allocation in the extra memory we allocated, and return
// a pointer after the header.
alignPtrCast([*]Header, res.ptr)[0] = .{ .size = n };
return @ptrCast(*c_void, res[header_size..].ptr);
}
fn free(handle: Handle, m_old: ?*c_void) callconv(.C) void {
const old = @ptrCast(?[*]u8, m_old) orelse return;
const old_with_header = old - header_size;
const header = alignPtrCast([*]Header, old_with_header)[0];
const al = alignPtrCast(*mem.Allocator, handle.ptr);
al.free(old_with_header[0 .. header_size + header.size]);
}
fn alignPtrCast(comptime Ptr: type, ptr: anytype) Ptr {
return @ptrCast(Ptr, @alignCast(@typeInfo(Ptr).Pointer.alignment, ptr));
}
};
test {
std.testing.refAllDecls(@This());
}
test "initFixed" {
var font: UserFont = undefined;
var buf: [1024]u8 = undefined;
var ctx = &initFixed(&buf, &font);
defer free(ctx);
}
// test "Context.initCustom" {
// var ctx = Context.initCustom(&buf, null);
// defer ctx.free();
// }
// | nuklear.zig |
const regs = @import("rp2040_ras");
pub const SIO_GPIO = enum {
GPIO0,
GPIO1,
GPIO2,
GPIO3,
GPIO4,
GPIO5,
GPIO6,
GPIO7,
GPIO8,
GPIO9,
GPIO10,
GPIO11,
GPIO12,
GPIO13,
GPIO14,
GPIO15,
GPIO16,
GPIO17,
GPIO18,
GPIO19,
GPIO20,
GPIO21,
GPIO22,
GPIO23,
GPIO24,
GPIO25,
GPIO26,
GPIO27,
GPIO28,
GPIO29,
};
pub fn set_output_enable(gpio: SIO_GPIO) void {
switch (gpio) {
SIO_GPIO.GPIO0 => regs.SIO.GPIO_OE_SET.write_raw(1 << 0),
SIO_GPIO.GPIO1 => regs.SIO.GPIO_OE_SET.write_raw(1 << 1),
SIO_GPIO.GPIO2 => regs.SIO.GPIO_OE_SET.write_raw(1 << 2),
SIO_GPIO.GPIO3 => regs.SIO.GPIO_OE_SET.write_raw(1 << 3),
SIO_GPIO.GPIO4 => regs.SIO.GPIO_OE_SET.write_raw(1 << 4),
SIO_GPIO.GPIO5 => regs.SIO.GPIO_OE_SET.write_raw(1 << 5),
SIO_GPIO.GPIO6 => regs.SIO.GPIO_OE_SET.write_raw(1 << 6),
SIO_GPIO.GPIO7 => regs.SIO.GPIO_OE_SET.write_raw(1 << 7),
SIO_GPIO.GPIO8 => regs.SIO.GPIO_OE_SET.write_raw(1 << 8),
SIO_GPIO.GPIO9 => regs.SIO.GPIO_OE_SET.write_raw(1 << 9),
SIO_GPIO.GPIO10 => regs.SIO.GPIO_OE_SET.write_raw(1 << 10),
SIO_GPIO.GPIO11 => regs.SIO.GPIO_OE_SET.write_raw(1 << 11),
SIO_GPIO.GPIO12 => regs.SIO.GPIO_OE_SET.write_raw(1 << 12),
SIO_GPIO.GPIO13 => regs.SIO.GPIO_OE_SET.write_raw(1 << 13),
SIO_GPIO.GPIO14 => regs.SIO.GPIO_OE_SET.write_raw(1 << 14),
SIO_GPIO.GPIO15 => regs.SIO.GPIO_OE_SET.write_raw(1 << 15),
SIO_GPIO.GPIO16 => regs.SIO.GPIO_OE_SET.write_raw(1 << 16),
SIO_GPIO.GPIO17 => regs.SIO.GPIO_OE_SET.write_raw(1 << 17),
SIO_GPIO.GPIO18 => regs.SIO.GPIO_OE_SET.write_raw(1 << 18),
SIO_GPIO.GPIO19 => regs.SIO.GPIO_OE_SET.write_raw(1 << 19),
SIO_GPIO.GPIO20 => regs.SIO.GPIO_OE_SET.write_raw(1 << 20),
SIO_GPIO.GPIO21 => regs.SIO.GPIO_OE_SET.write_raw(1 << 21),
SIO_GPIO.GPIO22 => regs.SIO.GPIO_OE_SET.write_raw(1 << 22),
SIO_GPIO.GPIO23 => regs.SIO.GPIO_OE_SET.write_raw(1 << 23),
SIO_GPIO.GPIO24 => regs.SIO.GPIO_OE_SET.write_raw(1 << 24),
SIO_GPIO.GPIO25 => regs.SIO.GPIO_OE_SET.write_raw(1 << 25),
SIO_GPIO.GPIO26 => regs.SIO.GPIO_OE_SET.write_raw(1 << 26),
SIO_GPIO.GPIO27 => regs.SIO.GPIO_OE_SET.write_raw(1 << 27),
SIO_GPIO.GPIO28 => regs.SIO.GPIO_OE_SET.write_raw(1 << 28),
SIO_GPIO.GPIO29 => regs.SIO.GPIO_OE_SET.write_raw(1 << 29),
}
}
pub fn set_output(gpio: SIO_GPIO) void {
switch (gpio) {
SIO_GPIO.GPIO0 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 0),
SIO_GPIO.GPIO1 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 1),
SIO_GPIO.GPIO2 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 2),
SIO_GPIO.GPIO3 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 3),
SIO_GPIO.GPIO4 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 4),
SIO_GPIO.GPIO5 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 5),
SIO_GPIO.GPIO6 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 6),
SIO_GPIO.GPIO7 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 7),
SIO_GPIO.GPIO8 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 8),
SIO_GPIO.GPIO9 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 9),
SIO_GPIO.GPIO10 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 10),
SIO_GPIO.GPIO11 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 11),
SIO_GPIO.GPIO12 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 12),
SIO_GPIO.GPIO13 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 13),
SIO_GPIO.GPIO14 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 14),
SIO_GPIO.GPIO15 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 15),
SIO_GPIO.GPIO16 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 16),
SIO_GPIO.GPIO17 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 17),
SIO_GPIO.GPIO18 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 18),
SIO_GPIO.GPIO19 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 19),
SIO_GPIO.GPIO20 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 20),
SIO_GPIO.GPIO21 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 21),
SIO_GPIO.GPIO22 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 22),
SIO_GPIO.GPIO23 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 23),
SIO_GPIO.GPIO24 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 24),
SIO_GPIO.GPIO25 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 25),
SIO_GPIO.GPIO26 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 26),
SIO_GPIO.GPIO27 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 27),
SIO_GPIO.GPIO28 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 28),
SIO_GPIO.GPIO29 => regs.SIO.GPIO_OUT_SET.write_raw(1 << 29),
}
}
pub fn clear_output(gpio: SIO_GPIO) void {
switch (gpio) {
SIO_GPIO.GPIO0 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 0),
SIO_GPIO.GPIO1 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 1),
SIO_GPIO.GPIO2 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 2),
SIO_GPIO.GPIO3 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 3),
SIO_GPIO.GPIO4 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 4),
SIO_GPIO.GPIO5 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 5),
SIO_GPIO.GPIO6 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 6),
SIO_GPIO.GPIO7 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 7),
SIO_GPIO.GPIO8 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 8),
SIO_GPIO.GPIO9 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 9),
SIO_GPIO.GPIO10 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 10),
SIO_GPIO.GPIO11 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 11),
SIO_GPIO.GPIO12 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 12),
SIO_GPIO.GPIO13 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 13),
SIO_GPIO.GPIO14 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 14),
SIO_GPIO.GPIO15 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 15),
SIO_GPIO.GPIO16 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 16),
SIO_GPIO.GPIO17 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 17),
SIO_GPIO.GPIO18 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 18),
SIO_GPIO.GPIO19 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 19),
SIO_GPIO.GPIO20 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 20),
SIO_GPIO.GPIO21 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 21),
SIO_GPIO.GPIO22 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 22),
SIO_GPIO.GPIO23 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 23),
SIO_GPIO.GPIO24 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 24),
SIO_GPIO.GPIO25 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 25),
SIO_GPIO.GPIO26 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 26),
SIO_GPIO.GPIO27 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 27),
SIO_GPIO.GPIO28 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 28),
SIO_GPIO.GPIO29 => regs.SIO.GPIO_OUT_CLR.write_raw(1 << 29),
}
}
pub fn xor_output(gpio: SIO_GPIO) void {
switch (gpio) {
SIO_GPIO.GPIO0 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 0),
SIO_GPIO.GPIO1 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 1),
SIO_GPIO.GPIO2 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 2),
SIO_GPIO.GPIO3 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 3),
SIO_GPIO.GPIO4 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 4),
SIO_GPIO.GPIO5 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 5),
SIO_GPIO.GPIO6 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 6),
SIO_GPIO.GPIO7 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 7),
SIO_GPIO.GPIO8 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 8),
SIO_GPIO.GPIO9 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 9),
SIO_GPIO.GPIO10 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 10),
SIO_GPIO.GPIO11 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 11),
SIO_GPIO.GPIO12 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 12),
SIO_GPIO.GPIO13 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 13),
SIO_GPIO.GPIO14 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 14),
SIO_GPIO.GPIO15 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 15),
SIO_GPIO.GPIO16 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 16),
SIO_GPIO.GPIO17 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 17),
SIO_GPIO.GPIO18 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 18),
SIO_GPIO.GPIO19 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 19),
SIO_GPIO.GPIO20 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 20),
SIO_GPIO.GPIO21 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 21),
SIO_GPIO.GPIO22 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 22),
SIO_GPIO.GPIO23 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 23),
SIO_GPIO.GPIO24 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 24),
SIO_GPIO.GPIO25 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 25),
SIO_GPIO.GPIO26 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 26),
SIO_GPIO.GPIO27 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 27),
SIO_GPIO.GPIO28 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 28),
SIO_GPIO.GPIO29 => regs.SIO.GPIO_OUT_XOR.write_raw(1 << 29),
}
} | src/hal/sio.zig |
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const mem = std.mem;
const config = @import("config.zig");
const vsr = @import("vsr.zig");
const Header = vsr.Header;
comptime {
// message_size_max must be a multiple of sector_size for Direct I/O
assert(config.message_size_max % config.sector_size == 0);
}
/// Add an extra sector_size bytes to allow a partially received subsequent
/// message to be shifted to make space for 0 padding to vsr.sector_ceil.
const message_size_max_padded = config.message_size_max + config.sector_size;
/// The number of full-sized messages allocated at initialization by the replica message pool.
/// There must be enough messages to ensure that the replica can always progress, to avoid deadlock.
pub const messages_max_replica = messages_max: {
var sum: usize = 0;
sum += config.io_depth_read + config.io_depth_write; // Journal I/O
sum += config.clients_max; // Replica.client_table
sum += 1; // Replica.loopback_queue
sum += config.pipelining_max; // Replica.pipeline
sum += config.replicas_max; // Replica.do_view_change_from_all_replicas quorum (all others are bitsets)
sum += config.connections_max; // Connection.recv_message
sum += config.connections_max * config.connection_send_queue_max_replica; // Connection.send_queue
sum += 1; // Handle bursts (e.g. Connection.parse_message)
// Handle Replica.commit_op's reply:
// (This is separate from the burst +1 because they may occur concurrently).
sum += 1;
sum += 20; // TODO Our network simulator allows up to 20 messages for path_capacity_max.
break :messages_max sum;
};
/// The number of full-sized messages allocated at initialization by the client message pool.
pub const messages_max_client = messages_max: {
var sum: usize = 0;
sum += config.replicas_max; // Connection.recv_message
sum += config.replicas_max * config.connection_send_queue_max_client; // Connection.send_queue
sum += config.client_request_queue_max; // Client.request_queue
// Handle bursts (e.g. Connection.parse_message, or sending a ping when the send queue is full).
sum += 1;
sum += 20; // TODO Our network simulator allows up to 20 messages for path_capacity_max.
break :messages_max sum;
};
comptime {
// These conditions are necessary (but not sufficient) to prevent deadlocks.
assert(messages_max_replica > config.replicas_max);
assert(messages_max_client > config.client_request_queue_max);
}
/// A pool of reference-counted Messages, memory for which is allocated only once during
/// initialization and reused thereafter. The messages_max values determine the size of this pool.
pub const MessagePool = struct {
pub const Message = struct {
// TODO: replace this with a header() function to save memory
header: *Header,
/// This buffer is aligned to config.sector_size and casting to that alignment in order
/// to perform Direct I/O is safe.
buffer: []u8,
references: u32 = 0,
next: ?*Message,
/// Increment the reference count of the message and return the same pointer passed.
pub fn ref(message: *Message) *Message {
message.references += 1;
return message;
}
pub fn body(message: *Message) []u8 {
return message.buffer[@sizeOf(Header)..message.header.size];
}
};
/// List of currently unused messages of message_size_max_padded
free_list: ?*Message,
pub fn init(allocator: mem.Allocator, process_type: vsr.ProcessType) error{OutOfMemory}!MessagePool {
const messages_max: usize = switch (process_type) {
.replica => messages_max_replica,
.client => messages_max_client,
};
var ret: MessagePool = .{
.free_list = null,
};
{
var i: usize = 0;
while (i < messages_max) : (i += 1) {
const buffer = try allocator.allocAdvanced(
u8,
config.sector_size,
message_size_max_padded,
.exact,
);
const message = try allocator.create(Message);
message.* = .{
.header = mem.bytesAsValue(Header, buffer[0..@sizeOf(Header)]),
.buffer = buffer,
.next = ret.free_list,
};
ret.free_list = message;
}
}
return ret;
}
/// Get an unused message with a buffer of config.message_size_max.
/// The returned message has exactly one reference.
pub fn get_message(pool: *MessagePool) *Message {
const message = pool.free_list.?;
pool.free_list = message.next;
message.next = null;
assert(message.references == 0);
message.references = 1;
return message;
}
/// Decrement the reference count of the message, possibly freeing it.
pub fn unref(pool: *MessagePool, message: *Message) void {
message.references -= 1;
if (message.references == 0) {
if (builtin.mode == .Debug) mem.set(u8, message.buffer, undefined);
message.next = pool.free_list;
pool.free_list = message;
}
}
}; | src/message_pool.zig |
const std = @import("std");
const mem = std.mem;
const reserved_chars = &[_]u8{
'!', '#', '$', '%', '&', '\'',
'(', ')', '*', '+', ',', ':',
';', '=', '?', '@', '[', ']',
};
const reserved_escapes = blk: {
var escapes: [reserved_chars.len][3]u8 = [_][3]u8{[_]u8{undefined} ** 3} ** reserved_chars.len;
for (reserved_chars) |c, i| {
escapes[i][0] = '%';
_ = std.fmt.bufPrint(escapes[i][1..], "{X}", .{c}) catch unreachable;
}
break :blk &escapes;
};
/// Returns a URI from a path, caller owns the memory allocated with `allocator`
pub fn fromPath(allocator: *mem.Allocator, path: []const u8) ![]const u8 {
if (path.len == 0) return "";
const prefix = if (std.builtin.os.tag == .windows) "file:///" else "file://";
var buf = std.ArrayList(u8).init(allocator);
try buf.appendSlice(prefix);
for (path) |char| {
if (char == std.fs.path.sep) {
try buf.append('/');
} else if (mem.indexOfScalar(u8, reserved_chars, char)) |reserved| {
try buf.appendSlice(&reserved_escapes[reserved]);
} else {
try buf.append(char);
}
}
// On windows, we need to lowercase the drive name.
if (std.builtin.os.tag == .windows) {
if (buf.items.len > prefix.len + 1 and
std.ascii.isAlpha(buf.items[prefix.len]) and
mem.startsWith(u8, buf.items[prefix.len + 1 ..], "%3A"))
{
buf.items[prefix.len] = std.ascii.toLower(buf.items[prefix.len]);
}
}
return buf.toOwnedSlice();
}
/// Move along `rel` from `base` with a single allocation.
/// `base` is a URI of a folder, `rel` is a raw relative path.
pub fn pathRelative(allocator: *mem.Allocator, base: []const u8, rel: []const u8) ![]const u8 {
const max_size = base.len + rel.len * 3 + 1;
var result = try allocator.alloc(u8, max_size);
errdefer allocator.free(result);
mem.copy(u8, result, base);
var result_index: usize = base.len;
var it = mem.tokenize(u8, rel, "/");
while (it.next()) |component| {
if (mem.eql(u8, component, ".")) {
continue;
} else if (mem.eql(u8, component, "..")) {
while (true) {
if (result_index == 0)
return error.UriBadScheme;
result_index -= 1;
if (result[result_index] == '/')
break;
}
} else {
result[result_index] = '/';
result_index += 1;
for (component) |char| {
if (mem.indexOfScalar(u8, reserved_chars, char)) |reserved| {
const escape = &reserved_escapes[reserved];
mem.copy(u8, result[result_index..], escape);
result_index += escape.len;
} else {
result[result_index] = char;
result_index += 1;
}
}
}
}
return allocator.resize(result, result_index);
}
pub const UriParseError = error{
UriBadScheme,
UriBadHexChar,
UriBadEscape,
OutOfMemory,
};
// Original code: https://github.com/andersfr/zig-lsp/blob/master/uri.zig
fn parseHex(c: u8) !u8 {
return switch (c) {
'0'...'9' => c - '0',
'a'...'f' => c - 'a' + 10,
'A'...'F' => c - 'A' + 10,
else => return error.UriBadHexChar,
};
}
/// Caller should free memory
pub fn parse(allocator: *mem.Allocator, str: []const u8) ![]u8 {
if (str.len < 7 or !mem.eql(u8, "file://", str[0..7])) return error.UriBadScheme;
const uri = try allocator.alloc(u8, str.len - (if (std.fs.path.sep == '\\') 8 else 7));
errdefer allocator.free(uri);
const path = if (std.fs.path.sep == '\\') str[8..] else str[7..];
var i: usize = 0;
var j: usize = 0;
while (j < path.len) : (i += 1) {
if (path[j] == '%') {
if (j + 2 >= path.len) return error.UriBadEscape;
const upper = try parseHex(path[j + 1]);
const lower = try parseHex(path[j + 2]);
uri[i] = (upper << 4) + lower;
j += 3;
} else {
uri[i] = if (path[j] == '/') std.fs.path.sep else path[j];
j += 1;
}
}
// Remove trailing separator
if (i > 0 and uri[i - 1] == std.fs.path.sep) {
i -= 1;
}
return allocator.shrink(uri, i);
} | src/uri.zig |
const std = @import("std");
const DocumentStore = @import("./DocumentStore.zig");
const Ast = std.zig.Ast;
const types = @import("./types.zig");
const offsets = @import("./offsets.zig");
const log = std.log.scoped(.analysis);
const ast = @import("./ast.zig");
var using_trail: std.ArrayList([*]const u8) = undefined;
var resolve_trail: std.ArrayList(NodeWithHandle) = undefined;
pub fn init(allocator: std.mem.Allocator) void {
using_trail = std.ArrayList([*]const u8).init(allocator);
resolve_trail = std.ArrayList(NodeWithHandle).init(allocator);
}
pub fn deinit() void {
using_trail.deinit();
resolve_trail.deinit();
}
/// Gets a declaration's doc comments. Caller owns returned memory.
pub fn getDocComments(allocator: std.mem.Allocator, tree: Ast, node: Ast.Node.Index, format: types.MarkupContent.Kind) !?[]const u8 {
const base = tree.nodes.items(.main_token)[node];
const base_kind = tree.nodes.items(.tag)[node];
const tokens = tree.tokens.items(.tag);
switch (base_kind) {
// As far as I know, this does not actually happen yet, but it
// may come in useful.
.root => return try collectDocComments(allocator, tree, 0, format, true),
.fn_proto,
.fn_proto_one,
.fn_proto_simple,
.fn_proto_multi,
.fn_decl,
.local_var_decl,
.global_var_decl,
.aligned_var_decl,
.simple_var_decl,
.container_field_init,
=> {
if (getDocCommentTokenIndex(tokens, base)) |doc_comment_index|
return try collectDocComments(allocator, tree, doc_comment_index, format, false);
},
else => {},
}
return null;
}
/// Get the first doc comment of a declaration.
pub fn getDocCommentTokenIndex(tokens: []std.zig.Token.Tag, base_token: Ast.TokenIndex) ?Ast.TokenIndex {
var idx = base_token;
if (idx == 0) return null;
idx -= 1;
if (tokens[idx] == .keyword_threadlocal and idx > 0) idx -= 1;
if (tokens[idx] == .string_literal and idx > 1 and tokens[idx - 1] == .keyword_extern) idx -= 1;
if (tokens[idx] == .keyword_extern and idx > 0) idx -= 1;
if (tokens[idx] == .keyword_export and idx > 0) idx -= 1;
if (tokens[idx] == .keyword_inline and idx > 0) idx -= 1;
if (tokens[idx] == .keyword_pub and idx > 0) idx -= 1;
// Find first doc comment token
if (!(tokens[idx] == .doc_comment))
return null;
return while (tokens[idx] == .doc_comment) {
if (idx == 0) break 0;
idx -= 1;
} else idx + 1;
}
pub fn collectDocComments(allocator: std.mem.Allocator, tree: Ast, doc_comments: Ast.TokenIndex, format: types.MarkupContent.Kind, container_doc: bool) ![]const u8 {
var lines = std.ArrayList([]const u8).init(allocator);
defer lines.deinit();
const tokens = tree.tokens.items(.tag);
var curr_line_tok = doc_comments;
while (true) : (curr_line_tok += 1) {
const comm = tokens[curr_line_tok];
if ((container_doc and comm == .container_doc_comment) or (!container_doc and comm == .doc_comment)) {
try lines.append(std.mem.trim(u8, tree.tokenSlice(curr_line_tok)[3..], &std.ascii.spaces));
} else break;
}
return try std.mem.join(allocator, if (format == .Markdown) " \n" else "\n", lines.items);
}
/// Gets a function's keyword, name, arguments and return value.
pub fn getFunctionSignature(tree: Ast, func: Ast.full.FnProto) []const u8 {
const start = offsets.tokenLocation(tree, func.ast.fn_token);
const end = if (func.ast.return_type != 0)
offsets.tokenLocation(tree, ast.lastToken(tree, func.ast.return_type))
else
start;
return tree.source[start.start..end.end];
}
/// Creates snippet insert text for a function. Caller owns returned memory.
pub fn getFunctionSnippet(allocator: std.mem.Allocator, tree: Ast, func: Ast.full.FnProto, skip_self_param: bool) ![]const u8 {
const name_index = func.name_token.?;
var buffer = std.ArrayList(u8).init(allocator);
try buffer.ensureTotalCapacity(128);
try buffer.appendSlice(tree.tokenSlice(name_index));
try buffer.append('(');
var buf_stream = buffer.writer();
const token_tags = tree.tokens.items(.tag);
var it = func.iterate(&tree);
var i: usize = 0;
while (it.next()) |param| : (i += 1) {
if (skip_self_param and i == 0) continue;
if (i != @boolToInt(skip_self_param))
try buffer.appendSlice(", ${")
else
try buffer.appendSlice("${");
try buf_stream.print("{d}:", .{i + 1});
if (param.comptime_noalias) |token_index| {
if (token_tags[token_index] == .keyword_comptime)
try buffer.appendSlice("comptime ")
else
try buffer.appendSlice("noalias ");
}
if (param.name_token) |name_token| {
try buffer.appendSlice(tree.tokenSlice(name_token));
try buffer.appendSlice(": ");
}
if (param.anytype_ellipsis3) |token_index| {
if (token_tags[token_index] == .keyword_anytype)
try buffer.appendSlice("anytype")
else
try buffer.appendSlice("...");
} else if (param.type_expr != 0) {
var curr_token = tree.firstToken(param.type_expr);
var end_token = ast.lastToken(tree, param.type_expr);
while (curr_token <= end_token) : (curr_token += 1) {
const tag = token_tags[curr_token];
const is_comma = tag == .comma;
if (curr_token == end_token and is_comma) continue;
try buffer.appendSlice(tree.tokenSlice(curr_token));
if (is_comma or tag == .keyword_const) try buffer.append(' ');
}
} else unreachable;
try buffer.append('}');
}
try buffer.append(')');
return buffer.toOwnedSlice();
}
pub fn hasSelfParam(arena: *std.heap.ArenaAllocator, document_store: *DocumentStore, handle: *DocumentStore.Handle, func: Ast.full.FnProto) !bool {
// Non-decl prototypes cannot have a self parameter.
if (func.name_token == null) return false;
if (func.ast.params.len == 0) return false;
const tree = handle.tree;
var it = func.iterate(&tree);
const param = it.next().?;
if (param.type_expr == 0) return false;
const token_starts = tree.tokens.items(.start);
const token_data = tree.nodes.items(.data);
const in_container = innermostContainer(handle, token_starts[func.ast.fn_token]);
if (try resolveTypeOfNode(document_store, arena, .{
.node = param.type_expr,
.handle = handle,
})) |resolved_type| {
if (std.meta.eql(in_container, resolved_type))
return true;
}
if (isPtrType(tree, param.type_expr)) {
if (try resolveTypeOfNode(document_store, arena, .{
.node = token_data[param.type_expr].rhs,
.handle = handle,
})) |resolved_prefix_op| {
if (std.meta.eql(in_container, resolved_prefix_op))
return true;
}
}
return false;
}
pub fn getVariableSignature(tree: Ast, var_decl: Ast.full.VarDecl) []const u8 {
const start = offsets.tokenLocation(tree, var_decl.ast.mut_token).start;
const end = offsets.tokenLocation(tree, ast.lastToken(tree, var_decl.ast.init_node)).end;
return tree.source[start..end];
}
pub fn getContainerFieldSignature(tree: Ast, field: Ast.full.ContainerField) []const u8 {
const start = offsets.tokenLocation(tree, field.ast.name_token).start;
const end_node = if (field.ast.value_expr != 0) field.ast.value_expr else field.ast.type_expr;
const end = offsets.tokenLocation(tree, ast.lastToken(tree, end_node)).end;
return tree.source[start..end];
}
/// The node is the meta-type `type`
fn isMetaType(tree: Ast, node: Ast.Node.Index) bool {
if (tree.nodes.items(.tag)[node] == .identifier) {
return std.mem.eql(u8, tree.tokenSlice(tree.nodes.items(.main_token)[node]), "type");
}
return false;
}
pub fn isTypeFunction(tree: Ast, func: Ast.full.FnProto) bool {
return isMetaType(tree, func.ast.return_type);
}
pub fn isGenericFunction(tree: Ast, func: Ast.full.FnProto) bool {
var it = func.iterate(&tree);
while (it.next()) |param| {
if (param.anytype_ellipsis3 != null or param.comptime_noalias != null) {
return true;
}
}
return false;
}
// STYLE
pub fn isCamelCase(name: []const u8) bool {
return !std.ascii.isUpper(name[0]) and !isSnakeCase(name);
}
pub fn isPascalCase(name: []const u8) bool {
return std.ascii.isUpper(name[0]) and !isSnakeCase(name);
}
pub fn isSnakeCase(name: []const u8) bool {
return std.mem.indexOf(u8, name, "_") != null;
}
// ANALYSIS ENGINE
pub fn getDeclNameToken(tree: Ast, node: Ast.Node.Index) ?Ast.TokenIndex {
const tags = tree.nodes.items(.tag);
const main_token = tree.nodes.items(.main_token)[node];
return switch (tags[node]) {
// regular declaration names. + 1 to mut token because name comes after 'const'/'var'
.local_var_decl => tree.localVarDecl(node).ast.mut_token + 1,
.global_var_decl => tree.globalVarDecl(node).ast.mut_token + 1,
.simple_var_decl => tree.simpleVarDecl(node).ast.mut_token + 1,
.aligned_var_decl => tree.alignedVarDecl(node).ast.mut_token + 1,
// function declaration names
.fn_proto,
.fn_proto_multi,
.fn_proto_one,
.fn_proto_simple,
.fn_decl,
=> blk: {
var params: [1]Ast.Node.Index = undefined;
break :blk ast.fnProto(tree, node, ¶ms).?.name_token;
},
// containers
.container_field => tree.containerField(node).ast.name_token,
.container_field_init => tree.containerFieldInit(node).ast.name_token,
.container_field_align => tree.containerFieldAlign(node).ast.name_token,
.identifier => main_token,
.error_value => main_token + 2, // 'error'.<main_token +2>
// lhs of main token is name token, so use `node` - 1
.test_decl => if (tree.tokens.items(.tag)[main_token + 1] == .string_literal)
return main_token + 1
else
null,
else => null,
};
}
fn getDeclName(tree: Ast, node: Ast.Node.Index) ?[]const u8 {
const name = tree.tokenSlice(getDeclNameToken(tree, node) orelse return null);
return switch (tree.nodes.items(.tag)[node]) {
.test_decl => name[1 .. name.len - 1],
else => name,
};
}
fn isContainerDecl(decl_handle: DeclWithHandle) bool {
return switch (decl_handle.decl.*) {
.ast_node => |inner_node| ast.isContainer(decl_handle.handle.tree.nodes.items(.tag)[inner_node]),
else => false,
};
}
fn resolveVarDeclAliasInternal(store: *DocumentStore, arena: *std.heap.ArenaAllocator, node_handle: NodeWithHandle, root: bool) error{OutOfMemory}!?DeclWithHandle {
_ = root;
const handle = node_handle.handle;
const tree = handle.tree;
const node_tags = tree.nodes.items(.tag);
const main_tokens = tree.nodes.items(.main_token);
const datas = tree.nodes.items(.data);
if (node_tags[node_handle.node] == .identifier) {
const token = main_tokens[node_handle.node];
return try lookupSymbolGlobal(
store,
arena,
handle,
tree.tokenSlice(token),
tree.tokens.items(.start)[token],
);
}
if (node_tags[node_handle.node] == .field_access) {
const lhs = datas[node_handle.node].lhs;
const container_node = if (ast.isBuiltinCall(tree, lhs)) block: {
if (!std.mem.eql(u8, tree.tokenSlice(main_tokens[lhs]), "@import"))
return null;
const inner_node = (try resolveTypeOfNode(store, arena, .{ .node = lhs, .handle = handle })) orelse return null;
// assert root node
std.debug.assert(inner_node.type.data.other == 0);
break :block NodeWithHandle{ .node = inner_node.type.data.other, .handle = inner_node.handle };
} else if (try resolveVarDeclAliasInternal(store, arena, .{ .node = lhs, .handle = handle }, false)) |decl_handle| block: {
if (decl_handle.decl.* != .ast_node) return null;
const resolved = (try resolveTypeOfNode(store, arena, .{ .node = decl_handle.decl.ast_node, .handle = decl_handle.handle })) orelse return null;
const resolved_node = switch (resolved.type.data) {
.other => |n| n,
else => return null,
};
if (!ast.isContainer(resolved.handle.tree, resolved_node)) return null;
break :block NodeWithHandle{ .node = resolved_node, .handle = resolved.handle };
} else return null;
return try lookupSymbolContainer(store, arena, container_node, tree.tokenSlice(datas[node_handle.node].rhs), false);
}
return null;
}
/// Resolves variable declarations consisting of chains of imports and field accesses of containers, ending with the same name as the variable decl's name
/// Examples:
///```zig
/// const decl = @import("decl-file.zig").decl;
/// const other = decl.middle.other;
///```
pub fn resolveVarDeclAlias(store: *DocumentStore, arena: *std.heap.ArenaAllocator, decl_handle: NodeWithHandle) !?DeclWithHandle {
const decl = decl_handle.node;
const handle = decl_handle.handle;
const tree = handle.tree;
const token_tags = tree.tokens.items(.tag);
const node_tags = tree.nodes.items(.tag);
if (ast.varDecl(handle.tree, decl)) |var_decl| {
if (var_decl.ast.init_node == 0) return null;
const base_exp = var_decl.ast.init_node;
if (token_tags[var_decl.ast.mut_token] != .keyword_const) return null;
if (node_tags[base_exp] == .field_access) {
const name = tree.tokenSlice(tree.nodes.items(.data)[base_exp].rhs);
if (!std.mem.eql(u8, tree.tokenSlice(var_decl.ast.mut_token + 1), name))
return null;
return try resolveVarDeclAliasInternal(store, arena, .{ .node = base_exp, .handle = handle }, true);
}
}
return null;
}
fn isBlock(tree: Ast, node: Ast.Node.Index) bool {
return switch (tree.nodes.items(.tag)[node]) {
.block,
.block_semicolon,
.block_two,
.block_two_semicolon,
=> true,
else => false,
};
}
fn findReturnStatementInternal(tree: Ast, fn_decl: Ast.full.FnProto, body: Ast.Node.Index, already_found: *bool) ?Ast.Node.Index {
var result: ?Ast.Node.Index = null;
const node_tags = tree.nodes.items(.tag);
const datas = tree.nodes.items(.data);
if (!isBlock(tree, body)) return null;
const statements: []const Ast.Node.Index = switch (node_tags[body]) {
.block, .block_semicolon => tree.extra_data[datas[body].lhs..datas[body].rhs],
.block_two, .block_two_semicolon => blk: {
const statements = &[_]Ast.Node.Index{ datas[body].lhs, datas[body].rhs };
const len: usize = if (datas[body].lhs == 0)
@as(usize, 0)
else if (datas[body].rhs == 0)
@as(usize, 1)
else
@as(usize, 2);
break :blk statements[0..len];
},
else => unreachable,
};
for (statements) |child_idx| {
if (node_tags[child_idx] == .@"return") {
if (datas[child_idx].lhs != 0) {
const lhs = datas[child_idx].lhs;
if (ast.isCall(tree, lhs)) {
const call_name = getDeclName(tree, datas[lhs].lhs);
if (call_name) |name| {
if (std.mem.eql(u8, name, tree.tokenSlice(fn_decl.name_token.?))) {
continue;
}
}
}
}
if (already_found.*) return null;
already_found.* = true;
result = child_idx;
continue;
}
result = findReturnStatementInternal(tree, fn_decl, child_idx, already_found);
}
return result;
}
fn findReturnStatement(tree: Ast, fn_decl: Ast.full.FnProto, body: Ast.Node.Index) ?Ast.Node.Index {
var already_found = false;
return findReturnStatementInternal(tree, fn_decl, body, &already_found);
}
pub fn resolveReturnType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, fn_decl: Ast.full.FnProto, handle: *DocumentStore.Handle, bound_type_params: *BoundTypeParams, fn_body: ?Ast.Node.Index) !?TypeWithHandle {
const tree = handle.tree;
if (isTypeFunction(tree, fn_decl) and fn_body != null) {
// If this is a type function and it only contains a single return statement that returns
// a container declaration, we will return that declaration.
const ret = findReturnStatement(tree, fn_decl, fn_body.?) orelse return null;
const data = tree.nodes.items(.data)[ret];
if (data.lhs != 0) {
return try resolveTypeOfNodeInternal(store, arena, .{
.node = data.lhs,
.handle = handle,
}, bound_type_params);
}
return null;
}
if (fn_decl.ast.return_type == 0) return null;
const return_type = fn_decl.ast.return_type;
const ret = .{ .node = return_type, .handle = handle };
const child_type = (try resolveTypeOfNodeInternal(store, arena, ret, bound_type_params)) orelse
return null;
const is_inferred_error = tree.tokens.items(.tag)[tree.firstToken(return_type) - 1] == .bang;
if (is_inferred_error) {
const child_type_node = switch (child_type.type.data) {
.other => |n| n,
else => return null,
};
return TypeWithHandle{
.type = .{ .data = .{ .error_union = child_type_node }, .is_type_val = false },
.handle = child_type.handle,
};
} else return child_type.instanceTypeVal();
}
/// Resolves the child type of an optional type
fn resolveUnwrapOptionalType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, opt: TypeWithHandle, bound_type_params: *BoundTypeParams) !?TypeWithHandle {
const opt_node = switch (opt.type.data) {
.other => |n| n,
else => return null,
};
if (opt.handle.tree.nodes.items(.tag)[opt_node] == .optional_type) {
return ((try resolveTypeOfNodeInternal(store, arena, .{
.node = opt.handle.tree.nodes.items(.data)[opt_node].lhs,
.handle = opt.handle,
}, bound_type_params)) orelse return null).instanceTypeVal();
}
return null;
}
fn resolveUnwrapErrorType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, rhs: TypeWithHandle, bound_type_params: *BoundTypeParams) !?TypeWithHandle {
const rhs_node = switch (rhs.type.data) {
.other => |n| n,
.error_union => |n| return TypeWithHandle{
.type = .{ .data = .{ .other = n }, .is_type_val = rhs.type.is_type_val },
.handle = rhs.handle,
},
.primitive, .slice, .pointer => return null,
};
if (rhs.handle.tree.nodes.items(.tag)[rhs_node] == .error_union) {
return ((try resolveTypeOfNodeInternal(store, arena, .{
.node = rhs.handle.tree.nodes.items(.data)[rhs_node].rhs,
.handle = rhs.handle,
}, bound_type_params)) orelse return null).instanceTypeVal();
}
return null;
}
pub fn isPtrType(tree: Ast, node: Ast.Node.Index) bool {
return switch (tree.nodes.items(.tag)[node]) {
.ptr_type,
.ptr_type_aligned,
.ptr_type_bit_range,
.ptr_type_sentinel,
=> true,
else => false,
};
}
/// Resolves the child type of a deref type
fn resolveDerefType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, deref: TypeWithHandle, bound_type_params: *BoundTypeParams) !?TypeWithHandle {
const deref_node = switch (deref.type.data) {
.other => |n| n,
.pointer => |n| return TypeWithHandle{
.type = .{
.is_type_val = false,
.data = .{ .other = n },
},
.handle = deref.handle,
},
else => return null,
};
const tree = deref.handle.tree;
const main_token = tree.nodes.items(.main_token)[deref_node];
const token_tag = tree.tokens.items(.tag)[main_token];
if (isPtrType(tree, deref_node)) {
const ptr_type = ast.ptrType(tree, deref_node).?;
switch (token_tag) {
.asterisk => {
return ((try resolveTypeOfNodeInternal(store, arena, .{
.node = ptr_type.ast.child_type,
.handle = deref.handle,
}, bound_type_params)) orelse return null).instanceTypeVal();
},
.l_bracket, .asterisk_asterisk => return null,
else => unreachable,
}
}
return null;
}
/// Resolves slicing and array access
fn resolveBracketAccessType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, lhs: TypeWithHandle, rhs: enum { Single, Range }, bound_type_params: *BoundTypeParams) !?TypeWithHandle {
const lhs_node = switch (lhs.type.data) {
.other => |n| n,
else => return null,
};
const tree = lhs.handle.tree;
const tags = tree.nodes.items(.tag);
const tag = tags[lhs_node];
const data = tree.nodes.items(.data)[lhs_node];
if (tag == .array_type or tag == .array_type_sentinel) {
if (rhs == .Single)
return ((try resolveTypeOfNodeInternal(store, arena, .{
.node = data.rhs,
.handle = lhs.handle,
}, bound_type_params)) orelse return null).instanceTypeVal();
return TypeWithHandle{
.type = .{ .data = .{ .slice = data.rhs }, .is_type_val = false },
.handle = lhs.handle,
};
} else if (ast.ptrType(tree, lhs_node)) |ptr_type| {
if (ptr_type.size == .Slice) {
if (rhs == .Single) {
return ((try resolveTypeOfNodeInternal(store, arena, .{
.node = ptr_type.ast.child_type,
.handle = lhs.handle,
}, bound_type_params)) orelse return null).instanceTypeVal();
}
return lhs;
}
}
return null;
}
/// Called to remove one level of pointerness before a field access
pub fn resolveFieldAccessLhsType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, lhs: TypeWithHandle, bound_type_params: *BoundTypeParams) !TypeWithHandle {
return (try resolveDerefType(store, arena, lhs, bound_type_params)) orelse lhs;
}
pub const BoundTypeParams = std.AutoHashMap(Ast.full.FnProto.Param, TypeWithHandle);
fn allDigits(str: []const u8) bool {
for (str) |c| {
if (!std.ascii.isDigit(c)) return false;
}
return true;
}
pub fn isTypeIdent(tree: Ast, token_idx: Ast.TokenIndex) bool {
const PrimitiveTypes = std.ComptimeStringMap(void, .{
.{"isize"}, .{"usize"},
.{"c_short"}, .{"c_ushort"},
.{"c_int"}, .{"c_uint"},
.{"c_long"}, .{"c_ulong"},
.{"c_longlong"}, .{"c_ulonglong"},
.{"c_longdouble"}, .{"anyopaque"},
.{"f16"}, .{"f32"},
.{"f64"}, .{"f128"},
.{"bool"}, .{"void"},
.{"noreturn"}, .{"type"},
.{"anyerror"}, .{"comptime_int"},
.{"comptime_float"}, .{"anyframe"},
.{"anytype"},
});
const text = tree.tokenSlice(token_idx);
if (PrimitiveTypes.has(text)) return true;
if (text.len == 1) return false;
if (!(text[0] == 'u' or text[0] == 'i')) return false;
if (!allDigits(text[1..])) return false;
_ = std.fmt.parseUnsigned(u16, text[1..], 10) catch return false;
return true;
}
/// Resolves the type of a node
pub fn resolveTypeOfNodeInternal(store: *DocumentStore, arena: *std.heap.ArenaAllocator, node_handle: NodeWithHandle, bound_type_params: *BoundTypeParams) error{OutOfMemory}!?TypeWithHandle {
// If we were asked to resolve this node before,
// it is self-referential and we cannot resolve it.
for (resolve_trail.items) |i| {
if (std.meta.eql(i, node_handle))
return null;
}
try resolve_trail.append(node_handle);
defer _ = resolve_trail.pop();
const node = node_handle.node;
const handle = node_handle.handle;
const tree = handle.tree;
const main_tokens = tree.nodes.items(.main_token);
const node_tags = tree.nodes.items(.tag);
const datas = tree.nodes.items(.data);
const token_tags = tree.tokens.items(.tag);
const starts = tree.tokens.items(.start);
switch (node_tags[node]) {
.global_var_decl,
.local_var_decl,
.simple_var_decl,
.aligned_var_decl,
=> {
const var_decl = ast.varDecl(tree, node).?;
if (var_decl.ast.type_node != 0) {
const decl_type = .{ .node = var_decl.ast.type_node, .handle = handle };
if (try resolveTypeOfNodeInternal(store, arena, decl_type, bound_type_params)) |typ|
return typ.instanceTypeVal();
}
if (var_decl.ast.init_node == 0)
return null;
const value = .{ .node = var_decl.ast.init_node, .handle = handle };
return try resolveTypeOfNodeInternal(store, arena, value, bound_type_params);
},
.identifier => {
if (isTypeIdent(handle.tree, main_tokens[node])) {
return TypeWithHandle{
.type = .{ .data = .primitive, .is_type_val = true },
.handle = handle,
};
}
if (try lookupSymbolGlobal(
store,
arena,
handle,
tree.getNodeSource(node),
starts[main_tokens[node]],
)) |child| {
switch (child.decl.*) {
.ast_node => |n| {
if (n == node) return null;
if (ast.varDecl(child.handle.tree, n)) |var_decl| {
if (var_decl.ast.init_node == node)
return null;
}
},
else => {},
}
return try child.resolveType(store, arena, bound_type_params);
}
return null;
},
.call,
.call_comma,
.async_call,
.async_call_comma,
.call_one,
.call_one_comma,
.async_call_one,
.async_call_one_comma,
=> {
var params: [1]Ast.Node.Index = undefined;
const call = ast.callFull(tree, node, ¶ms) orelse unreachable;
const callee = .{ .node = call.ast.fn_expr, .handle = handle };
const decl = (try resolveTypeOfNodeInternal(store, arena, callee, bound_type_params)) orelse
return null;
if (decl.type.is_type_val) return null;
const decl_node = switch (decl.type.data) {
.other => |n| n,
else => return null,
};
var buf: [1]Ast.Node.Index = undefined;
const func_maybe = ast.fnProto(decl.handle.tree, decl_node, &buf);
if (func_maybe) |fn_decl| {
var expected_params = fn_decl.ast.params.len;
// If we call as method, the first parameter should be skipped
// TODO: Back-parse to extract the self argument?
var it = fn_decl.iterate(&decl.handle.tree);
if (token_tags[call.ast.lparen - 2] == .period) {
if (try hasSelfParam(arena, store, decl.handle, fn_decl)) {
_ = it.next();
expected_params -= 1;
}
}
// Bind type params to the arguments passed in the call.
const param_len = std.math.min(call.ast.params.len, expected_params);
var i: usize = 0;
while (it.next()) |decl_param| : (i += 1) {
if (i >= param_len) break;
if (!isMetaType(decl.handle.tree, decl_param.type_expr))
continue;
const argument = .{ .node = call.ast.params[i], .handle = handle };
const argument_type = (try resolveTypeOfNodeInternal(
store,
arena,
argument,
bound_type_params,
)) orelse
continue;
if (!argument_type.type.is_type_val) continue;
_ = try bound_type_params.put(decl_param, argument_type);
}
const has_body = decl.handle.tree.nodes.items(.tag)[decl_node] == .fn_decl;
const body = decl.handle.tree.nodes.items(.data)[decl_node].rhs;
return try resolveReturnType(store, arena, fn_decl, decl.handle, bound_type_params, if (has_body) body else null);
}
return null;
},
.@"comptime",
.@"nosuspend",
.grouped_expression,
.container_field,
.container_field_init,
.container_field_align,
.struct_init,
.struct_init_comma,
.struct_init_one,
.struct_init_one_comma,
.slice,
.slice_sentinel,
.slice_open,
.deref,
.unwrap_optional,
.array_access,
.@"orelse",
.@"catch",
.@"try",
.address_of,
=> {
const base = .{ .node = datas[node].lhs, .handle = handle };
const base_type = (try resolveTypeOfNodeInternal(store, arena, base, bound_type_params)) orelse
return null;
return switch (node_tags[node]) {
.@"comptime",
.@"nosuspend",
.grouped_expression,
=> base_type,
.container_field,
.container_field_init,
.container_field_align,
.struct_init,
.struct_init_comma,
.struct_init_one,
.struct_init_one_comma,
=> base_type.instanceTypeVal(),
.slice,
.slice_sentinel,
.slice_open,
=> try resolveBracketAccessType(store, arena, base_type, .Range, bound_type_params),
.deref => try resolveDerefType(store, arena, base_type, bound_type_params),
.unwrap_optional => try resolveUnwrapOptionalType(store, arena, base_type, bound_type_params),
.array_access => try resolveBracketAccessType(store, arena, base_type, .Single, bound_type_params),
.@"orelse" => try resolveUnwrapOptionalType(store, arena, base_type, bound_type_params),
.@"catch" => try resolveUnwrapErrorType(store, arena, base_type, bound_type_params),
.@"try" => try resolveUnwrapErrorType(store, arena, base_type, bound_type_params),
.address_of => {
const lhs_node = switch (base_type.type.data) {
.other => |n| n,
else => return null,
};
return TypeWithHandle{
.type = .{ .data = .{ .pointer = lhs_node }, .is_type_val = base_type.type.is_type_val },
.handle = base_type.handle,
};
},
else => unreachable,
};
},
.field_access => {
if (datas[node].rhs == 0) return null;
const rhs_str = tree.tokenSlice(datas[node].rhs);
// If we are accessing a pointer type, remove one pointerness level :)
const left_type = try resolveFieldAccessLhsType(
store,
arena,
(try resolveTypeOfNodeInternal(store, arena, .{
.node = datas[node].lhs,
.handle = handle,
}, bound_type_params)) orelse return null,
bound_type_params,
);
const left_type_node = switch (left_type.type.data) {
.other => |n| n,
else => return null,
};
if (try lookupSymbolContainer(
store,
arena,
.{ .node = left_type_node, .handle = left_type.handle },
rhs_str,
!left_type.type.is_type_val,
)) |child| {
return try child.resolveType(store, arena, bound_type_params);
} else return null;
},
.array_type,
.array_type_sentinel,
.optional_type,
.ptr_type_aligned,
.ptr_type,
.ptr_type_bit_range,
.error_union,
.error_set_decl,
.container_decl,
.container_decl_arg,
.container_decl_arg_trailing,
.container_decl_trailing,
.container_decl_two,
.container_decl_two_trailing,
.tagged_union,
.tagged_union_trailing,
.tagged_union_two,
.tagged_union_two_trailing,
.tagged_union_enum_tag,
.tagged_union_enum_tag_trailing,
=> return TypeWithHandle.typeVal(node_handle),
.builtin_call,
.builtin_call_comma,
.builtin_call_two,
.builtin_call_two_comma,
=> {
const data = datas[node];
const params = switch (node_tags[node]) {
.builtin_call, .builtin_call_comma => tree.extra_data[data.lhs..data.rhs],
.builtin_call_two, .builtin_call_two_comma => if (data.lhs == 0)
&[_]Ast.Node.Index{}
else if (data.rhs == 0)
&[_]Ast.Node.Index{data.lhs}
else
&[_]Ast.Node.Index{ data.lhs, data.rhs },
else => unreachable,
};
const call_name = tree.tokenSlice(main_tokens[node]);
if (std.mem.eql(u8, call_name, "@This")) {
if (params.len != 0) return null;
return innermostContainer(handle, starts[tree.firstToken(node)]);
}
const cast_map = std.ComptimeStringMap(void, .{
.{"@as"},
.{"@bitCast"},
.{"@fieldParentPtr"},
.{"@floatCast"},
.{"@floatToInt"},
.{"@intCast"},
.{"@intToEnum"},
.{"@intToFloat"},
.{"@intToPtr"},
.{"@truncate"},
.{"@ptrCast"},
});
if (cast_map.has(call_name)) {
if (params.len < 1) return null;
return ((try resolveTypeOfNodeInternal(store, arena, .{
.node = params[0],
.handle = handle,
}, bound_type_params)) orelse return null).instanceTypeVal();
}
// Almost the same as the above, return a type value though.
// TODO Do peer type resolution, we just keep the first for now.
if (std.mem.eql(u8, call_name, "@TypeOf")) {
if (params.len < 1) return null;
var resolved_type = (try resolveTypeOfNodeInternal(store, arena, .{
.node = params[0],
.handle = handle,
}, bound_type_params)) orelse return null;
if (resolved_type.type.is_type_val) return null;
resolved_type.type.is_type_val = true;
return resolved_type;
}
if (std.mem.eql(u8, call_name, "@typeInfo")) {
return resolveTypeInfoType(store, arena, handle) catch null;
}
if (!std.mem.eql(u8, call_name, "@import")) return null;
if (params.len == 0) return null;
const import_param = params[0];
if (node_tags[import_param] != .string_literal) return null;
const import_str = tree.tokenSlice(main_tokens[import_param]);
const new_handle = (store.resolveImport(handle, import_str[1 .. import_str.len - 1]) catch |err| {
log.debug("Error {} while processing import {s}", .{ err, import_str });
return null;
}) orelse return null;
// reference to node '0' which is root
return TypeWithHandle.typeVal(.{ .node = 0, .handle = new_handle });
},
.fn_proto,
.fn_proto_multi,
.fn_proto_one,
.fn_proto_simple,
.fn_decl,
=> {
var buf: [1]Ast.Node.Index = undefined;
// This is a function type
if (ast.fnProto(tree, node, &buf).?.name_token == null) {
return TypeWithHandle.typeVal(node_handle);
}
return TypeWithHandle{
.type = .{ .data = .{ .other = node }, .is_type_val = false },
.handle = handle,
};
},
.multiline_string_literal,
.string_literal,
=> return TypeWithHandle{
.type = .{ .data = .{ .other = node }, .is_type_val = false },
.handle = handle,
},
else => {},
}
return null;
}
// TODO Reorganize this file, perhaps split into a couple as well
// TODO Make this better, nested levels of type vals
pub const Type = struct {
data: union(enum) {
pointer: Ast.Node.Index,
slice: Ast.Node.Index,
error_union: Ast.Node.Index,
other: Ast.Node.Index,
primitive,
},
/// If true, the type `type`, the attached data is the value of the type value.
is_type_val: bool,
};
pub const TypeWithHandle = struct {
type: Type,
handle: *DocumentStore.Handle,
pub fn typeVal(node_handle: NodeWithHandle) TypeWithHandle {
return .{
.type = .{
.data = .{ .other = node_handle.node },
.is_type_val = true,
},
.handle = node_handle.handle,
};
}
fn instanceTypeVal(self: TypeWithHandle) ?TypeWithHandle {
if (!self.type.is_type_val) return null;
return TypeWithHandle{
.type = .{ .data = self.type.data, .is_type_val = false },
.handle = self.handle,
};
}
fn isRoot(self: TypeWithHandle) bool {
switch (self.type.data) {
// root is always index 0
.other => |n| return n == 0,
else => return false,
}
}
fn isContainerKind(self: TypeWithHandle, container_kind_tok: std.zig.Token.Tag) bool {
const tree = self.handle.tree;
const main_tokens = tree.nodes.items(.main_token);
const tags = tree.tokens.items(.tag);
switch (self.type.data) {
.other => |n| return tags[main_tokens[n]] == container_kind_tok,
else => return false,
}
}
pub fn isStructType(self: TypeWithHandle) bool {
return self.isContainerKind(.keyword_struct) or self.isRoot();
}
pub fn isNamespace(self: TypeWithHandle) bool {
if (!self.isStructType()) return false;
const tree = self.handle.tree;
const node = self.type.data.other;
const tags = tree.nodes.items(.tag);
if (ast.isContainer(tree, node)) {
var buf: [2]Ast.Node.Index = undefined;
for (ast.declMembers(tree, node, &buf)) |child| {
if (tags[child].isContainerField()) return false;
}
}
return true;
}
pub fn isEnumType(self: TypeWithHandle) bool {
return self.isContainerKind(.keyword_enum);
}
pub fn isUnionType(self: TypeWithHandle) bool {
return self.isContainerKind(.keyword_union);
}
pub fn isOpaqueType(self: TypeWithHandle) bool {
return self.isContainerKind(.keyword_opaque);
}
pub fn isTypeFunc(self: TypeWithHandle) bool {
var buf: [1]Ast.Node.Index = undefined;
const tree = self.handle.tree;
return switch (self.type.data) {
.other => |n| if (ast.fnProto(tree, n, &buf)) |fn_proto| blk: {
break :blk isTypeFunction(tree, fn_proto);
} else false,
else => false,
};
}
pub fn isGenericFunc(self: TypeWithHandle) bool {
var buf: [1]Ast.Node.Index = undefined;
const tree = self.handle.tree;
return switch (self.type.data) {
.other => |n| if (ast.fnProto(tree, n, &buf)) |fn_proto| blk: {
break :blk isGenericFunction(tree, fn_proto);
} else false,
else => false,
};
}
pub fn isFunc(self: TypeWithHandle) bool {
const tree = self.handle.tree;
const tags = tree.nodes.items(.tag);
return switch (self.type.data) {
.other => |n| switch (tags[n]) {
.fn_proto,
.fn_proto_multi,
.fn_proto_one,
.fn_proto_simple,
.fn_decl,
=> true,
else => false,
},
else => false,
};
}
};
pub fn resolveTypeOfNode(store: *DocumentStore, arena: *std.heap.ArenaAllocator, node_handle: NodeWithHandle) error{OutOfMemory}!?TypeWithHandle {
var bound_type_params = BoundTypeParams.init(arena.allocator());
return resolveTypeOfNodeInternal(store, arena, node_handle, &bound_type_params);
}
/// Collects all imports we can find into a slice of import paths (without quotes).
pub fn collectImports(import_arr: *std.ArrayList([]const u8), tree: Ast) !void {
const tags = tree.tokens.items(.tag);
var i: usize = 0;
while (i < tags.len) : (i += 1) {
if (tags[i] != .builtin)
continue;
const text = tree.tokenSlice(@intCast(u32, i));
if (std.mem.eql(u8, text, "@import")) {
if (i + 3 >= tags.len)
break;
if (tags[i + 1] != .l_paren)
continue;
if (tags[i + 2] != .string_literal)
continue;
if (tags[i + 3] != .r_paren)
continue;
const str = tree.tokenSlice(@intCast(u32, i + 2));
try import_arr.append(str[1 .. str.len - 1]);
}
}
}
pub const NodeWithHandle = struct {
node: Ast.Node.Index,
handle: *DocumentStore.Handle,
};
pub const FieldAccessReturn = struct {
original: TypeWithHandle,
unwrapped: ?TypeWithHandle = null,
};
var cached_type_info_type: ?TypeWithHandle = null;
pub fn resolveTypeInfoType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle) !?TypeWithHandle {
if (cached_type_info_type == null) {
const std_handle = (try store.resolveImport(handle, "std")) orelse {
log.debug("Could not find handle for std uri", .{});
return null;
};
const std_builtin_decl: DeclWithHandle = (try lookupSymbolContainer(store, arena, .{ .node = 0, .handle = std_handle }, "builtin", false)) orelse {
log.debug("Could not lookupSymbolContainer for std_builtin_decl", .{});
return null;
};
const std_builtin_type = (try resolveTypeOfNode(store, arena, .{ .node = std_builtin_decl.decl.ast_node, .handle = std_builtin_decl.handle })) orelse {
log.debug("Could not resolveTypeOfNode for std_builtin_decl", .{});
return null;
};
const std_builtin_module_node = NodeWithHandle{ .node = std_builtin_type.type.data.other, .handle = std_builtin_type.handle };
const type_info_decl = (try lookupSymbolContainer(store, arena, std_builtin_module_node, "Type", false)) orelse {
log.debug("could not find type_info_decl", .{});
return null;
};
const type_info_node = NodeWithHandle{ .node = type_info_decl.decl.ast_node, .handle = type_info_decl.handle };
var bound_type_params = BoundTypeParams.init(arena.allocator());
cached_type_info_type = (try resolveTypeOfNodeInternal(store, arena, type_info_node, &bound_type_params)) orelse {
log.debug("could not resolveType std.builtin.Type", .{});
return null;
};
}
return cached_type_info_type;
}
pub fn getFieldAccessType(store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, source_index: usize, tokenizer: *std.zig.Tokenizer) !?FieldAccessReturn {
var current_type = TypeWithHandle.typeVal(.{
.node = undefined,
.handle = handle,
});
var bound_type_params = BoundTypeParams.init(arena.allocator());
while (true) {
const tok = tokenizer.next();
switch (tok.tag) {
.eof => return FieldAccessReturn{
.original = current_type,
.unwrapped = try resolveDerefType(store, arena, current_type, &bound_type_params),
},
.identifier => {
if (try lookupSymbolGlobal(
store,
arena,
current_type.handle,
tokenizer.buffer[tok.loc.start..tok.loc.end],
source_index,
)) |child| {
current_type = (try child.resolveType(store, arena, &bound_type_params)) orelse return null;
} else return null;
},
.period => {
const after_period = tokenizer.next();
switch (after_period.tag) {
.eof => {
// function labels cannot be dot accessed
if (current_type.isFunc()) return null;
return FieldAccessReturn{
.original = current_type,
.unwrapped = try resolveDerefType(store, arena, current_type, &bound_type_params),
};
},
.identifier => {
if (after_period.loc.end == tokenizer.buffer.len) {
return FieldAccessReturn{
.original = current_type,
.unwrapped = try resolveDerefType(store, arena, current_type, &bound_type_params),
};
}
current_type = try resolveFieldAccessLhsType(store, arena, current_type, &bound_type_params);
const current_type_node = switch (current_type.type.data) {
.other => |n| n,
else => return null,
};
if (try lookupSymbolContainer(
store,
arena,
.{ .node = current_type_node, .handle = current_type.handle },
tokenizer.buffer[after_period.loc.start..after_period.loc.end],
!current_type.type.is_type_val,
)) |child| {
current_type = (try child.resolveType(
store,
arena,
&bound_type_params,
)) orelse return null;
} else return null;
},
.question_mark => {
current_type = (try resolveUnwrapOptionalType(
store,
arena,
current_type,
&bound_type_params,
)) orelse return null;
},
else => {
log.debug("Unrecognized token {} after period.", .{after_period.tag});
return null;
},
}
},
.period_asterisk => {
current_type = (try resolveDerefType(
store,
arena,
current_type,
&bound_type_params,
)) orelse return null;
},
.l_paren => {
const current_type_node = switch (current_type.type.data) {
.other => |n| n,
else => return null,
};
// Can't call a function type, we need a function type instance.
if (current_type.type.is_type_val) return null;
const cur_tree = current_type.handle.tree;
var buf: [1]Ast.Node.Index = undefined;
if (ast.fnProto(cur_tree, current_type_node, &buf)) |func| {
// Check if the function has a body and if so, pass it
// so the type can be resolved if it's a generic function returning
// an anonymous struct
const has_body = cur_tree.nodes.items(.tag)[current_type_node] == .fn_decl;
const body = cur_tree.nodes.items(.data)[current_type_node].rhs;
// TODO Actually bind params here when calling functions instead of just skipping args.
if (try resolveReturnType(store, arena, func, current_type.handle, &bound_type_params, if (has_body) body else null)) |ret| {
current_type = ret;
// Skip to the right paren
var paren_count: usize = 1;
var next = tokenizer.next();
while (next.tag != .eof) : (next = tokenizer.next()) {
if (next.tag == .r_paren) {
paren_count -= 1;
if (paren_count == 0) break;
} else if (next.tag == .l_paren) {
paren_count += 1;
}
} else return null;
} else return null;
} else return null;
},
.l_bracket => {
var brack_count: usize = 1;
var next = tokenizer.next();
var is_range = false;
while (next.tag != .eof) : (next = tokenizer.next()) {
if (next.tag == .r_bracket) {
brack_count -= 1;
if (brack_count == 0) break;
} else if (next.tag == .l_bracket) {
brack_count += 1;
} else if (next.tag == .ellipsis2 and brack_count == 1) {
is_range = true;
}
} else return null;
current_type = (try resolveBracketAccessType(store, arena, current_type, if (is_range) .Range else .Single, &bound_type_params)) orelse return null;
},
.builtin => {
const builtin_name = tokenizer.buffer[tok.loc.start..tok.loc.end];
if (!std.mem.eql(u8, builtin_name, "@typeInfo")) {
log.debug("Unimplemented builtin: {s}", .{builtin_name});
return null;
}
if (try resolveTypeInfoType(store, arena, current_type.handle)) |type_info_type| {
current_type = type_info_type.instanceTypeVal().?;
// Skip to the right paren
var paren_count: u32 = 1;
var next_tag = if (tokenizer.next().tag != .l_paren) .eof else tokenizer.next().tag;
while (next_tag != .eof) : (next_tag = tokenizer.next().tag) {
switch (next_tag) {
.l_paren => paren_count += 1,
.r_paren => paren_count -= 1,
else => {},
}
if (paren_count == 0) break;
} else {
log.debug("mismatch paren count for builtin call {s}", .{builtin_name});
return null;
}
} else return null;
},
else => {
log.debug("Unimplemented token: {}", .{tok.tag});
return null;
},
}
}
return FieldAccessReturn{
.original = current_type,
.unwrapped = try resolveDerefType(store, arena, current_type, &bound_type_params),
};
}
pub fn isNodePublic(tree: Ast, node: Ast.Node.Index) bool {
var buf: [1]Ast.Node.Index = undefined;
return switch (tree.nodes.items(.tag)[node]) {
.global_var_decl,
.local_var_decl,
.simple_var_decl,
.aligned_var_decl,
=> ast.varDecl(tree, node).?.visib_token != null,
.fn_proto,
.fn_proto_multi,
.fn_proto_one,
.fn_proto_simple,
.fn_decl,
=> ast.fnProto(tree, node, &buf).?.visib_token != null,
else => true,
};
}
pub fn nodeToString(tree: Ast, node: Ast.Node.Index) ?[]const u8 {
const data = tree.nodes.items(.data);
const main_token = tree.nodes.items(.main_token)[node];
var buf: [1]Ast.Node.Index = undefined;
switch (tree.nodes.items(.tag)[node]) {
.container_field => return tree.tokenSlice(tree.containerField(node).ast.name_token),
.container_field_init => return tree.tokenSlice(tree.containerFieldInit(node).ast.name_token),
.container_field_align => return tree.tokenSlice(tree.containerFieldAlign(node).ast.name_token),
.error_value => return tree.tokenSlice(data[node].rhs),
.identifier => return tree.tokenSlice(main_token),
.fn_proto,
.fn_proto_multi,
.fn_proto_one,
.fn_proto_simple,
.fn_decl,
=> if (ast.fnProto(tree, node, &buf).?.name_token) |name|
return tree.tokenSlice(name),
.field_access => return tree.tokenSlice(data[node].rhs),
.call,
.call_comma,
.async_call,
.async_call_comma,
=> return tree.tokenSlice(tree.callFull(node).ast.lparen - 1),
.call_one,
.call_one_comma,
.async_call_one,
.async_call_one_comma,
=> return tree.tokenSlice(tree.callOne(&buf, node).ast.lparen - 1),
.test_decl => if (data[node].lhs != 0)
return tree.tokenSlice(data[node].lhs),
else => |tag| log.debug("INVALID: {}", .{tag}),
}
return null;
}
fn nodeContainsSourceIndex(tree: Ast, node: Ast.Node.Index, source_index: usize) bool {
const first_token = offsets.tokenLocation(tree, tree.firstToken(node)).start;
const last_token = offsets.tokenLocation(tree, ast.lastToken(tree, node)).end;
return source_index >= first_token and source_index <= last_token;
}
pub fn getImportStr(tree: Ast, node: Ast.Node.Index, source_index: usize) ?[]const u8 {
const node_tags = tree.nodes.items(.tag);
var buf: [2]Ast.Node.Index = undefined;
if (ast.isContainer(tree, node)) {
const decls = ast.declMembers(tree, node, &buf);
for (decls) |decl_idx| {
if (getImportStr(tree, decl_idx, source_index)) |name| {
return name;
}
}
return null;
} else if (ast.varDecl(tree, node)) |var_decl| {
return getImportStr(tree, var_decl.ast.init_node, source_index);
} else if (node_tags[node] == .@"usingnamespace") {
return getImportStr(tree, tree.nodes.items(.data)[node].lhs, source_index);
}
if (!nodeContainsSourceIndex(tree, node, source_index)) {
return null;
}
if (ast.isBuiltinCall(tree, node)) {
const builtin_token = tree.nodes.items(.main_token)[node];
const call_name = tree.tokenSlice(builtin_token);
if (!std.mem.eql(u8, call_name, "@import")) return null;
const data = tree.nodes.items(.data)[node];
const params = switch (node_tags[node]) {
.builtin_call, .builtin_call_comma => tree.extra_data[data.lhs..data.rhs],
.builtin_call_two, .builtin_call_two_comma => if (data.lhs == 0)
&[_]Ast.Node.Index{}
else if (data.rhs == 0)
&[_]Ast.Node.Index{data.lhs}
else
&[_]Ast.Node.Index{ data.lhs, data.rhs },
else => unreachable,
};
if (params.len != 1) return null;
const import_str = tree.tokenSlice(tree.nodes.items(.main_token)[params[0]]);
return import_str[1 .. import_str.len - 1];
}
return null;
}
pub const SourceRange = std.zig.Token.Loc;
pub const PositionContext = union(enum) {
builtin: SourceRange,
comment,
string_literal: SourceRange,
field_access: SourceRange,
var_access: SourceRange,
global_error_set,
enum_literal,
pre_label,
label: bool,
other,
empty,
pub fn range(self: PositionContext) ?SourceRange {
return switch (self) {
.builtin => |r| r,
.comment => null,
.string_literal => |r| r,
.field_access => |r| r,
.var_access => |r| r,
.enum_literal => null,
.pre_label => null,
.label => null,
.other => null,
.empty => null,
.global_error_set => null,
};
}
};
const StackState = struct {
ctx: PositionContext,
stack_id: enum { Paren, Bracket, Global },
};
fn peek(arr: *std.ArrayList(StackState)) !*StackState {
if (arr.items.len == 0) {
try arr.append(.{ .ctx = .empty, .stack_id = .Global });
}
return &arr.items[arr.items.len - 1];
}
fn tokenRangeAppend(prev: SourceRange, token: std.zig.Token) SourceRange {
return .{
.start = prev.start,
.end = token.loc.end,
};
}
const DocumentPosition = offsets.DocumentPosition;
pub fn documentPositionContext(arena: *std.heap.ArenaAllocator, document: types.TextDocument, doc_position: DocumentPosition) !PositionContext {
_ = document;
const line = doc_position.line;
const line_mem_start = @ptrToInt(line.ptr) - @ptrToInt(document.mem.ptr);
var stack = try std.ArrayList(StackState).initCapacity(arena.allocator(), 8);
{
var held_line = document.borrowNullTerminatedSlice(
line_mem_start,
line_mem_start + doc_position.line_index,
);
defer held_line.release();
var tokenizer = std.zig.Tokenizer.init(held_line.data());
while (true) {
const tok = tokenizer.next();
// Early exits.
switch (tok.tag) {
.invalid => {
// Single '@' do not return a builtin token so we check this on our own.
if (line[doc_position.line_index - 1] == '@') {
return PositionContext{
.builtin = .{
.start = doc_position.line_index - 1,
.end = doc_position.line_index,
},
};
}
return .other;
},
.doc_comment, .container_doc_comment => return .comment,
.eof => break,
else => {},
}
// State changes
var curr_ctx = try peek(&stack);
switch (tok.tag) {
.string_literal, .multiline_string_literal_line => curr_ctx.ctx = .{ .string_literal = tok.loc },
.identifier => switch (curr_ctx.ctx) {
.empty, .pre_label => curr_ctx.ctx = .{ .var_access = tok.loc },
.label => |filled| if (!filled) {
curr_ctx.ctx = .{ .label = true };
} else {
curr_ctx.ctx = .{ .var_access = tok.loc };
},
else => {},
},
.builtin => switch (curr_ctx.ctx) {
.empty, .pre_label => curr_ctx.ctx = .{ .builtin = tok.loc },
else => {},
},
.period, .period_asterisk => switch (curr_ctx.ctx) {
.empty, .pre_label => curr_ctx.ctx = .enum_literal,
.enum_literal => curr_ctx.ctx = .empty,
.field_access => {},
.other => {},
.global_error_set => {},
else => curr_ctx.ctx = .{
.field_access = tokenRangeAppend(curr_ctx.ctx.range().?, tok),
},
},
.keyword_break, .keyword_continue => curr_ctx.ctx = .pre_label,
.colon => if (curr_ctx.ctx == .pre_label) {
curr_ctx.ctx = .{ .label = false };
} else {
curr_ctx.ctx = .empty;
},
.question_mark => switch (curr_ctx.ctx) {
.field_access => {},
else => curr_ctx.ctx = .empty,
},
.l_paren => try stack.append(.{ .ctx = .empty, .stack_id = .Paren }),
.l_bracket => try stack.append(.{ .ctx = .empty, .stack_id = .Bracket }),
.r_paren => {
_ = stack.pop();
if (curr_ctx.stack_id != .Paren) {
(try peek(&stack)).ctx = .empty;
}
},
.r_bracket => {
_ = stack.pop();
if (curr_ctx.stack_id != .Bracket) {
(try peek(&stack)).ctx = .empty;
}
},
.keyword_error => curr_ctx.ctx = .global_error_set,
else => curr_ctx.ctx = .empty,
}
switch (curr_ctx.ctx) {
.field_access => |r| curr_ctx.ctx = .{
.field_access = tokenRangeAppend(r, tok),
},
else => {},
}
}
}
return block: {
if (stack.popOrNull()) |state| {
switch (state.ctx) {
.empty => {},
.label => |filled| {
// We need to check this because the state could be a filled
// label if only a space follows it
const last_char = line[doc_position.line_index - 1];
if (!filled or last_char != ' ') {
break :block state.ctx;
}
},
else => break :block state.ctx,
}
}
if (doc_position.line_index < line.len) {
var held_line = document.borrowNullTerminatedSlice(
line_mem_start + doc_position.line_index,
line_mem_start + line.len,
);
defer held_line.release();
switch (line[doc_position.line_index]) {
'a'...'z', 'A'...'Z', '_', '@' => {},
else => break :block .empty,
}
var tokenizer = std.zig.Tokenizer.init(held_line.data());
const tok = tokenizer.next();
if (tok.tag == .identifier)
break :block PositionContext{ .var_access = tok.loc };
}
break :block .empty;
};
}
fn containerDeclFull(tree: Ast, node: Ast.Node.Index, buf: *[2]Ast.Node.Index) ?Ast.full.ContainerDecl {
return switch (tree.nodes.items(.tag)[node]) {
// zig fmt: off
.container_decl, .container_decl_trailing => tree.containerDecl(node),
.container_decl_arg, .container_decl_arg_trailing => tree.containerDeclArg(node),
.container_decl_two, .container_decl_two_trailing => tree.containerDeclTwo(buf, node),
.tagged_union, .tagged_union_trailing => tree.taggedUnion(node),
.tagged_union_enum_tag, .tagged_union_enum_tag_trailing => tree.taggedUnionEnumTag(node),
.tagged_union_two, .tagged_union_two_trailing => tree.taggedUnionTwo(buf, node),
else => null,
// zig fmt: on
};
}
fn shouldAddToOutline(node_tag: Ast.Node.Tag) bool {
return switch (node_tag) {
.grouped_expression,
.error_value,
.@"suspend",
.@"nosuspend",
.@"errdefer",
.@"catch",
.@"asm",
.asm_simple,
.asm_output,
.asm_input,
=> false,
.anyframe_type,
.anyframe_literal,
.unreachable_literal,
.char_literal,
.float_literal,
.string_literal,
.integer_literal,
.builtin_call,
.builtin_call_comma,
.builtin_call_two,
.builtin_call_two_comma,
.call,
.call_comma,
.call_one,
.call_one_comma,
.async_call,
.async_call_comma,
.async_call_one,
.async_call_one_comma,
.identifier,
.add,
.add_wrap,
.array_cat,
.array_mult,
.assign,
.assign_bit_and,
.assign_bit_or,
.assign_shl,
.assign_shr,
.assign_bit_xor,
.assign_div,
.assign_sub,
.assign_sub_wrap,
.assign_mod,
.assign_add,
.assign_add_wrap,
.assign_mul,
.assign_mul_wrap,
.assign_mul_sat,
.assign_add_sat,
.assign_sub_sat,
.assign_shl_sat,
.mul_sat,
.add_sat,
.sub_sat,
.shl_sat,
.bang_equal,
.bit_and,
.bit_or,
.shl,
.shr,
.bit_xor,
.bool_and,
.bool_or,
.div,
.equal_equal,
.error_union,
.greater_or_equal,
.greater_than,
.less_or_equal,
.less_than,
.merge_error_sets,
.mod,
.mul,
.mul_wrap,
.field_access,
.switch_range,
.sub,
.sub_wrap,
.@"orelse",
.address_of,
.@"await",
.bit_not,
.bool_not,
.optional_type,
.negation,
.negation_wrap,
.@"resume",
.@"try",
.array_type,
.array_type_sentinel,
.ptr_type,
.ptr_type_aligned,
.ptr_type_bit_range,
.ptr_type_sentinel,
.slice_open,
.slice_sentinel,
.deref,
.unwrap_optional,
.array_access,
.@"return",
.@"break",
.@"continue",
.array_init,
.array_init_comma,
.array_init_dot,
.array_init_dot_comma,
.array_init_dot_two,
.array_init_dot_two_comma,
.array_init_one,
.array_init_one_comma,
.slice,
.@"switch",
.switch_comma,
.switch_case,
.switch_case_one,
.@"for",
.for_simple,
.enum_literal,
.struct_init,
.struct_init_comma,
.struct_init_dot,
.struct_init_dot_comma,
.struct_init_dot_two,
.struct_init_dot_two_comma,
.struct_init_one,
.struct_init_one_comma,
.@"while",
.while_simple,
.while_cont,
.@"defer",
.@"if",
.if_simple,
.multiline_string_literal,
.block,
.block_semicolon,
.block_two,
.block_two_semicolon,
=> false,
.container_decl,
.container_decl_trailing,
.container_decl_arg,
.container_decl_arg_trailing,
.container_decl_two,
.container_decl_two_trailing,
.tagged_union,
.tagged_union_trailing,
.tagged_union_enum_tag,
.tagged_union_enum_tag_trailing,
.tagged_union_two,
.tagged_union_two_trailing,
=> true,
.root,
.@"usingnamespace",
.@"comptime",
.test_decl,
.error_set_decl,
.fn_proto,
.fn_proto_simple,
.fn_proto_multi,
.fn_proto_one,
.fn_decl,
.local_var_decl,
.global_var_decl,
.aligned_var_decl,
.simple_var_decl,
.container_field,
.container_field_align,
.container_field_init,
=> true,
};
}
const DocSmblNice = struct {
kind: types.DocumentSymbol.Kind,
detail: []const u8 = "",
decl_members: ?[]const Ast.Node.Index = null,
fn getName(tree: Ast, node: Ast.Node.Index) ?[]const u8 {
// zig fmt: off
const node_tags: []const Ast.Node.Tag = tree.nodes.items(.tag);
const main_tokens: []const Ast.TokenIndex = tree.nodes.items(.main_token);
const node_datas: []const Ast.Node.Data = tree.nodes.items(.data);
const token_tags: []const std.zig.Token.Tag = tree.tokens.items(.tag);
// zig fmt: on
const main_token = main_tokens[node];
return switch (node_tags[node]) {
.local_var_decl,
.global_var_decl,
.simple_var_decl,
.aligned_var_decl,
.fn_proto,
.fn_proto_multi,
.fn_proto_one,
.fn_proto_simple,
.fn_decl,
=> tree.tokenSlice(main_token + 1),
.container_field,
.container_field_init,
.container_field_align,
.string_literal,
.identifier,
=> tree.tokenSlice(main_token),
.@"usingnamespace" => DocSmblNice.getName(tree, node_datas[node].lhs),
.error_value => tree.tokenSlice(main_token + 2),
.test_decl => {
const test_name_token = main_token + 1;
return switch (token_tags[test_name_token]) {
.string_literal, .identifier => tree.tokenSlice(test_name_token),
else => @as([]const u8, "unnamed_test_decl"),
};
},
else => return null,
};
}
fn get(tree: Ast, parent_kind: types.DocumentSymbol.Kind, node: Ast.Node.Index, decl_mem_buf: *[2]Ast.Node.Index) DocSmblNice {
// zig fmt: off
const node_tags: []const Ast.Node.Tag = tree.nodes.items(.tag);
const main_tokens: []const Ast.TokenIndex = tree.nodes.items(.main_token);
const node_datas: []const Ast.Node.Data = tree.nodes.items(.data);
const token_tags: []const std.zig.Token.Tag = tree.tokens.items(.tag);
// zig fmt: on
switch (node_tags[node]) {
.root => return DocSmblNice{
.kind = .File,
.detail = "root",
},
.@"usingnamespace" => {
const main_token = main_tokens[node];
const is_pub = (main_token > 0 and token_tags[main_token - 1] == .keyword_pub);
return DocSmblNice{
.kind = .Namespace,
.detail = if (is_pub) "usingnamespace" else "pub usingnamespace",
};
},
.test_decl => return DocSmblNice{
.kind = .Variable,
.detail = DocSmblNice.getName(tree, node) orelse "",
},
.error_set_decl => return DocSmblNice{
.kind = .Class,
.detail = DocSmblNice.getName(tree, node) orelse "",
},
.builtin_call,
.builtin_call_comma,
.builtin_call_two,
.builtin_call_two_comma,
=> return if (std.mem.eql(u8, tree.tokenSlice(main_tokens[node]), "@import"))
DocSmblNice{ .kind = .Module, .detail = "import" }
else
DocSmblNice{ .kind = parent_kind },
.global_var_decl,
.local_var_decl,
.simple_var_decl,
.aligned_var_decl,
=> {
const full_var = ast.varDecl(tree, node).?;
const is_const = token_tags[full_var.ast.mut_token] != .keyword_var;
const has_type = full_var.ast.type_node != 0;
const has_init = full_var.ast.init_node != 0;
const kind: types.DocumentSymbol.Kind = if (is_const) .Constant else .Variable;
if (!has_type and has_init)
return DocSmblNice.get(tree, kind, full_var.ast.init_node, decl_mem_buf)
else {
const ty_name = if (has_type) DocSmblNice.getName(tree, full_var.ast.type_node) else null;
return DocSmblNice{
.kind = kind,
.detail = ty_name orelse "",
};
}
},
.fn_proto,
.fn_proto_simple,
.fn_proto_multi,
.fn_proto_one,
=> return DocSmblNice{ .kind = .Function },
.fn_decl => {
const fn_data = node_datas[node];
var fn_params: [1]Ast.Node.Index = undefined;
const fn_proto = ast.fnProto(tree, fn_data.lhs, &fn_params).?;
const ret_stmt = if (isTypeFunction(tree, fn_proto)) findReturnStatement(tree, fn_proto, fn_data.rhs) else null;
const ret_ty_node = if (ret_stmt != null) node_datas[ret_stmt.?].lhs else 0;
return if (ret_ty_node != 0)
DocSmblNice.get(tree, .Function, ret_ty_node, decl_mem_buf)
else
DocSmblNice{ .kind = .Function };
},
.container_field,
.container_field_align,
.container_field_init,
=> return DocSmblNice{ .kind = if (parent_kind == .Enum) .EnumMember else .Field },
.container_decl,
.container_decl_trailing,
.container_decl_arg,
.container_decl_arg_trailing,
.container_decl_two,
.container_decl_two_trailing,
.tagged_union,
.tagged_union_trailing,
.tagged_union_enum_tag,
.tagged_union_enum_tag_trailing,
.tagged_union_two,
.tagged_union_two_trailing,
=> {
const full_decl = containerDeclFull(tree, node, decl_mem_buf).?;
switch (token_tags[main_tokens[node]]) {
.keyword_enum => {
const decl_arg_name = if (full_decl.ast.arg != 0) DocSmblNice.getName(tree, full_decl.ast.arg) else null;
return DocSmblNice{
.kind = .Enum,
.detail = decl_arg_name orelse "",
.decl_members = full_decl.ast.members,
};
},
.keyword_struct => return DocSmblNice{
.kind = .Class,
.decl_members = full_decl.ast.members,
},
.keyword_union => {
const has_auto_enum = full_decl.ast.enum_token != null;
const decl_arg_name = if (full_decl.ast.arg != 0) DocSmblNice.getName(tree, full_decl.ast.arg) else null;
return DocSmblNice{
.kind = .Struct,
.detail = decl_arg_name orelse (if (has_auto_enum) "union(enum)" else "union"),
.decl_members = full_decl.ast.members,
};
},
.keyword_opaque => return DocSmblNice{
.kind = .Class,
.detail = "opaque",
.decl_members = full_decl.ast.members,
},
else => |token_tag| return DocSmblNice{
.kind = .Object,
.detail = @tagName(token_tag),
.decl_members = full_decl.ast.members,
},
}
},
else => |node_tag| {
// const node_tag_name = @tagName(node_tag);
const detail = DocSmblNice.getName(tree, node) orelse @tagName(node_tag);
return DocSmblNice{
.kind = .Variable,
.detail = detail,
};
},
}
}
};
const GetDocumentSymbolsContext = struct {
prev_loc: offsets.TokenLocation = .{
.line = 0,
.column = 0,
.offset = 0,
},
symbols: std.ArrayListUnmanaged(types.DocumentSymbol),
encoding: offsets.Encoding,
};
fn getDocumentSymbolsInternal(
allocator: std.mem.Allocator,
tree: Ast,
node: Ast.Node.Index,
context: *GetDocumentSymbolsContext,
parent_kind: types.DocumentSymbol.Kind,
) anyerror!void {
const node_tags: []const Ast.Node.Tag = tree.nodes.items(.tag);
const name = DocSmblNice.getName(tree, node) orelse return;
if (name.len == 0) return;
const starts = tree.tokens.items(.start);
const start_loc = context.prev_loc.add(try offsets.tokenRelativeLocation(
tree,
context.prev_loc.offset,
starts[tree.firstToken(node)],
context.encoding,
));
const end_loc = start_loc.add(try offsets.tokenRelativeLocation(
tree,
start_loc.offset,
starts[ast.lastToken(tree, node)],
context.encoding,
));
context.prev_loc = end_loc;
const range = types.Range{
.start = .{
.line = @intCast(i64, start_loc.line),
.character = @intCast(i64, start_loc.column),
},
.end = .{
.line = @intCast(i64, end_loc.line),
.character = @intCast(i64, end_loc.column),
},
};
// var child_context = GetDocumentSymbolsContext{
// .prev_loc = start_loc,
// .symbols = .{},
// .encoding = context.encoding,
// };
// const child_symbol_detail = try getDocumentSymbolChildren(allocator, tree, node, &child_context, parent_kind);
// try context.symbols.append(allocator, types.DocumentSymbol{
// .name = name,
// .kind = child_symbol_detail.kind,
// .range = range,
// .selectionRange = range,
// .detail = child_symbol_detail.detail,
// .children = child_context.symbols.items,
// });
var child_context = GetDocumentSymbolsContext{
.prev_loc = start_loc,
.symbols = .{},
.encoding = context.encoding,
};
var decl_mem_buf: [2]Ast.Node.Index = undefined;
const child_symbol_detail = DocSmblNice.get(tree, parent_kind, node, &decl_mem_buf);
if (child_symbol_detail.decl_members) |decl_members| {
for (decl_members) |decl_member| {
if (shouldAddToOutline(node_tags[decl_member]))
try getDocumentSymbolsInternal(allocator, tree, decl_member, &child_context, child_symbol_detail.kind);
}
}
try context.symbols.append(allocator, types.DocumentSymbol{
.name = name,
.kind = child_symbol_detail.kind,
.range = range,
.selectionRange = range,
.detail = child_symbol_detail.detail,
.children = child_context.symbols.items,
});
}
pub fn getDocumentSymbols(allocator: std.mem.Allocator, tree: Ast, encoding: offsets.Encoding) ![]types.DocumentSymbol {
var context = GetDocumentSymbolsContext{
.symbols = try std.ArrayListUnmanaged(types.DocumentSymbol).initCapacity(allocator, tree.rootDecls().len),
.encoding = encoding,
};
for (tree.rootDecls()) |decl_member|
try getDocumentSymbolsInternal(allocator, tree, decl_member, &context, .File);
return context.symbols.items;
}
pub const Declaration = union(enum) {
/// Index of the ast node
ast_node: Ast.Node.Index,
/// Function parameter
param_decl: Ast.full.FnProto.Param,
pointer_payload: struct {
name: Ast.TokenIndex,
condition: Ast.Node.Index,
},
array_payload: struct {
identifier: Ast.TokenIndex,
array_expr: Ast.Node.Index,
},
array_index: Ast.TokenIndex,
switch_payload: struct {
node: Ast.TokenIndex,
switch_expr: Ast.Node.Index,
items: []const Ast.Node.Index,
},
label_decl: Ast.TokenIndex,
};
pub const DeclWithHandle = struct {
decl: *Declaration,
handle: *DocumentStore.Handle,
pub fn nameToken(self: DeclWithHandle) Ast.TokenIndex {
const tree = self.handle.tree;
return switch (self.decl.*) {
.ast_node => |n| getDeclNameToken(tree, n).?,
.param_decl => |p| p.name_token.?,
.pointer_payload => |pp| pp.name,
.array_payload => |ap| ap.identifier,
.array_index => |ai| ai,
.switch_payload => |sp| sp.node,
.label_decl => |ld| ld,
};
}
pub fn location(self: DeclWithHandle, encoding: offsets.Encoding) !offsets.TokenLocation {
const tree = self.handle.tree;
return try offsets.tokenRelativeLocation(tree, 0, tree.tokens.items(.start)[self.nameToken()], encoding);
}
fn isPublic(self: DeclWithHandle) bool {
return switch (self.decl.*) {
.ast_node => |node| isNodePublic(self.handle.tree, node),
else => true,
};
}
pub fn resolveType(self: DeclWithHandle, store: *DocumentStore, arena: *std.heap.ArenaAllocator, bound_type_params: *BoundTypeParams) !?TypeWithHandle {
const tree = self.handle.tree;
const node_tags = tree.nodes.items(.tag);
const main_tokens = tree.nodes.items(.main_token);
return switch (self.decl.*) {
.ast_node => |node| try resolveTypeOfNodeInternal(
store,
arena,
.{ .node = node, .handle = self.handle },
bound_type_params,
),
.param_decl => |param_decl| {
if (isMetaType(self.handle.tree, param_decl.type_expr)) {
var bound_param_it = bound_type_params.iterator();
while (bound_param_it.next()) |entry| {
if (std.meta.eql(entry.key_ptr.*, param_decl)) return entry.value_ptr.*;
}
return null;
} else if (node_tags[param_decl.type_expr] == .identifier) {
if (param_decl.name_token) |name_tok| {
if (std.mem.eql(u8, tree.tokenSlice(main_tokens[param_decl.type_expr]), tree.tokenSlice(name_tok)))
return null;
}
}
return ((try resolveTypeOfNodeInternal(
store,
arena,
.{ .node = param_decl.type_expr, .handle = self.handle },
bound_type_params,
)) orelse return null).instanceTypeVal();
},
.pointer_payload => |pay| try resolveUnwrapOptionalType(
store,
arena,
(try resolveTypeOfNodeInternal(store, arena, .{
.node = pay.condition,
.handle = self.handle,
}, bound_type_params)) orelse return null,
bound_type_params,
),
.array_payload => |pay| try resolveBracketAccessType(
store,
arena,
(try resolveTypeOfNodeInternal(store, arena, .{
.node = pay.array_expr,
.handle = self.handle,
}, bound_type_params)) orelse return null,
.Single,
bound_type_params,
),
.array_index => TypeWithHandle{
.type = .{ .data = .primitive, .is_type_val = false },
.handle = self.handle,
},
.label_decl => return null,
.switch_payload => |pay| {
if (pay.items.len == 0) return null;
// TODO Peer type resolution, we just use the first item for now.
const switch_expr_type = (try resolveTypeOfNodeInternal(store, arena, .{
.node = pay.switch_expr,
.handle = self.handle,
}, bound_type_params)) orelse return null;
if (!switch_expr_type.isUnionType())
return null;
if (node_tags[pay.items[0]] == .enum_literal) {
const scope = findContainerScope(.{ .node = switch_expr_type.type.data.other, .handle = switch_expr_type.handle }) orelse return null;
if (scope.decls.getEntry(tree.tokenSlice(main_tokens[pay.items[0]]))) |candidate| {
switch (candidate.value_ptr.*) {
.ast_node => |node| {
if (ast.containerField(switch_expr_type.handle.tree, node)) |container_field| {
if (container_field.ast.type_expr != 0) {
return ((try resolveTypeOfNodeInternal(
store,
arena,
.{ .node = container_field.ast.type_expr, .handle = switch_expr_type.handle },
bound_type_params,
)) orelse return null).instanceTypeVal();
}
}
},
else => {},
}
return null;
}
}
return null;
},
};
}
};
fn findContainerScope(container_handle: NodeWithHandle) ?*Scope {
const container = container_handle.node;
const handle = container_handle.handle;
if (!ast.isContainer(handle.tree, container)) return null;
// Find the container scope.
return for (handle.document_scope.scopes) |*scope| {
switch (scope.data) {
.container => |node| if (node == container) {
break scope;
},
else => {},
}
} else null;
}
fn iterateSymbolsContainerInternal(store: *DocumentStore, arena: *std.heap.ArenaAllocator, container_handle: NodeWithHandle, orig_handle: *DocumentStore.Handle, comptime callback: anytype, context: anytype, instance_access: bool, use_trail: *std.ArrayList(*const Ast.Node.Index)) error{OutOfMemory}!void {
const container = container_handle.node;
const handle = container_handle.handle;
const tree = handle.tree;
const node_tags = tree.nodes.items(.tag);
const token_tags = tree.tokens.items(.tag);
const main_token = tree.nodes.items(.main_token)[container];
const is_enum = token_tags[main_token] == .keyword_enum;
const container_scope = findContainerScope(container_handle) orelse return;
var decl_it = container_scope.decls.iterator();
while (decl_it.next()) |entry| {
switch (entry.value_ptr.*) {
.ast_node => |node| {
if (node_tags[node].isContainerField()) {
if (!instance_access and !is_enum) continue;
if (instance_access and is_enum) continue;
} else if (node_tags[node] == .global_var_decl or
node_tags[node] == .local_var_decl or
node_tags[node] == .simple_var_decl or
node_tags[node] == .aligned_var_decl)
{
if (instance_access) continue;
}
},
.label_decl => continue,
else => {},
}
const decl = DeclWithHandle{ .decl = entry.value_ptr, .handle = handle };
if (handle != orig_handle and !decl.isPublic()) continue;
try callback(context, decl);
}
for (container_scope.uses) |use| {
const use_token = tree.nodes.items(.main_token)[use.*];
const is_pub = use_token > 0 and token_tags[use_token - 1] == .keyword_pub;
if (handle != orig_handle and !is_pub) continue;
if (std.mem.indexOfScalar(*const Ast.Node.Index, use_trail.items, use) != null) continue;
try use_trail.append(use);
const lhs = tree.nodes.items(.data)[use.*].lhs;
const use_expr = (try resolveTypeOfNode(store, arena, .{
.node = lhs,
.handle = handle,
})) orelse continue;
const use_expr_node = switch (use_expr.type.data) {
.other => |n| n,
else => continue,
};
try iterateSymbolsContainerInternal(
store,
arena,
.{ .node = use_expr_node, .handle = use_expr.handle },
orig_handle,
callback,
context,
false,
use_trail,
);
}
}
pub fn iterateSymbolsContainer(store: *DocumentStore, arena: *std.heap.ArenaAllocator, container_handle: NodeWithHandle, orig_handle: *DocumentStore.Handle, comptime callback: anytype, context: anytype, instance_access: bool) error{OutOfMemory}!void {
var use_trail = std.ArrayList(*const Ast.Node.Index).init(arena.allocator());
return try iterateSymbolsContainerInternal(store, arena, container_handle, orig_handle, callback, context, instance_access, &use_trail);
}
pub fn iterateLabels(handle: *DocumentStore.Handle, source_index: usize, comptime callback: anytype, context: anytype) error{OutOfMemory}!void {
for (handle.document_scope.scopes) |scope| {
if (source_index >= scope.range.start and source_index < scope.range.end) {
var decl_it = scope.decls.iterator();
while (decl_it.next()) |entry| {
switch (entry.value_ptr.*) {
.label_decl => {},
else => continue,
}
try callback(context, DeclWithHandle{ .decl = entry.value_ptr, .handle = handle });
}
}
if (scope.range.start >= source_index) return;
}
}
fn iterateSymbolsGlobalInternal(store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, source_index: usize, comptime callback: anytype, context: anytype, use_trail: *std.ArrayList(*const Ast.Node.Index)) error{OutOfMemory}!void {
for (handle.document_scope.scopes) |scope| {
if (source_index >= scope.range.start and source_index <= scope.range.end) {
var decl_it = scope.decls.iterator();
while (decl_it.next()) |entry| {
if (entry.value_ptr.* == .ast_node and
handle.tree.nodes.items(.tag)[entry.value_ptr.*.ast_node].isContainerField()) continue;
if (entry.value_ptr.* == .label_decl) continue;
try callback(context, DeclWithHandle{ .decl = entry.value_ptr, .handle = handle });
}
for (scope.uses) |use| {
if (std.mem.indexOfScalar(*const Ast.Node.Index, use_trail.items, use) != null) continue;
try use_trail.append(use);
const use_expr = (try resolveTypeOfNode(
store,
arena,
.{ .node = handle.tree.nodes.items(.data)[use.*].lhs, .handle = handle },
)) orelse continue;
const use_expr_node = switch (use_expr.type.data) {
.other => |n| n,
else => continue,
};
try iterateSymbolsContainerInternal(
store,
arena,
.{ .node = use_expr_node, .handle = use_expr.handle },
handle,
callback,
context,
false,
use_trail,
);
}
}
if (scope.range.start >= source_index) return;
}
}
pub fn iterateSymbolsGlobal(store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, source_index: usize, comptime callback: anytype, context: anytype) error{OutOfMemory}!void {
var use_trail = std.ArrayList(*const Ast.Node.Index).init(arena.allocator());
return try iterateSymbolsGlobalInternal(store, arena, handle, source_index, callback, context, &use_trail);
}
pub fn innermostBlockScopeIndex(handle: DocumentStore.Handle, source_index: usize) usize {
if (handle.document_scope.scopes.len == 1) return 0;
var current: usize = 0;
for (handle.document_scope.scopes[1..]) |*scope, idx| {
if (source_index >= scope.range.start and source_index <= scope.range.end) {
switch (scope.data) {
.container, .function, .block => current = idx + 1,
else => {},
}
}
if (scope.range.start > source_index) break;
}
return current;
}
pub fn innermostBlockScope(handle: DocumentStore.Handle, source_index: usize) Ast.Node.Index {
return handle.document_scope.scopes[innermostBlockScopeIndex(handle, source_index)].toNodeIndex().?;
}
pub fn innermostContainer(handle: *DocumentStore.Handle, source_index: usize) TypeWithHandle {
var current = handle.document_scope.scopes[0].data.container;
if (handle.document_scope.scopes.len == 1) return TypeWithHandle.typeVal(.{ .node = current, .handle = handle });
for (handle.document_scope.scopes[1..]) |scope| {
if (source_index >= scope.range.start and source_index <= scope.range.end) {
switch (scope.data) {
.container => |node| current = node,
else => {},
}
}
if (scope.range.start > source_index) break;
}
return TypeWithHandle.typeVal(.{ .node = current, .handle = handle });
}
fn resolveUse(store: *DocumentStore, arena: *std.heap.ArenaAllocator, uses: []const *const Ast.Node.Index, symbol: []const u8, handle: *DocumentStore.Handle) error{OutOfMemory}!?DeclWithHandle {
// If we were asked to resolve this symbol before,
// it is self-referential and we cannot resolve it.
if (std.mem.indexOfScalar([*]const u8, using_trail.items, symbol.ptr) != null)
return null;
try using_trail.append(symbol.ptr);
defer _ = using_trail.pop();
for (uses) |use| {
const index = use.*;
if (handle.tree.nodes.items(.data).len <= index) continue;
const expr = .{ .node = handle.tree.nodes.items(.data)[index].lhs, .handle = handle };
const expr_type_node = (try resolveTypeOfNode(store, arena, expr)) orelse
continue;
const expr_type = .{
.node = switch (expr_type_node.type.data) {
.other => |n| n,
else => continue,
},
.handle = expr_type_node.handle,
};
if (try lookupSymbolContainer(store, arena, expr_type, symbol, false)) |candidate| {
if (candidate.handle == handle or candidate.isPublic()) {
return candidate;
}
}
}
return null;
}
pub fn lookupLabel(handle: *DocumentStore.Handle, symbol: []const u8, source_index: usize) error{OutOfMemory}!?DeclWithHandle {
for (handle.document_scope.scopes) |scope| {
if (source_index >= scope.range.start and source_index < scope.range.end) {
if (scope.decls.getEntry(symbol)) |candidate| {
switch (candidate.value_ptr.*) {
.label_decl => {},
else => continue,
}
return DeclWithHandle{
.decl = candidate.value_ptr,
.handle = handle,
};
}
}
if (scope.range.start > source_index) return null;
}
return null;
}
pub fn lookupSymbolGlobal(store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, symbol: []const u8, source_index: usize) error{OutOfMemory}!?DeclWithHandle {
const innermost_scope_idx = innermostBlockScopeIndex(handle.*, source_index);
var curr = innermost_scope_idx;
while (curr >= 0) : (curr -= 1) {
const scope = &handle.document_scope.scopes[curr];
if (source_index >= scope.range.start and source_index <= scope.range.end) blk: {
if (scope.decls.getEntry(symbol)) |candidate| {
switch (candidate.value_ptr.*) {
.ast_node => |node| {
if (handle.tree.nodes.items(.tag)[node].isContainerField()) break :blk;
},
.label_decl => break :blk,
else => {},
}
return DeclWithHandle{
.decl = candidate.value_ptr,
.handle = handle,
};
}
if (try resolveUse(store, arena, scope.uses, symbol, handle)) |result| return result;
}
if (curr == 0) break;
}
return null;
}
pub fn lookupSymbolContainer(
store: *DocumentStore,
arena: *std.heap.ArenaAllocator,
container_handle: NodeWithHandle,
symbol: []const u8,
/// If true, we are looking up the symbol like we are accessing through a field access
/// of an instance of the type, otherwise as a field access of the type value itself.
instance_access: bool,
) error{OutOfMemory}!?DeclWithHandle {
const container = container_handle.node;
const handle = container_handle.handle;
const tree = handle.tree;
const node_tags = tree.nodes.items(.tag);
const token_tags = tree.tokens.items(.tag);
const main_token = tree.nodes.items(.main_token)[container];
const is_enum = token_tags[main_token] == .keyword_enum;
if (findContainerScope(container_handle)) |container_scope| {
if (container_scope.decls.getEntry(symbol)) |candidate| {
switch (candidate.value_ptr.*) {
.ast_node => |node| {
if (node_tags[node].isContainerField()) {
if (!instance_access and !is_enum) return null;
if (instance_access and is_enum) return null;
}
},
.label_decl => unreachable,
else => {},
}
return DeclWithHandle{ .decl = candidate.value_ptr, .handle = handle };
}
if (try resolveUse(store, arena, container_scope.uses, symbol, handle)) |result| return result;
return null;
}
return null;
}
const CompletionContext = struct {
pub fn hash(self: @This(), item: types.CompletionItem) u32 {
_ = self;
return @truncate(u32, std.hash.Wyhash.hash(0, item.label));
}
pub fn eql(self: @This(), a: types.CompletionItem, b: types.CompletionItem, b_index: usize) bool {
_ = self;
_ = b_index;
return std.mem.eql(u8, a.label, b.label);
}
};
pub const CompletionSet = std.ArrayHashMapUnmanaged(
types.CompletionItem,
void,
CompletionContext,
false,
);
comptime {
std.debug.assert(@sizeOf(types.CompletionItem) == @sizeOf(CompletionSet.Data));
}
pub const DocumentScope = struct {
scopes: []Scope,
error_completions: CompletionSet,
enum_completions: CompletionSet,
pub fn debugPrint(self: DocumentScope) void {
for (self.scopes) |scope| {
log.debug(
\\--------------------------
\\Scope {}, range: [{d}, {d})
\\ {d} usingnamespaces
\\Decls:
, .{
scope.data,
scope.range.start,
scope.range.end,
scope.uses.len,
});
var decl_it = scope.decls.iterator();
var idx: usize = 0;
while (decl_it.next()) |_| : (idx += 1) {
if (idx != 0) log.debug(", ", .{});
}
// log.debug("{s}", .{name_decl.key});
log.debug("\n--------------------------\n", .{});
}
}
pub fn deinit(self: *DocumentScope, allocator: std.mem.Allocator) void {
for (self.scopes) |*scope| {
scope.decls.deinit();
allocator.free(scope.uses);
allocator.free(scope.tests);
}
allocator.free(self.scopes);
for (self.error_completions.entries.items(.key)) |item| {
if (item.documentation) |doc| allocator.free(doc.value);
}
self.error_completions.deinit(allocator);
for (self.enum_completions.entries.items(.key)) |item| {
if (item.documentation) |doc| allocator.free(doc.value);
}
self.enum_completions.deinit(allocator);
}
};
pub const Scope = struct {
pub const Data = union(enum) {
container: Ast.Node.Index, // .tag is ContainerDecl or Root or ErrorSetDecl
function: Ast.Node.Index, // .tag is FnProto
block: Ast.Node.Index, // .tag is Block
other,
};
range: SourceRange,
decls: std.StringHashMap(Declaration),
tests: []const Ast.Node.Index = &.{},
uses: []const *const Ast.Node.Index = &.{},
data: Data,
pub fn toNodeIndex(self: Scope) ?Ast.Node.Index {
return switch (self.data) {
.container, .function, .block => |idx| idx,
else => null,
};
}
};
pub fn makeDocumentScope(allocator: std.mem.Allocator, tree: Ast) !DocumentScope {
var scopes = std.ArrayListUnmanaged(Scope){};
var error_completions = CompletionSet{};
var enum_completions = CompletionSet{};
errdefer {
scopes.deinit(allocator);
for (error_completions.entries.items(.key)) |completion| {
if (completion.documentation) |doc| allocator.free(doc.value);
}
error_completions.deinit(allocator);
for (enum_completions.entries.items(.key)) |completion| {
if (completion.documentation) |doc| allocator.free(doc.value);
}
enum_completions.deinit(allocator);
}
// pass root node index ('0')
had_root = false;
try makeScopeInternal(allocator, .{
.scopes = &scopes,
.errors = &error_completions,
.enums = &enum_completions,
.tree = tree,
}, 0);
return DocumentScope{
.scopes = scopes.toOwnedSlice(allocator),
.error_completions = error_completions,
.enum_completions = enum_completions,
};
}
fn nodeSourceRange(tree: Ast, node: Ast.Node.Index) SourceRange {
const loc_start = offsets.tokenLocation(tree, tree.firstToken(node));
const loc_end = offsets.tokenLocation(tree, ast.lastToken(tree, node));
return SourceRange{
.start = loc_start.start,
.end = loc_end.end,
};
}
const ScopeContext = struct {
scopes: *std.ArrayListUnmanaged(Scope),
enums: *CompletionSet,
errors: *CompletionSet,
tree: Ast,
};
fn makeInnerScope(allocator: std.mem.Allocator, context: ScopeContext, node_idx: Ast.Node.Index) error{OutOfMemory}!void {
const scopes = context.scopes;
const tree = context.tree;
const tags = tree.nodes.items(.tag);
const token_tags = tree.tokens.items(.tag);
const data = tree.nodes.items(.data);
const main_tokens = tree.nodes.items(.main_token);
const node_tag = tags[node_idx];
var buf: [2]Ast.Node.Index = undefined;
const ast_decls = ast.declMembers(tree, node_idx, &buf);
(try scopes.addOne(allocator)).* = .{
.range = nodeSourceRange(tree, node_idx),
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .{ .container = node_idx },
};
const scope_idx = scopes.items.len - 1;
var uses = std.ArrayListUnmanaged(*const Ast.Node.Index){};
var tests = std.ArrayListUnmanaged(Ast.Node.Index){};
errdefer {
scopes.items[scope_idx].decls.deinit();
uses.deinit(allocator);
tests.deinit(allocator);
}
if (node_tag == .error_set_decl) {
// All identifiers in main_token..data.lhs are error fields.
var i = main_tokens[node_idx];
while (i < data[node_idx].rhs) : (i += 1) {
if (token_tags[i] == .identifier) {
try context.errors.put(allocator, .{
.label = tree.tokenSlice(i),
.kind = .Constant,
.insertText = tree.tokenSlice(i),
.insertTextFormat = .PlainText,
}, {});
}
}
}
const container_decl = switch (node_tag) {
.container_decl, .container_decl_trailing => tree.containerDecl(node_idx),
.container_decl_arg, .container_decl_arg_trailing => tree.containerDeclArg(node_idx),
.container_decl_two, .container_decl_two_trailing => blk: {
var buffer: [2]Ast.Node.Index = undefined;
break :blk tree.containerDeclTwo(&buffer, node_idx);
},
.tagged_union, .tagged_union_trailing => tree.taggedUnion(node_idx),
.tagged_union_enum_tag, .tagged_union_enum_tag_trailing => tree.taggedUnionEnumTag(node_idx),
.tagged_union_two, .tagged_union_two_trailing => blk: {
var buffer: [2]Ast.Node.Index = undefined;
break :blk tree.taggedUnionTwo(&buffer, node_idx);
},
else => null,
};
// Only tagged unions and enums should pass this
const can_have_enum_completions = if (container_decl) |container| blk: {
const kind = token_tags[container.ast.main_token];
break :blk kind != .keyword_struct and
(kind != .keyword_union or container.ast.enum_token != null or container.ast.arg != 0);
} else false;
for (ast_decls) |*ptr_decl| {
const decl = ptr_decl.*;
if (tags[decl] == .@"usingnamespace") {
try uses.append(allocator, ptr_decl);
continue;
}
try makeScopeInternal(allocator, context, decl);
const name = getDeclName(tree, decl) orelse continue;
if (tags[decl] == .test_decl) {
try tests.append(allocator, decl);
continue;
}
if (try scopes.items[scope_idx].decls.fetchPut(name, .{ .ast_node = decl })) |existing| {
_ = existing;
// TODO Record a redefinition error.
}
if (!can_have_enum_completions)
continue;
const container_field = switch (tags[decl]) {
.container_field => tree.containerField(decl),
.container_field_align => tree.containerFieldAlign(decl),
.container_field_init => tree.containerFieldInit(decl),
else => null,
};
if (container_field) |_| {
if (!std.mem.eql(u8, name, "_")) {
try context.enums.put(allocator, .{
.label = name,
.kind = .Constant,
.insertText = name,
.insertTextFormat = .PlainText,
.documentation = if (try getDocComments(allocator, tree, decl, .Markdown)) |docs|
types.MarkupContent{ .kind = .Markdown, .value = docs }
else
null,
}, {});
}
}
}
scopes.items[scope_idx].tests = tests.toOwnedSlice(allocator);
scopes.items[scope_idx].uses = uses.toOwnedSlice(allocator);
}
// Whether we have already visited the root node.
var had_root = true;
fn makeScopeInternal(allocator: std.mem.Allocator, context: ScopeContext, node_idx: Ast.Node.Index) error{OutOfMemory}!void {
const scopes = context.scopes;
const tree = context.tree;
const tags = tree.nodes.items(.tag);
const token_tags = tree.tokens.items(.tag);
const data = tree.nodes.items(.data);
const main_tokens = tree.nodes.items(.main_token);
const node_tag = tags[node_idx];
if (node_idx == 0) {
if (had_root)
return
else
had_root = true;
}
switch (node_tag) {
.container_decl,
.container_decl_trailing,
.container_decl_arg,
.container_decl_arg_trailing,
.container_decl_two,
.container_decl_two_trailing,
.tagged_union,
.tagged_union_trailing,
.tagged_union_two,
.tagged_union_two_trailing,
.tagged_union_enum_tag,
.tagged_union_enum_tag_trailing,
.root,
.error_set_decl,
=> {
try makeInnerScope(allocator, context, node_idx);
},
.array_type_sentinel => {
// TODO: ???
return;
},
.fn_proto,
.fn_proto_one,
.fn_proto_simple,
.fn_proto_multi,
.fn_decl,
=> |fn_tag| {
var buf: [1]Ast.Node.Index = undefined;
const func = ast.fnProto(tree, node_idx, &buf).?;
(try scopes.addOne(allocator)).* = .{
.range = nodeSourceRange(tree, node_idx),
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .{ .function = node_idx },
};
var scope_idx = scopes.items.len - 1;
errdefer scopes.items[scope_idx].decls.deinit();
var it = func.iterate(&tree);
while (it.next()) |param| {
// Add parameter decls
if (param.name_token) |name_token| {
if (try scopes.items[scope_idx].decls.fetchPut(
tree.tokenSlice(name_token),
.{ .param_decl = param },
)) |existing| {
_ = existing;
// TODO record a redefinition error
}
}
// Visit parameter types to pick up any error sets and enum
// completions
try makeScopeInternal(allocator, context, param.type_expr);
}
if (fn_tag == .fn_decl) blk: {
if (data[node_idx].lhs == 0) break :blk;
const return_type_node = data[data[node_idx].lhs].rhs;
// Visit the return type
try makeScopeInternal(allocator, context, return_type_node);
}
// Visit the function body
try makeScopeInternal(allocator, context, data[node_idx].rhs);
},
.test_decl => {
return try makeScopeInternal(allocator, context, data[node_idx].rhs);
},
.block,
.block_semicolon,
.block_two,
.block_two_semicolon,
=> {
const first_token = tree.firstToken(node_idx);
const last_token = ast.lastToken(tree, node_idx);
// if labeled block
if (token_tags[first_token] == .identifier) {
const scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, main_tokens[node_idx]).start,
.end = offsets.tokenLocation(tree, last_token).start,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
try scope.decls.putNoClobber(tree.tokenSlice(first_token), .{ .label_decl = first_token });
}
(try scopes.addOne(allocator)).* = .{
.range = nodeSourceRange(tree, node_idx),
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .{ .block = node_idx },
};
var scope_idx = scopes.items.len - 1;
var uses = std.ArrayList(*const Ast.Node.Index).init(allocator);
errdefer {
scopes.items[scope_idx].decls.deinit();
uses.deinit();
}
const statements: []const Ast.Node.Index = switch (node_tag) {
.block, .block_semicolon => tree.extra_data[data[node_idx].lhs..data[node_idx].rhs],
.block_two, .block_two_semicolon => blk: {
const statements = &[_]Ast.Node.Index{ data[node_idx].lhs, data[node_idx].rhs };
const len: usize = if (data[node_idx].lhs == 0)
@as(usize, 0)
else if (data[node_idx].rhs == 0)
@as(usize, 1)
else
@as(usize, 2);
break :blk statements[0..len];
},
else => unreachable,
};
for (statements) |*ptr_stmt| {
const idx = ptr_stmt.*;
if (tags[idx] == .@"usingnamespace") {
try uses.append(ptr_stmt);
continue;
}
try makeScopeInternal(allocator, context, idx);
if (ast.varDecl(tree, idx)) |var_decl| {
const name = tree.tokenSlice(var_decl.ast.mut_token + 1);
if (try scopes.items[scope_idx].decls.fetchPut(name, .{ .ast_node = idx })) |existing| {
_ = existing;
// TODO record a redefinition error.
}
}
}
scopes.items[scope_idx].uses = uses.toOwnedSlice();
return;
},
.@"if",
.if_simple,
=> {
const if_node = ast.ifFull(tree, node_idx);
if (if_node.payload_token) |payload| {
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, payload).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, if_node.ast.then_expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
const name_token = payload + @boolToInt(token_tags[payload] == .asterisk);
std.debug.assert(token_tags[name_token] == .identifier);
const name = tree.tokenSlice(name_token);
try scope.decls.putNoClobber(name, .{
.pointer_payload = .{
.name = name_token,
.condition = if_node.ast.cond_expr,
},
});
}
try makeScopeInternal(allocator, context, if_node.ast.then_expr);
if (if_node.ast.else_expr != 0) {
if (if_node.error_token) |err_token| {
std.debug.assert(token_tags[err_token] == .identifier);
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, err_token).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, if_node.ast.else_expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
const name = tree.tokenSlice(err_token);
try scope.decls.putNoClobber(name, .{ .ast_node = if_node.ast.else_expr });
}
try makeScopeInternal(allocator, context, if_node.ast.else_expr);
}
},
.@"catch" => {
try makeScopeInternal(allocator, context, data[node_idx].lhs);
const catch_token = main_tokens[node_idx];
const catch_expr = data[node_idx].rhs;
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, tree.firstToken(catch_expr)).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, catch_expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
if (token_tags.len > catch_token + 2 and
token_tags[catch_token + 1] == .pipe and
token_tags[catch_token + 2] == .identifier)
{
const name = tree.tokenSlice(catch_token + 2);
try scope.decls.putNoClobber(name, .{ .ast_node = catch_expr });
}
try makeScopeInternal(allocator, context, catch_expr);
},
.@"while",
.while_simple,
.while_cont,
.@"for",
.for_simple,
=> {
const while_node = ast.whileAst(tree, node_idx).?;
const is_for = node_tag == .@"for" or node_tag == .for_simple;
if (while_node.label_token) |label| {
std.debug.assert(token_tags[label] == .identifier);
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, while_node.ast.while_token).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, node_idx)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
try scope.decls.putNoClobber(tree.tokenSlice(label), .{ .label_decl = label });
}
if (while_node.payload_token) |payload| {
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, payload).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, while_node.ast.then_expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
const name_token = payload + @boolToInt(token_tags[payload] == .asterisk);
std.debug.assert(token_tags[name_token] == .identifier);
const name = tree.tokenSlice(name_token);
try scope.decls.putNoClobber(name, if (is_for) .{
.array_payload = .{
.identifier = name_token,
.array_expr = while_node.ast.cond_expr,
},
} else .{
.pointer_payload = .{
.name = name_token,
.condition = while_node.ast.cond_expr,
},
});
// for loop with index as well
if (token_tags[name_token + 1] == .comma) {
const index_token = name_token + 2;
std.debug.assert(token_tags[index_token] == .identifier);
if (try scope.decls.fetchPut(
tree.tokenSlice(index_token),
.{ .array_index = index_token },
)) |existing| {
_ = existing;
// TODO Record a redefinition error
}
}
}
try makeScopeInternal(allocator, context, while_node.ast.then_expr);
if (while_node.ast.else_expr != 0) {
if (while_node.error_token) |err_token| {
std.debug.assert(token_tags[err_token] == .identifier);
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, err_token).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, while_node.ast.else_expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
const name = tree.tokenSlice(err_token);
try scope.decls.putNoClobber(name, .{ .ast_node = while_node.ast.else_expr });
}
try makeScopeInternal(allocator, context, while_node.ast.else_expr);
}
},
.@"switch",
.switch_comma,
=> {
const cond = data[node_idx].lhs;
const extra = tree.extraData(data[node_idx].rhs, Ast.Node.SubRange);
const cases = tree.extra_data[extra.start..extra.end];
for (cases) |case| {
const switch_case: Ast.full.SwitchCase = switch (tags[case]) {
.switch_case => tree.switchCase(case),
.switch_case_one => tree.switchCaseOne(case),
else => continue,
};
if (switch_case.payload_token) |payload| {
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, payload).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, switch_case.ast.target_expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
// if payload is *name than get next token
const name_token = payload + @boolToInt(token_tags[payload] == .asterisk);
const name = tree.tokenSlice(name_token);
try scope.decls.putNoClobber(name, .{
.switch_payload = .{
.node = name_token,
.switch_expr = cond,
.items = switch_case.ast.values,
},
});
}
try makeScopeInternal(allocator, context, switch_case.ast.target_expr);
}
},
.switch_case,
.switch_case_one,
.switch_range,
=> {
return;
},
.global_var_decl,
.local_var_decl,
.aligned_var_decl,
.simple_var_decl,
=> {
const var_decl = ast.varDecl(tree, node_idx).?;
if (var_decl.ast.type_node != 0) {
try makeScopeInternal(allocator, context, var_decl.ast.type_node);
}
if (var_decl.ast.init_node != 0) {
try makeScopeInternal(allocator, context, var_decl.ast.init_node);
}
},
.call,
.call_comma,
.call_one,
.call_one_comma,
.async_call,
.async_call_comma,
.async_call_one,
.async_call_one_comma,
=> {
var buf: [1]Ast.Node.Index = undefined;
const call = ast.callFull(tree, node_idx, &buf).?;
try makeScopeInternal(allocator, context, call.ast.fn_expr);
for (call.ast.params) |param|
try makeScopeInternal(allocator, context, param);
},
.struct_init,
.struct_init_comma,
.struct_init_dot,
.struct_init_dot_comma,
.struct_init_dot_two,
.struct_init_dot_two_comma,
.struct_init_one,
.struct_init_one_comma,
=> {
var buf: [2]Ast.Node.Index = undefined;
const struct_init: Ast.full.StructInit = switch (node_tag) {
.struct_init, .struct_init_comma => tree.structInit(node_idx),
.struct_init_dot, .struct_init_dot_comma => tree.structInitDot(node_idx),
.struct_init_dot_two, .struct_init_dot_two_comma => tree.structInitDotTwo(&buf, node_idx),
.struct_init_one, .struct_init_one_comma => tree.structInitOne(buf[0..1], node_idx),
else => unreachable,
};
if (struct_init.ast.type_expr != 0)
try makeScopeInternal(allocator, context, struct_init.ast.type_expr);
for (struct_init.ast.fields) |field| {
try makeScopeInternal(allocator, context, field);
}
},
.array_init,
.array_init_comma,
.array_init_dot,
.array_init_dot_comma,
.array_init_dot_two,
.array_init_dot_two_comma,
.array_init_one,
.array_init_one_comma,
=> {
var buf: [2]Ast.Node.Index = undefined;
const array_init: Ast.full.ArrayInit = switch (node_tag) {
.array_init, .array_init_comma => tree.arrayInit(node_idx),
.array_init_dot, .array_init_dot_comma => tree.arrayInitDot(node_idx),
.array_init_dot_two, .array_init_dot_two_comma => tree.arrayInitDotTwo(&buf, node_idx),
.array_init_one, .array_init_one_comma => tree.arrayInitOne(buf[0..1], node_idx),
else => unreachable,
};
if (array_init.ast.type_expr != 0)
try makeScopeInternal(allocator, context, array_init.ast.type_expr);
for (array_init.ast.elements) |elem| {
try makeScopeInternal(allocator, context, elem);
}
},
.container_field,
.container_field_align,
.container_field_init,
=> {
const field = ast.containerField(tree, node_idx).?;
try makeScopeInternal(allocator, context, field.ast.type_expr);
try makeScopeInternal(allocator, context, field.ast.align_expr);
try makeScopeInternal(allocator, context, field.ast.value_expr);
},
.builtin_call,
.builtin_call_comma,
.builtin_call_two,
.builtin_call_two_comma,
=> {
const b_data = data[node_idx];
const params = switch (node_tag) {
.builtin_call, .builtin_call_comma => tree.extra_data[b_data.lhs..b_data.rhs],
.builtin_call_two, .builtin_call_two_comma => if (b_data.lhs == 0)
&[_]Ast.Node.Index{}
else if (b_data.rhs == 0)
&[_]Ast.Node.Index{b_data.lhs}
else
&[_]Ast.Node.Index{ b_data.lhs, b_data.rhs },
else => unreachable,
};
for (params) |param| {
try makeScopeInternal(allocator, context, param);
}
},
.ptr_type,
.ptr_type_aligned,
.ptr_type_bit_range,
.ptr_type_sentinel,
=> {
const ptr_type: Ast.full.PtrType = ast.ptrType(tree, node_idx).?;
try makeScopeInternal(allocator, context, ptr_type.ast.sentinel);
try makeScopeInternal(allocator, context, ptr_type.ast.align_node);
try makeScopeInternal(allocator, context, ptr_type.ast.child_type);
},
.slice,
.slice_open,
.slice_sentinel,
=> {
const slice: Ast.full.Slice = switch (node_tag) {
.slice => tree.slice(node_idx),
.slice_open => tree.sliceOpen(node_idx),
.slice_sentinel => tree.sliceSentinel(node_idx),
else => unreachable,
};
try makeScopeInternal(allocator, context, slice.ast.sliced);
try makeScopeInternal(allocator, context, slice.ast.start);
try makeScopeInternal(allocator, context, slice.ast.end);
try makeScopeInternal(allocator, context, slice.ast.sentinel);
},
.@"errdefer" => {
const expr = data[node_idx].rhs;
if (data[node_idx].lhs != 0) {
const payload_token = data[node_idx].lhs;
var scope = try scopes.addOne(allocator);
scope.* = .{
.range = .{
.start = offsets.tokenLocation(tree, payload_token).start,
.end = offsets.tokenLocation(tree, ast.lastToken(tree, expr)).end,
},
.decls = std.StringHashMap(Declaration).init(allocator),
.data = .other,
};
errdefer scope.decls.deinit();
const name = tree.tokenSlice(payload_token);
try scope.decls.putNoClobber(name, .{ .ast_node = expr });
}
try makeScopeInternal(allocator, context, expr);
},
.@"asm",
.asm_simple,
.asm_output,
.asm_input,
.error_value,
.multiline_string_literal,
.string_literal,
.enum_literal,
.identifier,
.anyframe_type,
.anyframe_literal,
.char_literal,
.integer_literal,
.float_literal,
.unreachable_literal,
.@"continue",
=> {},
.@"break", .@"defer" => {
try makeScopeInternal(allocator, context, data[node_idx].rhs);
},
.@"return",
.@"resume",
.field_access,
.@"suspend",
.deref,
.@"try",
.@"await",
.optional_type,
.@"comptime",
.@"nosuspend",
.bool_not,
.negation,
.bit_not,
.negation_wrap,
.address_of,
.grouped_expression,
.unwrap_optional,
.@"usingnamespace",
=> {
try makeScopeInternal(allocator, context, data[node_idx].lhs);
},
.equal_equal,
.bang_equal,
.less_than,
.greater_than,
.less_or_equal,
.greater_or_equal,
.assign_mul,
.assign_div,
.assign_mod,
.assign_add,
.assign_sub,
.assign_shl,
.assign_shr,
.assign_bit_and,
.assign_bit_xor,
.assign_bit_or,
.assign_mul_wrap,
.assign_add_wrap,
.assign_sub_wrap,
.assign_mul_sat,
.assign_add_sat,
.assign_sub_sat,
.assign_shl_sat,
.assign,
.merge_error_sets,
.mul,
.div,
.mod,
.array_mult,
.mul_wrap,
.mul_sat,
.add,
.sub,
.array_cat,
.add_wrap,
.sub_wrap,
.add_sat,
.sub_sat,
.shl,
.shl_sat,
.shr,
.bit_and,
.bit_xor,
.bit_or,
.@"orelse",
.bool_and,
.bool_or,
.array_type,
.array_access,
.error_union,
=> {
try makeScopeInternal(allocator, context, data[node_idx].lhs);
try makeScopeInternal(allocator, context, data[node_idx].rhs);
},
}
} | src/analysis.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const assert = std.debug.assert;
const testing = std.testing;
const leb = std.leb;
const mem = std.mem;
const wasm = std.wasm;
const Module = @import("../Module.zig");
const Decl = Module.Decl;
const Type = @import("../type.zig").Type;
const Value = @import("../value.zig").Value;
const Compilation = @import("../Compilation.zig");
const LazySrcLoc = Module.LazySrcLoc;
const link = @import("../link.zig");
const TypedValue = @import("../TypedValue.zig");
const Air = @import("../Air.zig");
const Liveness = @import("../Liveness.zig");
/// Wasm Value, created when generating an instruction
const WValue = union(enum) {
/// May be referenced but is unused
none: void,
/// Index of the local variable
local: u32,
/// Holds a memoized typed value
constant: TypedValue,
/// Offset position in the list of bytecode instructions
code_offset: usize,
/// Used for variables that create multiple locals on the stack when allocated
/// such as structs and optionals.
multi_value: struct {
/// The index of the first local variable
index: u32,
/// The count of local variables this `WValue` consists of.
/// i.e. an ErrorUnion has a 'count' of 2.
count: u32,
},
};
/// Wasm ops, but without input/output/signedness information
/// Used for `buildOpcode`
const Op = enum {
@"unreachable",
nop,
block,
loop,
@"if",
@"else",
end,
br,
br_if,
br_table,
@"return",
call,
call_indirect,
drop,
select,
local_get,
local_set,
local_tee,
global_get,
global_set,
load,
store,
memory_size,
memory_grow,
@"const",
eqz,
eq,
ne,
lt,
gt,
le,
ge,
clz,
ctz,
popcnt,
add,
sub,
mul,
div,
rem,
@"and",
@"or",
xor,
shl,
shr,
rotl,
rotr,
abs,
neg,
ceil,
floor,
trunc,
nearest,
sqrt,
min,
max,
copysign,
wrap,
convert,
demote,
promote,
reinterpret,
extend,
};
/// Contains the settings needed to create an `Opcode` using `buildOpcode`.
///
/// The fields correspond to the opcode name. Here is an example
/// i32_trunc_f32_s
/// ^ ^ ^ ^
/// | | | |
/// valtype1 | | |
/// = .i32 | | |
/// | | |
/// op | |
/// = .trunc | |
/// | |
/// valtype2 |
/// = .f32 |
/// |
/// width |
/// = null |
/// |
/// signed
/// = true
///
/// There can be missing fields, here are some more examples:
/// i64_load8_u
/// --> .{ .valtype1 = .i64, .op = .load, .width = 8, signed = false }
/// i32_mul
/// --> .{ .valtype1 = .i32, .op = .trunc }
/// nop
/// --> .{ .op = .nop }
const OpcodeBuildArguments = struct {
/// First valtype in the opcode (usually represents the type of the output)
valtype1: ?wasm.Valtype = null,
/// The operation (e.g. call, unreachable, div, min, sqrt, etc.)
op: Op,
/// Width of the operation (e.g. 8 for i32_load8_s, 16 for i64_extend16_i32_s)
width: ?u8 = null,
/// Second valtype in the opcode name (usually represents the type of the input)
valtype2: ?wasm.Valtype = null,
/// Signedness of the op
signedness: ?std.builtin.Signedness = null,
};
/// Helper function that builds an Opcode given the arguments needed
fn buildOpcode(args: OpcodeBuildArguments) wasm.Opcode {
switch (args.op) {
.@"unreachable" => return .@"unreachable",
.nop => return .nop,
.block => return .block,
.loop => return .loop,
.@"if" => return .@"if",
.@"else" => return .@"else",
.end => return .end,
.br => return .br,
.br_if => return .br_if,
.br_table => return .br_table,
.@"return" => return .@"return",
.call => return .call,
.call_indirect => return .call_indirect,
.drop => return .drop,
.select => return .select,
.local_get => return .local_get,
.local_set => return .local_set,
.local_tee => return .local_tee,
.global_get => return .global_get,
.global_set => return .global_set,
.load => if (args.width) |width| switch (width) {
8 => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_load8_s else return .i32_load8_u,
.i64 => if (args.signedness.? == .signed) return .i64_load8_s else return .i64_load8_u,
.f32, .f64 => unreachable,
},
16 => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_load16_s else return .i32_load16_u,
.i64 => if (args.signedness.? == .signed) return .i64_load16_s else return .i64_load16_u,
.f32, .f64 => unreachable,
},
32 => switch (args.valtype1.?) {
.i64 => if (args.signedness.? == .signed) return .i64_load32_s else return .i64_load32_u,
.i32, .f32, .f64 => unreachable,
},
else => unreachable,
} else switch (args.valtype1.?) {
.i32 => return .i32_load,
.i64 => return .i64_load,
.f32 => return .f32_load,
.f64 => return .f64_load,
},
.store => if (args.width) |width| {
switch (width) {
8 => switch (args.valtype1.?) {
.i32 => return .i32_store8,
.i64 => return .i64_store8,
.f32, .f64 => unreachable,
},
16 => switch (args.valtype1.?) {
.i32 => return .i32_store16,
.i64 => return .i64_store16,
.f32, .f64 => unreachable,
},
32 => switch (args.valtype1.?) {
.i64 => return .i64_store32,
.i32, .f32, .f64 => unreachable,
},
else => unreachable,
}
} else {
switch (args.valtype1.?) {
.i32 => return .i32_store,
.i64 => return .i64_store,
.f32 => return .f32_store,
.f64 => return .f64_store,
}
},
.memory_size => return .memory_size,
.memory_grow => return .memory_grow,
.@"const" => switch (args.valtype1.?) {
.i32 => return .i32_const,
.i64 => return .i64_const,
.f32 => return .f32_const,
.f64 => return .f64_const,
},
.eqz => switch (args.valtype1.?) {
.i32 => return .i32_eqz,
.i64 => return .i64_eqz,
.f32, .f64 => unreachable,
},
.eq => switch (args.valtype1.?) {
.i32 => return .i32_eq,
.i64 => return .i64_eq,
.f32 => return .f32_eq,
.f64 => return .f64_eq,
},
.ne => switch (args.valtype1.?) {
.i32 => return .i32_ne,
.i64 => return .i64_ne,
.f32 => return .f32_ne,
.f64 => return .f64_ne,
},
.lt => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_lt_s else return .i32_lt_u,
.i64 => if (args.signedness.? == .signed) return .i64_lt_s else return .i64_lt_u,
.f32 => return .f32_lt,
.f64 => return .f64_lt,
},
.gt => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_gt_s else return .i32_gt_u,
.i64 => if (args.signedness.? == .signed) return .i64_gt_s else return .i64_gt_u,
.f32 => return .f32_gt,
.f64 => return .f64_gt,
},
.le => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_le_s else return .i32_le_u,
.i64 => if (args.signedness.? == .signed) return .i64_le_s else return .i64_le_u,
.f32 => return .f32_le,
.f64 => return .f64_le,
},
.ge => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_ge_s else return .i32_ge_u,
.i64 => if (args.signedness.? == .signed) return .i64_ge_s else return .i64_ge_u,
.f32 => return .f32_ge,
.f64 => return .f64_ge,
},
.clz => switch (args.valtype1.?) {
.i32 => return .i32_clz,
.i64 => return .i64_clz,
.f32, .f64 => unreachable,
},
.ctz => switch (args.valtype1.?) {
.i32 => return .i32_ctz,
.i64 => return .i64_ctz,
.f32, .f64 => unreachable,
},
.popcnt => switch (args.valtype1.?) {
.i32 => return .i32_popcnt,
.i64 => return .i64_popcnt,
.f32, .f64 => unreachable,
},
.add => switch (args.valtype1.?) {
.i32 => return .i32_add,
.i64 => return .i64_add,
.f32 => return .f32_add,
.f64 => return .f64_add,
},
.sub => switch (args.valtype1.?) {
.i32 => return .i32_sub,
.i64 => return .i64_sub,
.f32 => return .f32_sub,
.f64 => return .f64_sub,
},
.mul => switch (args.valtype1.?) {
.i32 => return .i32_mul,
.i64 => return .i64_mul,
.f32 => return .f32_mul,
.f64 => return .f64_mul,
},
.div => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_div_s else return .i32_div_u,
.i64 => if (args.signedness.? == .signed) return .i64_div_s else return .i64_div_u,
.f32 => return .f32_div,
.f64 => return .f64_div,
},
.rem => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_rem_s else return .i32_rem_u,
.i64 => if (args.signedness.? == .signed) return .i64_rem_s else return .i64_rem_u,
.f32, .f64 => unreachable,
},
.@"and" => switch (args.valtype1.?) {
.i32 => return .i32_and,
.i64 => return .i64_and,
.f32, .f64 => unreachable,
},
.@"or" => switch (args.valtype1.?) {
.i32 => return .i32_or,
.i64 => return .i64_or,
.f32, .f64 => unreachable,
},
.xor => switch (args.valtype1.?) {
.i32 => return .i32_xor,
.i64 => return .i64_xor,
.f32, .f64 => unreachable,
},
.shl => switch (args.valtype1.?) {
.i32 => return .i32_shl,
.i64 => return .i64_shl,
.f32, .f64 => unreachable,
},
.shr => switch (args.valtype1.?) {
.i32 => if (args.signedness.? == .signed) return .i32_shr_s else return .i32_shr_u,
.i64 => if (args.signedness.? == .signed) return .i64_shr_s else return .i64_shr_u,
.f32, .f64 => unreachable,
},
.rotl => switch (args.valtype1.?) {
.i32 => return .i32_rotl,
.i64 => return .i64_rotl,
.f32, .f64 => unreachable,
},
.rotr => switch (args.valtype1.?) {
.i32 => return .i32_rotr,
.i64 => return .i64_rotr,
.f32, .f64 => unreachable,
},
.abs => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_abs,
.f64 => return .f64_abs,
},
.neg => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_neg,
.f64 => return .f64_neg,
},
.ceil => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_ceil,
.f64 => return .f64_ceil,
},
.floor => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_floor,
.f64 => return .f64_floor,
},
.trunc => switch (args.valtype1.?) {
.i32 => switch (args.valtype2.?) {
.i32 => unreachable,
.i64 => unreachable,
.f32 => if (args.signedness.? == .signed) return .i32_trunc_f32_s else return .i32_trunc_f32_u,
.f64 => if (args.signedness.? == .signed) return .i32_trunc_f64_s else return .i32_trunc_f64_u,
},
.i64 => unreachable,
.f32 => return .f32_trunc,
.f64 => return .f64_trunc,
},
.nearest => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_nearest,
.f64 => return .f64_nearest,
},
.sqrt => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_sqrt,
.f64 => return .f64_sqrt,
},
.min => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_min,
.f64 => return .f64_min,
},
.max => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_max,
.f64 => return .f64_max,
},
.copysign => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => return .f32_copysign,
.f64 => return .f64_copysign,
},
.wrap => switch (args.valtype1.?) {
.i32 => switch (args.valtype2.?) {
.i32 => unreachable,
.i64 => return .i32_wrap_i64,
.f32, .f64 => unreachable,
},
.i64, .f32, .f64 => unreachable,
},
.convert => switch (args.valtype1.?) {
.i32, .i64 => unreachable,
.f32 => switch (args.valtype2.?) {
.i32 => if (args.signedness.? == .signed) return .f32_convert_i32_s else return .f32_convert_i32_u,
.i64 => if (args.signedness.? == .signed) return .f32_convert_i64_s else return .f32_convert_i64_u,
.f32, .f64 => unreachable,
},
.f64 => switch (args.valtype2.?) {
.i32 => if (args.signedness.? == .signed) return .f64_convert_i32_s else return .f64_convert_i32_u,
.i64 => if (args.signedness.? == .signed) return .f64_convert_i64_s else return .f64_convert_i64_u,
.f32, .f64 => unreachable,
},
},
.demote => if (args.valtype1.? == .f32 and args.valtype2.? == .f64) return .f32_demote_f64 else unreachable,
.promote => if (args.valtype1.? == .f64 and args.valtype2.? == .f32) return .f64_promote_f32 else unreachable,
.reinterpret => switch (args.valtype1.?) {
.i32 => if (args.valtype2.? == .f32) return .i32_reinterpret_f32 else unreachable,
.i64 => if (args.valtype2.? == .f64) return .i64_reinterpret_f64 else unreachable,
.f32 => if (args.valtype2.? == .i32) return .f32_reinterpret_i32 else unreachable,
.f64 => if (args.valtype2.? == .i64) return .f64_reinterpret_i64 else unreachable,
},
.extend => switch (args.valtype1.?) {
.i32 => switch (args.width.?) {
8 => if (args.signedness.? == .signed) return .i32_extend8_s else unreachable,
16 => if (args.signedness.? == .signed) return .i32_extend16_s else unreachable,
else => unreachable,
},
.i64 => switch (args.width.?) {
8 => if (args.signedness.? == .signed) return .i64_extend8_s else unreachable,
16 => if (args.signedness.? == .signed) return .i64_extend16_s else unreachable,
32 => if (args.signedness.? == .signed) return .i64_extend32_s else unreachable,
else => unreachable,
},
.f32, .f64 => unreachable,
},
}
}
test "Wasm - buildOpcode" {
// Make sure buildOpcode is referenced, and test some examples
const i32_const = buildOpcode(.{ .op = .@"const", .valtype1 = .i32 });
const end = buildOpcode(.{ .op = .end });
const local_get = buildOpcode(.{ .op = .local_get });
const i64_extend32_s = buildOpcode(.{ .op = .extend, .valtype1 = .i64, .width = 32, .signedness = .signed });
const f64_reinterpret_i64 = buildOpcode(.{ .op = .reinterpret, .valtype1 = .f64, .valtype2 = .i64 });
try testing.expectEqual(@as(wasm.Opcode, .i32_const), i32_const);
try testing.expectEqual(@as(wasm.Opcode, .end), end);
try testing.expectEqual(@as(wasm.Opcode, .local_get), local_get);
try testing.expectEqual(@as(wasm.Opcode, .i64_extend32_s), i64_extend32_s);
try testing.expectEqual(@as(wasm.Opcode, .f64_reinterpret_i64), f64_reinterpret_i64);
}
pub const Result = union(enum) {
/// The codegen bytes have been appended to `Context.code`
appended: void,
/// The data is managed externally and are part of the `Result`
externally_managed: []const u8,
};
/// Hashmap to store generated `WValue` for each `Air.Inst.Ref`
pub const ValueTable = std.AutoHashMapUnmanaged(Air.Inst.Index, WValue);
/// Code represents the `Code` section of wasm that
/// belongs to a function
pub const Context = struct {
/// Reference to the function declaration the code
/// section belongs to
decl: *Decl,
air: Air,
liveness: Liveness,
gpa: *mem.Allocator,
/// Table to save `WValue`'s generated by an `Air.Inst`
values: ValueTable,
/// Mapping from Air.Inst.Index to block ids
blocks: std.AutoArrayHashMapUnmanaged(Air.Inst.Index, u32) = .{},
/// `bytes` contains the wasm bytecode belonging to the 'code' section.
code: ArrayList(u8),
/// Contains the generated function type bytecode for the current function
/// found in `decl`
func_type_data: ArrayList(u8),
/// The index the next local generated will have
/// NOTE: arguments share the index with locals therefore the first variable
/// will have the index that comes after the last argument's index
local_index: u32 = 0,
/// If codegen fails, an error messages will be allocated and saved in `err_msg`
err_msg: *Module.ErrorMsg,
/// Current block depth. Used to calculate the relative difference between a break
/// and block
block_depth: u32 = 0,
/// List of all locals' types generated throughout this declaration
/// used to emit locals count at start of 'code' section.
locals: std.ArrayListUnmanaged(u8),
/// The Target we're emitting (used to call intInfo)
target: std.Target,
/// Table with the global error set. Consists of every error found in
/// the compiled code. Each error name maps to a `Module.ErrorInt` which is emitted
/// during codegen to determine the error value.
global_error_set: std.StringHashMapUnmanaged(Module.ErrorInt),
const InnerError = error{
OutOfMemory,
CodegenFail,
/// Can occur when dereferencing a pointer that points to a `Decl` of which the analysis has failed
AnalysisFail,
};
pub fn deinit(self: *Context) void {
self.values.deinit(self.gpa);
self.blocks.deinit(self.gpa);
self.locals.deinit(self.gpa);
self.* = undefined;
}
/// Sets `err_msg` on `Context` and returns `error.CodegemFail` which is caught in link/Wasm.zig
fn fail(self: *Context, comptime fmt: []const u8, args: anytype) InnerError {
const src: LazySrcLoc = .{ .node_offset = 0 };
const src_loc = src.toSrcLocWithDecl(self.decl);
self.err_msg = try Module.ErrorMsg.create(self.gpa, src_loc, fmt, args);
return error.CodegenFail;
}
/// Resolves the `WValue` for the given instruction `inst`
/// When the given instruction has a `Value`, it returns a constant instead
fn resolveInst(self: Context, ref: Air.Inst.Ref) WValue {
const inst_index = Air.refToIndex(ref) orelse {
const tv = Air.Inst.Ref.typed_value_map[@enumToInt(ref)];
if (!tv.ty.hasCodeGenBits()) {
return WValue.none;
}
return WValue{ .constant = tv };
};
const inst_type = self.air.typeOfIndex(inst_index);
if (!inst_type.hasCodeGenBits()) return .none;
if (self.air.instructions.items(.tag)[inst_index] == .constant) {
const ty_pl = self.air.instructions.items(.data)[inst_index].ty_pl;
return WValue{ .constant = .{ .ty = inst_type, .val = self.air.values[ty_pl.payload] } };
}
return self.values.get(inst_index).?; // Instruction does not dominate all uses!
}
/// Using a given `Type`, returns the corresponding wasm Valtype
fn typeToValtype(self: *Context, ty: Type) InnerError!wasm.Valtype {
return switch (ty.zigTypeTag()) {
.Float => blk: {
const bits = ty.floatBits(self.target);
if (bits == 16 or bits == 32) break :blk wasm.Valtype.f32;
if (bits == 64) break :blk wasm.Valtype.f64;
return self.fail("Float bit size not supported by wasm: '{d}'", .{bits});
},
.Int => blk: {
const info = ty.intInfo(self.target);
if (info.bits <= 32) break :blk wasm.Valtype.i32;
if (info.bits > 32 and info.bits <= 64) break :blk wasm.Valtype.i64;
return self.fail("Integer bit size not supported by wasm: '{d}'", .{info.bits});
},
.Enum => switch (ty.tag()) {
.enum_simple => wasm.Valtype.i32,
else => self.typeToValtype(ty.cast(Type.Payload.EnumFull).?.data.tag_ty),
},
.Bool,
.Pointer,
.ErrorSet,
=> wasm.Valtype.i32,
.Struct, .ErrorUnion, .Optional => unreachable, // Multi typed, must be handled individually.
else => |tag| self.fail("TODO - Wasm valtype for type '{s}'", .{tag}),
};
}
/// Using a given `Type`, returns the byte representation of its wasm value type
fn genValtype(self: *Context, ty: Type) InnerError!u8 {
return wasm.valtype(try self.typeToValtype(ty));
}
/// Using a given `Type`, returns the corresponding wasm value type
/// Differently from `genValtype` this also allows `void` to create a block
/// with no return type
fn genBlockType(self: *Context, ty: Type) InnerError!u8 {
return switch (ty.tag()) {
.void, .noreturn => wasm.block_empty,
else => self.genValtype(ty),
};
}
/// Writes the bytecode depending on the given `WValue` in `val`
fn emitWValue(self: *Context, val: WValue) InnerError!void {
const writer = self.code.writer();
switch (val) {
.multi_value => unreachable, // multi_value can never be written directly, and must be accessed individually
.none, .code_offset => {}, // no-op
.local => |idx| {
try writer.writeByte(wasm.opcode(.local_get));
try leb.writeULEB128(writer, idx);
},
.constant => |tv| try self.emitConstant(tv.val, tv.ty), // Creates a new constant on the stack
}
}
/// Creates one or multiple locals for a given `Type`.
/// Returns a corresponding `Wvalue` that can either be of tag
/// local or multi_value
fn allocLocal(self: *Context, ty: Type) InnerError!WValue {
const initial_index = self.local_index;
switch (ty.zigTypeTag()) {
.Struct => {
// for each struct field, generate a local
const struct_data: *Module.Struct = ty.castTag(.@"struct").?.data;
const fields_len = @intCast(u32, struct_data.fields.count());
try self.locals.ensureUnusedCapacity(self.gpa, fields_len);
for (struct_data.fields.values()) |*value| {
const val_type = try self.genValtype(value.ty);
self.locals.appendAssumeCapacity(val_type);
self.local_index += 1;
}
return WValue{ .multi_value = .{
.index = initial_index,
.count = fields_len,
} };
},
.ErrorUnion => {
const payload_type = ty.errorUnionPayload();
const val_type = try self.genValtype(payload_type);
// we emit the error value as the first local, and the payload as the following.
// The first local is also used to find the index of the error and payload.
//
// TODO: Add support where the payload is a type that contains multiple locals such as a struct.
try self.locals.ensureUnusedCapacity(self.gpa, 2);
self.locals.appendAssumeCapacity(wasm.valtype(.i32)); // error values are always i32
self.locals.appendAssumeCapacity(val_type);
self.local_index += 2;
return WValue{ .multi_value = .{
.index = initial_index,
.count = 2,
} };
},
.Optional => {
var opt_buf: Type.Payload.ElemType = undefined;
const child_type = ty.optionalChild(&opt_buf);
if (ty.isPtrLikeOptional()) {
return self.fail("TODO: wasm optional pointer", .{});
}
try self.locals.ensureUnusedCapacity(self.gpa, 2);
self.locals.appendAssumeCapacity(wasm.valtype(.i32)); // optional 'tag' for null-checking is always i32
self.locals.appendAssumeCapacity(try self.genValtype(child_type));
self.local_index += 2;
return WValue{ .multi_value = .{
.index = initial_index,
.count = 2,
} };
},
else => {
const valtype = try self.genValtype(ty);
try self.locals.append(self.gpa, valtype);
self.local_index += 1;
return WValue{ .local = initial_index };
},
}
}
fn genFunctype(self: *Context) InnerError!void {
assert(self.decl.has_tv);
const ty = self.decl.ty;
const writer = self.func_type_data.writer();
try writer.writeByte(wasm.function_type);
// param types
try leb.writeULEB128(writer, @intCast(u32, ty.fnParamLen()));
if (ty.fnParamLen() != 0) {
const params = try self.gpa.alloc(Type, ty.fnParamLen());
defer self.gpa.free(params);
ty.fnParamTypes(params);
for (params) |param_type| {
// Can we maybe get the source index of each param?
const val_type = try self.genValtype(param_type);
try writer.writeByte(val_type);
}
}
// return type
const return_type = ty.fnReturnType();
switch (return_type.zigTypeTag()) {
.Void, .NoReturn => try leb.writeULEB128(writer, @as(u32, 0)),
.Struct => return self.fail("TODO: Implement struct as return type for wasm", .{}),
.Optional => return self.fail("TODO: Implement optionals as return type for wasm", .{}),
.ErrorUnion => {
const val_type = try self.genValtype(return_type.errorUnionPayload());
// write down the amount of return values
try leb.writeULEB128(writer, @as(u32, 2));
try writer.writeByte(wasm.valtype(.i32)); // error code is always an i32 integer.
try writer.writeByte(val_type);
},
else => {
try leb.writeULEB128(writer, @as(u32, 1));
// Can we maybe get the source index of the return type?
const val_type = try self.genValtype(return_type);
try writer.writeByte(val_type);
},
}
}
pub fn genFunc(self: *Context) InnerError!Result {
try self.genFunctype();
// TODO: check for and handle death of instructions
// Reserve space to write the size after generating the code as well as space for locals count
try self.code.resize(10);
try self.genBody(self.air.getMainBody());
// finally, write our local types at the 'offset' position
{
leb.writeUnsignedFixed(5, self.code.items[5..10], @intCast(u32, self.locals.items.len));
// offset into 'code' section where we will put our locals types
var local_offset: usize = 10;
// emit the actual locals amount
for (self.locals.items) |local| {
var buf: [6]u8 = undefined;
leb.writeUnsignedFixed(5, buf[0..5], @as(u32, 1));
buf[5] = local;
try self.code.insertSlice(local_offset, &buf);
local_offset += 6;
}
}
const writer = self.code.writer();
try writer.writeByte(wasm.opcode(.end));
// Fill in the size of the generated code to the reserved space at the
// beginning of the buffer.
const size = self.code.items.len - 5 + self.decl.fn_link.wasm.idx_refs.items.len * 5;
leb.writeUnsignedFixed(5, self.code.items[0..5], @intCast(u32, size));
// codegen data has been appended to `code`
return Result.appended;
}
/// Generates the wasm bytecode for the declaration belonging to `Context`
pub fn gen(self: *Context, ty: Type, val: Value) InnerError!Result {
switch (ty.zigTypeTag()) {
.Fn => {
try self.genFunctype();
if (val.tag() == .extern_fn) {
return Result.appended; // don't need code body for extern functions
}
return self.fail("TODO implement wasm codegen for function pointers", .{});
},
.Array => {
if (val.castTag(.bytes)) |payload| {
if (ty.sentinel()) |sentinel| {
try self.code.appendSlice(payload.data);
switch (try self.gen(ty.elemType(), sentinel)) {
.appended => return Result.appended,
.externally_managed => |data| {
try self.code.appendSlice(data);
return Result.appended;
},
}
}
return Result{ .externally_managed = payload.data };
} else return self.fail("TODO implement gen for more kinds of arrays", .{});
},
.Int => {
const info = ty.intInfo(self.target);
if (info.bits == 8 and info.signedness == .unsigned) {
const int_byte = val.toUnsignedInt();
try self.code.append(@intCast(u8, int_byte));
return Result.appended;
}
return self.fail("TODO: Implement codegen for int type: '{}'", .{ty});
},
.Enum => {
try self.emitConstant(val, ty);
return Result.appended;
},
else => |tag| return self.fail("TODO: Implement zig type codegen for type: '{s}'", .{tag}),
}
}
fn genInst(self: *Context, inst: Air.Inst.Index) !WValue {
const air_tags = self.air.instructions.items(.tag);
return switch (air_tags[inst]) {
.add => self.airBinOp(inst, .add),
.addwrap => self.airWrapBinOp(inst, .add),
.sub => self.airBinOp(inst, .sub),
.subwrap => self.airWrapBinOp(inst, .sub),
.mul => self.airBinOp(inst, .mul),
.mulwrap => self.airWrapBinOp(inst, .mul),
.div => self.airBinOp(inst, .div),
.bit_and => self.airBinOp(inst, .@"and"),
.bit_or => self.airBinOp(inst, .@"or"),
.bool_and => self.airBinOp(inst, .@"and"),
.bool_or => self.airBinOp(inst, .@"or"),
.xor => self.airBinOp(inst, .xor),
.cmp_eq => self.airCmp(inst, .eq),
.cmp_gte => self.airCmp(inst, .gte),
.cmp_gt => self.airCmp(inst, .gt),
.cmp_lte => self.airCmp(inst, .lte),
.cmp_lt => self.airCmp(inst, .lt),
.cmp_neq => self.airCmp(inst, .neq),
.alloc => self.airAlloc(inst),
.arg => self.airArg(inst),
.bitcast => self.airBitcast(inst),
.block => self.airBlock(inst),
.breakpoint => self.airBreakpoint(inst),
.br => self.airBr(inst),
.call => self.airCall(inst),
.cond_br => self.airCondBr(inst),
.constant => unreachable,
.dbg_stmt => WValue.none,
.intcast => self.airIntcast(inst),
.is_err => self.airIsErr(inst, .i32_ne),
.is_non_err => self.airIsErr(inst, .i32_eq),
.is_null => self.airIsNull(inst, .i32_ne),
.is_non_null => self.airIsNull(inst, .i32_eq),
.is_null_ptr => self.airIsNull(inst, .i32_ne),
.is_non_null_ptr => self.airIsNull(inst, .i32_eq),
.load => self.airLoad(inst),
.loop => self.airLoop(inst),
.not => self.airNot(inst),
.ret => self.airRet(inst),
.store => self.airStore(inst),
.struct_field_ptr => self.airStructFieldPtr(inst),
.switch_br => self.airSwitchBr(inst),
.unreach => self.airUnreachable(inst),
.wrap_optional => self.airWrapOptional(inst),
.unwrap_errunion_payload => self.airUnwrapErrUnionPayload(inst),
.wrap_errunion_payload => self.airWrapErrUnionPayload(inst),
.optional_payload => self.airOptionalPayload(inst),
.optional_payload_ptr => self.airOptionalPayload(inst),
else => |tag| self.fail("TODO: Implement wasm inst: {s}", .{@tagName(tag)}),
};
}
fn genBody(self: *Context, body: []const Air.Inst.Index) InnerError!void {
for (body) |inst| {
const result = try self.genInst(inst);
try self.values.putNoClobber(self.gpa, inst, result);
}
}
fn airRet(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const un_op = self.air.instructions.items(.data)[inst].un_op;
const operand = self.resolveInst(un_op);
try self.emitWValue(operand);
try self.code.append(wasm.opcode(.@"return"));
return .none;
}
fn airCall(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const pl_op = self.air.instructions.items(.data)[inst].pl_op;
const extra = self.air.extraData(Air.Call, pl_op.payload);
const args = self.air.extra[extra.end..][0..extra.data.args_len];
const target: *Decl = blk: {
const func_val = self.air.value(pl_op.operand).?;
if (func_val.castTag(.function)) |func| {
break :blk func.data.owner_decl;
} else if (func_val.castTag(.extern_fn)) |ext_fn| {
break :blk ext_fn.data;
}
return self.fail("Expected a function, but instead found type '{s}'", .{func_val.tag()});
};
for (args) |arg| {
const arg_val = self.resolveInst(@intToEnum(Air.Inst.Ref, arg));
try self.emitWValue(arg_val);
}
try self.code.append(wasm.opcode(.call));
// The function index immediate argument will be filled in using this data
// in link.Wasm.flush().
try self.decl.fn_link.wasm.idx_refs.append(self.gpa, .{
.offset = @intCast(u32, self.code.items.len),
.decl = target,
});
return .none;
}
fn airAlloc(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const elem_type = self.air.typeOfIndex(inst).elemType();
return self.allocLocal(elem_type);
}
fn airStore(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
const writer = self.code.writer();
const lhs = self.resolveInst(bin_op.lhs);
const rhs = self.resolveInst(bin_op.rhs);
switch (lhs) {
.multi_value => |multi_value| switch (rhs) {
// When assigning a value to a multi_value such as a struct,
// we simply assign the local_index to the rhs one.
// This allows us to update struct fields without having to individually
// set each local as each field's index will be calculated off the struct's base index
.multi_value => self.values.put(self.gpa, Air.refToIndex(bin_op.lhs).?, rhs) catch unreachable, // Instruction does not dominate all uses!
.constant, .none => {
// emit all values onto the stack if constant
try self.emitWValue(rhs);
// for each local, pop the stack value into the local
// As the last element is on top of the stack, we must populate the locals
// in reverse.
var i: u32 = multi_value.count;
while (i > 0) : (i -= 1) {
try writer.writeByte(wasm.opcode(.local_set));
try leb.writeULEB128(writer, multi_value.index + i - 1);
}
},
.local => {
// This can occur when we wrap a single value into a multi-value,
// such as wrapping a non-optional value into an optional.
// This means we must zero the null-tag, and set the payload.
assert(multi_value.count == 2);
// set null-tag
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeULEB128(writer, @as(u32, 0));
try writer.writeByte(wasm.opcode(.local_set));
try leb.writeULEB128(writer, multi_value.index);
// set payload
try self.emitWValue(rhs);
try writer.writeByte(wasm.opcode(.local_set));
try leb.writeULEB128(writer, multi_value.index + 1);
},
else => unreachable,
},
.local => |local| {
try self.emitWValue(rhs);
try writer.writeByte(wasm.opcode(.local_set));
try leb.writeULEB128(writer, local);
},
else => unreachable,
}
return .none;
}
fn airLoad(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
return self.resolveInst(ty_op.operand);
}
fn airArg(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
_ = inst;
// arguments share the index with locals
defer self.local_index += 1;
return WValue{ .local = self.local_index };
}
fn airBinOp(self: *Context, inst: Air.Inst.Index, op: Op) InnerError!WValue {
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
const lhs = self.resolveInst(bin_op.lhs);
const rhs = self.resolveInst(bin_op.rhs);
// it's possible for both lhs and/or rhs to return an offset as well,
// in which case we return the first offset occurance we find.
const offset = blk: {
if (lhs == .code_offset) break :blk lhs.code_offset;
if (rhs == .code_offset) break :blk rhs.code_offset;
break :blk self.code.items.len;
};
try self.emitWValue(lhs);
try self.emitWValue(rhs);
const bin_ty = self.air.typeOf(bin_op.lhs);
const opcode: wasm.Opcode = buildOpcode(.{
.op = op,
.valtype1 = try self.typeToValtype(bin_ty),
.signedness = if (bin_ty.isSignedInt()) .signed else .unsigned,
});
try self.code.append(wasm.opcode(opcode));
return WValue{ .code_offset = offset };
}
fn airWrapBinOp(self: *Context, inst: Air.Inst.Index, op: Op) InnerError!WValue {
const bin_op = self.air.instructions.items(.data)[inst].bin_op;
const lhs = self.resolveInst(bin_op.lhs);
const rhs = self.resolveInst(bin_op.rhs);
// it's possible for both lhs and/or rhs to return an offset as well,
// in which case we return the first offset occurance we find.
const offset = blk: {
if (lhs == .code_offset) break :blk lhs.code_offset;
if (rhs == .code_offset) break :blk rhs.code_offset;
break :blk self.code.items.len;
};
try self.emitWValue(lhs);
try self.emitWValue(rhs);
const bin_ty = self.air.typeOf(bin_op.lhs);
const opcode: wasm.Opcode = buildOpcode(.{
.op = op,
.valtype1 = try self.typeToValtype(bin_ty),
.signedness = if (bin_ty.isSignedInt()) .signed else .unsigned,
});
try self.code.append(wasm.opcode(opcode));
const int_info = bin_ty.intInfo(self.target);
const bitsize = int_info.bits;
const is_signed = int_info.signedness == .signed;
// if target type bitsize is x < 32 and 32 > x < 64, we perform
// result & ((1<<N)-1) where N = bitsize or bitsize -1 incase of signed.
if (bitsize != 32 and bitsize < 64) {
// first check if we can use a single instruction,
// wasm provides those if the integers are signed and 8/16-bit.
// For arbitrary integer sizes, we use the algorithm mentioned above.
if (is_signed and bitsize == 8) {
try self.code.append(wasm.opcode(.i32_extend8_s));
} else if (is_signed and bitsize == 16) {
try self.code.append(wasm.opcode(.i32_extend16_s));
} else {
const result = (@as(u64, 1) << @intCast(u6, bitsize - @boolToInt(is_signed))) - 1;
if (bitsize < 32) {
try self.code.append(wasm.opcode(.i32_const));
try leb.writeILEB128(self.code.writer(), @bitCast(i32, @intCast(u32, result)));
try self.code.append(wasm.opcode(.i32_and));
} else {
try self.code.append(wasm.opcode(.i64_const));
try leb.writeILEB128(self.code.writer(), @bitCast(i64, result));
try self.code.append(wasm.opcode(.i64_and));
}
}
} else if (int_info.bits > 64) {
return self.fail("TODO wasm: Integer wrapping for bitsizes larger than 64", .{});
}
return WValue{ .code_offset = offset };
}
fn emitConstant(self: *Context, val: Value, ty: Type) InnerError!void {
const writer = self.code.writer();
switch (ty.zigTypeTag()) {
.Int => {
// write opcode
const opcode: wasm.Opcode = buildOpcode(.{
.op = .@"const",
.valtype1 = try self.typeToValtype(ty),
});
try writer.writeByte(wasm.opcode(opcode));
const int_info = ty.intInfo(self.target);
// write constant
switch (int_info.signedness) {
.signed => try leb.writeILEB128(writer, val.toSignedInt()),
.unsigned => switch (int_info.bits) {
0...32 => try leb.writeILEB128(writer, @bitCast(i32, @intCast(u32, val.toUnsignedInt()))),
33...64 => try leb.writeILEB128(writer, @bitCast(i64, val.toUnsignedInt())),
else => |bits| return self.fail("Wasm TODO: emitConstant for integer with {d} bits", .{bits}),
},
}
},
.Bool => {
// write opcode
try writer.writeByte(wasm.opcode(.i32_const));
// write constant
try leb.writeILEB128(writer, val.toSignedInt());
},
.Float => {
// write opcode
const opcode: wasm.Opcode = buildOpcode(.{
.op = .@"const",
.valtype1 = try self.typeToValtype(ty),
});
try writer.writeByte(wasm.opcode(opcode));
// write constant
switch (ty.floatBits(self.target)) {
0...32 => try writer.writeIntLittle(u32, @bitCast(u32, val.toFloat(f32))),
64 => try writer.writeIntLittle(u64, @bitCast(u64, val.toFloat(f64))),
else => |bits| return self.fail("Wasm TODO: emitConstant for float with {d} bits", .{bits}),
}
},
.Pointer => {
if (val.castTag(.decl_ref)) |payload| {
const decl = payload.data;
decl.alive = true;
// offset into the offset table within the 'data' section
const ptr_width = self.target.cpu.arch.ptrBitWidth() / 8;
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeULEB128(writer, decl.link.wasm.offset_index * ptr_width);
// memory instruction followed by their memarg immediate
// memarg ::== x:u32, y:u32 => {align x, offset y}
try writer.writeByte(wasm.opcode(.i32_load));
try leb.writeULEB128(writer, @as(u32, 0));
try leb.writeULEB128(writer, @as(u32, 0));
} else return self.fail("Wasm TODO: emitConstant for other const pointer tag {s}", .{val.tag()});
},
.Void => {},
.Enum => {
if (val.castTag(.enum_field_index)) |field_index| {
switch (ty.tag()) {
.enum_simple => {
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeULEB128(writer, field_index.data);
},
.enum_full, .enum_nonexhaustive => {
const enum_full = ty.cast(Type.Payload.EnumFull).?.data;
if (enum_full.values.count() != 0) {
const tag_val = enum_full.values.keys()[field_index.data];
try self.emitConstant(tag_val, enum_full.tag_ty);
} else {
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeULEB128(writer, field_index.data);
}
},
else => unreachable,
}
} else {
var int_tag_buffer: Type.Payload.Bits = undefined;
const int_tag_ty = ty.intTagType(&int_tag_buffer);
try self.emitConstant(val, int_tag_ty);
}
},
.ErrorSet => {
const error_index = self.global_error_set.get(val.getError().?).?;
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeULEB128(writer, error_index);
},
.ErrorUnion => {
const data = val.castTag(.error_union).?.data;
const error_type = ty.errorUnionSet();
const payload_type = ty.errorUnionPayload();
if (val.getError()) |_| {
// write the error val
try self.emitConstant(data, error_type);
// no payload, so write a '0' const
const opcode: wasm.Opcode = buildOpcode(.{
.op = .@"const",
.valtype1 = try self.typeToValtype(payload_type),
});
try writer.writeByte(wasm.opcode(opcode));
try leb.writeULEB128(writer, @as(u32, 0));
} else {
// no error, so write a '0' const
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeULEB128(writer, @as(u32, 0));
// after the error code, we emit the payload
try self.emitConstant(data, payload_type);
}
},
.Optional => {
var buf: Type.Payload.ElemType = undefined;
const payload_type = ty.optionalChild(&buf);
if (ty.isPtrLikeOptional()) {
return self.fail("Wasm TODO: emitConstant for optional pointer", .{});
}
// When constant has value 'null', set is_null local to '1'
// and payload to '0'
if (val.tag() == .null_value) {
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeILEB128(writer, @as(i32, 1));
const opcode: wasm.Opcode = buildOpcode(.{
.op = .@"const",
.valtype1 = try self.typeToValtype(payload_type),
});
try writer.writeByte(wasm.opcode(opcode));
try leb.writeULEB128(writer, @as(u32, 0));
} else {
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeILEB128(writer, @as(i32, 0));
try self.emitConstant(val, payload_type);
}
},
else => |zig_type| return self.fail("Wasm TODO: emitConstant for zigTypeTag {s}", .{zig_type}),
}
}
/// Returns a `Value` as a signed 32 bit value.
/// It's illegal to provide a value with a type that cannot be represented
/// as an integer value.
fn valueAsI32(self: Context, val: Value, ty: Type) i32 {
switch (ty.zigTypeTag()) {
.Enum => {
if (val.castTag(.enum_field_index)) |field_index| {
switch (ty.tag()) {
.enum_simple => return @bitCast(i32, field_index.data),
.enum_full, .enum_nonexhaustive => {
const enum_full = ty.cast(Type.Payload.EnumFull).?.data;
if (enum_full.values.count() != 0) {
const tag_val = enum_full.values.keys()[field_index.data];
return self.valueAsI32(tag_val, enum_full.tag_ty);
} else return @bitCast(i32, field_index.data);
},
else => unreachable,
}
} else {
var int_tag_buffer: Type.Payload.Bits = undefined;
const int_tag_ty = ty.intTagType(&int_tag_buffer);
return self.valueAsI32(val, int_tag_ty);
}
},
.Int => switch (ty.intInfo(self.target).signedness) {
.signed => return @truncate(i32, val.toSignedInt()),
.unsigned => return @bitCast(i32, @truncate(u32, val.toUnsignedInt())),
},
.ErrorSet => {
const error_index = self.global_error_set.get(val.getError().?).?;
return @bitCast(i32, error_index);
},
else => unreachable, // Programmer called this function for an illegal type
}
}
fn airBlock(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
const block_ty = try self.genBlockType(self.air.getRefType(ty_pl.ty));
const extra = self.air.extraData(Air.Block, ty_pl.payload);
const body = self.air.extra[extra.end..][0..extra.data.body_len];
try self.startBlock(.block, block_ty, null);
// Here we set the current block idx, so breaks know the depth to jump
// to when breaking out.
try self.blocks.putNoClobber(self.gpa, inst, self.block_depth);
try self.genBody(body);
try self.endBlock();
return .none;
}
/// appends a new wasm block to the code section and increases the `block_depth` by 1
fn startBlock(self: *Context, block_type: wasm.Opcode, valtype: u8, with_offset: ?usize) !void {
self.block_depth += 1;
if (with_offset) |offset| {
try self.code.insert(offset, wasm.opcode(block_type));
try self.code.insert(offset + 1, valtype);
} else {
try self.code.append(wasm.opcode(block_type));
try self.code.append(valtype);
}
}
/// Ends the current wasm block and decreases the `block_depth` by 1
fn endBlock(self: *Context) !void {
try self.code.append(wasm.opcode(.end));
self.block_depth -= 1;
}
fn airLoop(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
const loop = self.air.extraData(Air.Block, ty_pl.payload);
const body = self.air.extra[loop.end..][0..loop.data.body_len];
// result type of loop is always 'noreturn', meaning we can always
// emit the wasm type 'block_empty'.
try self.startBlock(.loop, wasm.block_empty, null);
try self.genBody(body);
// breaking to the index of a loop block will continue the loop instead
try self.code.append(wasm.opcode(.br));
try leb.writeULEB128(self.code.writer(), @as(u32, 0));
try self.endBlock();
return .none;
}
fn airCondBr(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const pl_op = self.air.instructions.items(.data)[inst].pl_op;
const condition = self.resolveInst(pl_op.operand);
const extra = self.air.extraData(Air.CondBr, pl_op.payload);
const then_body = self.air.extra[extra.end..][0..extra.data.then_body_len];
const else_body = self.air.extra[extra.end + then_body.len ..][0..extra.data.else_body_len];
const writer = self.code.writer();
// TODO: Handle death instructions for then and else body
// insert blocks at the position of `offset` so
// the condition can jump to it
const offset = switch (condition) {
.code_offset => |offset| offset,
else => blk: {
const offset = self.code.items.len;
try self.emitWValue(condition);
break :blk offset;
},
};
// result type is always noreturn, so use `block_empty` as type.
try self.startBlock(.block, wasm.block_empty, offset);
// we inserted the block in front of the condition
// so now check if condition matches. If not, break outside this block
// and continue with the then codepath
try writer.writeByte(wasm.opcode(.br_if));
try leb.writeULEB128(writer, @as(u32, 0));
try self.genBody(else_body);
try self.endBlock();
// Outer block that matches the condition
try self.genBody(then_body);
return .none;
}
fn airCmp(self: *Context, inst: Air.Inst.Index, op: std.math.CompareOperator) InnerError!WValue {
// save offset, so potential conditions can insert blocks in front of
// the comparison that we can later jump back to
const offset = self.code.items.len;
const data: Air.Inst.Data = self.air.instructions.items(.data)[inst];
const lhs = self.resolveInst(data.bin_op.lhs);
const rhs = self.resolveInst(data.bin_op.rhs);
const lhs_ty = self.air.typeOf(data.bin_op.lhs);
try self.emitWValue(lhs);
try self.emitWValue(rhs);
const signedness: std.builtin.Signedness = blk: {
// by default we tell the operand type is unsigned (i.e. bools and enum values)
if (lhs_ty.zigTypeTag() != .Int) break :blk .unsigned;
// incase of an actual integer, we emit the correct signedness
break :blk lhs_ty.intInfo(self.target).signedness;
};
const opcode: wasm.Opcode = buildOpcode(.{
.valtype1 = try self.typeToValtype(lhs_ty),
.op = switch (op) {
.lt => .lt,
.lte => .le,
.eq => .eq,
.neq => .ne,
.gte => .ge,
.gt => .gt,
},
.signedness = signedness,
});
try self.code.append(wasm.opcode(opcode));
return WValue{ .code_offset = offset };
}
fn airBr(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const br = self.air.instructions.items(.data)[inst].br;
// if operand has codegen bits we should break with a value
if (self.air.typeOf(br.operand).hasCodeGenBits()) {
try self.emitWValue(self.resolveInst(br.operand));
}
// We map every block to its block index.
// We then determine how far we have to jump to it by substracting it from current block depth
const idx: u32 = self.block_depth - self.blocks.get(br.block_inst).?;
const writer = self.code.writer();
try writer.writeByte(wasm.opcode(.br));
try leb.writeULEB128(writer, idx);
return .none;
}
fn airNot(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
const offset = self.code.items.len;
const operand = self.resolveInst(ty_op.operand);
try self.emitWValue(operand);
// wasm does not have booleans nor the `not` instruction, therefore compare with 0
// to create the same logic
const writer = self.code.writer();
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeILEB128(writer, @as(i32, 0));
try writer.writeByte(wasm.opcode(.i32_eq));
return WValue{ .code_offset = offset };
}
fn airBreakpoint(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
_ = self;
_ = inst;
// unsupported by wasm itself. Can be implemented once we support DWARF
// for wasm
return .none;
}
fn airUnreachable(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
_ = inst;
try self.code.append(wasm.opcode(.@"unreachable"));
return .none;
}
fn airBitcast(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
return self.resolveInst(ty_op.operand);
}
fn airStructFieldPtr(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
const extra = self.air.extraData(Air.StructField, ty_pl.payload);
const struct_ptr = self.resolveInst(extra.data.struct_operand);
return WValue{ .local = struct_ptr.multi_value.index + @intCast(u32, extra.data.field_index) };
}
fn airSwitchBr(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
// result type is always 'noreturn'
const blocktype = wasm.block_empty;
const pl_op = self.air.instructions.items(.data)[inst].pl_op;
const target = self.resolveInst(pl_op.operand);
const target_ty = self.air.typeOf(pl_op.operand);
const switch_br = self.air.extraData(Air.SwitchBr, pl_op.payload);
var extra_index: usize = switch_br.end;
var case_i: u32 = 0;
// a list that maps each value with its value and body based on the order inside the list.
const CaseValue = struct { integer: i32, value: Value };
var case_list = try std.ArrayList(struct {
values: []const CaseValue,
body: []const Air.Inst.Index,
}).initCapacity(self.gpa, switch_br.data.cases_len);
defer for (case_list.items) |case| {
self.gpa.free(case.values);
} else case_list.deinit();
var lowest: i32 = 0;
var highest: i32 = 0;
while (case_i < switch_br.data.cases_len) : (case_i += 1) {
const case = self.air.extraData(Air.SwitchBr.Case, extra_index);
const items = @bitCast([]const Air.Inst.Ref, self.air.extra[case.end..][0..case.data.items_len]);
const case_body = self.air.extra[case.end + items.len ..][0..case.data.body_len];
extra_index = case.end + items.len + case_body.len;
const values = try self.gpa.alloc(CaseValue, items.len);
errdefer self.gpa.free(values);
for (items) |ref, i| {
const item_val = self.air.value(ref).?;
const int_val = self.valueAsI32(item_val, target_ty);
if (int_val < lowest) {
lowest = int_val;
}
if (int_val > highest) {
highest = int_val;
}
values[i] = .{ .integer = int_val, .value = item_val };
}
case_list.appendAssumeCapacity(.{ .values = values, .body = case_body });
try self.startBlock(.block, blocktype, null);
}
// When the highest and lowest values are seperated by '50',
// we define it as sparse and use an if/else-chain, rather than a jump table.
// When the target is an integer size larger than u32, we have no way to use the value
// as an index, therefore we also use an if/else-chain for those cases.
// TODO: Benchmark this to find a proper value, LLVM seems to draw the line at '40~45'.
const is_sparse = highest - lowest > 50 or target_ty.bitSize(self.target) > 32;
const else_body = self.air.extra[extra_index..][0..switch_br.data.else_body_len];
const has_else_body = else_body.len != 0;
if (has_else_body) {
try self.startBlock(.block, blocktype, null);
}
if (!is_sparse) {
// Generate the jump table 'br_table' when the prongs are not sparse.
// The value 'target' represents the index into the table.
// Each index in the table represents a label to the branch
// to jump to.
try self.startBlock(.block, blocktype, null);
try self.emitWValue(target);
if (lowest < 0) {
// since br_table works using indexes, starting from '0', we must ensure all values
// we put inside, are atleast 0.
try self.code.append(wasm.opcode(.i32_const));
try leb.writeILEB128(self.code.writer(), lowest * -1);
try self.code.append(wasm.opcode(.i32_add));
}
try self.code.append(wasm.opcode(.br_table));
const depth = highest - lowest + @boolToInt(has_else_body);
try leb.writeILEB128(self.code.writer(), depth);
while (lowest <= highest) : (lowest += 1) {
// idx represents the branch we jump to
const idx = blk: {
for (case_list.items) |case, idx| {
for (case.values) |case_value| {
if (case_value.integer == lowest) break :blk @intCast(u32, idx);
}
}
break :blk if (has_else_body) case_i else unreachable;
};
try leb.writeULEB128(self.code.writer(), idx);
} else if (has_else_body) {
try leb.writeULEB128(self.code.writer(), @as(u32, case_i)); // default branch
}
try self.endBlock();
}
const signedness: std.builtin.Signedness = blk: {
// by default we tell the operand type is unsigned (i.e. bools and enum values)
if (target_ty.zigTypeTag() != .Int) break :blk .unsigned;
// incase of an actual integer, we emit the correct signedness
break :blk target_ty.intInfo(self.target).signedness;
};
for (case_list.items) |case| {
// when sparse, we use if/else-chain, so emit conditional checks
if (is_sparse) {
// for single value prong we can emit a simple if
if (case.values.len == 1) {
try self.emitWValue(target);
try self.emitConstant(case.values[0].value, target_ty);
const opcode = buildOpcode(.{
.valtype1 = try self.typeToValtype(target_ty),
.op = .ne, // not equal, because we want to jump out of this block if it does not match the condition.
.signedness = signedness,
});
try self.code.append(wasm.opcode(opcode));
try self.code.append(wasm.opcode(.br_if));
try leb.writeULEB128(self.code.writer(), @as(u32, 0));
} else {
// in multi-value prongs we must check if any prongs match the target value.
try self.startBlock(.block, blocktype, null);
for (case.values) |value| {
try self.emitWValue(target);
try self.emitConstant(value.value, target_ty);
const opcode = buildOpcode(.{
.valtype1 = try self.typeToValtype(target_ty),
.op = .eq,
.signedness = signedness,
});
try self.code.append(wasm.opcode(opcode));
try self.code.append(wasm.opcode(.br_if));
try leb.writeULEB128(self.code.writer(), @as(u32, 0));
}
// value did not match any of the prong values
try self.code.append(wasm.opcode(.br));
try leb.writeULEB128(self.code.writer(), @as(u32, 1));
try self.endBlock();
}
}
try self.genBody(case.body);
try self.endBlock();
}
if (has_else_body) {
try self.genBody(else_body);
try self.endBlock();
}
return .none;
}
fn airIsErr(self: *Context, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!WValue {
const un_op = self.air.instructions.items(.data)[inst].un_op;
const operand = self.resolveInst(un_op);
const offset = self.code.items.len;
const writer = self.code.writer();
// load the error value which is positioned at multi_value's index
try self.emitWValue(.{ .local = operand.multi_value.index });
// Compare the error value with '0'
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeILEB128(writer, @as(i32, 0));
try writer.writeByte(@enumToInt(opcode));
return WValue{ .code_offset = offset };
}
fn airUnwrapErrUnionPayload(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
const operand = self.resolveInst(ty_op.operand);
// The index of multi_value contains the error code. To get the initial index of the payload we get
// the following index. Next, convert it to a `WValue.local`
//
// TODO: Check if payload is a type that requires a multi_value as well and emit that instead. i.e. a struct.
return WValue{ .local = operand.multi_value.index + 1 };
}
fn airWrapErrUnionPayload(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
return self.resolveInst(ty_op.operand);
}
fn airIntcast(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
const ty = self.air.getRefType(ty_op.ty);
const operand = self.resolveInst(ty_op.operand);
const ref_ty = self.air.typeOf(ty_op.operand);
const ref_info = ref_ty.intInfo(self.target);
const op_bits = ref_info.bits;
const wanted_bits = ty.intInfo(self.target).bits;
try self.emitWValue(operand);
if (op_bits > 32 and wanted_bits <= 32) {
try self.code.append(wasm.opcode(.i32_wrap_i64));
} else if (op_bits <= 32 and wanted_bits > 32) {
try self.code.append(wasm.opcode(switch (ref_info.signedness) {
.signed => .i64_extend_i32_s,
.unsigned => .i64_extend_i32_u,
}));
}
// other cases are no-op
return .none;
}
fn airIsNull(self: *Context, inst: Air.Inst.Index, opcode: wasm.Opcode) InnerError!WValue {
const un_op = self.air.instructions.items(.data)[inst].un_op;
const operand = self.resolveInst(un_op);
// const offset = self.code.items.len;
const writer = self.code.writer();
// load the null value which is positioned at multi_value's index
try self.emitWValue(.{ .local = operand.multi_value.index });
// Compare the null value with '0'
try writer.writeByte(wasm.opcode(.i32_const));
try leb.writeILEB128(writer, @as(i32, 0));
try writer.writeByte(@enumToInt(opcode));
// we save the result in a new local
const local = try self.allocLocal(Type.initTag(.i32));
try writer.writeByte(wasm.opcode(.local_set));
try leb.writeULEB128(writer, local.local);
return local;
}
fn airOptionalPayload(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
const operand = self.resolveInst(ty_op.operand);
return WValue{ .local = operand.multi_value.index + 1 };
}
fn airWrapOptional(self: *Context, inst: Air.Inst.Index) InnerError!WValue {
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
return self.resolveInst(ty_op.operand);
}
}; | src/codegen/wasm.zig |
const compiler_rt_armhf_target = false; // TODO
const ConditionalOperator = enum {
Eq,
Lt,
Le,
Ge,
Gt,
};
pub nakedcc fn __aeabi_dcmpeq() noreturn {
@setRuntimeSafety(false);
@call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Eq});
unreachable;
}
pub nakedcc fn __aeabi_dcmplt() noreturn {
@setRuntimeSafety(false);
@call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Lt});
unreachable;
}
pub nakedcc fn __aeabi_dcmple() noreturn {
@setRuntimeSafety(false);
@call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Le});
unreachable;
}
pub nakedcc fn __aeabi_dcmpge() noreturn {
@setRuntimeSafety(false);
@call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Ge});
unreachable;
}
pub nakedcc fn __aeabi_dcmpgt() noreturn {
@setRuntimeSafety(false);
@call(.{ .modifier = .always_inline }, aeabi_dcmp, .{.Gt});
unreachable;
}
inline fn convert_dcmp_args_to_df2_args() void {
asm volatile (
\\ vmov d0, r0, r1
\\ vmov d1, r2, r3
);
}
fn aeabi_dcmp(comptime cond: ConditionalOperator) void {
@setRuntimeSafety(false);
asm volatile (
\\ push { r4, lr }
);
if (compiler_rt_armhf_target) {
convert_dcmp_args_to_df2_args();
}
switch (cond) {
.Eq => asm volatile (
\\ bl __eqdf2
\\ cmp r0, #0
\\ beq 1f
\\ movs r0, #0
\\ pop { r4, pc }
\\ 1:
),
.Lt => asm volatile (
\\ bl __ltdf2
\\ cmp r0, #0
\\ blt 1f
\\ movs r0, #0
\\ pop { r4, pc }
\\ 1:
),
.Le => asm volatile (
\\ bl __ledf2
\\ cmp r0, #0
\\ ble 1f
\\ movs r0, #0
\\ pop { r4, pc }
\\ 1:
),
.Ge => asm volatile (
\\ bl __ltdf2
\\ cmp r0, #0
\\ bge 1f
\\ movs r0, #0
\\ pop { r4, pc }
\\ 1:
),
.Gt => asm volatile (
\\ bl __gtdf2
\\ cmp r0, #0
\\ bgt 1f
\\ movs r0, #0
\\ pop { r4, pc }
\\ 1:
),
}
asm volatile (
\\ movs r0, #1
\\ pop { r4, pc }
);
} | lib/std/special/compiler_rt/arm/aeabi_dcmp.zig |
const std = @import("std");
const zzz = @import("zzz");
const version = @import("version");
const Package = @import("Package.zig");
const Dependency = @import("Dependency.zig");
usingnamespace @import("common.zig");
const Self = @This();
allocator: *std.mem.Allocator,
text: []const u8,
packages: std.StringHashMap(Package),
dependencies: std.ArrayList(Dependency),
build_dependencies: std.ArrayList(Dependency),
pub const Iterator = struct {
inner: std.StringHashMap(Package).Iterator,
pub fn next(self: *Iterator) ?*Package {
return if (self.inner.next()) |entry| &entry.value else null;
}
};
pub fn init(allocator: *std.mem.Allocator, file: std.fs.File) !Self {
return Self{
.allocator = allocator,
.text = try file.readToEndAlloc(allocator, std.math.maxInt(usize)),
.packages = std.StringHashMap(Package).init(allocator),
.dependencies = std.ArrayList(Dependency).init(allocator),
.build_dependencies = std.ArrayList(Dependency).init(allocator),
};
}
pub fn deinit(self: *Self) void {
var it = self.packages.iterator();
while (it.next()) |entry| {
entry.value.deinit();
self.packages.removeAssertDiscard(entry.key);
}
self.dependencies.deinit();
self.build_dependencies.deinit();
self.packages.deinit();
self.allocator.free(self.text);
}
pub fn contains(self: Self, name: []const u8) bool {
return self.packages.contains(name);
}
pub fn get(self: Self, name: []const u8) ?*Package {
return if (self.packages.getEntry(name)) |entry| &entry.value else null;
}
pub fn iterator(self: Self) Iterator {
return Iterator{ .inner = self.packages.iterator() };
}
pub fn fromFile(allocator: *std.mem.Allocator, file: std.fs.File) !Self {
var ret = try Self.init(allocator, file);
errdefer ret.deinit();
if (std.mem.indexOf(u8, ret.text, "\r\n") != null) {
std.log.err("gyro.zzz requires LF line endings, not CRLF", .{});
return error.Explained;
}
var tree = zzz.ZTree(1, 1000){};
var root = try tree.appendText(ret.text);
if (zFindChild(root, "deps")) |deps| {
var it = ZChildIterator.init(deps);
while (it.next()) |dep|
try ret.dependencies.append(try Dependency.fromZNode(dep));
}
if (zFindChild(root, "build_deps")) |build_deps| {
var it = ZChildIterator.init(build_deps);
while (it.next()) |dep|
try ret.build_dependencies.append(try Dependency.fromZNode(dep));
}
if (zFindChild(root, "pkgs")) |pkgs| {
var it = ZChildIterator.init(pkgs);
while (it.next()) |node| {
const name = try zGetString(node);
const ver_str = (try zFindString(node, "version")) orelse {
std.log.err("missing version string in package", .{});
return error.Explained;
};
const ver = version.Semver.parse(ver_str) catch |err| {
std.log.err("failed to parse version string '{}', must be <major>.<minor>.<patch>: {}", .{ ver_str, err });
return error.Explained;
};
const res = try ret.packages.getOrPut(name);
if (res.found_existing) {
std.log.err("duplicate exported packages {}", .{name});
return error.Explained;
}
res.entry.value = Package.init(
allocator,
name,
ver,
ret.dependencies.items,
ret.build_dependencies.items,
);
try res.entry.value.fillFromZNode(node);
}
}
return ret;
} | src/Project.zig |
const PipelineLayout = @import("PipelineLayout.zig");
const VertexState = @import("structs.zig").VertexState;
const PrimitiveState = @import("structs.zig").PrimitiveState;
const DepthStencilState = @import("structs.zig").DepthStencilState;
const MultisampleState = @import("structs.zig").MultisampleState;
const FragmentState = @import("structs.zig").FragmentState;
const BindGroupLayout = @import("BindGroupLayout.zig");
const RenderPipeline = @This();
/// The type erased pointer to the RenderPipeline implementation
/// Equal to c.WGPURenderPipeline for NativeInstance.
ptr: *anyopaque,
vtable: *const VTable,
pub const VTable = struct {
reference: fn (ptr: *anyopaque) void,
release: fn (ptr: *anyopaque) void,
setLabel: fn (ptr: *anyopaque, label: [:0]const u8) void,
getBindGroupLayout: fn (ptr: *anyopaque, group_index: u32) BindGroupLayout,
};
pub inline fn reference(pipeline: RenderPipeline) void {
pipeline.vtable.reference(pipeline.ptr);
}
pub inline fn release(pipeline: RenderPipeline) void {
pipeline.vtable.release(pipeline.ptr);
}
pub inline fn setLabel(pipeline: RenderPipeline, label: [:0]const u8) void {
pipeline.vtable.setLabel(pipeline.ptr, label);
}
pub inline fn getBindGroupLayout(pipeline: RenderPipeline, group_index: u32) BindGroupLayout {
return pipeline.vtable.getBindGroupLayout(pipeline.ptr, group_index);
}
pub const Descriptor = struct {
label: ?[*:0]const u8 = null,
layout: ?PipelineLayout,
vertex: VertexState,
primitive: PrimitiveState,
depth_stencil: ?*const DepthStencilState,
multisample: MultisampleState,
fragment: *const FragmentState,
};
pub const CreateStatus = enum(u32) {
success = 0x00000000,
err = 0x00000001,
device_lost = 0x00000002,
device_destroyed = 0x00000003,
unknown = 0x00000004,
};
pub const CreateCallback = struct {
type_erased_ctx: *anyopaque,
type_erased_callback: fn (
ctx: *anyopaque,
status: CreateStatus,
pipeline: RenderPipeline,
message: [:0]const u8,
) callconv(.Inline) void,
pub fn init(
comptime Context: type,
ctx: Context,
comptime callback: fn (
ctx: Context,
status: CreateStatus,
pipeline: RenderPipeline,
message: [:0]const u8,
) void,
) CreateCallback {
const erased = (struct {
pub inline fn erased(
type_erased_ctx: *anyopaque,
status: CreateStatus,
pipeline: RenderPipeline,
message: [:0]const u8,
) void {
callback(
@ptrCast(Context, @alignCast(@alignOf(Context), type_erased_ctx)),
status,
pipeline,
message,
);
}
}).erased;
return .{
.type_erased_ctx = if (Context == void) undefined else ctx,
.type_erased_callback = erased,
};
}
};
test {
_ = VTable;
_ = reference;
_ = release;
_ = setLabel;
_ = getBindGroupLayout;
_ = Descriptor;
_ = CreateStatus;
_ = CreateCallback;
} | gpu/src/RenderPipeline.zig |
const builtin = @import("builtin");
const c = @import("../c.zig");
const ico = @import("../image/ico.zig");
const nyancore_options = @import("nyancore_options");
const rg = @import("../renderer/render_graph/render_graph.zig");
const std = @import("std");
const tracy = @import("../tracy.zig");
const Allocator = std.mem.Allocator;
const Global = @import("../global.zig");
const Config = @import("config.zig").Config;
const Image = @import("../image/image.zig").Image;
pub const System = @import("../system/system.zig").System;
const printError = @import("print_error.zig").printError;
const printErrorNoPanic = @import("print_error.zig").printErrorNoPanic;
const imgui_mouse_button_count: usize = 5;
const ApplicationError = error{
GLFW_FAILED_TO_INIT,
GLFW_FAILED_TO_CREATE_WINDOW,
};
var application_glfw_map: std.AutoHashMap(*c.GLFWwindow, *Application) = undefined;
pub fn initGlobalData(allocator: Allocator) void {
application_glfw_map = std.AutoHashMap(*c.GLFWwindow, *Application).init(allocator);
}
pub fn deinitGlobalData() void {
application_glfw_map.deinit();
}
pub var app: Application = undefined;
pub const Application = struct {
pub const DelayedTask = struct {
task: fn (context: *anyopaque) void,
context: *anyopaque,
delay: f64,
};
allocator: Allocator,
config: *Config,
config_file: []const u8,
name: [:0]const u8,
mouse_just_pressed: [imgui_mouse_button_count]bool,
systems: []*System,
window: *c.GLFWwindow,
framebuffer_resized: bool,
args: std.StringHashMap([]const u8),
delayed_tasks: std.ArrayList(DelayedTask),
pub fn init(self: *Application, comptime name: [:0]const u8, allocator: Allocator, systems: []*System) void {
self.allocator = allocator;
self.config_file = name ++ ".conf";
self.mouse_just_pressed = [_]bool{false} ** imgui_mouse_button_count;
self.name = name;
self.systems = systems;
self.window = undefined;
self.framebuffer_resized = false;
self.config = &Global.config;
self.args = parseArgs(self.allocator);
self.delayed_tasks = std.ArrayList(DelayedTask).init(allocator);
}
pub fn deinit(self: *Application) void {
var args_iter = self.args.iterator();
while (args_iter.next()) |arg| {
self.allocator.free(arg.key_ptr.*);
self.allocator.free(arg.value_ptr.*);
}
self.args.deinit();
self.delayed_tasks.deinit();
}
fn parseArgs(allocator: Allocator) std.StringHashMap([]const u8) {
var map: std.StringHashMap([]const u8) = std.StringHashMap([]const u8).init(allocator);
const args: []const [:0]u8 = std.process.argsAlloc(allocator) catch unreachable;
defer std.process.argsFree(allocator, args);
var ind: usize = 1;
while (ind < args.len) {
const arg: [:0]u8 = args[ind];
var offset: usize = 0;
if (std.mem.startsWith(u8, arg, "--")) {
offset = 2;
} else if (std.mem.startsWith(u8, arg, "-")) {
offset = 1;
}
if (offset == 0) {
var arg_dupe: []const u8 = allocator.dupe(u8, arg) catch unreachable;
map.put("", arg_dupe) catch unreachable;
ind += 1;
continue;
}
if (ind + 1 < args.len) {
var arg_dupe: []const u8 = allocator.dupe(u8, arg[offset..]) catch unreachable;
var val_dupe: []const u8 = allocator.dupe(u8, args[ind + 1]) catch unreachable;
map.put(arg_dupe, val_dupe) catch unreachable;
ind += 2;
}
}
return map;
}
pub fn initSystems(self: *Application) !void {
Global.config.init(self.allocator, self.name, self.config_file);
errdefer Global.config.deinit();
try Global.config.load();
if (c.glfwInit() == c.GLFW_FALSE) {
printError("GLFW", "Couldn't initialize GLFW");
return error.GLFW_FAILED_TO_INIT;
}
errdefer c.glfwTerminate();
_ = c.glfwSetErrorCallback(glfwErrorCallback);
c.glfwWindowHint(c.GLFW_CLIENT_API, c.GLFW_NO_API);
c.glfwWindowHint(c.GLFW_MAXIMIZED, c.GLFW_TRUE);
self.window = c.glfwCreateWindow(640, 480, @ptrCast([*c]const u8, self.name), null, null) orelse {
printError("GLFW", "Couldn't create window");
return error.GLFW_FAILED_TO_CREATE_WINDOW;
};
errdefer c.glfwDestroyWindow(self.window);
try application_glfw_map.putNoClobber(self.window, self);
c.glfwSetInputMode(self.window, c.GLFW_STICKY_KEYS, c.GLFW_TRUE);
_ = c.glfwSetKeyCallback(self.window, glfwKeyCallback);
_ = c.glfwSetCharCallback(self.window, glfwCharCallback);
_ = c.glfwSetScrollCallback(self.window, glfwScrollCallback);
_ = c.glfwSetMouseButtonCallback(self.window, glfwMouseButtonCallback);
if (c.glfwVulkanSupported() == c.GLFW_FALSE) {
printError("GLFW", "Vulkan is not supported");
return error.GLFW_VULKAN_NOT_SUPPORTED;
}
for (self.systems) |system|
system.init(system, self);
rg.global_render_graph.initPasses();
glfwInitKeymap();
_ = c.glfwSetFramebufferSizeCallback(self.window, framebufferResizeCallback);
}
pub fn deinitSystems(self: *Application) void {
rg.global_render_graph.deinitCommandBuffers();
var i: usize = self.systems.len - 1;
while (i > 0) : (i -= 1) {
self.systems[i].deinit(self.systems[i]);
}
Global.config.flush() catch {
printErrorNoPanic("Config", "Error during config flushing");
};
_ = application_glfw_map.remove(self.window);
c.glfwDestroyWindow(self.window);
c.glfwTerminate();
Global.config.deinit();
}
pub fn close(self: *Application) void {
c.glfwSetWindowShouldClose(self.window, 1);
}
pub fn mainLoop(self: *Application) !void {
var prev_time: f64 = c.glfwGetTime();
var tracy_frame: tracy.Frame = undefined;
while (c.glfwWindowShouldClose(self.window) == c.GLFW_FALSE) {
if (nyancore_options.enable_tracing)
tracy_frame = tracy.Frame.start(null);
c.glfwPollEvents();
self.updateMousePosAndButtons();
const now_time = c.glfwGetTime();
const elapsed = now_time - prev_time;
prev_time = now_time;
const io: *c.ImGuiIO = c.igGetIO();
io.DeltaTime = @floatCast(f32, elapsed);
self.updateDelayedTasks(elapsed);
for (self.systems) |system|
system.update(system, elapsed);
self.framebuffer_resized = false;
if (nyancore_options.enable_tracing)
tracy_frame.end();
}
}
fn framebufferResizeCallback(window: ?*c.GLFWwindow, width: c_int, height: c_int) callconv(.C) void {
_ = width;
_ = height;
var self: *Application = application_glfw_map.get(window.?).?;
self.framebuffer_resized = true;
}
fn glfwMouseButtonCallback(window: ?*c.GLFWwindow, button: c_int, action: c_int, mods: c_int) callconv(.C) void {
_ = mods;
var self: *Application = application_glfw_map.get(window.?).?;
if (action == c.GLFW_PRESS and button >= 0 and button < imgui_mouse_button_count)
self.mouse_just_pressed[@intCast(usize, button)] = true;
}
fn updateDelayedTasks(self: *Application, elapsed: f64) void {
var i: usize = 0;
while (i < self.delayed_tasks.items.len) {
const t: *DelayedTask = &self.delayed_tasks.items[i];
t.delay -= elapsed;
if (t.delay <= 0.0) {
t.task(t.context);
_ = self.delayed_tasks.swapRemove(i);
continue;
}
i += 1;
}
}
fn updateMousePosAndButtons(self: *Application) void {
var io: *c.ImGuiIO = c.igGetIO();
var i: usize = 0;
while (i < imgui_mouse_button_count) : (i += 1) {
io.MouseDown[i] = self.mouse_just_pressed[i] or (c.glfwGetMouseButton(self.window, @intCast(c_int, i)) == c.GLFW_TRUE);
self.mouse_just_pressed[i] = false;
}
const mouse_pos_backup: c.ImVec2 = io.MousePos;
io.MousePos = .{
.x = -c.igGET_FLT_MAX(),
.y = -c.igGET_FLT_MAX(),
};
const focused: bool = c.glfwGetWindowAttrib(self.window, c.GLFW_FOCUSED) == c.GLFW_TRUE;
if (focused) {
if (io.WantSetMousePos) {
c.glfwSetCursorPos(self.window, @floatCast(f64, mouse_pos_backup.x), @floatCast(f64, mouse_pos_backup.y));
} else {
var mouseX: f64 = undefined;
var mouseY: f64 = undefined;
c.glfwGetCursorPos(self.window, &mouseX, &mouseY);
io.MousePos = .{
.x = @floatCast(f32, mouseX),
.y = @floatCast(f32, mouseY),
};
}
}
}
fn glfwInitKeymap() void {
var io: *c.ImGuiIO = c.igGetIO();
io.KeyMap[c.ImGuiKey_Tab] = c.GLFW_KEY_TAB;
io.KeyMap[c.ImGuiKey_LeftArrow] = c.GLFW_KEY_LEFT;
io.KeyMap[c.ImGuiKey_RightArrow] = c.GLFW_KEY_RIGHT;
io.KeyMap[c.ImGuiKey_UpArrow] = c.GLFW_KEY_UP;
io.KeyMap[c.ImGuiKey_DownArrow] = c.GLFW_KEY_DOWN;
io.KeyMap[c.ImGuiKey_PageUp] = c.GLFW_KEY_PAGE_UP;
io.KeyMap[c.ImGuiKey_PageDown] = c.GLFW_KEY_PAGE_DOWN;
io.KeyMap[c.ImGuiKey_Home] = c.GLFW_KEY_HOME;
io.KeyMap[c.ImGuiKey_End] = c.GLFW_KEY_END;
io.KeyMap[c.ImGuiKey_Insert] = c.GLFW_KEY_INSERT;
io.KeyMap[c.ImGuiKey_Delete] = c.GLFW_KEY_DELETE;
io.KeyMap[c.ImGuiKey_Backspace] = c.GLFW_KEY_BACKSPACE;
io.KeyMap[c.ImGuiKey_Space] = c.GLFW_KEY_SPACE;
io.KeyMap[c.ImGuiKey_Enter] = c.GLFW_KEY_ENTER;
io.KeyMap[c.ImGuiKey_Escape] = c.GLFW_KEY_ESCAPE;
io.KeyMap[c.ImGuiKey_KeyPadEnter] = c.GLFW_KEY_KP_ENTER;
io.KeyMap[c.ImGuiKey_A] = c.GLFW_KEY_A;
io.KeyMap[c.ImGuiKey_C] = c.GLFW_KEY_C;
io.KeyMap[c.ImGuiKey_V] = c.GLFW_KEY_V;
io.KeyMap[c.ImGuiKey_X] = c.GLFW_KEY_X;
io.KeyMap[c.ImGuiKey_Y] = c.GLFW_KEY_Y;
io.KeyMap[c.ImGuiKey_Z] = c.GLFW_KEY_Z;
}
fn glfwErrorCallback(err: c_int, description: [*c]const u8) callconv(.C) void {
_ = err;
printError("GLFW", std.mem.span(description));
}
fn glfwKeyCallback(win: ?*c.GLFWwindow, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void {
_ = win;
_ = scancode;
_ = mods;
var io: *c.ImGuiIO = c.igGetIO();
if (action == c.GLFW_PRESS)
io.KeysDown[@intCast(c_uint, key)] = true;
if (action == c.GLFW_RELEASE)
io.KeysDown[@intCast(c_uint, key)] = false;
// Modifiers are not reliable across systems
io.KeyCtrl = io.KeysDown[c.GLFW_KEY_LEFT_CONTROL] or io.KeysDown[c.GLFW_KEY_RIGHT_CONTROL];
io.KeyShift = io.KeysDown[c.GLFW_KEY_LEFT_SHIFT] or io.KeysDown[c.GLFW_KEY_RIGHT_SHIFT];
io.KeyAlt = io.KeysDown[c.GLFW_KEY_LEFT_ALT] or io.KeysDown[c.GLFW_KEY_RIGHT_ALT];
if (builtin.os.tag == .windows) {
io.KeySuper = false;
} else {
io.KeySuper = io.KeysDown[c.GLFW_KEY_LEFT_SUPER] or io.KeysDown[c.GLFW_KEY_RIGHT_SUPER];
}
}
fn glfwCharCallback(win: ?*c.GLFWwindow, char: c_uint) callconv(.C) void {
_ = win;
var io: *c.ImGuiIO = c.igGetIO();
c.ImGuiIO_AddInputCharacter(io, char);
}
fn glfwScrollCallback(win: ?*c.GLFWwindow, xoffset: f64, yoffset: f64) callconv(.C) void {
_ = win;
var io: *c.ImGuiIO = c.igGetIO();
io.MouseWheelH += @floatCast(f32, xoffset);
io.MouseWheel += @floatCast(f32, yoffset);
}
pub fn set_icon(self: *Application, data: []const u8) void {
var buffer_stream: std.io.FixedBufferStream([]const u8) = undefined;
buffer_stream.buffer = data;
buffer_stream.pos = 0;
const images: []Image = ico.parse(buffer_stream.reader(), self.allocator) catch unreachable;
defer self.allocator.free(images);
const glfw_images: []c.GLFWimage = self.allocator.alloc(c.GLFWimage, images.len) catch unreachable;
defer self.allocator.free(glfw_images);
for (glfw_images) |*img, i|
img.* = images[i].asGLFWimage();
c.glfwSetWindowIcon(self.window, @intCast(c_int, images.len), glfw_images.ptr);
for (images) |img|
self.allocator.free(img.data);
}
}; | src/application/application.zig |
pub const SI_TEMPORARY = @as(u32, 2147483648);
pub const SUBSINFO_ALLFLAGS = @as(u32, 61311);
pub const RS_READY = @as(u32, 1);
pub const RS_SUSPENDED = @as(u32, 2);
pub const RS_UPDATING = @as(u32, 4);
pub const RS_SUSPENDONIDLE = @as(u32, 65536);
pub const RS_MAYBOTHERUSER = @as(u32, 131072);
pub const RS_COMPLETED = @as(u32, 2147483648);
pub const SUBSMGRUPDATE_MINIMIZE = @as(u32, 1);
pub const SUBSMGRUPDATE_MASK = @as(u32, 1);
pub const SUBSMGRENUM_TEMP = @as(u32, 1);
pub const SUBSMGRENUM_MASK = @as(u32, 1);
pub const INET_E_AGENT_MAX_SIZE_EXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693248));
pub const INET_S_AGENT_PART_FAIL = @import("../zig.zig").typedConst(HRESULT, @as(i32, 790401));
pub const INET_E_AGENT_CACHE_SIZE_EXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693246));
pub const INET_E_AGENT_CONNECTION_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693245));
pub const INET_E_SCHEDULED_UPDATES_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693244));
pub const INET_E_SCHEDULED_UPDATES_RESTRICTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693243));
pub const INET_E_SCHEDULED_UPDATE_INTERVAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693242));
pub const INET_E_SCHEDULED_EXCLUDE_RANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693241));
pub const INET_E_AGENT_EXCEEDING_CACHE_SIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2146693232));
pub const INET_S_AGENT_INCREASED_CACHE_SIZE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 790416));
pub const OLEDBVER = @as(u32, 624);
pub const DB_NULL_HACCESSOR = @as(u32, 0);
pub const DB_INVALID_HACCESSOR = @as(u32, 0);
pub const DB_NULL_HROW = @as(u32, 0);
pub const DB_NULL_HCHAPTER = @as(u32, 0);
pub const DB_INVALID_HCHAPTER = @as(u32, 0);
pub const STD_BOOKMARKLENGTH = @as(u32, 1);
pub const DBPROPVAL_BMK_NUMERIC = @as(i32, 1);
pub const DBPROPVAL_BMK_KEY = @as(i32, 2);
pub const DBPROPVAL_CL_START = @as(i32, 1);
pub const DBPROPVAL_CL_END = @as(i32, 2);
pub const DBPROPVAL_CU_DML_STATEMENTS = @as(i32, 1);
pub const DBPROPVAL_CU_TABLE_DEFINITION = @as(i32, 2);
pub const DBPROPVAL_CU_INDEX_DEFINITION = @as(i32, 4);
pub const DBPROPVAL_CU_PRIVILEGE_DEFINITION = @as(i32, 8);
pub const DBPROPVAL_CD_NOTNULL = @as(i32, 1);
pub const DBPROPVAL_CB_NULL = @as(i32, 1);
pub const DBPROPVAL_CB_NON_NULL = @as(i32, 2);
pub const DBPROPVAL_FU_NOT_SUPPORTED = @as(i32, 1);
pub const DBPROPVAL_FU_COLUMN = @as(i32, 2);
pub const DBPROPVAL_FU_TABLE = @as(i32, 4);
pub const DBPROPVAL_FU_CATALOG = @as(i32, 8);
pub const DBPROPVAL_GB_NOT_SUPPORTED = @as(i32, 1);
pub const DBPROPVAL_GB_EQUALS_SELECT = @as(i32, 2);
pub const DBPROPVAL_GB_CONTAINS_SELECT = @as(i32, 4);
pub const DBPROPVAL_GB_NO_RELATION = @as(i32, 8);
pub const DBPROPVAL_HT_DIFFERENT_CATALOGS = @as(i32, 1);
pub const DBPROPVAL_HT_DIFFERENT_PROVIDERS = @as(i32, 2);
pub const DBPROPVAL_IC_UPPER = @as(i32, 1);
pub const DBPROPVAL_IC_LOWER = @as(i32, 2);
pub const DBPROPVAL_IC_SENSITIVE = @as(i32, 4);
pub const DBPROPVAL_IC_MIXED = @as(i32, 8);
pub const DBPROPVAL_LM_NONE = @as(i32, 1);
pub const DBPROPVAL_LM_READ = @as(i32, 2);
pub const DBPROPVAL_LM_INTENT = @as(i32, 4);
pub const DBPROPVAL_LM_RITE = @as(i32, 8);
pub const DBPROPVAL_NP_OKTODO = @as(i32, 1);
pub const DBPROPVAL_NP_ABOUTTODO = @as(i32, 2);
pub const DBPROPVAL_NP_SYNCHAFTER = @as(i32, 4);
pub const DBPROPVAL_NP_FAILEDTODO = @as(i32, 8);
pub const DBPROPVAL_NP_DIDEVENT = @as(i32, 16);
pub const DBPROPVAL_NC_END = @as(i32, 1);
pub const DBPROPVAL_NC_HIGH = @as(i32, 2);
pub const DBPROPVAL_NC_LOW = @as(i32, 4);
pub const DBPROPVAL_NC_START = @as(i32, 8);
pub const DBPROPVAL_OO_BLOB = @as(i32, 1);
pub const DBPROPVAL_OO_IPERSIST = @as(i32, 2);
pub const DBPROPVAL_CB_DELETE = @as(i32, 1);
pub const DBPROPVAL_CB_PRESERVE = @as(i32, 2);
pub const DBPROPVAL_SU_DML_STATEMENTS = @as(i32, 1);
pub const DBPROPVAL_SU_TABLE_DEFINITION = @as(i32, 2);
pub const DBPROPVAL_SU_INDEX_DEFINITION = @as(i32, 4);
pub const DBPROPVAL_SU_PRIVILEGE_DEFINITION = @as(i32, 8);
pub const DBPROPVAL_SQ_CORRELATEDSUBQUERIES = @as(i32, 1);
pub const DBPROPVAL_SQ_COMPARISON = @as(i32, 2);
pub const DBPROPVAL_SQ_EXISTS = @as(i32, 4);
pub const DBPROPVAL_SQ_IN = @as(i32, 8);
pub const DBPROPVAL_SQ_QUANTIFIED = @as(i32, 16);
pub const DBPROPVAL_SQ_TABLE = @as(i32, 32);
pub const DBPROPVAL_SS_ISEQUENTIALSTREAM = @as(i32, 1);
pub const DBPROPVAL_SS_ISTREAM = @as(i32, 2);
pub const DBPROPVAL_SS_ISTORAGE = @as(i32, 4);
pub const DBPROPVAL_SS_ILOCKBYTES = @as(i32, 8);
pub const DBPROPVAL_TI_CHAOS = @as(i32, 16);
pub const DBPROPVAL_TI_READUNCOMMITTED = @as(i32, 256);
pub const DBPROPVAL_TI_BROWSE = @as(i32, 256);
pub const DBPROPVAL_TI_CURSORSTABILITY = @as(i32, 4096);
pub const DBPROPVAL_TI_READCOMMITTED = @as(i32, 4096);
pub const DBPROPVAL_TI_REPEATABLEREAD = @as(i32, 65536);
pub const DBPROPVAL_TI_SERIALIZABLE = @as(i32, 1048576);
pub const DBPROPVAL_TI_ISOLATED = @as(i32, 1048576);
pub const DBPROPVAL_TR_COMMIT_DC = @as(i32, 1);
pub const DBPROPVAL_TR_COMMIT = @as(i32, 2);
pub const DBPROPVAL_TR_COMMIT_NO = @as(i32, 4);
pub const DBPROPVAL_TR_ABORT_DC = @as(i32, 8);
pub const DBPROPVAL_TR_ABORT = @as(i32, 16);
pub const DBPROPVAL_TR_ABORT_NO = @as(i32, 32);
pub const DBPROPVAL_TR_DONTCARE = @as(i32, 64);
pub const DBPROPVAL_TR_BOTH = @as(i32, 128);
pub const DBPROPVAL_TR_NONE = @as(i32, 256);
pub const DBPROPVAL_TR_OPTIMISTIC = @as(i32, 512);
pub const DBPROPVAL_RT_FREETHREAD = @as(i32, 1);
pub const DBPROPVAL_RT_APTMTTHREAD = @as(i32, 2);
pub const DBPROPVAL_RT_SINGLETHREAD = @as(i32, 4);
pub const DBPROPVAL_UP_CHANGE = @as(i32, 1);
pub const DBPROPVAL_UP_DELETE = @as(i32, 2);
pub const DBPROPVAL_UP_INSERT = @as(i32, 4);
pub const DBPROPVAL_SQL_NONE = @as(i32, 0);
pub const DBPROPVAL_SQL_ODBC_MINIMUM = @as(i32, 1);
pub const DBPROPVAL_SQL_ODBC_CORE = @as(i32, 2);
pub const DBPROPVAL_SQL_ODBC_EXTENDED = @as(i32, 4);
pub const DBPROPVAL_SQL_ANSI89_IEF = @as(i32, 8);
pub const DBPROPVAL_SQL_ANSI92_ENTRY = @as(i32, 16);
pub const DBPROPVAL_SQL_FIPS_TRANSITIONAL = @as(i32, 32);
pub const DBPROPVAL_SQL_ANSI92_INTERMEDIATE = @as(i32, 64);
pub const DBPROPVAL_SQL_ANSI92_FULL = @as(i32, 128);
pub const DBPROPVAL_SQL_ESCAPECLAUSES = @as(i32, 256);
pub const DBPROPVAL_IT_BTREE = @as(i32, 1);
pub const DBPROPVAL_IT_HASH = @as(i32, 2);
pub const DBPROPVAL_IT_CONTENT = @as(i32, 3);
pub const DBPROPVAL_IT_OTHER = @as(i32, 4);
pub const DBPROPVAL_IN_DISALLOWNULL = @as(i32, 1);
pub const DBPROPVAL_IN_IGNORENULL = @as(i32, 2);
pub const DBPROPVAL_IN_IGNOREANYNULL = @as(i32, 4);
pub const DBPROPVAL_TC_NONE = @as(i32, 0);
pub const DBPROPVAL_TC_DML = @as(i32, 1);
pub const DBPROPVAL_TC_DDL_COMMIT = @as(i32, 2);
pub const DBPROPVAL_TC_DDL_IGNORE = @as(i32, 4);
pub const DBPROPVAL_TC_ALL = @as(i32, 8);
pub const DBPROPVAL_OA_NOTSUPPORTED = @as(i32, 1);
pub const DBPROPVAL_OA_ATEXECUTE = @as(i32, 2);
pub const DBPROPVAL_OA_ATROWRELEASE = @as(i32, 4);
pub const DBPROPVAL_MR_NOTSUPPORTED = @as(i32, 0);
pub const DBPROPVAL_MR_SUPPORTED = @as(i32, 1);
pub const DBPROPVAL_MR_CONCURRENT = @as(i32, 2);
pub const DBPROPVAL_PT_GUID_NAME = @as(i32, 1);
pub const DBPROPVAL_PT_GUID_PROPID = @as(i32, 2);
pub const DBPROPVAL_PT_NAME = @as(i32, 4);
pub const DBPROPVAL_PT_GUID = @as(i32, 8);
pub const DBPROPVAL_PT_PROPID = @as(i32, 16);
pub const DBPROPVAL_PT_PGUID_NAME = @as(i32, 32);
pub const DBPROPVAL_PT_PGUID_PROPID = @as(i32, 64);
pub const DBPROPVAL_NT_SINGLEROW = @as(i32, 1);
pub const DBPROPVAL_NT_MULTIPLEROWS = @as(i32, 2);
pub const DBPROPVAL_ASYNCH_INITIALIZE = @as(i32, 1);
pub const DBPROPVAL_ASYNCH_SEQUENTIALPOPULATION = @as(i32, 2);
pub const DBPROPVAL_ASYNCH_RANDOMPOPULATION = @as(i32, 4);
pub const DBPROPVAL_OP_EQUAL = @as(i32, 1);
pub const DBPROPVAL_OP_RELATIVE = @as(i32, 2);
pub const DBPROPVAL_OP_STRING = @as(i32, 4);
pub const DBPROPVAL_CO_EQUALITY = @as(i32, 1);
pub const DBPROPVAL_CO_STRING = @as(i32, 2);
pub const DBPROPVAL_CO_CASESENSITIVE = @as(i32, 4);
pub const DBPROPVAL_CO_CASEINSENSITIVE = @as(i32, 8);
pub const DBPROPVAL_CO_CONTAINS = @as(i32, 16);
pub const DBPROPVAL_CO_BEGINSWITH = @as(i32, 32);
pub const DBPROPVAL_ASYNCH_BACKGROUNDPOPULATION = @as(i32, 8);
pub const DBPROPVAL_ASYNCH_PREPOPULATE = @as(i32, 16);
pub const DBPROPVAL_ASYNCH_POPULATEONDEMAND = @as(i32, 32);
pub const DBPROPVAL_LM_SINGLEROW = @as(i32, 2);
pub const DBPROPVAL_SQL_SUBMINIMUM = @as(i32, 512);
pub const DBPROPVAL_DST_TDP = @as(i32, 1);
pub const DBPROPVAL_DST_MDP = @as(i32, 2);
pub const DBPROPVAL_DST_TDPANDMDP = @as(i32, 3);
pub const MDPROPVAL_AU_UNSUPPORTED = @as(i32, 0);
pub const MDPROPVAL_AU_UNCHANGED = @as(i32, 1);
pub const MDPROPVAL_AU_UNKNOWN = @as(i32, 2);
pub const MDPROPVAL_MF_WITH_CALCMEMBERS = @as(i32, 1);
pub const MDPROPVAL_MF_WITH_NAMEDSETS = @as(i32, 2);
pub const MDPROPVAL_MF_CREATE_CALCMEMBERS = @as(i32, 4);
pub const MDPROPVAL_MF_CREATE_NAMEDSETS = @as(i32, 8);
pub const MDPROPVAL_MF_SCOPE_SESSION = @as(i32, 16);
pub const MDPROPVAL_MF_SCOPE_GLOBAL = @as(i32, 32);
pub const MDPROPVAL_MMF_COUSIN = @as(i32, 1);
pub const MDPROPVAL_MMF_PARALLELPERIOD = @as(i32, 2);
pub const MDPROPVAL_MMF_OPENINGPERIOD = @as(i32, 4);
pub const MDPROPVAL_MMF_CLOSINGPERIOD = @as(i32, 8);
pub const MDPROPVAL_MNF_MEDIAN = @as(i32, 1);
pub const MDPROPVAL_MNF_VAR = @as(i32, 2);
pub const MDPROPVAL_MNF_STDDEV = @as(i32, 4);
pub const MDPROPVAL_MNF_RANK = @as(i32, 8);
pub const MDPROPVAL_MNF_AGGREGATE = @as(i32, 16);
pub const MDPROPVAL_MNF_COVARIANCE = @as(i32, 32);
pub const MDPROPVAL_MNF_CORRELATION = @as(i32, 64);
pub const MDPROPVAL_MNF_LINREGSLOPE = @as(i32, 128);
pub const MDPROPVAL_MNF_LINREGVARIANCE = @as(i32, 256);
pub const MDPROPVAL_MNF_LINREG2 = @as(i32, 512);
pub const MDPROPVAL_MNF_LINREGPOINT = @as(i32, 1024);
pub const MDPROPVAL_MNF_DRILLDOWNLEVEL = @as(i32, 2048);
pub const MDPROPVAL_MNF_DRILLDOWNMEMBERTOP = @as(i32, 4096);
pub const MDPROPVAL_MNF_DRILLDOWNMEMBERBOTTOM = @as(i32, 8192);
pub const MDPROPVAL_MNF_DRILLDOWNLEVELTOP = @as(i32, 16384);
pub const MDPROPVAL_MNF_DRILLDOWNLEVELBOTTOM = @as(i32, 32768);
pub const MDPROPVAL_MNF_DRILLUPMEMBER = @as(i32, 65536);
pub const MDPROPVAL_MNF_DRILLUPLEVEL = @as(i32, 131072);
pub const MDPROPVAL_MSF_TOPPERCENT = @as(i32, 1);
pub const MDPROPVAL_MSF_BOTTOMPERCENT = @as(i32, 2);
pub const MDPROPVAL_MSF_TOPSUM = @as(i32, 4);
pub const MDPROPVAL_MSF_BOTTOMSUM = @as(i32, 8);
pub const MDPROPVAL_MSF_PERIODSTODATE = @as(i32, 16);
pub const MDPROPVAL_MSF_LASTPERIODS = @as(i32, 32);
pub const MDPROPVAL_MSF_YTD = @as(i32, 64);
pub const MDPROPVAL_MSF_QTD = @as(i32, 128);
pub const MDPROPVAL_MSF_MTD = @as(i32, 256);
pub const MDPROPVAL_MSF_WTD = @as(i32, 512);
pub const MDPROPVAL_MSF_DRILLDOWNMEMBBER = @as(i32, 1024);
pub const MDPROPVAL_MSF_DRILLDOWNLEVEL = @as(i32, 2048);
pub const MDPROPVAL_MSF_DRILLDOWNMEMBERTOP = @as(i32, 4096);
pub const MDPROPVAL_MSF_DRILLDOWNMEMBERBOTTOM = @as(i32, 8192);
pub const MDPROPVAL_MSF_DRILLDOWNLEVELTOP = @as(i32, 16384);
pub const MDPROPVAL_MSF_DRILLDOWNLEVELBOTTOM = @as(i32, 32768);
pub const MDPROPVAL_MSF_DRILLUPMEMBER = @as(i32, 65536);
pub const MDPROPVAL_MSF_DRILLUPLEVEL = @as(i32, 131072);
pub const MDPROPVAL_MSF_TOGGLEDRILLSTATE = @as(i32, 262144);
pub const MDPROPVAL_MD_SELF = @as(i32, 1);
pub const MDPROPVAL_MD_BEFORE = @as(i32, 2);
pub const MDPROPVAL_MD_AFTER = @as(i32, 4);
pub const MDPROPVAL_MSC_LESSTHAN = @as(i32, 1);
pub const MDPROPVAL_MSC_GREATERTHAN = @as(i32, 2);
pub const MDPROPVAL_MSC_LESSTHANEQUAL = @as(i32, 4);
pub const MDPROPVAL_MSC_GREATERTHANEQUAL = @as(i32, 8);
pub const MDPROPVAL_MC_SINGLECASE = @as(i32, 1);
pub const MDPROPVAL_MC_SEARCHEDCASE = @as(i32, 2);
pub const MDPROPVAL_MOQ_OUTERREFERENCE = @as(i32, 1);
pub const MDPROPVAL_MOQ_DATASOURCE_CUBE = @as(i32, 1);
pub const MDPROPVAL_MOQ_CATALOG_CUBE = @as(i32, 2);
pub const MDPROPVAL_MOQ_SCHEMA_CUBE = @as(i32, 4);
pub const MDPROPVAL_MOQ_CUBE_DIM = @as(i32, 8);
pub const MDPROPVAL_MOQ_DIM_HIER = @as(i32, 16);
pub const MDPROPVAL_MOQ_DIMHIER_LEVEL = @as(i32, 32);
pub const MDPROPVAL_MOQ_LEVEL_MEMBER = @as(i32, 64);
pub const MDPROPVAL_MOQ_MEMBER_MEMBER = @as(i32, 128);
pub const MDPROPVAL_MOQ_DIMHIER_MEMBER = @as(i32, 256);
pub const MDPROPVAL_FS_FULL_SUPPORT = @as(i32, 1);
pub const MDPROPVAL_FS_GENERATED_COLUMN = @as(i32, 2);
pub const MDPROPVAL_FS_GENERATED_DIMENSION = @as(i32, 3);
pub const MDPROPVAL_FS_NO_SUPPORT = @as(i32, 4);
pub const MDPROPVAL_NL_NAMEDLEVELS = @as(i32, 1);
pub const MDPROPVAL_NL_NUMBEREDLEVELS = @as(i32, 2);
pub const MDPROPVAL_MJC_SINGLECUBE = @as(i32, 1);
pub const MDPROPVAL_MJC_MULTICUBES = @as(i32, 2);
pub const MDPROPVAL_MJC_IMPLICITCUBE = @as(i32, 4);
pub const MDPROPVAL_RR_NORANGEROWSET = @as(i32, 1);
pub const MDPROPVAL_RR_READONLY = @as(i32, 2);
pub const MDPROPVAL_RR_UPDATE = @as(i32, 4);
pub const MDPROPVAL_MS_MULTIPLETUPLES = @as(i32, 1);
pub const MDPROPVAL_MS_SINGLETUPLE = @as(i32, 2);
pub const MDPROPVAL_NME_ALLDIMENSIONS = @as(i32, 0);
pub const MDPROPVAL_NME_MEASURESONLY = @as(i32, 1);
pub const DBPROPVAL_AO_SEQUENTIAL = @as(i32, 0);
pub const DBPROPVAL_AO_SEQUENTIALSTORAGEOBJECTS = @as(i32, 1);
pub const DBPROPVAL_AO_RANDOM = @as(i32, 2);
pub const DBPROPVAL_BD_ROWSET = @as(i32, 0);
pub const DBPROPVAL_BD_INTRANSACTION = @as(i32, 1);
pub const DBPROPVAL_BD_XTRANSACTION = @as(i32, 2);
pub const DBPROPVAL_BD_REORGANIZATION = @as(i32, 3);
pub const BMK_DURABILITY_ROWSET = @as(i32, 0);
pub const BMK_DURABILITY_INTRANSACTION = @as(i32, 1);
pub const BMK_DURABILITY_XTRANSACTION = @as(i32, 2);
pub const BMK_DURABILITY_REORGANIZATION = @as(i32, 3);
pub const DBPROPVAL_BO_NOLOG = @as(i32, 0);
pub const DBPROPVAL_BO_NOINDEXUPDATE = @as(i32, 1);
pub const DBPROPVAL_BO_REFINTEGRITY = @as(i32, 2);
pub const DBPROPVAL_STGM_DIRECT = @as(u32, 65536);
pub const DBPROPVAL_STGM_TRANSACTED = @as(u32, 131072);
pub const DBPROPVAL_STGM_CONVERT = @as(u32, 262144);
pub const DBPROPVAL_STGM_FAILIFTHERE = @as(u32, 524288);
pub const DBPROPVAL_STGM_PRIORITY = @as(u32, 1048576);
pub const DBPROPVAL_STGM_DELETEONRELEASE = @as(u32, 2097152);
pub const DBPROPVAL_GB_COLLATE = @as(i32, 16);
pub const DBPROPVAL_CS_UNINITIALIZED = @as(i32, 0);
pub const DBPROPVAL_CS_INITIALIZED = @as(i32, 1);
pub const DBPROPVAL_CS_COMMUNICATIONFAILURE = @as(i32, 2);
pub const DBPROPVAL_RD_RESETALL = @as(i32, -1);
pub const DBPROPVAL_OS_RESOURCEPOOLING = @as(i32, 1);
pub const DBPROPVAL_OS_TXNENLISTMENT = @as(i32, 2);
pub const DBPROPVAL_OS_CLIENTCURSOR = @as(i32, 4);
pub const DBPROPVAL_OS_ENABLEALL = @as(i32, -1);
pub const DBPROPVAL_BI_CROSSROWSET = @as(i32, 1);
pub const MDPROPVAL_NL_SCHEMAONLY = @as(i32, 4);
pub const DBPROPVAL_OS_DISABLEALL = @as(i32, 0);
pub const DBPROPVAL_OO_ROWOBJECT = @as(i32, 4);
pub const DBPROPVAL_OO_SCOPED = @as(i32, 8);
pub const DBPROPVAL_OO_DIRECTBIND = @as(i32, 16);
pub const DBPROPVAL_DST_DOCSOURCE = @as(i32, 4);
pub const DBPROPVAL_GU_NOTSUPPORTED = @as(i32, 1);
pub const DBPROPVAL_GU_SUFFIX = @as(i32, 2);
pub const DB_BINDFLAGS_DELAYFETCHCOLUMNS = @as(i32, 1);
pub const DB_BINDFLAGS_DELAYFETCHSTREAM = @as(i32, 2);
pub const DB_BINDFLAGS_RECURSIVE = @as(i32, 4);
pub const DB_BINDFLAGS_OUTPUT = @as(i32, 8);
pub const DB_BINDFLAGS_COLLECTION = @as(i32, 16);
pub const DB_BINDFLAGS_OPENIFEXISTS = @as(i32, 32);
pub const DB_BINDFLAGS_OVERWRITE = @as(i32, 64);
pub const DB_BINDFLAGS_ISSTRUCTUREDDOCUMENT = @as(i32, 128);
pub const DBPROPVAL_ORS_TABLE = @as(i32, 0);
pub const DBPROPVAL_ORS_INDEX = @as(i32, 1);
pub const DBPROPVAL_ORS_INTEGRATEDINDEX = @as(i32, 2);
pub const DBPROPVAL_TC_DDL_LOCK = @as(i32, 16);
pub const DBPROPVAL_ORS_STOREDPROC = @as(i32, 4);
pub const DBPROPVAL_IN_ALLOWNULL = @as(i32, 0);
pub const DBPROPVAL_OO_SINGLETON = @as(i32, 32);
pub const DBPROPVAL_OS_AGR_AFTERSESSION = @as(i32, 8);
pub const DBPROPVAL_CM_TRANSACTIONS = @as(i32, 1);
pub const DBPROPVAL_TS_CARDINALITY = @as(i32, 1);
pub const DBPROPVAL_TS_HISTOGRAM = @as(i32, 2);
pub const DBPROPVAL_ORS_HISTOGRAM = @as(i32, 8);
pub const MDPROPVAL_VISUAL_MODE_DEFAULT = @as(i32, 0);
pub const MDPROPVAL_VISUAL_MODE_VISUAL = @as(i32, 1);
pub const MDPROPVAL_VISUAL_MODE_VISUAL_OFF = @as(i32, 2);
pub const DB_IMP_LEVEL_ANONYMOUS = @as(u32, 0);
pub const DB_IMP_LEVEL_IDENTIFY = @as(u32, 1);
pub const DB_IMP_LEVEL_IMPERSONATE = @as(u32, 2);
pub const DB_IMP_LEVEL_DELEGATE = @as(u32, 3);
pub const DBPROMPT_PROMPT = @as(u32, 1);
pub const DBPROMPT_COMPLETE = @as(u32, 2);
pub const DBPROMPT_COMPLETEREQUIRED = @as(u32, 3);
pub const DBPROMPT_NOPROMPT = @as(u32, 4);
pub const DB_PROT_LEVEL_NONE = @as(u32, 0);
pub const DB_PROT_LEVEL_CONNECT = @as(u32, 1);
pub const DB_PROT_LEVEL_CALL = @as(u32, 2);
pub const DB_PROT_LEVEL_PKT = @as(u32, 3);
pub const DB_PROT_LEVEL_PKT_INTEGRITY = @as(u32, 4);
pub const DB_PROT_LEVEL_PKT_PRIVACY = @as(u32, 5);
pub const DB_MODE_READ = @as(u32, 1);
pub const DB_MODE_WRITE = @as(u32, 2);
pub const DB_MODE_READWRITE = @as(u32, 3);
pub const DB_MODE_SHARE_DENY_READ = @as(u32, 4);
pub const DB_MODE_SHARE_DENY_WRITE = @as(u32, 8);
pub const DB_MODE_SHARE_EXCLUSIVE = @as(u32, 12);
pub const DB_MODE_SHARE_DENY_NONE = @as(u32, 16);
pub const DBCOMPUTEMODE_COMPUTED = @as(u32, 1);
pub const DBCOMPUTEMODE_DYNAMIC = @as(u32, 2);
pub const DBCOMPUTEMODE_NOTCOMPUTED = @as(u32, 3);
pub const DBPROPVAL_DF_INITIALLY_DEFERRED = @as(u32, 1);
pub const DBPROPVAL_DF_INITIALLY_IMMEDIATE = @as(u32, 2);
pub const DBPROPVAL_DF_NOT_DEFERRABLE = @as(u32, 3);
pub const DBPARAMTYPE_INPUT = @as(u32, 1);
pub const DBPARAMTYPE_INPUTOUTPUT = @as(u32, 2);
pub const DBPARAMTYPE_OUTPUT = @as(u32, 3);
pub const DBPARAMTYPE_RETURNVALUE = @as(u32, 4);
pub const DB_PT_UNKNOWN = @as(u32, 1);
pub const DB_PT_PROCEDURE = @as(u32, 2);
pub const DB_PT_FUNCTION = @as(u32, 3);
pub const DB_REMOTE = @as(u32, 1);
pub const DB_LOCAL_SHARED = @as(u32, 2);
pub const DB_LOCAL_EXCLUSIVE = @as(u32, 3);
pub const DB_COLLATION_ASC = @as(u32, 1);
pub const DB_COLLATION_DESC = @as(u32, 2);
pub const DB_UNSEARCHABLE = @as(u32, 1);
pub const DB_LIKE_ONLY = @as(u32, 2);
pub const DB_ALL_EXCEPT_LIKE = @as(u32, 3);
pub const DB_SEARCHABLE = @as(u32, 4);
pub const MDTREEOP_CHILDREN = @as(u32, 1);
pub const MDTREEOP_SIBLINGS = @as(u32, 2);
pub const MDTREEOP_PARENT = @as(u32, 4);
pub const MDTREEOP_SELF = @as(u32, 8);
pub const MDTREEOP_DESCENDANTS = @as(u32, 16);
pub const MDTREEOP_ANCESTORS = @as(u32, 32);
pub const MD_DIMTYPE_UNKNOWN = @as(u32, 0);
pub const MD_DIMTYPE_TIME = @as(u32, 1);
pub const MD_DIMTYPE_MEASURE = @as(u32, 2);
pub const MD_DIMTYPE_OTHER = @as(u32, 3);
pub const MDLEVEL_TYPE_UNKNOWN = @as(u32, 0);
pub const MDLEVEL_TYPE_REGULAR = @as(u32, 0);
pub const MDLEVEL_TYPE_ALL = @as(u32, 1);
pub const MDLEVEL_TYPE_CALCULATED = @as(u32, 2);
pub const MDLEVEL_TYPE_TIME = @as(u32, 4);
pub const MDLEVEL_TYPE_RESERVED1 = @as(u32, 8);
pub const MDLEVEL_TYPE_TIME_YEARS = @as(u32, 20);
pub const MDLEVEL_TYPE_TIME_HALF_YEAR = @as(u32, 36);
pub const MDLEVEL_TYPE_TIME_QUARTERS = @as(u32, 68);
pub const MDLEVEL_TYPE_TIME_MONTHS = @as(u32, 132);
pub const MDLEVEL_TYPE_TIME_WEEKS = @as(u32, 260);
pub const MDLEVEL_TYPE_TIME_DAYS = @as(u32, 516);
pub const MDLEVEL_TYPE_TIME_HOURS = @as(u32, 772);
pub const MDLEVEL_TYPE_TIME_MINUTES = @as(u32, 1028);
pub const MDLEVEL_TYPE_TIME_SECONDS = @as(u32, 2052);
pub const MDLEVEL_TYPE_TIME_UNDEFINED = @as(u32, 4100);
pub const MDMEASURE_AGGR_UNKNOWN = @as(u32, 0);
pub const MDMEASURE_AGGR_SUM = @as(u32, 1);
pub const MDMEASURE_AGGR_COUNT = @as(u32, 2);
pub const MDMEASURE_AGGR_MIN = @as(u32, 3);
pub const MDMEASURE_AGGR_MAX = @as(u32, 4);
pub const MDMEASURE_AGGR_AVG = @as(u32, 5);
pub const MDMEASURE_AGGR_VAR = @as(u32, 6);
pub const MDMEASURE_AGGR_STD = @as(u32, 7);
pub const MDMEASURE_AGGR_CALCULATED = @as(u32, 127);
pub const MDPROP_MEMBER = @as(u32, 1);
pub const MDPROP_CELL = @as(u32, 2);
pub const MDMEMBER_TYPE_UNKNOWN = @as(u32, 0);
pub const MDMEMBER_TYPE_REGULAR = @as(u32, 1);
pub const MDMEMBER_TYPE_ALL = @as(u32, 2);
pub const MDMEMBER_TYPE_MEASURE = @as(u32, 3);
pub const MDMEMBER_TYPE_FORMULA = @as(u32, 4);
pub const MDMEMBER_TYPE_RESERVE1 = @as(u32, 5);
pub const MDMEMBER_TYPE_RESERVE2 = @as(u32, 6);
pub const MDMEMBER_TYPE_RESERVE3 = @as(u32, 7);
pub const MDMEMBER_TYPE_RESERVE4 = @as(u32, 8);
pub const MDDISPINFO_DRILLED_DOWN = @as(u32, 65536);
pub const MDDISPINFO_PARENT_SAME_AS_PREV = @as(u32, 131072);
pub const DB_COUNTUNAVAILABLE = @as(i32, -1);
pub const MDFF_BOLD = @as(u32, 1);
pub const MDFF_ITALIC = @as(u32, 2);
pub const MDFF_UNDERLINE = @as(u32, 4);
pub const MDFF_STRIKEOUT = @as(u32, 8);
pub const MDAXIS_COLUMNS = @as(u32, 0);
pub const MDAXIS_ROWS = @as(u32, 1);
pub const MDAXIS_PAGES = @as(u32, 2);
pub const MDAXIS_SECTIONS = @as(u32, 3);
pub const MDAXIS_CHAPTERS = @as(u32, 4);
pub const MDAXIS_SLICERS = @as(u32, 4294967295);
pub const CRESTRICTIONS_DBSCHEMA_ASSERTIONS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_CATALOGS = @as(u32, 1);
pub const CRESTRICTIONS_DBSCHEMA_CHARACTER_SETS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_COLLATIONS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_COLUMNS = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_CHECK_CONSTRAINTS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_CONSTRAINT_COLUMN_USAGE = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_CONSTRAINT_TABLE_USAGE = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_KEY_COLUMN_USAGE = @as(u32, 7);
pub const CRESTRICTIONS_DBSCHEMA_REFERENTIAL_CONSTRAINTS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_TABLE_CONSTRAINTS = @as(u32, 7);
pub const CRESTRICTIONS_DBSCHEMA_COLUMN_DOMAIN_USAGE = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_INDEXES = @as(u32, 5);
pub const CRESTRICTIONS_DBSCHEMA_OBJECT_ACTIONS = @as(u32, 1);
pub const CRESTRICTIONS_DBSCHEMA_OBJECTS = @as(u32, 1);
pub const CRESTRICTIONS_DBSCHEMA_COLUMN_PRIVILEGES = @as(u32, 6);
pub const CRESTRICTIONS_DBSCHEMA_TABLE_PRIVILEGES = @as(u32, 5);
pub const CRESTRICTIONS_DBSCHEMA_USAGE_PRIVILEGES = @as(u32, 6);
pub const CRESTRICTIONS_DBSCHEMA_PROCEDURES = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_SCHEMATA = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_SQL_LANGUAGES = @as(u32, 0);
pub const CRESTRICTIONS_DBSCHEMA_STATISTICS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_TABLES = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_TRANSLATIONS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_PROVIDER_TYPES = @as(u32, 2);
pub const CRESTRICTIONS_DBSCHEMA_VIEWS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_VIEW_COLUMN_USAGE = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_VIEW_TABLE_USAGE = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_PROCEDURE_PARAMETERS = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_FOREIGN_KEYS = @as(u32, 6);
pub const CRESTRICTIONS_DBSCHEMA_PRIMARY_KEYS = @as(u32, 3);
pub const CRESTRICTIONS_DBSCHEMA_PROCEDURE_COLUMNS = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_TABLES_INFO = @as(u32, 4);
pub const CRESTRICTIONS_MDSCHEMA_CUBES = @as(u32, 3);
pub const CRESTRICTIONS_MDSCHEMA_DIMENSIONS = @as(u32, 5);
pub const CRESTRICTIONS_MDSCHEMA_HIERARCHIES = @as(u32, 6);
pub const CRESTRICTIONS_MDSCHEMA_LEVELS = @as(u32, 7);
pub const CRESTRICTIONS_MDSCHEMA_MEASURES = @as(u32, 5);
pub const CRESTRICTIONS_MDSCHEMA_PROPERTIES = @as(u32, 9);
pub const CRESTRICTIONS_MDSCHEMA_MEMBERS = @as(u32, 12);
pub const CRESTRICTIONS_DBSCHEMA_TRUSTEE = @as(u32, 4);
pub const CRESTRICTIONS_DBSCHEMA_TABLE_STATISTICS = @as(u32, 7);
pub const CRESTRICTIONS_DBSCHEMA_CHECK_CONSTRAINTS_BY_TABLE = @as(u32, 6);
pub const CRESTRICTIONS_MDSCHEMA_FUNCTIONS = @as(u32, 4);
pub const CRESTRICTIONS_MDSCHEMA_ACTIONS = @as(u32, 8);
pub const CRESTRICTIONS_MDSCHEMA_COMMANDS = @as(u32, 5);
pub const CRESTRICTIONS_MDSCHEMA_SETS = @as(u32, 5);
pub const IDENTIFIER_SDK_MASK = @as(u32, 4026531840);
pub const IDENTIFIER_SDK_ERROR = @as(u32, 268435456);
pub const DBPROP_MSDAORA_DETERMINEKEYCOLUMNS = @as(u32, 1);
pub const DBPROP_MSDAORA8_DETERMINEKEYCOLUMNS = @as(u32, 2);
pub const PWPROP_OSPVALUE = @as(u32, 2);
pub const STGM_COLLECTION = @as(i32, 8192);
pub const STGM_OUTPUT = @as(i32, 32768);
pub const STGM_OPEN = @as(i32, -2147483648);
pub const STGM_RECURSIVE = @as(i32, 16777216);
pub const STGM_STRICTOPEN = @as(i32, 1073741824);
pub const KAGPROP_QUERYBASEDUPDATES = @as(u32, 2);
pub const KAGPROP_MARSHALLABLE = @as(u32, 3);
pub const KAGPROP_POSITIONONNEWROW = @as(u32, 4);
pub const KAGPROP_IRowsetChangeExtInfo = @as(u32, 5);
pub const KAGPROP_CURSOR = @as(u32, 6);
pub const KAGPROP_CONCURRENCY = @as(u32, 7);
pub const KAGPROP_BLOBSONFOCURSOR = @as(u32, 8);
pub const KAGPROP_INCLUDENONEXACT = @as(u32, 9);
pub const KAGPROP_FORCESSFIREHOSEMODE = @as(u32, 10);
pub const KAGPROP_FORCENOPARAMETERREBIND = @as(u32, 11);
pub const KAGPROP_FORCENOPREPARE = @as(u32, 12);
pub const KAGPROP_FORCENOREEXECUTE = @as(u32, 13);
pub const KAGPROP_ACCESSIBLEPROCEDURES = @as(u32, 2);
pub const KAGPROP_ACCESSIBLETABLES = @as(u32, 3);
pub const KAGPROP_ODBCSQLOPTIEF = @as(u32, 4);
pub const KAGPROP_OJCAPABILITY = @as(u32, 5);
pub const KAGPROP_PROCEDURES = @as(u32, 6);
pub const KAGPROP_DRIVERNAME = @as(u32, 7);
pub const KAGPROP_DRIVERVER = @as(u32, 8);
pub const KAGPROP_DRIVERODBCVER = @as(u32, 9);
pub const KAGPROP_LIKEESCAPECLAUSE = @as(u32, 10);
pub const KAGPROP_SPECIALCHARACTERS = @as(u32, 11);
pub const KAGPROP_MAXCOLUMNSINGROUPBY = @as(u32, 12);
pub const KAGPROP_MAXCOLUMNSININDEX = @as(u32, 13);
pub const KAGPROP_MAXCOLUMNSINORDERBY = @as(u32, 14);
pub const KAGPROP_MAXCOLUMNSINSELECT = @as(u32, 15);
pub const KAGPROP_MAXCOLUMNSINTABLE = @as(u32, 16);
pub const KAGPROP_NUMERICFUNCTIONS = @as(u32, 17);
pub const KAGPROP_ODBCSQLCONFORMANCE = @as(u32, 18);
pub const KAGPROP_OUTERJOINS = @as(u32, 19);
pub const KAGPROP_STRINGFUNCTIONS = @as(u32, 20);
pub const KAGPROP_SYSTEMFUNCTIONS = @as(u32, 21);
pub const KAGPROP_TIMEDATEFUNCTIONS = @as(u32, 22);
pub const KAGPROP_FILEUSAGE = @as(u32, 23);
pub const KAGPROP_ACTIVESTATEMENTS = @as(u32, 24);
pub const KAGPROP_AUTH_TRUSTEDCONNECTION = @as(u32, 2);
pub const KAGPROP_AUTH_SERVERINTEGRATED = @as(u32, 3);
pub const KAGPROPVAL_CONCUR_ROWVER = @as(u32, 1);
pub const KAGPROPVAL_CONCUR_VALUES = @as(u32, 2);
pub const KAGPROPVAL_CONCUR_LOCK = @as(u32, 4);
pub const KAGPROPVAL_CONCUR_READ_ONLY = @as(u32, 8);
pub const ODBCVER = @as(u32, 896);
pub const ODBC_ADD_DSN = @as(u32, 1);
pub const ODBC_CONFIG_DSN = @as(u32, 2);
pub const ODBC_REMOVE_DSN = @as(u32, 3);
pub const ODBC_ADD_SYS_DSN = @as(u32, 4);
pub const ODBC_CONFIG_SYS_DSN = @as(u32, 5);
pub const ODBC_REMOVE_SYS_DSN = @as(u32, 6);
pub const ODBC_REMOVE_DEFAULT_DSN = @as(u32, 7);
pub const ODBC_INSTALL_INQUIRY = @as(u32, 1);
pub const ODBC_INSTALL_COMPLETE = @as(u32, 2);
pub const ODBC_INSTALL_DRIVER = @as(u32, 1);
pub const ODBC_REMOVE_DRIVER = @as(u32, 2);
pub const ODBC_CONFIG_DRIVER = @as(u32, 3);
pub const ODBC_CONFIG_DRIVER_MAX = @as(u32, 100);
pub const ODBC_BOTH_DSN = @as(u32, 0);
pub const ODBC_USER_DSN = @as(u32, 1);
pub const ODBC_SYSTEM_DSN = @as(u32, 2);
pub const ODBC_ERROR_GENERAL_ERR = @as(u32, 1);
pub const ODBC_ERROR_INVALID_BUFF_LEN = @as(u32, 2);
pub const ODBC_ERROR_INVALID_HWND = @as(u32, 3);
pub const ODBC_ERROR_INVALID_STR = @as(u32, 4);
pub const ODBC_ERROR_INVALID_REQUEST_TYPE = @as(u32, 5);
pub const ODBC_ERROR_COMPONENT_NOT_FOUND = @as(u32, 6);
pub const ODBC_ERROR_INVALID_NAME = @as(u32, 7);
pub const ODBC_ERROR_INVALID_KEYWORD_VALUE = @as(u32, 8);
pub const ODBC_ERROR_INVALID_DSN = @as(u32, 9);
pub const ODBC_ERROR_INVALID_INF = @as(u32, 10);
pub const ODBC_ERROR_REQUEST_FAILED = @as(u32, 11);
pub const ODBC_ERROR_INVALID_PATH = @as(u32, 12);
pub const ODBC_ERROR_LOAD_LIB_FAILED = @as(u32, 13);
pub const ODBC_ERROR_INVALID_PARAM_SEQUENCE = @as(u32, 14);
pub const ODBC_ERROR_INVALID_LOG_FILE = @as(u32, 15);
pub const ODBC_ERROR_USER_CANCELED = @as(u32, 16);
pub const ODBC_ERROR_USAGE_UPDATE_FAILED = @as(u32, 17);
pub const ODBC_ERROR_CREATE_DSN_FAILED = @as(u32, 18);
pub const ODBC_ERROR_WRITING_SYSINFO_FAILED = @as(u32, 19);
pub const ODBC_ERROR_REMOVE_DSN_FAILED = @as(u32, 20);
pub const ODBC_ERROR_OUT_OF_MEM = @as(u32, 21);
pub const ODBC_ERROR_OUTPUT_STRING_TRUNCATED = @as(u32, 22);
pub const ODBC_ERROR_NOTRANINFO = @as(u32, 23);
pub const ODBC_ERROR_MAX = @as(u32, 23);
pub const SQL_MAX_SQLSERVERNAME = @as(u32, 128);
pub const SQL_COPT_SS_BASE = @as(u32, 1200);
pub const SQL_COPT_SS_REMOTE_PWD = @as(u32, 1201);
pub const SQL_COPT_SS_USE_PROC_FOR_PREP = @as(u32, 1202);
pub const SQL_COPT_SS_INTEGRATED_SECURITY = @as(u32, 1203);
pub const SQL_COPT_SS_PRESERVE_CURSORS = @as(u32, 1204);
pub const SQL_COPT_SS_USER_DATA = @as(u32, 1205);
pub const SQL_COPT_SS_FALLBACK_CONNECT = @as(u32, 1210);
pub const SQL_COPT_SS_PERF_DATA = @as(u32, 1211);
pub const SQL_COPT_SS_PERF_DATA_LOG = @as(u32, 1212);
pub const SQL_COPT_SS_PERF_QUERY_INTERVAL = @as(u32, 1213);
pub const SQL_COPT_SS_PERF_QUERY_LOG = @as(u32, 1214);
pub const SQL_COPT_SS_PERF_QUERY = @as(u32, 1215);
pub const SQL_COPT_SS_PERF_DATA_LOG_NOW = @as(u32, 1216);
pub const SQL_COPT_SS_QUOTED_IDENT = @as(u32, 1217);
pub const SQL_COPT_SS_ANSI_NPW = @as(u32, 1218);
pub const SQL_COPT_SS_BCP = @as(u32, 1219);
pub const SQL_COPT_SS_TRANSLATE = @as(u32, 1220);
pub const SQL_COPT_SS_ATTACHDBFILENAME = @as(u32, 1221);
pub const SQL_COPT_SS_CONCAT_NULL = @as(u32, 1222);
pub const SQL_COPT_SS_ENCRYPT = @as(u32, 1223);
pub const SQL_COPT_SS_MAX_USED = @as(u32, 1223);
pub const SQL_SOPT_SS_BASE = @as(u32, 1225);
pub const SQL_SOPT_SS_TEXTPTR_LOGGING = @as(u32, 1225);
pub const SQL_SOPT_SS_CURRENT_COMMAND = @as(u32, 1226);
pub const SQL_SOPT_SS_HIDDEN_COLUMNS = @as(u32, 1227);
pub const SQL_SOPT_SS_NOBROWSETABLE = @as(u32, 1228);
pub const SQL_SOPT_SS_REGIONALIZE = @as(u32, 1229);
pub const SQL_SOPT_SS_CURSOR_OPTIONS = @as(u32, 1230);
pub const SQL_SOPT_SS_NOCOUNT_STATUS = @as(u32, 1231);
pub const SQL_SOPT_SS_DEFER_PREPARE = @as(u32, 1232);
pub const SQL_SOPT_SS_MAX_USED = @as(u32, 1232);
pub const SQL_COPT_SS_BASE_EX = @as(u32, 1240);
pub const SQL_COPT_SS_BROWSE_CONNECT = @as(u32, 1241);
pub const SQL_COPT_SS_BROWSE_SERVER = @as(u32, 1242);
pub const SQL_COPT_SS_WARN_ON_CP_ERROR = @as(u32, 1243);
pub const SQL_COPT_SS_CONNECTION_DEAD = @as(u32, 1244);
pub const SQL_COPT_SS_BROWSE_CACHE_DATA = @as(u32, 1245);
pub const SQL_COPT_SS_RESET_CONNECTION = @as(u32, 1246);
pub const SQL_COPT_SS_EX_MAX_USED = @as(u32, 1246);
pub const SQL_UP_OFF = @as(i32, 0);
pub const SQL_UP_ON = @as(i32, 1);
pub const SQL_UP_ON_DROP = @as(i32, 2);
pub const SQL_UP_DEFAULT = @as(i32, 1);
pub const SQL_IS_OFF = @as(i32, 0);
pub const SQL_IS_ON = @as(i32, 1);
pub const SQL_IS_DEFAULT = @as(i32, 0);
pub const SQL_PC_OFF = @as(i32, 0);
pub const SQL_PC_ON = @as(i32, 1);
pub const SQL_PC_DEFAULT = @as(i32, 0);
pub const SQL_XL_OFF = @as(i32, 0);
pub const SQL_XL_ON = @as(i32, 1);
pub const SQL_XL_DEFAULT = @as(i32, 1);
pub const SQL_FB_OFF = @as(i32, 0);
pub const SQL_FB_ON = @as(i32, 1);
pub const SQL_FB_DEFAULT = @as(i32, 0);
pub const SQL_BCP_OFF = @as(i32, 0);
pub const SQL_BCP_ON = @as(i32, 1);
pub const SQL_BCP_DEFAULT = @as(i32, 0);
pub const SQL_QI_OFF = @as(i32, 0);
pub const SQL_QI_ON = @as(i32, 1);
pub const SQL_QI_DEFAULT = @as(i32, 1);
pub const SQL_AD_OFF = @as(i32, 0);
pub const SQL_AD_ON = @as(i32, 1);
pub const SQL_AD_DEFAULT = @as(i32, 1);
pub const SQL_CN_OFF = @as(i32, 0);
pub const SQL_CN_ON = @as(i32, 1);
pub const SQL_CN_DEFAULT = @as(i32, 1);
pub const SQL_TL_OFF = @as(i32, 0);
pub const SQL_TL_ON = @as(i32, 1);
pub const SQL_TL_DEFAULT = @as(i32, 1);
pub const SQL_HC_OFF = @as(i32, 0);
pub const SQL_HC_ON = @as(i32, 1);
pub const SQL_HC_DEFAULT = @as(i32, 0);
pub const SQL_NB_OFF = @as(i32, 0);
pub const SQL_NB_ON = @as(i32, 1);
pub const SQL_NB_DEFAULT = @as(i32, 0);
pub const SQL_RE_OFF = @as(i32, 0);
pub const SQL_RE_ON = @as(i32, 1);
pub const SQL_RE_DEFAULT = @as(i32, 0);
pub const SQL_CO_OFF = @as(i32, 0);
pub const SQL_CO_FFO = @as(i32, 1);
pub const SQL_CO_AF = @as(i32, 2);
pub const SQL_CO_FIREHOSE_AF = @as(i32, 4);
pub const SQL_CO_DEFAULT = @as(i32, 0);
pub const SQL_NC_OFF = @as(i32, 0);
pub const SQL_NC_ON = @as(i32, 1);
pub const SQL_DP_OFF = @as(i32, 0);
pub const SQL_DP_ON = @as(i32, 1);
pub const SQL_EN_OFF = @as(i32, 0);
pub const SQL_EN_ON = @as(i32, 1);
pub const SQL_MORE_INFO_NO = @as(i32, 0);
pub const SQL_MORE_INFO_YES = @as(i32, 1);
pub const SQL_CACHE_DATA_NO = @as(i32, 0);
pub const SQL_CACHE_DATA_YES = @as(i32, 1);
pub const SQL_RESET_YES = @as(i32, 1);
pub const SQL_WARN_NO = @as(i32, 0);
pub const SQL_WARN_YES = @as(i32, 1);
pub const SQL_CURSOR_FAST_FORWARD_ONLY = @as(u32, 8);
pub const SQL_CA_SS_BASE = @as(u32, 1200);
pub const SQL_CA_SS_COLUMN_SSTYPE = @as(u32, 1200);
pub const SQL_CA_SS_COLUMN_UTYPE = @as(u32, 1201);
pub const SQL_CA_SS_NUM_ORDERS = @as(u32, 1202);
pub const SQL_CA_SS_COLUMN_ORDER = @as(u32, 1203);
pub const SQL_CA_SS_COLUMN_VARYLEN = @as(u32, 1204);
pub const SQL_CA_SS_NUM_COMPUTES = @as(u32, 1205);
pub const SQL_CA_SS_COMPUTE_ID = @as(u32, 1206);
pub const SQL_CA_SS_COMPUTE_BYLIST = @as(u32, 1207);
pub const SQL_CA_SS_COLUMN_ID = @as(u32, 1208);
pub const SQL_CA_SS_COLUMN_OP = @as(u32, 1209);
pub const SQL_CA_SS_COLUMN_SIZE = @as(u32, 1210);
pub const SQL_CA_SS_COLUMN_HIDDEN = @as(u32, 1211);
pub const SQL_CA_SS_COLUMN_KEY = @as(u32, 1212);
pub const SQL_CA_SS_COLUMN_COLLATION = @as(u32, 1214);
pub const SQL_CA_SS_VARIANT_TYPE = @as(u32, 1215);
pub const SQL_CA_SS_VARIANT_SQL_TYPE = @as(u32, 1216);
pub const SQL_CA_SS_VARIANT_SERVER_TYPE = @as(u32, 1217);
pub const SQL_CA_SS_MAX_USED = @as(u32, 1218);
pub const SQLTEXT = @as(u32, 35);
pub const SQLVARBINARY = @as(u32, 37);
pub const SQLINTN = @as(u32, 38);
pub const SQLVARCHAR = @as(u32, 39);
pub const SQLBINARY = @as(u32, 45);
pub const SQLIMAGE = @as(u32, 34);
pub const SQLCHARACTER = @as(u32, 47);
pub const SQLINT1 = @as(u32, 48);
pub const SQLBIT = @as(u32, 50);
pub const SQLINT2 = @as(u32, 52);
pub const SQLINT4 = @as(u32, 56);
pub const SQLMONEY = @as(u32, 60);
pub const SQLDATETIME = @as(u32, 61);
pub const SQLFLT8 = @as(u32, 62);
pub const SQLFLTN = @as(u32, 109);
pub const SQLMONEYN = @as(u32, 110);
pub const SQLDATETIMN = @as(u32, 111);
pub const SQLFLT4 = @as(u32, 59);
pub const SQLMONEY4 = @as(u32, 122);
pub const SQLDATETIM4 = @as(u32, 58);
pub const SQLDECIMAL = @as(u32, 106);
pub const SQLNUMERIC = @as(u32, 108);
pub const SQLUNIQUEID = @as(u32, 36);
pub const SQLBIGCHAR = @as(u32, 175);
pub const SQLBIGVARCHAR = @as(u32, 167);
pub const SQLBIGBINARY = @as(u32, 173);
pub const SQLBIGVARBINARY = @as(u32, 165);
pub const SQLBITN = @as(u32, 104);
pub const SQLNCHAR = @as(u32, 239);
pub const SQLNVARCHAR = @as(u32, 231);
pub const SQLNTEXT = @as(u32, 99);
pub const SQLINT8 = @as(u32, 127);
pub const SQLVARIANT = @as(u32, 98);
pub const SQLudtBINARY = @as(u32, 3);
pub const SQLudtBIT = @as(u32, 16);
pub const SQLudtBITN = @as(u32, 0);
pub const SQLudtCHAR = @as(u32, 1);
pub const SQLudtDATETIM4 = @as(u32, 22);
pub const SQLudtDATETIME = @as(u32, 12);
pub const SQLudtDATETIMN = @as(u32, 15);
pub const SQLudtDECML = @as(u32, 24);
pub const SQLudtDECMLN = @as(u32, 26);
pub const SQLudtFLT4 = @as(u32, 23);
pub const SQLudtFLT8 = @as(u32, 8);
pub const SQLudtFLTN = @as(u32, 14);
pub const SQLudtIMAGE = @as(u32, 20);
pub const SQLudtINT1 = @as(u32, 5);
pub const SQLudtINT2 = @as(u32, 6);
pub const SQLudtINT4 = @as(u32, 7);
pub const SQLudtINTN = @as(u32, 13);
pub const SQLudtMONEY = @as(u32, 11);
pub const SQLudtMONEY4 = @as(u32, 21);
pub const SQLudtMONEYN = @as(u32, 17);
pub const SQLudtNUM = @as(u32, 10);
pub const SQLudtNUMN = @as(u32, 25);
pub const SQLudtSYSNAME = @as(u32, 18);
pub const SQLudtTEXT = @as(u32, 19);
pub const SQLudtTIMESTAMP = @as(u32, 80);
pub const SQLudtUNIQUEIDENTIFIER = @as(u32, 0);
pub const SQLudtVARBINARY = @as(u32, 4);
pub const SQLudtVARCHAR = @as(u32, 2);
pub const MIN_USER_DATATYPE = @as(u32, 256);
pub const SQLAOPSTDEV = @as(u32, 48);
pub const SQLAOPSTDEVP = @as(u32, 49);
pub const SQLAOPVAR = @as(u32, 50);
pub const SQLAOPVARP = @as(u32, 51);
pub const SQLAOPCNT = @as(u32, 75);
pub const SQLAOPSUM = @as(u32, 77);
pub const SQLAOPAVG = @as(u32, 79);
pub const SQLAOPMIN = @as(u32, 81);
pub const SQLAOPMAX = @as(u32, 82);
pub const SQLAOPANY = @as(u32, 83);
pub const SQLAOPNOOP = @as(u32, 86);
pub const SQL_INFO_SS_FIRST = @as(u32, 1199);
pub const SQL_INFO_SS_NETLIB_NAMEW = @as(u32, 1199);
pub const SQL_INFO_SS_NETLIB_NAMEA = @as(u32, 1200);
pub const SQL_INFO_SS_MAX_USED = @as(u32, 1200);
pub const SQL_INFO_SS_NETLIB_NAME = @as(u32, 1199);
pub const SQL_SS_VARIANT = @as(i32, -150);
pub const SQL_DIAG_SS_BASE = @as(i32, -1150);
pub const SQL_DIAG_SS_MSGSTATE = @as(i32, -1150);
pub const SQL_DIAG_DFC_SS_BASE = @as(i32, -200);
pub const EX_ANY = @as(u32, 0);
pub const EX_INFO = @as(u32, 10);
pub const EX_MAXISEVERITY = @as(u32, 10);
pub const EX_MISSING = @as(u32, 11);
pub const EX_TYPE = @as(u32, 12);
pub const EX_DEADLOCK = @as(u32, 13);
pub const EX_PERMIT = @as(u32, 14);
pub const EX_SYNTAX = @as(u32, 15);
pub const EX_USER = @as(u32, 16);
pub const EX_RESOURCE = @as(u32, 17);
pub const EX_INTOK = @as(u32, 18);
pub const MAXUSEVERITY = @as(u32, 18);
pub const EX_LIMIT = @as(u32, 19);
pub const EX_CMDFATAL = @as(u32, 20);
pub const MINFATALERR = @as(u32, 20);
pub const EX_DBFATAL = @as(u32, 21);
pub const EX_TABCORRUPT = @as(u32, 22);
pub const EX_DBCORRUPT = @as(u32, 23);
pub const EX_HARDWARE = @as(u32, 24);
pub const EX_CONTROL = @as(u32, 25);
pub const DBMAXCHAR = @as(u32, 8001);
pub const MAXNAME = @as(u32, 129);
pub const MAXNUMERICLEN = @as(u32, 16);
pub const SQL_PERF_START = @as(u32, 1);
pub const SQL_PERF_STOP = @as(u32, 2);
pub const SQL_SS_QI_DEFAULT = @as(u32, 30000);
pub const SUCCEED = @as(u32, 1);
pub const FAIL = @as(u32, 0);
pub const SUCCEED_ABORT = @as(u32, 2);
pub const SUCCEED_ASYNC = @as(u32, 3);
pub const DB_IN = @as(u32, 1);
pub const DB_OUT = @as(u32, 2);
pub const BCPMAXERRS = @as(u32, 1);
pub const BCPFIRST = @as(u32, 2);
pub const BCPLAST = @as(u32, 3);
pub const BCPBATCH = @as(u32, 4);
pub const BCPKEEPNULLS = @as(u32, 5);
pub const BCPABORT = @as(u32, 6);
pub const BCPODBC = @as(u32, 7);
pub const BCPKEEPIDENTITY = @as(u32, 8);
pub const BCP6xFILEFMT = @as(u32, 9);
pub const BCPHINTSA = @as(u32, 10);
pub const BCPHINTSW = @as(u32, 11);
pub const BCPFILECP = @as(u32, 12);
pub const BCPUNICODEFILE = @as(u32, 13);
pub const BCPTEXTFILE = @as(u32, 14);
pub const BCPFILEFMT = @as(u32, 15);
pub const BCPFILECP_ACP = @as(u32, 0);
pub const BCPFILECP_OEMCP = @as(u32, 1);
pub const BCPFILECP_RAW = @as(i32, -1);
pub const SQL_VARLEN_DATA = @as(i32, -10);
pub const BCPHINTS = @as(u32, 11);
pub const BCP_FMT_TYPE = @as(u32, 1);
pub const BCP_FMT_INDICATOR_LEN = @as(u32, 2);
pub const BCP_FMT_DATA_LEN = @as(u32, 3);
pub const BCP_FMT_TERMINATOR = @as(u32, 4);
pub const BCP_FMT_SERVER_COL = @as(u32, 5);
pub const BCP_FMT_COLLATION = @as(u32, 6);
pub const BCP_FMT_COLLATION_ID = @as(u32, 7);
pub const SQL_FAST_CONNECT = @as(u32, 1200);
pub const SQL_FC_OFF = @as(i32, 0);
pub const SQL_FC_ON = @as(i32, 1);
pub const SQL_FC_DEFAULT = @as(i32, 0);
pub const SQL_COPT_SS_ANSI_OEM = @as(u32, 1206);
pub const SQL_AO_OFF = @as(i32, 0);
pub const SQL_AO_ON = @as(i32, 1);
pub const SQL_AO_DEFAULT = @as(i32, 0);
pub const SQL_REMOTE_PWD = @as(u32, 1201);
pub const SQL_USE_PROCEDURE_FOR_PREPARE = @as(u32, 1202);
pub const SQL_INTEGRATED_SECURITY = @as(u32, 1203);
pub const SQL_PRESERVE_CURSORS = @as(u32, 1204);
pub const SQL_TEXTPTR_LOGGING = @as(u32, 1225);
pub const SQLDECIMALN = @as(u32, 106);
pub const SQLNUMERICN = @as(u32, 108);
pub const DB_E_BOGUS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217665));
pub const DB_E_BADACCESSORHANDLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217920));
pub const DB_E_ROWLIMITEXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217919));
pub const DB_E_READONLYACCESSOR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217918));
pub const DB_E_SCHEMAVIOLATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217917));
pub const DB_E_BADROWHANDLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217916));
pub const DB_E_OBJECTOPEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217915));
pub const DB_E_BADCHAPTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217914));
pub const DB_E_CANTCONVERTVALUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217913));
pub const DB_E_BADBINDINFO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217912));
pub const DB_SEC_E_PERMISSIONDENIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217911));
pub const DB_E_NOTAREFERENCECOLUMN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217910));
pub const DB_E_LIMITREJECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217909));
pub const DB_E_NOCOMMAND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217908));
pub const DB_E_COSTLIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217907));
pub const DB_E_BADBOOKMARK = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217906));
pub const DB_E_BADLOCKMODE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217905));
pub const DB_E_PARAMNOTOPTIONAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217904));
pub const DB_E_BADCOLUMNID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217903));
pub const DB_E_BADRATIO = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217902));
pub const DB_E_BADVALUES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217901));
pub const DB_E_ERRORSINCOMMAND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217900));
pub const DB_E_CANTCANCEL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217899));
pub const DB_E_DIALECTNOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217898));
pub const DB_E_DUPLICATEDATASOURCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217897));
pub const DB_E_CANNOTRESTART = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217896));
pub const DB_E_NOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217895));
pub const DB_E_NEWLYINSERTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217893));
pub const DB_E_CANNOTFREE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217894));
pub const DB_E_GOALREJECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217892));
pub const DB_E_UNSUPPORTEDCONVERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217891));
pub const DB_E_BADSTARTPOSITION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217890));
pub const DB_E_NOQUERY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217889));
pub const DB_E_NOTREENTRANT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217888));
pub const DB_E_ERRORSOCCURRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217887));
pub const DB_E_NOAGGREGATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217886));
pub const DB_E_DELETEDROW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217885));
pub const DB_E_CANTFETCHBACKWARDS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217884));
pub const DB_E_ROWSNOTRELEASED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217883));
pub const DB_E_BADSTORAGEFLAG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217882));
pub const DB_E_BADCOMPAREOP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217881));
pub const DB_E_BADSTATUSVALUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217880));
pub const DB_E_CANTSCROLLBACKWARDS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217879));
pub const DB_E_BADREGIONHANDLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217878));
pub const DB_E_NONCONTIGUOUSRANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217877));
pub const DB_E_INVALIDTRANSITION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217876));
pub const DB_E_NOTASUBREGION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217875));
pub const DB_E_MULTIPLESTATEMENTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217874));
pub const DB_E_INTEGRITYVIOLATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217873));
pub const DB_E_BADTYPENAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217872));
pub const DB_E_ABORTLIMITREACHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217871));
pub const DB_E_ROWSETINCOMMAND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217870));
pub const DB_E_CANTTRANSLATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217869));
pub const DB_E_DUPLICATEINDEXID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217868));
pub const DB_E_NOINDEX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217867));
pub const DB_E_INDEXINUSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217866));
pub const DB_E_NOTABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217865));
pub const DB_E_CONCURRENCYVIOLATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217864));
pub const DB_E_BADCOPY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217863));
pub const DB_E_BADPRECISION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217862));
pub const DB_E_BADSCALE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217861));
pub const DB_E_BADTABLEID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217860));
pub const DB_E_BADID = @as(i32, -2147217860);
pub const DB_E_BADTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217859));
pub const DB_E_DUPLICATECOLUMNID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217858));
pub const DB_E_DUPLICATETABLEID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217857));
pub const DB_E_TABLEINUSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217856));
pub const DB_E_NOLOCALE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217855));
pub const DB_E_BADRECORDNUM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217854));
pub const DB_E_BOOKMARKSKIPPED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217853));
pub const DB_E_BADPROPERTYVALUE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217852));
pub const DB_E_INVALID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217851));
pub const DB_E_BADACCESSORFLAGS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217850));
pub const DB_E_BADSTORAGEFLAGS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217849));
pub const DB_E_BYREFACCESSORNOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217848));
pub const DB_E_NULLACCESSORNOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217847));
pub const DB_E_NOTPREPARED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217846));
pub const DB_E_BADACCESSORTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217845));
pub const DB_E_WRITEONLYACCESSOR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217844));
pub const DB_SEC_E_AUTH_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217843));
pub const DB_E_CANCELED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217842));
pub const DB_E_CHAPTERNOTRELEASED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217841));
pub const DB_E_BADSOURCEHANDLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217840));
pub const DB_E_PARAMUNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217839));
pub const DB_E_ALREADYINITIALIZED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217838));
pub const DB_E_NOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217837));
pub const DB_E_MAXPENDCHANGESEXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217836));
pub const DB_E_BADORDINAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217835));
pub const DB_E_PENDINGCHANGES = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217834));
pub const DB_E_DATAOVERFLOW = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217833));
pub const DB_E_BADHRESULT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217832));
pub const DB_E_BADLOOKUPID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217831));
pub const DB_E_BADDYNAMICERRORID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217830));
pub const DB_E_PENDINGINSERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217829));
pub const DB_E_BADCONVERTFLAG = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217828));
pub const DB_E_BADPARAMETERNAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217827));
pub const DB_E_MULTIPLESTORAGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217826));
pub const DB_E_CANTFILTER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217825));
pub const DB_E_CANTORDER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217824));
pub const MD_E_BADTUPLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217823));
pub const MD_E_BADCOORDINATE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217822));
pub const MD_E_INVALIDAXIS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217821));
pub const MD_E_INVALIDCELLRANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217820));
pub const DB_E_NOCOLUMN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217819));
pub const DB_E_COMMANDNOTPERSISTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217817));
pub const DB_E_DUPLICATEID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217816));
pub const DB_E_OBJECTCREATIONLIMITREACHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217815));
pub const DB_E_BADINDEXID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217806));
pub const DB_E_BADINITSTRING = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217805));
pub const DB_E_NOPROVIDERSREGISTERED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217804));
pub const DB_E_MISMATCHEDPROVIDER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217803));
pub const DB_E_BADCOMMANDID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217802));
pub const SEC_E_PERMISSIONDENIED = @as(i32, -2147217911);
pub const SEC_E_BADTRUSTEEID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217814));
pub const SEC_E_NOTRUSTEEID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217813));
pub const SEC_E_NOMEMBERSHIPSUPPORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217812));
pub const SEC_E_INVALIDOBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217811));
pub const SEC_E_NOOWNER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217810));
pub const SEC_E_INVALIDACCESSENTRYLIST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217809));
pub const SEC_E_INVALIDOWNER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217808));
pub const SEC_E_INVALIDACCESSENTRY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217807));
pub const DB_E_BADCONSTRAINTTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217801));
pub const DB_E_BADCONSTRAINTFORM = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217800));
pub const DB_E_BADDEFERRABILITY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217799));
pub const DB_E_BADMATCHTYPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217792));
pub const DB_E_BADUPDATEDELETERULE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217782));
pub const DB_E_BADCONSTRAINTID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217781));
pub const DB_E_BADCOMMANDFLAGS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217780));
pub const DB_E_OBJECTMISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217779));
pub const DB_E_NOSOURCEOBJECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217775));
pub const DB_E_RESOURCELOCKED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217774));
pub const DB_E_NOTCOLLECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217773));
pub const DB_E_READONLY = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217772));
pub const DB_E_ASYNCNOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217771));
pub const DB_E_CANNOTCONNECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217770));
pub const DB_E_TIMEOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217769));
pub const DB_E_RESOURCEEXISTS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217768));
pub const DB_E_RESOURCEOUTOFSCOPE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217778));
pub const DB_E_DROPRESTRICTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217776));
pub const DB_E_DUPLICATECONSTRAINTID = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217767));
pub const DB_E_OUTOFSPACE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217766));
pub const DB_SEC_E_SAFEMODE_DENIED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217765));
pub const DB_E_NOSTATISTIC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217764));
pub const DB_E_ALTERRESTRICTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217763));
pub const DB_E_RESOURCENOTSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217762));
pub const DB_E_NOCONSTRAINT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217761));
pub const DB_E_COLUMNUNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147217760));
pub const DB_S_ROWLIMITEXCEEDED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265920));
pub const DB_S_COLUMNTYPEMISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265921));
pub const DB_S_TYPEINFOOVERRIDDEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265922));
pub const DB_S_BOOKMARKSKIPPED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265923));
pub const DB_S_NONEXTROWSET = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265925));
pub const DB_S_ENDOFROWSET = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265926));
pub const DB_S_COMMANDREEXECUTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265927));
pub const DB_S_BUFFERFULL = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265928));
pub const DB_S_NORESULT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265929));
pub const DB_S_CANTRELEASE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265930));
pub const DB_S_GOALCHANGED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265931));
pub const DB_S_UNWANTEDOPERATION = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265932));
pub const DB_S_DIALECTIGNORED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265933));
pub const DB_S_UNWANTEDPHASE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265934));
pub const DB_S_UNWANTEDREASON = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265935));
pub const DB_S_ASYNCHRONOUS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265936));
pub const DB_S_COLUMNSCHANGED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265937));
pub const DB_S_ERRORSRETURNED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265938));
pub const DB_S_BADROWHANDLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265939));
pub const DB_S_DELETEDROW = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265940));
pub const DB_S_TOOMANYCHANGES = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265941));
pub const DB_S_STOPLIMITREACHED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265942));
pub const DB_S_LOCKUPGRADED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265944));
pub const DB_S_PROPERTIESCHANGED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265945));
pub const DB_S_ERRORSOCCURRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265946));
pub const DB_S_PARAMUNAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265947));
pub const DB_S_MULTIPLECHANGES = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265948));
pub const DB_S_NOTSINGLETON = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265943));
pub const DB_S_NOROWSPECIFICCOLUMNS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 265949));
pub const DBPROPFLAGS_PERSIST = @as(u32, 8192);
pub const DBPROPVAL_PERSIST_ADTG = @as(u32, 0);
pub const DBPROPVAL_PERSIST_XML = @as(u32, 1);
pub const DBPROP_PersistFormat = @as(u32, 2);
pub const DBPROP_PersistSchema = @as(u32, 3);
pub const DBPROP_HCHAPTER = @as(u32, 4);
pub const DBPROP_MAINTAINPROPS = @as(u32, 5);
pub const DBPROP_Unicode = @as(u32, 6);
pub const DBPROP_INTERLEAVEDROWS = @as(u32, 8);
pub const DISPID_QUERY_RANKVECTOR = @as(u32, 2);
pub const DISPID_QUERY_RANK = @as(u32, 3);
pub const DISPID_QUERY_HITCOUNT = @as(u32, 4);
pub const DISPID_QUERY_WORKID = @as(u32, 5);
pub const DISPID_QUERY_ALL = @as(u32, 6);
pub const DISPID_QUERY_UNFILTERED = @as(u32, 7);
pub const DISPID_QUERY_REVNAME = @as(u32, 8);
pub const DISPID_QUERY_VIRTUALPATH = @as(u32, 9);
pub const DISPID_QUERY_LASTSEENTIME = @as(u32, 10);
pub const CQUERYDISPIDS = @as(u32, 11);
pub const DISPID_QUERY_METADATA_VROOTUSED = @as(u32, 2);
pub const DISPID_QUERY_METADATA_VROOTAUTOMATIC = @as(u32, 3);
pub const DISPID_QUERY_METADATA_VROOTMANUAL = @as(u32, 4);
pub const DISPID_QUERY_METADATA_PROPGUID = @as(u32, 5);
pub const DISPID_QUERY_METADATA_PROPDISPID = @as(u32, 6);
pub const DISPID_QUERY_METADATA_PROPNAME = @as(u32, 7);
pub const DISPID_QUERY_METADATA_STORELEVEL = @as(u32, 8);
pub const DISPID_QUERY_METADATA_PROPMODIFIABLE = @as(u32, 9);
pub const CQUERYMETADISPIDS = @as(u32, 10);
pub const PROPID_DBBMK_BOOKMARK = @as(u32, 2);
pub const PROPID_DBBMK_CHAPTER = @as(u32, 3);
pub const CDBBMKDISPIDS = @as(u32, 8);
pub const PROPID_DBSELF_SELF = @as(u32, 2);
pub const CDBSELFDISPIDS = @as(u32, 8);
pub const CDBCOLDISPIDS = @as(u32, 28);
pub const CQUERYPROPERTY = @as(u32, 64);
pub const QUERY_VALIDBITS = @as(u32, 3);
pub const RTNone = @as(u32, 0);
pub const RTAnd = @as(u32, 1);
pub const RTOr = @as(u32, 2);
pub const RTNot = @as(u32, 3);
pub const RTContent = @as(u32, 4);
pub const RTProperty = @as(u32, 5);
pub const RTProximity = @as(u32, 6);
pub const RTVector = @as(u32, 7);
pub const RTNatLanguage = @as(u32, 8);
pub const GENERATE_METHOD_PREFIXMATCH = @as(u32, 1);
pub const GENERATE_METHOD_STEMMED = @as(u32, 2);
pub const PRRE = @as(u32, 6);
pub const PRAllBits = @as(u32, 7);
pub const PRSomeBits = @as(u32, 8);
pub const PRAll = @as(u32, 256);
pub const PRAny = @as(u32, 512);
pub const QUERY_SORTXASCEND = @as(u32, 2);
pub const QUERY_SORTXDESCEND = @as(u32, 3);
pub const QUERY_SORTDEFAULT = @as(u32, 4);
pub const CATEGORIZE_UNIQUE = @as(u32, 0);
pub const CATEGORIZE_CLUSTER = @as(u32, 1);
pub const CATEGORIZE_BUCKETS = @as(u32, 2);
pub const BUCKET_LINEAR = @as(u32, 0);
pub const BUCKET_EXPONENTIAL = @as(u32, 1);
pub const CATEGORIZE_RANGE = @as(u32, 3);
pub const OCC_INVALID = @as(u32, 4294967295);
pub const MAX_QUERY_RANK = @as(u32, 1000);
pub const OSP_IndexLabel = @as(u32, 0);
pub const SQL_NULL_DATA = @as(i32, -1);
pub const SQL_DATA_AT_EXEC = @as(i32, -2);
pub const SQL_SUCCESS = @as(u32, 0);
pub const SQL_SUCCESS_WITH_INFO = @as(u32, 1);
pub const SQL_NO_DATA = @as(u32, 100);
pub const SQL_PARAM_DATA_AVAILABLE = @as(u32, 101);
pub const SQL_ERROR = @as(i32, -1);
pub const SQL_INVALID_HANDLE = @as(i32, -2);
pub const SQL_STILL_EXECUTING = @as(u32, 2);
pub const SQL_NEED_DATA = @as(u32, 99);
pub const SQL_NTS = @as(i32, -3);
pub const SQL_NTSL = @as(i32, -3);
pub const SQL_MAX_MESSAGE_LENGTH = @as(u32, 512);
pub const SQL_DATE_LEN = @as(u32, 10);
pub const SQL_TIME_LEN = @as(u32, 8);
pub const SQL_TIMESTAMP_LEN = @as(u32, 19);
pub const SQL_HANDLE_ENV = @as(u32, 1);
pub const SQL_HANDLE_DBC = @as(u32, 2);
pub const SQL_HANDLE_STMT = @as(u32, 3);
pub const SQL_HANDLE_DESC = @as(u32, 4);
pub const SQL_ATTR_OUTPUT_NTS = @as(u32, 10001);
pub const SQL_ATTR_AUTO_IPD = @as(u32, 10001);
pub const SQL_ATTR_METADATA_ID = @as(u32, 10014);
pub const SQL_ATTR_APP_ROW_DESC = @as(u32, 10010);
pub const SQL_ATTR_APP_PARAM_DESC = @as(u32, 10011);
pub const SQL_ATTR_IMP_ROW_DESC = @as(u32, 10012);
pub const SQL_ATTR_IMP_PARAM_DESC = @as(u32, 10013);
pub const SQL_ATTR_CURSOR_SCROLLABLE = @as(i32, -1);
pub const SQL_ATTR_CURSOR_SENSITIVITY = @as(i32, -2);
pub const SQL_NONSCROLLABLE = @as(u32, 0);
pub const SQL_SCROLLABLE = @as(u32, 1);
pub const SQL_DESC_COUNT = @as(u32, 1001);
pub const SQL_DESC_TYPE = @as(u32, 1002);
pub const SQL_DESC_LENGTH = @as(u32, 1003);
pub const SQL_DESC_OCTET_LENGTH_PTR = @as(u32, 1004);
pub const SQL_DESC_PRECISION = @as(u32, 1005);
pub const SQL_DESC_SCALE = @as(u32, 1006);
pub const SQL_DESC_DATETIME_INTERVAL_CODE = @as(u32, 1007);
pub const SQL_DESC_NULLABLE = @as(u32, 1008);
pub const SQL_DESC_INDICATOR_PTR = @as(u32, 1009);
pub const SQL_DESC_DATA_PTR = @as(u32, 1010);
pub const SQL_DESC_NAME = @as(u32, 1011);
pub const SQL_DESC_UNNAMED = @as(u32, 1012);
pub const SQL_DESC_OCTET_LENGTH = @as(u32, 1013);
pub const SQL_DESC_ALLOC_TYPE = @as(u32, 1099);
pub const SQL_DIAG_RETURNCODE = @as(u32, 1);
pub const SQL_DIAG_NUMBER = @as(u32, 2);
pub const SQL_DIAG_ROW_COUNT = @as(u32, 3);
pub const SQL_DIAG_SQLSTATE = @as(u32, 4);
pub const SQL_DIAG_NATIVE = @as(u32, 5);
pub const SQL_DIAG_MESSAGE_TEXT = @as(u32, 6);
pub const SQL_DIAG_DYNAMIC_FUNCTION = @as(u32, 7);
pub const SQL_DIAG_CLASS_ORIGIN = @as(u32, 8);
pub const SQL_DIAG_SUBCLASS_ORIGIN = @as(u32, 9);
pub const SQL_DIAG_CONNECTION_NAME = @as(u32, 10);
pub const SQL_DIAG_SERVER_NAME = @as(u32, 11);
pub const SQL_DIAG_DYNAMIC_FUNCTION_CODE = @as(u32, 12);
pub const SQL_DIAG_ALTER_DOMAIN = @as(u32, 3);
pub const SQL_DIAG_ALTER_TABLE = @as(u32, 4);
pub const SQL_DIAG_CALL = @as(u32, 7);
pub const SQL_DIAG_CREATE_ASSERTION = @as(u32, 6);
pub const SQL_DIAG_CREATE_CHARACTER_SET = @as(u32, 8);
pub const SQL_DIAG_CREATE_COLLATION = @as(u32, 10);
pub const SQL_DIAG_CREATE_DOMAIN = @as(u32, 23);
pub const SQL_DIAG_CREATE_INDEX = @as(i32, -1);
pub const SQL_DIAG_CREATE_SCHEMA = @as(u32, 64);
pub const SQL_DIAG_CREATE_TABLE = @as(u32, 77);
pub const SQL_DIAG_CREATE_TRANSLATION = @as(u32, 79);
pub const SQL_DIAG_CREATE_VIEW = @as(u32, 84);
pub const SQL_DIAG_DELETE_WHERE = @as(u32, 19);
pub const SQL_DIAG_DROP_ASSERTION = @as(u32, 24);
pub const SQL_DIAG_DROP_CHARACTER_SET = @as(u32, 25);
pub const SQL_DIAG_DROP_COLLATION = @as(u32, 26);
pub const SQL_DIAG_DROP_DOMAIN = @as(u32, 27);
pub const SQL_DIAG_DROP_INDEX = @as(i32, -2);
pub const SQL_DIAG_DROP_SCHEMA = @as(u32, 31);
pub const SQL_DIAG_DROP_TABLE = @as(u32, 32);
pub const SQL_DIAG_DROP_TRANSLATION = @as(u32, 33);
pub const SQL_DIAG_DROP_VIEW = @as(u32, 36);
pub const SQL_DIAG_DYNAMIC_DELETE_CURSOR = @as(u32, 38);
pub const SQL_DIAG_DYNAMIC_UPDATE_CURSOR = @as(u32, 81);
pub const SQL_DIAG_GRANT = @as(u32, 48);
pub const SQL_DIAG_INSERT = @as(u32, 50);
pub const SQL_DIAG_REVOKE = @as(u32, 59);
pub const SQL_DIAG_SELECT_CURSOR = @as(u32, 85);
pub const SQL_DIAG_UNKNOWN_STATEMENT = @as(u32, 0);
pub const SQL_DIAG_UPDATE_WHERE = @as(u32, 82);
pub const SQL_UNKNOWN_TYPE = @as(u32, 0);
pub const SQL_CHAR = @as(u32, 1);
pub const SQL_NUMERIC = @as(u32, 2);
pub const SQL_DECIMAL = @as(u32, 3);
pub const SQL_INTEGER = @as(u32, 4);
pub const SQL_SMALLINT = @as(u32, 5);
pub const SQL_FLOAT = @as(u32, 6);
pub const SQL_REAL = @as(u32, 7);
pub const SQL_DOUBLE = @as(u32, 8);
pub const SQL_DATETIME = @as(u32, 9);
pub const SQL_VARCHAR = @as(u32, 12);
pub const SQL_TYPE_DATE = @as(u32, 91);
pub const SQL_TYPE_TIME = @as(u32, 92);
pub const SQL_TYPE_TIMESTAMP = @as(u32, 93);
pub const SQL_UNSPECIFIED = @as(u32, 0);
pub const SQL_INSENSITIVE = @as(u32, 1);
pub const SQL_SENSITIVE = @as(u32, 2);
pub const SQL_ALL_TYPES = @as(u32, 0);
pub const SQL_DEFAULT = @as(u32, 99);
pub const SQL_ARD_TYPE = @as(i32, -99);
pub const SQL_APD_TYPE = @as(i32, -100);
pub const SQL_CODE_DATE = @as(u32, 1);
pub const SQL_CODE_TIME = @as(u32, 2);
pub const SQL_CODE_TIMESTAMP = @as(u32, 3);
pub const SQL_FALSE = @as(u32, 0);
pub const SQL_TRUE = @as(u32, 1);
pub const SQL_NO_NULLS = @as(u32, 0);
pub const SQL_NULLABLE = @as(u32, 1);
pub const SQL_NULLABLE_UNKNOWN = @as(u32, 2);
pub const SQL_PRED_NONE = @as(u32, 0);
pub const SQL_PRED_CHAR = @as(u32, 1);
pub const SQL_PRED_BASIC = @as(u32, 2);
pub const SQL_NAMED = @as(u32, 0);
pub const SQL_UNNAMED = @as(u32, 1);
pub const SQL_DESC_ALLOC_AUTO = @as(u32, 1);
pub const SQL_DESC_ALLOC_USER = @as(u32, 2);
pub const SQL_CLOSE = @as(u32, 0);
pub const SQL_DROP = @as(u32, 1);
pub const SQL_UNBIND = @as(u32, 2);
pub const SQL_RESET_PARAMS = @as(u32, 3);
pub const SQL_FETCH_NEXT = @as(u32, 1);
pub const SQL_FETCH_FIRST = @as(u32, 2);
pub const SQL_FETCH_LAST = @as(u32, 3);
pub const SQL_FETCH_PRIOR = @as(u32, 4);
pub const SQL_FETCH_ABSOLUTE = @as(u32, 5);
pub const SQL_FETCH_RELATIVE = @as(u32, 6);
pub const SQL_COMMIT = @as(u32, 0);
pub const SQL_ROLLBACK = @as(u32, 1);
pub const SQL_NULL_HENV = @as(u32, 0);
pub const SQL_NULL_HDBC = @as(u32, 0);
pub const SQL_NULL_HSTMT = @as(u32, 0);
pub const SQL_NULL_HDESC = @as(u32, 0);
pub const SQL_NULL_HANDLE = @as(i32, 0);
pub const SQL_SCOPE_CURROW = @as(u32, 0);
pub const SQL_SCOPE_TRANSACTION = @as(u32, 1);
pub const SQL_SCOPE_SESSION = @as(u32, 2);
pub const SQL_PC_UNKNOWN = @as(u32, 0);
pub const SQL_PC_NON_PSEUDO = @as(u32, 1);
pub const SQL_PC_PSEUDO = @as(u32, 2);
pub const SQL_ROW_IDENTIFIER = @as(u32, 1);
pub const SQL_INDEX_UNIQUE = @as(u32, 0);
pub const SQL_INDEX_ALL = @as(u32, 1);
pub const SQL_INDEX_CLUSTERED = @as(u32, 1);
pub const SQL_INDEX_HASHED = @as(u32, 2);
pub const SQL_INDEX_OTHER = @as(u32, 3);
pub const SQL_API_SQLALLOCCONNECT = @as(u32, 1);
pub const SQL_API_SQLALLOCENV = @as(u32, 2);
pub const SQL_API_SQLALLOCHANDLE = @as(u32, 1001);
pub const SQL_API_SQLALLOCSTMT = @as(u32, 3);
pub const SQL_API_SQLBINDCOL = @as(u32, 4);
pub const SQL_API_SQLBINDPARAM = @as(u32, 1002);
pub const SQL_API_SQLCANCEL = @as(u32, 5);
pub const SQL_API_SQLCLOSECURSOR = @as(u32, 1003);
pub const SQL_API_SQLCOLATTRIBUTE = @as(u32, 6);
pub const SQL_API_SQLCOLUMNS = @as(u32, 40);
pub const SQL_API_SQLCONNECT = @as(u32, 7);
pub const SQL_API_SQLCOPYDESC = @as(u32, 1004);
pub const SQL_API_SQLDATASOURCES = @as(u32, 57);
pub const SQL_API_SQLDESCRIBECOL = @as(u32, 8);
pub const SQL_API_SQLDISCONNECT = @as(u32, 9);
pub const SQL_API_SQLENDTRAN = @as(u32, 1005);
pub const SQL_API_SQLERROR = @as(u32, 10);
pub const SQL_API_SQLEXECDIRECT = @as(u32, 11);
pub const SQL_API_SQLEXECUTE = @as(u32, 12);
pub const SQL_API_SQLFETCH = @as(u32, 13);
pub const SQL_API_SQLFETCHSCROLL = @as(u32, 1021);
pub const SQL_API_SQLFREECONNECT = @as(u32, 14);
pub const SQL_API_SQLFREEENV = @as(u32, 15);
pub const SQL_API_SQLFREEHANDLE = @as(u32, 1006);
pub const SQL_API_SQLFREESTMT = @as(u32, 16);
pub const SQL_API_SQLGETCONNECTATTR = @as(u32, 1007);
pub const SQL_API_SQLGETCONNECTOPTION = @as(u32, 42);
pub const SQL_API_SQLGETCURSORNAME = @as(u32, 17);
pub const SQL_API_SQLGETDATA = @as(u32, 43);
pub const SQL_API_SQLGETDESCFIELD = @as(u32, 1008);
pub const SQL_API_SQLGETDESCREC = @as(u32, 1009);
pub const SQL_API_SQLGETDIAGFIELD = @as(u32, 1010);
pub const SQL_API_SQLGETDIAGREC = @as(u32, 1011);
pub const SQL_API_SQLGETENVATTR = @as(u32, 1012);
pub const SQL_API_SQLGETFUNCTIONS = @as(u32, 44);
pub const SQL_API_SQLGETINFO = @as(u32, 45);
pub const SQL_API_SQLGETSTMTATTR = @as(u32, 1014);
pub const SQL_API_SQLGETSTMTOPTION = @as(u32, 46);
pub const SQL_API_SQLGETTYPEINFO = @as(u32, 47);
pub const SQL_API_SQLNUMRESULTCOLS = @as(u32, 18);
pub const SQL_API_SQLPARAMDATA = @as(u32, 48);
pub const SQL_API_SQLPREPARE = @as(u32, 19);
pub const SQL_API_SQLPUTDATA = @as(u32, 49);
pub const SQL_API_SQLROWCOUNT = @as(u32, 20);
pub const SQL_API_SQLSETCONNECTATTR = @as(u32, 1016);
pub const SQL_API_SQLSETCONNECTOPTION = @as(u32, 50);
pub const SQL_API_SQLSETCURSORNAME = @as(u32, 21);
pub const SQL_API_SQLSETDESCFIELD = @as(u32, 1017);
pub const SQL_API_SQLSETDESCREC = @as(u32, 1018);
pub const SQL_API_SQLSETENVATTR = @as(u32, 1019);
pub const SQL_API_SQLSETPARAM = @as(u32, 22);
pub const SQL_API_SQLSETSTMTATTR = @as(u32, 1020);
pub const SQL_API_SQLSETSTMTOPTION = @as(u32, 51);
pub const SQL_API_SQLSPECIALCOLUMNS = @as(u32, 52);
pub const SQL_API_SQLSTATISTICS = @as(u32, 53);
pub const SQL_API_SQLTABLES = @as(u32, 54);
pub const SQL_API_SQLTRANSACT = @as(u32, 23);
pub const SQL_API_SQLCANCELHANDLE = @as(u32, 1550);
pub const SQL_API_SQLCOMPLETEASYNC = @as(u32, 1551);
pub const SQL_MAX_DRIVER_CONNECTIONS = @as(u32, 0);
pub const SQL_MAXIMUM_DRIVER_CONNECTIONS = @as(u32, 0);
pub const SQL_MAX_CONCURRENT_ACTIVITIES = @as(u32, 1);
pub const SQL_MAXIMUM_CONCURRENT_ACTIVITIES = @as(u32, 1);
pub const SQL_DATA_SOURCE_NAME = @as(u32, 2);
pub const SQL_FETCH_DIRECTION = @as(u32, 8);
pub const SQL_SERVER_NAME = @as(u32, 13);
pub const SQL_SEARCH_PATTERN_ESCAPE = @as(u32, 14);
pub const SQL_DBMS_NAME = @as(u32, 17);
pub const SQL_DBMS_VER = @as(u32, 18);
pub const SQL_ACCESSIBLE_TABLES = @as(u32, 19);
pub const SQL_ACCESSIBLE_PROCEDURES = @as(u32, 20);
pub const SQL_CURSOR_COMMIT_BEHAVIOR = @as(u32, 23);
pub const SQL_DATA_SOURCE_READ_ONLY = @as(u32, 25);
pub const SQL_DEFAULT_TXN_ISOLATION = @as(u32, 26);
pub const SQL_IDENTIFIER_CASE = @as(u32, 28);
pub const SQL_IDENTIFIER_QUOTE_CHAR = @as(u32, 29);
pub const SQL_MAX_COLUMN_NAME_LEN = @as(u32, 30);
pub const SQL_MAXIMUM_COLUMN_NAME_LENGTH = @as(u32, 30);
pub const SQL_MAX_CURSOR_NAME_LEN = @as(u32, 31);
pub const SQL_MAXIMUM_CURSOR_NAME_LENGTH = @as(u32, 31);
pub const SQL_MAX_SCHEMA_NAME_LEN = @as(u32, 32);
pub const SQL_MAXIMUM_SCHEMA_NAME_LENGTH = @as(u32, 32);
pub const SQL_MAX_CATALOG_NAME_LEN = @as(u32, 34);
pub const SQL_MAXIMUM_CATALOG_NAME_LENGTH = @as(u32, 34);
pub const SQL_MAX_TABLE_NAME_LEN = @as(u32, 35);
pub const SQL_SCROLL_CONCURRENCY = @as(u32, 43);
pub const SQL_TXN_CAPABLE = @as(u32, 46);
pub const SQL_TRANSACTION_CAPABLE = @as(u32, 46);
pub const SQL_USER_NAME = @as(u32, 47);
pub const SQL_TXN_ISOLATION_OPTION = @as(u32, 72);
pub const SQL_TRANSACTION_ISOLATION_OPTION = @as(u32, 72);
pub const SQL_INTEGRITY = @as(u32, 73);
pub const SQL_GETDATA_EXTENSIONS = @as(u32, 81);
pub const SQL_NULL_COLLATION = @as(u32, 85);
pub const SQL_ALTER_TABLE = @as(u32, 86);
pub const SQL_ORDER_BY_COLUMNS_IN_SELECT = @as(u32, 90);
pub const SQL_SPECIAL_CHARACTERS = @as(u32, 94);
pub const SQL_MAX_COLUMNS_IN_GROUP_BY = @as(u32, 97);
pub const SQL_MAXIMUM_COLUMNS_IN_GROUP_BY = @as(u32, 97);
pub const SQL_MAX_COLUMNS_IN_INDEX = @as(u32, 98);
pub const SQL_MAXIMUM_COLUMNS_IN_INDEX = @as(u32, 98);
pub const SQL_MAX_COLUMNS_IN_ORDER_BY = @as(u32, 99);
pub const SQL_MAXIMUM_COLUMNS_IN_ORDER_BY = @as(u32, 99);
pub const SQL_MAX_COLUMNS_IN_SELECT = @as(u32, 100);
pub const SQL_MAXIMUM_COLUMNS_IN_SELECT = @as(u32, 100);
pub const SQL_MAX_COLUMNS_IN_TABLE = @as(u32, 101);
pub const SQL_MAX_INDEX_SIZE = @as(u32, 102);
pub const SQL_MAXIMUM_INDEX_SIZE = @as(u32, 102);
pub const SQL_MAX_ROW_SIZE = @as(u32, 104);
pub const SQL_MAXIMUM_ROW_SIZE = @as(u32, 104);
pub const SQL_MAX_STATEMENT_LEN = @as(u32, 105);
pub const SQL_MAXIMUM_STATEMENT_LENGTH = @as(u32, 105);
pub const SQL_MAX_TABLES_IN_SELECT = @as(u32, 106);
pub const SQL_MAXIMUM_TABLES_IN_SELECT = @as(u32, 106);
pub const SQL_MAX_USER_NAME_LEN = @as(u32, 107);
pub const SQL_MAXIMUM_USER_NAME_LENGTH = @as(u32, 107);
pub const SQL_OJ_CAPABILITIES = @as(u32, 115);
pub const SQL_OUTER_JOIN_CAPABILITIES = @as(u32, 115);
pub const SQL_XOPEN_CLI_YEAR = @as(u32, 10000);
pub const SQL_CURSOR_SENSITIVITY = @as(u32, 10001);
pub const SQL_DESCRIBE_PARAMETER = @as(u32, 10002);
pub const SQL_CATALOG_NAME = @as(u32, 10003);
pub const SQL_COLLATION_SEQ = @as(u32, 10004);
pub const SQL_MAX_IDENTIFIER_LEN = @as(u32, 10005);
pub const SQL_MAXIMUM_IDENTIFIER_LENGTH = @as(u32, 10005);
pub const SQL_AT_ADD_COLUMN = @as(i32, 1);
pub const SQL_AT_DROP_COLUMN = @as(i32, 2);
pub const SQL_AT_ADD_CONSTRAINT = @as(i32, 8);
pub const SQL_AM_NONE = @as(u32, 0);
pub const SQL_AM_CONNECTION = @as(u32, 1);
pub const SQL_AM_STATEMENT = @as(u32, 2);
pub const SQL_CB_DELETE = @as(u32, 0);
pub const SQL_CB_CLOSE = @as(u32, 1);
pub const SQL_CB_PRESERVE = @as(u32, 2);
pub const SQL_FD_FETCH_NEXT = @as(i32, 1);
pub const SQL_FD_FETCH_FIRST = @as(i32, 2);
pub const SQL_FD_FETCH_LAST = @as(i32, 4);
pub const SQL_FD_FETCH_PRIOR = @as(i32, 8);
pub const SQL_FD_FETCH_ABSOLUTE = @as(i32, 16);
pub const SQL_FD_FETCH_RELATIVE = @as(i32, 32);
pub const SQL_GD_ANY_COLUMN = @as(i32, 1);
pub const SQL_GD_ANY_ORDER = @as(i32, 2);
pub const SQL_IC_UPPER = @as(u32, 1);
pub const SQL_IC_LOWER = @as(u32, 2);
pub const SQL_IC_SENSITIVE = @as(u32, 3);
pub const SQL_IC_MIXED = @as(u32, 4);
pub const SQL_OJ_LEFT = @as(i32, 1);
pub const SQL_OJ_RIGHT = @as(i32, 2);
pub const SQL_OJ_FULL = @as(i32, 4);
pub const SQL_OJ_NESTED = @as(i32, 8);
pub const SQL_OJ_NOT_ORDERED = @as(i32, 16);
pub const SQL_OJ_INNER = @as(i32, 32);
pub const SQL_OJ_ALL_COMPARISON_OPS = @as(i32, 64);
pub const SQL_SCCO_READ_ONLY = @as(i32, 1);
pub const SQL_SCCO_LOCK = @as(i32, 2);
pub const SQL_SCCO_OPT_ROWVER = @as(i32, 4);
pub const SQL_SCCO_OPT_VALUES = @as(i32, 8);
pub const SQL_TC_NONE = @as(u32, 0);
pub const SQL_TC_DML = @as(u32, 1);
pub const SQL_TC_ALL = @as(u32, 2);
pub const SQL_TC_DDL_COMMIT = @as(u32, 3);
pub const SQL_TC_DDL_IGNORE = @as(u32, 4);
pub const SQL_TXN_READ_UNCOMMITTED = @as(i32, 1);
pub const SQL_TRANSACTION_READ_UNCOMMITTED = @as(i32, 1);
pub const SQL_TXN_READ_COMMITTED = @as(i32, 2);
pub const SQL_TRANSACTION_READ_COMMITTED = @as(i32, 2);
pub const SQL_TXN_REPEATABLE_READ = @as(i32, 4);
pub const SQL_TRANSACTION_REPEATABLE_READ = @as(i32, 4);
pub const SQL_TXN_SERIALIZABLE = @as(i32, 8);
pub const SQL_TRANSACTION_SERIALIZABLE = @as(i32, 8);
pub const SQL_NC_HIGH = @as(u32, 0);
pub const SQL_NC_LOW = @as(u32, 1);
pub const SQL_SPEC_MAJOR = @as(u32, 3);
pub const SQL_SPEC_MINOR = @as(u32, 80);
pub const SQL_SQLSTATE_SIZE = @as(u32, 5);
pub const SQL_MAX_DSN_LENGTH = @as(u32, 32);
pub const SQL_MAX_OPTION_STRING_LENGTH = @as(u32, 256);
pub const SQL_NO_DATA_FOUND = @as(u32, 100);
pub const SQL_HANDLE_SENV = @as(u32, 5);
pub const SQL_ATTR_ODBC_VERSION = @as(u32, 200);
pub const SQL_ATTR_CONNECTION_POOLING = @as(u32, 201);
pub const SQL_ATTR_CP_MATCH = @as(u32, 202);
pub const SQL_ATTR_APPLICATION_KEY = @as(u32, 203);
pub const SQL_CP_OFF = @as(u32, 0);
pub const SQL_CP_ONE_PER_DRIVER = @as(u32, 1);
pub const SQL_CP_ONE_PER_HENV = @as(u32, 2);
pub const SQL_CP_DRIVER_AWARE = @as(u32, 3);
pub const SQL_CP_DEFAULT = @as(u32, 0);
pub const SQL_CP_STRICT_MATCH = @as(u32, 0);
pub const SQL_CP_RELAXED_MATCH = @as(u32, 1);
pub const SQL_CP_MATCH_DEFAULT = @as(u32, 0);
pub const SQL_OV_ODBC2 = @as(u32, 2);
pub const SQL_OV_ODBC3 = @as(u32, 3);
pub const SQL_OV_ODBC3_80 = @as(u32, 380);
pub const SQL_ACCESS_MODE = @as(u32, 101);
pub const SQL_AUTOCOMMIT = @as(u32, 102);
pub const SQL_LOGIN_TIMEOUT = @as(u32, 103);
pub const SQL_OPT_TRACE = @as(u32, 104);
pub const SQL_OPT_TRACEFILE = @as(u32, 105);
pub const SQL_TRANSLATE_DLL = @as(u32, 106);
pub const SQL_TRANSLATE_OPTION = @as(u32, 107);
pub const SQL_TXN_ISOLATION = @as(u32, 108);
pub const SQL_CURRENT_QUALIFIER = @as(u32, 109);
pub const SQL_ODBC_CURSORS = @as(u32, 110);
pub const SQL_QUIET_MODE = @as(u32, 111);
pub const SQL_PACKET_SIZE = @as(u32, 112);
pub const SQL_ATTR_ACCESS_MODE = @as(u32, 101);
pub const SQL_ATTR_AUTOCOMMIT = @as(u32, 102);
pub const SQL_ATTR_CONNECTION_TIMEOUT = @as(u32, 113);
pub const SQL_ATTR_CURRENT_CATALOG = @as(u32, 109);
pub const SQL_ATTR_DISCONNECT_BEHAVIOR = @as(u32, 114);
pub const SQL_ATTR_ENLIST_IN_DTC = @as(u32, 1207);
pub const SQL_ATTR_ENLIST_IN_XA = @as(u32, 1208);
pub const SQL_ATTR_LOGIN_TIMEOUT = @as(u32, 103);
pub const SQL_ATTR_ODBC_CURSORS = @as(u32, 110);
pub const SQL_ATTR_PACKET_SIZE = @as(u32, 112);
pub const SQL_ATTR_QUIET_MODE = @as(u32, 111);
pub const SQL_ATTR_TRACE = @as(u32, 104);
pub const SQL_ATTR_TRACEFILE = @as(u32, 105);
pub const SQL_ATTR_TRANSLATE_LIB = @as(u32, 106);
pub const SQL_ATTR_TRANSLATE_OPTION = @as(u32, 107);
pub const SQL_ATTR_TXN_ISOLATION = @as(u32, 108);
pub const SQL_ATTR_CONNECTION_DEAD = @as(u32, 1209);
pub const SQL_ATTR_ANSI_APP = @as(u32, 115);
pub const SQL_ATTR_RESET_CONNECTION = @as(u32, 116);
pub const SQL_ATTR_ASYNC_DBC_FUNCTIONS_ENABLE = @as(u32, 117);
pub const SQL_ATTR_ASYNC_DBC_EVENT = @as(u32, 119);
pub const SQL_CONNECT_OPT_DRVR_START = @as(u32, 1000);
pub const SQL_CONN_OPT_MAX = @as(u32, 112);
pub const SQL_CONN_OPT_MIN = @as(u32, 101);
pub const SQL_MODE_READ_WRITE = @as(u32, 0);
pub const SQL_MODE_READ_ONLY = @as(u32, 1);
pub const SQL_MODE_DEFAULT = @as(u32, 0);
pub const SQL_AUTOCOMMIT_OFF = @as(u32, 0);
pub const SQL_AUTOCOMMIT_ON = @as(u32, 1);
pub const SQL_AUTOCOMMIT_DEFAULT = @as(u32, 1);
pub const SQL_LOGIN_TIMEOUT_DEFAULT = @as(u32, 15);
pub const SQL_OPT_TRACE_OFF = @as(u32, 0);
pub const SQL_OPT_TRACE_ON = @as(u32, 1);
pub const SQL_OPT_TRACE_DEFAULT = @as(u32, 0);
pub const SQL_CUR_USE_IF_NEEDED = @as(u32, 0);
pub const SQL_CUR_USE_ODBC = @as(u32, 1);
pub const SQL_CUR_USE_DRIVER = @as(u32, 2);
pub const SQL_CUR_DEFAULT = @as(u32, 2);
pub const SQL_DB_RETURN_TO_POOL = @as(u32, 0);
pub const SQL_DB_DISCONNECT = @as(u32, 1);
pub const SQL_DB_DEFAULT = @as(u32, 0);
pub const SQL_DTC_DONE = @as(i32, 0);
pub const SQL_CD_TRUE = @as(i32, 1);
pub const SQL_CD_FALSE = @as(i32, 0);
pub const SQL_AA_TRUE = @as(i32, 1);
pub const SQL_AA_FALSE = @as(i32, 0);
pub const SQL_RESET_CONNECTION_YES = @as(u32, 1);
pub const SQL_ASYNC_DBC_ENABLE_ON = @as(u32, 1);
pub const SQL_ASYNC_DBC_ENABLE_OFF = @as(u32, 0);
pub const SQL_ASYNC_DBC_ENABLE_DEFAULT = @as(u32, 0);
pub const SQL_QUERY_TIMEOUT = @as(u32, 0);
pub const SQL_MAX_ROWS = @as(u32, 1);
pub const SQL_NOSCAN = @as(u32, 2);
pub const SQL_MAX_LENGTH = @as(u32, 3);
pub const SQL_ASYNC_ENABLE = @as(u32, 4);
pub const SQL_BIND_TYPE = @as(u32, 5);
pub const SQL_CURSOR_TYPE = @as(u32, 6);
pub const SQL_CONCURRENCY = @as(u32, 7);
pub const SQL_KEYSET_SIZE = @as(u32, 8);
pub const SQL_ROWSET_SIZE = @as(u32, 9);
pub const SQL_SIMULATE_CURSOR = @as(u32, 10);
pub const SQL_RETRIEVE_DATA = @as(u32, 11);
pub const SQL_USE_BOOKMARKS = @as(u32, 12);
pub const SQL_GET_BOOKMARK = @as(u32, 13);
pub const SQL_ROW_NUMBER = @as(u32, 14);
pub const SQL_ATTR_ASYNC_ENABLE = @as(u32, 4);
pub const SQL_ATTR_CONCURRENCY = @as(u32, 7);
pub const SQL_ATTR_CURSOR_TYPE = @as(u32, 6);
pub const SQL_ATTR_ENABLE_AUTO_IPD = @as(u32, 15);
pub const SQL_ATTR_FETCH_BOOKMARK_PTR = @as(u32, 16);
pub const SQL_ATTR_KEYSET_SIZE = @as(u32, 8);
pub const SQL_ATTR_MAX_LENGTH = @as(u32, 3);
pub const SQL_ATTR_MAX_ROWS = @as(u32, 1);
pub const SQL_ATTR_NOSCAN = @as(u32, 2);
pub const SQL_ATTR_PARAM_BIND_OFFSET_PTR = @as(u32, 17);
pub const SQL_ATTR_PARAM_BIND_TYPE = @as(u32, 18);
pub const SQL_ATTR_PARAM_OPERATION_PTR = @as(u32, 19);
pub const SQL_ATTR_PARAM_STATUS_PTR = @as(u32, 20);
pub const SQL_ATTR_PARAMS_PROCESSED_PTR = @as(u32, 21);
pub const SQL_ATTR_PARAMSET_SIZE = @as(u32, 22);
pub const SQL_ATTR_QUERY_TIMEOUT = @as(u32, 0);
pub const SQL_ATTR_RETRIEVE_DATA = @as(u32, 11);
pub const SQL_ATTR_ROW_BIND_OFFSET_PTR = @as(u32, 23);
pub const SQL_ATTR_ROW_BIND_TYPE = @as(u32, 5);
pub const SQL_ATTR_ROW_NUMBER = @as(u32, 14);
pub const SQL_ATTR_ROW_OPERATION_PTR = @as(u32, 24);
pub const SQL_ATTR_ROW_STATUS_PTR = @as(u32, 25);
pub const SQL_ATTR_ROWS_FETCHED_PTR = @as(u32, 26);
pub const SQL_ATTR_ROW_ARRAY_SIZE = @as(u32, 27);
pub const SQL_ATTR_SIMULATE_CURSOR = @as(u32, 10);
pub const SQL_ATTR_USE_BOOKMARKS = @as(u32, 12);
pub const SQL_ATTR_ASYNC_STMT_EVENT = @as(u32, 29);
pub const SQL_STMT_OPT_MAX = @as(u32, 14);
pub const SQL_STMT_OPT_MIN = @as(u32, 0);
pub const SQL_IS_POINTER = @as(i32, -4);
pub const SQL_IS_UINTEGER = @as(i32, -5);
pub const SQL_IS_INTEGER = @as(i32, -6);
pub const SQL_IS_USMALLINT = @as(i32, -7);
pub const SQL_IS_SMALLINT = @as(i32, -8);
pub const SQL_PARAM_BIND_BY_COLUMN = @as(u32, 0);
pub const SQL_PARAM_BIND_TYPE_DEFAULT = @as(u32, 0);
pub const SQL_QUERY_TIMEOUT_DEFAULT = @as(u32, 0);
pub const SQL_MAX_ROWS_DEFAULT = @as(u32, 0);
pub const SQL_NOSCAN_OFF = @as(u32, 0);
pub const SQL_NOSCAN_ON = @as(u32, 1);
pub const SQL_NOSCAN_DEFAULT = @as(u32, 0);
pub const SQL_MAX_LENGTH_DEFAULT = @as(u32, 0);
pub const SQL_ASYNC_ENABLE_OFF = @as(u32, 0);
pub const SQL_ASYNC_ENABLE_ON = @as(u32, 1);
pub const SQL_ASYNC_ENABLE_DEFAULT = @as(u32, 0);
pub const SQL_BIND_BY_COLUMN = @as(u32, 0);
pub const SQL_BIND_TYPE_DEFAULT = @as(u32, 0);
pub const SQL_CONCUR_READ_ONLY = @as(u32, 1);
pub const SQL_CONCUR_LOCK = @as(u32, 2);
pub const SQL_CONCUR_ROWVER = @as(u32, 3);
pub const SQL_CONCUR_VALUES = @as(u32, 4);
pub const SQL_CONCUR_DEFAULT = @as(u32, 1);
pub const SQL_CURSOR_FORWARD_ONLY = @as(u32, 0);
pub const SQL_CURSOR_KEYSET_DRIVEN = @as(u32, 1);
pub const SQL_CURSOR_DYNAMIC = @as(u32, 2);
pub const SQL_CURSOR_STATIC = @as(u32, 3);
pub const SQL_CURSOR_TYPE_DEFAULT = @as(u32, 0);
pub const SQL_ROWSET_SIZE_DEFAULT = @as(u32, 1);
pub const SQL_KEYSET_SIZE_DEFAULT = @as(u32, 0);
pub const SQL_SC_NON_UNIQUE = @as(u32, 0);
pub const SQL_SC_TRY_UNIQUE = @as(u32, 1);
pub const SQL_SC_UNIQUE = @as(u32, 2);
pub const SQL_RD_OFF = @as(u32, 0);
pub const SQL_RD_ON = @as(u32, 1);
pub const SQL_RD_DEFAULT = @as(u32, 1);
pub const SQL_UB_OFF = @as(u32, 0);
pub const SQL_UB_ON = @as(u32, 1);
pub const SQL_UB_DEFAULT = @as(u32, 0);
pub const SQL_UB_FIXED = @as(u32, 1);
pub const SQL_UB_VARIABLE = @as(u32, 2);
pub const SQL_DESC_ARRAY_SIZE = @as(u32, 20);
pub const SQL_DESC_ARRAY_STATUS_PTR = @as(u32, 21);
pub const SQL_DESC_BASE_COLUMN_NAME = @as(u32, 22);
pub const SQL_DESC_BASE_TABLE_NAME = @as(u32, 23);
pub const SQL_DESC_BIND_OFFSET_PTR = @as(u32, 24);
pub const SQL_DESC_BIND_TYPE = @as(u32, 25);
pub const SQL_DESC_DATETIME_INTERVAL_PRECISION = @as(u32, 26);
pub const SQL_DESC_LITERAL_PREFIX = @as(u32, 27);
pub const SQL_DESC_LITERAL_SUFFIX = @as(u32, 28);
pub const SQL_DESC_LOCAL_TYPE_NAME = @as(u32, 29);
pub const SQL_DESC_MAXIMUM_SCALE = @as(u32, 30);
pub const SQL_DESC_MINIMUM_SCALE = @as(u32, 31);
pub const SQL_DESC_NUM_PREC_RADIX = @as(u32, 32);
pub const SQL_DESC_PARAMETER_TYPE = @as(u32, 33);
pub const SQL_DESC_ROWS_PROCESSED_PTR = @as(u32, 34);
pub const SQL_DESC_ROWVER = @as(u32, 35);
pub const SQL_DIAG_CURSOR_ROW_COUNT = @as(i32, -1249);
pub const SQL_DIAG_ROW_NUMBER = @as(i32, -1248);
pub const SQL_DIAG_COLUMN_NUMBER = @as(i32, -1247);
pub const SQL_DATE = @as(u32, 9);
pub const SQL_INTERVAL = @as(u32, 10);
pub const SQL_TIME = @as(u32, 10);
pub const SQL_TIMESTAMP = @as(u32, 11);
pub const SQL_LONGVARCHAR = @as(i32, -1);
pub const SQL_BINARY = @as(i32, -2);
pub const SQL_VARBINARY = @as(i32, -3);
pub const SQL_LONGVARBINARY = @as(i32, -4);
pub const SQL_BIGINT = @as(i32, -5);
pub const SQL_TINYINT = @as(i32, -6);
pub const SQL_BIT = @as(i32, -7);
pub const SQL_GUID = @as(i32, -11);
pub const SQL_CODE_YEAR = @as(u32, 1);
pub const SQL_CODE_MONTH = @as(u32, 2);
pub const SQL_CODE_DAY = @as(u32, 3);
pub const SQL_CODE_HOUR = @as(u32, 4);
pub const SQL_CODE_MINUTE = @as(u32, 5);
pub const SQL_CODE_SECOND = @as(u32, 6);
pub const SQL_CODE_YEAR_TO_MONTH = @as(u32, 7);
pub const SQL_CODE_DAY_TO_HOUR = @as(u32, 8);
pub const SQL_CODE_DAY_TO_MINUTE = @as(u32, 9);
pub const SQL_CODE_DAY_TO_SECOND = @as(u32, 10);
pub const SQL_CODE_HOUR_TO_MINUTE = @as(u32, 11);
pub const SQL_CODE_HOUR_TO_SECOND = @as(u32, 12);
pub const SQL_CODE_MINUTE_TO_SECOND = @as(u32, 13);
pub const SQL_INTERVAL_YEAR = @as(i32, -80);
pub const SQL_INTERVAL_MONTH = @as(i32, -81);
pub const SQL_INTERVAL_YEAR_TO_MONTH = @as(i32, -82);
pub const SQL_INTERVAL_DAY = @as(i32, -83);
pub const SQL_INTERVAL_HOUR = @as(i32, -84);
pub const SQL_INTERVAL_MINUTE = @as(i32, -85);
pub const SQL_INTERVAL_SECOND = @as(i32, -86);
pub const SQL_INTERVAL_DAY_TO_HOUR = @as(i32, -87);
pub const SQL_INTERVAL_DAY_TO_MINUTE = @as(i32, -88);
pub const SQL_INTERVAL_DAY_TO_SECOND = @as(i32, -89);
pub const SQL_INTERVAL_HOUR_TO_MINUTE = @as(i32, -90);
pub const SQL_INTERVAL_HOUR_TO_SECOND = @as(i32, -91);
pub const SQL_INTERVAL_MINUTE_TO_SECOND = @as(i32, -92);
pub const SQL_UNICODE = @as(i32, -95);
pub const SQL_UNICODE_VARCHAR = @as(i32, -96);
pub const SQL_UNICODE_LONGVARCHAR = @as(i32, -97);
pub const SQL_UNICODE_CHAR = @as(i32, -95);
pub const SQL_TYPE_DRIVER_START = @as(i32, -80);
pub const SQL_TYPE_DRIVER_END = @as(i32, -97);
pub const SQL_C_CHAR = @as(u32, 1);
pub const SQL_C_LONG = @as(u32, 4);
pub const SQL_C_SHORT = @as(u32, 5);
pub const SQL_C_FLOAT = @as(u32, 7);
pub const SQL_C_DOUBLE = @as(u32, 8);
pub const SQL_C_NUMERIC = @as(u32, 2);
pub const SQL_C_DEFAULT = @as(u32, 99);
pub const SQL_SIGNED_OFFSET = @as(i32, -20);
pub const SQL_UNSIGNED_OFFSET = @as(i32, -22);
pub const SQL_C_DATE = @as(u32, 9);
pub const SQL_C_TIME = @as(u32, 10);
pub const SQL_C_TIMESTAMP = @as(u32, 11);
pub const SQL_C_TYPE_DATE = @as(u32, 91);
pub const SQL_C_TYPE_TIME = @as(u32, 92);
pub const SQL_C_TYPE_TIMESTAMP = @as(u32, 93);
pub const SQL_C_INTERVAL_YEAR = @as(i32, -80);
pub const SQL_C_INTERVAL_MONTH = @as(i32, -81);
pub const SQL_C_INTERVAL_DAY = @as(i32, -83);
pub const SQL_C_INTERVAL_HOUR = @as(i32, -84);
pub const SQL_C_INTERVAL_MINUTE = @as(i32, -85);
pub const SQL_C_INTERVAL_SECOND = @as(i32, -86);
pub const SQL_C_INTERVAL_YEAR_TO_MONTH = @as(i32, -82);
pub const SQL_C_INTERVAL_DAY_TO_HOUR = @as(i32, -87);
pub const SQL_C_INTERVAL_DAY_TO_MINUTE = @as(i32, -88);
pub const SQL_C_INTERVAL_DAY_TO_SECOND = @as(i32, -89);
pub const SQL_C_INTERVAL_HOUR_TO_MINUTE = @as(i32, -90);
pub const SQL_C_INTERVAL_HOUR_TO_SECOND = @as(i32, -91);
pub const SQL_C_INTERVAL_MINUTE_TO_SECOND = @as(i32, -92);
pub const SQL_C_BINARY = @as(i32, -2);
pub const SQL_C_BIT = @as(i32, -7);
pub const SQL_C_TINYINT = @as(i32, -6);
pub const SQL_C_GUID = @as(i32, -11);
pub const SQL_TYPE_NULL = @as(u32, 0);
pub const SQL_TYPE_MIN = @as(i32, -7);
pub const SQL_TYPE_MAX = @as(u32, 12);
pub const SQL_DRIVER_C_TYPE_BASE = @as(u32, 16384);
pub const SQL_DRIVER_SQL_TYPE_BASE = @as(u32, 16384);
pub const SQL_DRIVER_DESC_FIELD_BASE = @as(u32, 16384);
pub const SQL_DRIVER_DIAG_FIELD_BASE = @as(u32, 16384);
pub const SQL_DRIVER_INFO_TYPE_BASE = @as(u32, 16384);
pub const SQL_DRIVER_CONN_ATTR_BASE = @as(u32, 16384);
pub const SQL_DRIVER_STMT_ATTR_BASE = @as(u32, 16384);
pub const SQL_C_VARBOOKMARK = @as(i32, -2);
pub const SQL_NO_ROW_NUMBER = @as(i32, -1);
pub const SQL_NO_COLUMN_NUMBER = @as(i32, -1);
pub const SQL_ROW_NUMBER_UNKNOWN = @as(i32, -2);
pub const SQL_COLUMN_NUMBER_UNKNOWN = @as(i32, -2);
pub const SQL_DEFAULT_PARAM = @as(i32, -5);
pub const SQL_IGNORE = @as(i32, -6);
pub const SQL_COLUMN_IGNORE = @as(i32, -6);
pub const SQL_LEN_DATA_AT_EXEC_OFFSET = @as(i32, -100);
pub const SQL_LEN_BINARY_ATTR_OFFSET = @as(i32, -100);
pub const SQL_SETPARAM_VALUE_MAX = @as(i32, -1);
pub const SQL_COLUMN_COUNT = @as(u32, 0);
pub const SQL_COLUMN_NAME = @as(u32, 1);
pub const SQL_COLUMN_TYPE = @as(u32, 2);
pub const SQL_COLUMN_LENGTH = @as(u32, 3);
pub const SQL_COLUMN_PRECISION = @as(u32, 4);
pub const SQL_COLUMN_SCALE = @as(u32, 5);
pub const SQL_COLUMN_DISPLAY_SIZE = @as(u32, 6);
pub const SQL_COLUMN_NULLABLE = @as(u32, 7);
pub const SQL_COLUMN_UNSIGNED = @as(u32, 8);
pub const SQL_COLUMN_MONEY = @as(u32, 9);
pub const SQL_COLUMN_UPDATABLE = @as(u32, 10);
pub const SQL_COLUMN_AUTO_INCREMENT = @as(u32, 11);
pub const SQL_COLUMN_CASE_SENSITIVE = @as(u32, 12);
pub const SQL_COLUMN_SEARCHABLE = @as(u32, 13);
pub const SQL_COLUMN_TYPE_NAME = @as(u32, 14);
pub const SQL_COLUMN_TABLE_NAME = @as(u32, 15);
pub const SQL_COLUMN_OWNER_NAME = @as(u32, 16);
pub const SQL_COLUMN_QUALIFIER_NAME = @as(u32, 17);
pub const SQL_COLUMN_LABEL = @as(u32, 18);
pub const SQL_COLATT_OPT_MAX = @as(u32, 18);
pub const SQL_COLUMN_DRIVER_START = @as(u32, 1000);
pub const SQL_COLATT_OPT_MIN = @as(u32, 0);
pub const SQL_ATTR_READONLY = @as(u32, 0);
pub const SQL_ATTR_WRITE = @as(u32, 1);
pub const SQL_ATTR_READWRITE_UNKNOWN = @as(u32, 2);
pub const SQL_UNSEARCHABLE = @as(u32, 0);
pub const SQL_LIKE_ONLY = @as(u32, 1);
pub const SQL_ALL_EXCEPT_LIKE = @as(u32, 2);
pub const SQL_SEARCHABLE = @as(u32, 3);
pub const SQL_PRED_SEARCHABLE = @as(u32, 3);
pub const SQL_NO_TOTAL = @as(i32, -4);
pub const SQL_API_SQLALLOCHANDLESTD = @as(u32, 73);
pub const SQL_API_SQLBULKOPERATIONS = @as(u32, 24);
pub const SQL_API_SQLBINDPARAMETER = @as(u32, 72);
pub const SQL_API_SQLBROWSECONNECT = @as(u32, 55);
pub const SQL_API_SQLCOLATTRIBUTES = @as(u32, 6);
pub const SQL_API_SQLCOLUMNPRIVILEGES = @as(u32, 56);
pub const SQL_API_SQLDESCRIBEPARAM = @as(u32, 58);
pub const SQL_API_SQLDRIVERCONNECT = @as(u32, 41);
pub const SQL_API_SQLDRIVERS = @as(u32, 71);
pub const SQL_API_SQLPRIVATEDRIVERS = @as(u32, 79);
pub const SQL_API_SQLEXTENDEDFETCH = @as(u32, 59);
pub const SQL_API_SQLFOREIGNKEYS = @as(u32, 60);
pub const SQL_API_SQLMORERESULTS = @as(u32, 61);
pub const SQL_API_SQLNATIVESQL = @as(u32, 62);
pub const SQL_API_SQLNUMPARAMS = @as(u32, 63);
pub const SQL_API_SQLPARAMOPTIONS = @as(u32, 64);
pub const SQL_API_SQLPRIMARYKEYS = @as(u32, 65);
pub const SQL_API_SQLPROCEDURECOLUMNS = @as(u32, 66);
pub const SQL_API_SQLPROCEDURES = @as(u32, 67);
pub const SQL_API_SQLSETPOS = @as(u32, 68);
pub const SQL_API_SQLSETSCROLLOPTIONS = @as(u32, 69);
pub const SQL_API_SQLTABLEPRIVILEGES = @as(u32, 70);
pub const SQL_EXT_API_LAST = @as(u32, 72);
pub const SQL_NUM_FUNCTIONS = @as(u32, 23);
pub const SQL_EXT_API_START = @as(u32, 40);
pub const SQL_API_ALL_FUNCTIONS = @as(u32, 0);
pub const SQL_API_LOADBYORDINAL = @as(u32, 199);
pub const SQL_API_ODBC3_ALL_FUNCTIONS = @as(u32, 999);
pub const SQL_API_ODBC3_ALL_FUNCTIONS_SIZE = @as(u32, 250);
pub const SQL_INFO_FIRST = @as(u32, 0);
pub const SQL_ACTIVE_CONNECTIONS = @as(u32, 0);
pub const SQL_ACTIVE_STATEMENTS = @as(u32, 1);
pub const SQL_DRIVER_HDBC = @as(u32, 3);
pub const SQL_DRIVER_HENV = @as(u32, 4);
pub const SQL_DRIVER_HSTMT = @as(u32, 5);
pub const SQL_DRIVER_NAME = @as(u32, 6);
pub const SQL_DRIVER_VER = @as(u32, 7);
pub const SQL_ODBC_API_CONFORMANCE = @as(u32, 9);
pub const SQL_ODBC_VER = @as(u32, 10);
pub const SQL_ROW_UPDATES = @as(u32, 11);
pub const SQL_ODBC_SAG_CLI_CONFORMANCE = @as(u32, 12);
pub const SQL_ODBC_SQL_CONFORMANCE = @as(u32, 15);
pub const SQL_PROCEDURES = @as(u32, 21);
pub const SQL_CONCAT_NULL_BEHAVIOR = @as(u32, 22);
pub const SQL_CURSOR_ROLLBACK_BEHAVIOR = @as(u32, 24);
pub const SQL_EXPRESSIONS_IN_ORDERBY = @as(u32, 27);
pub const SQL_MAX_OWNER_NAME_LEN = @as(u32, 32);
pub const SQL_MAX_PROCEDURE_NAME_LEN = @as(u32, 33);
pub const SQL_MAX_QUALIFIER_NAME_LEN = @as(u32, 34);
pub const SQL_MULT_RESULT_SETS = @as(u32, 36);
pub const SQL_MULTIPLE_ACTIVE_TXN = @as(u32, 37);
pub const SQL_OUTER_JOINS = @as(u32, 38);
pub const SQL_OWNER_TERM = @as(u32, 39);
pub const SQL_PROCEDURE_TERM = @as(u32, 40);
pub const SQL_QUALIFIER_NAME_SEPARATOR = @as(u32, 41);
pub const SQL_QUALIFIER_TERM = @as(u32, 42);
pub const SQL_SCROLL_OPTIONS = @as(u32, 44);
pub const SQL_TABLE_TERM = @as(u32, 45);
pub const SQL_CONVERT_FUNCTIONS = @as(u32, 48);
pub const SQL_NUMERIC_FUNCTIONS = @as(u32, 49);
pub const SQL_STRING_FUNCTIONS = @as(u32, 50);
pub const SQL_SYSTEM_FUNCTIONS = @as(u32, 51);
pub const SQL_TIMEDATE_FUNCTIONS = @as(u32, 52);
pub const SQL_CONVERT_BIGINT = @as(u32, 53);
pub const SQL_CONVERT_BINARY = @as(u32, 54);
pub const SQL_CONVERT_BIT = @as(u32, 55);
pub const SQL_CONVERT_CHAR = @as(u32, 56);
pub const SQL_CONVERT_DATE = @as(u32, 57);
pub const SQL_CONVERT_DECIMAL = @as(u32, 58);
pub const SQL_CONVERT_DOUBLE = @as(u32, 59);
pub const SQL_CONVERT_FLOAT = @as(u32, 60);
pub const SQL_CONVERT_INTEGER = @as(u32, 61);
pub const SQL_CONVERT_LONGVARCHAR = @as(u32, 62);
pub const SQL_CONVERT_NUMERIC = @as(u32, 63);
pub const SQL_CONVERT_REAL = @as(u32, 64);
pub const SQL_CONVERT_SMALLINT = @as(u32, 65);
pub const SQL_CONVERT_TIME = @as(u32, 66);
pub const SQL_CONVERT_TIMESTAMP = @as(u32, 67);
pub const SQL_CONVERT_TINYINT = @as(u32, 68);
pub const SQL_CONVERT_VARBINARY = @as(u32, 69);
pub const SQL_CONVERT_VARCHAR = @as(u32, 70);
pub const SQL_CONVERT_LONGVARBINARY = @as(u32, 71);
pub const SQL_ODBC_SQL_OPT_IEF = @as(u32, 73);
pub const SQL_CORRELATION_NAME = @as(u32, 74);
pub const SQL_NON_NULLABLE_COLUMNS = @as(u32, 75);
pub const SQL_DRIVER_HLIB = @as(u32, 76);
pub const SQL_DRIVER_ODBC_VER = @as(u32, 77);
pub const SQL_LOCK_TYPES = @as(u32, 78);
pub const SQL_POS_OPERATIONS = @as(u32, 79);
pub const SQL_POSITIONED_STATEMENTS = @as(u32, 80);
pub const SQL_BOOKMARK_PERSISTENCE = @as(u32, 82);
pub const SQL_STATIC_SENSITIVITY = @as(u32, 83);
pub const SQL_FILE_USAGE = @as(u32, 84);
pub const SQL_COLUMN_ALIAS = @as(u32, 87);
pub const SQL_GROUP_BY = @as(u32, 88);
pub const SQL_KEYWORDS = @as(u32, 89);
pub const SQL_OWNER_USAGE = @as(u32, 91);
pub const SQL_QUALIFIER_USAGE = @as(u32, 92);
pub const SQL_QUOTED_IDENTIFIER_CASE = @as(u32, 93);
pub const SQL_SUBQUERIES = @as(u32, 95);
pub const SQL_UNION = @as(u32, 96);
pub const SQL_MAX_ROW_SIZE_INCLUDES_LONG = @as(u32, 103);
pub const SQL_MAX_CHAR_LITERAL_LEN = @as(u32, 108);
pub const SQL_TIMEDATE_ADD_INTERVALS = @as(u32, 109);
pub const SQL_TIMEDATE_DIFF_INTERVALS = @as(u32, 110);
pub const SQL_NEED_LONG_DATA_LEN = @as(u32, 111);
pub const SQL_MAX_BINARY_LITERAL_LEN = @as(u32, 112);
pub const SQL_LIKE_ESCAPE_CLAUSE = @as(u32, 113);
pub const SQL_QUALIFIER_LOCATION = @as(u32, 114);
pub const SQL_INFO_LAST = @as(u32, 114);
pub const SQL_INFO_DRIVER_START = @as(u32, 1000);
pub const SQL_ACTIVE_ENVIRONMENTS = @as(u32, 116);
pub const SQL_ALTER_DOMAIN = @as(u32, 117);
pub const SQL_SQL_CONFORMANCE = @as(u32, 118);
pub const SQL_DATETIME_LITERALS = @as(u32, 119);
pub const SQL_ASYNC_MODE = @as(u32, 10021);
pub const SQL_BATCH_ROW_COUNT = @as(u32, 120);
pub const SQL_BATCH_SUPPORT = @as(u32, 121);
pub const SQL_CATALOG_LOCATION = @as(u32, 114);
pub const SQL_CATALOG_NAME_SEPARATOR = @as(u32, 41);
pub const SQL_CATALOG_TERM = @as(u32, 42);
pub const SQL_CATALOG_USAGE = @as(u32, 92);
pub const SQL_CONVERT_WCHAR = @as(u32, 122);
pub const SQL_CONVERT_INTERVAL_DAY_TIME = @as(u32, 123);
pub const SQL_CONVERT_INTERVAL_YEAR_MONTH = @as(u32, 124);
pub const SQL_CONVERT_WLONGVARCHAR = @as(u32, 125);
pub const SQL_CONVERT_WVARCHAR = @as(u32, 126);
pub const SQL_CREATE_ASSERTION = @as(u32, 127);
pub const SQL_CREATE_CHARACTER_SET = @as(u32, 128);
pub const SQL_CREATE_COLLATION = @as(u32, 129);
pub const SQL_CREATE_DOMAIN = @as(u32, 130);
pub const SQL_CREATE_SCHEMA = @as(u32, 131);
pub const SQL_CREATE_TABLE = @as(u32, 132);
pub const SQL_CREATE_TRANSLATION = @as(u32, 133);
pub const SQL_CREATE_VIEW = @as(u32, 134);
pub const SQL_DRIVER_HDESC = @as(u32, 135);
pub const SQL_DROP_ASSERTION = @as(u32, 136);
pub const SQL_DROP_CHARACTER_SET = @as(u32, 137);
pub const SQL_DROP_COLLATION = @as(u32, 138);
pub const SQL_DROP_DOMAIN = @as(u32, 139);
pub const SQL_DROP_SCHEMA = @as(u32, 140);
pub const SQL_DROP_TABLE = @as(u32, 141);
pub const SQL_DROP_TRANSLATION = @as(u32, 142);
pub const SQL_DROP_VIEW = @as(u32, 143);
pub const SQL_DYNAMIC_CURSOR_ATTRIBUTES1 = @as(u32, 144);
pub const SQL_DYNAMIC_CURSOR_ATTRIBUTES2 = @as(u32, 145);
pub const SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 = @as(u32, 146);
pub const SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 = @as(u32, 147);
pub const SQL_INDEX_KEYWORDS = @as(u32, 148);
pub const SQL_INFO_SCHEMA_VIEWS = @as(u32, 149);
pub const SQL_KEYSET_CURSOR_ATTRIBUTES1 = @as(u32, 150);
pub const SQL_KEYSET_CURSOR_ATTRIBUTES2 = @as(u32, 151);
pub const SQL_MAX_ASYNC_CONCURRENT_STATEMENTS = @as(u32, 10022);
pub const SQL_ODBC_INTERFACE_CONFORMANCE = @as(u32, 152);
pub const SQL_PARAM_ARRAY_ROW_COUNTS = @as(u32, 153);
pub const SQL_PARAM_ARRAY_SELECTS = @as(u32, 154);
pub const SQL_SCHEMA_TERM = @as(u32, 39);
pub const SQL_SCHEMA_USAGE = @as(u32, 91);
pub const SQL_SQL92_DATETIME_FUNCTIONS = @as(u32, 155);
pub const SQL_SQL92_FOREIGN_KEY_DELETE_RULE = @as(u32, 156);
pub const SQL_SQL92_FOREIGN_KEY_UPDATE_RULE = @as(u32, 157);
pub const SQL_SQL92_GRANT = @as(u32, 158);
pub const SQL_SQL92_NUMERIC_VALUE_FUNCTIONS = @as(u32, 159);
pub const SQL_SQL92_PREDICATES = @as(u32, 160);
pub const SQL_SQL92_RELATIONAL_JOIN_OPERATORS = @as(u32, 161);
pub const SQL_SQL92_REVOKE = @as(u32, 162);
pub const SQL_SQL92_ROW_VALUE_CONSTRUCTOR = @as(u32, 163);
pub const SQL_SQL92_STRING_FUNCTIONS = @as(u32, 164);
pub const SQL_SQL92_VALUE_EXPRESSIONS = @as(u32, 165);
pub const SQL_STANDARD_CLI_CONFORMANCE = @as(u32, 166);
pub const SQL_STATIC_CURSOR_ATTRIBUTES1 = @as(u32, 167);
pub const SQL_STATIC_CURSOR_ATTRIBUTES2 = @as(u32, 168);
pub const SQL_AGGREGATE_FUNCTIONS = @as(u32, 169);
pub const SQL_DDL_INDEX = @as(u32, 170);
pub const SQL_DM_VER = @as(u32, 171);
pub const SQL_INSERT_STATEMENT = @as(u32, 172);
pub const SQL_CONVERT_GUID = @as(u32, 173);
pub const SQL_UNION_STATEMENT = @as(u32, 96);
pub const SQL_ASYNC_DBC_FUNCTIONS = @as(u32, 10023);
pub const SQL_DRIVER_AWARE_POOLING_SUPPORTED = @as(u32, 10024);
pub const SQL_ASYNC_NOTIFICATION = @as(u32, 10025);
pub const SQL_ASYNC_NOTIFICATION_NOT_CAPABLE = @as(i32, 0);
pub const SQL_ASYNC_NOTIFICATION_CAPABLE = @as(i32, 1);
pub const SQL_DTC_TRANSITION_COST = @as(u32, 1750);
pub const SQL_AT_ADD_COLUMN_SINGLE = @as(i32, 32);
pub const SQL_AT_ADD_COLUMN_DEFAULT = @as(i32, 64);
pub const SQL_AT_ADD_COLUMN_COLLATION = @as(i32, 128);
pub const SQL_AT_SET_COLUMN_DEFAULT = @as(i32, 256);
pub const SQL_AT_DROP_COLUMN_DEFAULT = @as(i32, 512);
pub const SQL_AT_DROP_COLUMN_CASCADE = @as(i32, 1024);
pub const SQL_AT_DROP_COLUMN_RESTRICT = @as(i32, 2048);
pub const SQL_AT_ADD_TABLE_CONSTRAINT = @as(i32, 4096);
pub const SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE = @as(i32, 8192);
pub const SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT = @as(i32, 16384);
pub const SQL_AT_CONSTRAINT_NAME_DEFINITION = @as(i32, 32768);
pub const SQL_AT_CONSTRAINT_INITIALLY_DEFERRED = @as(i32, 65536);
pub const SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE = @as(i32, 131072);
pub const SQL_AT_CONSTRAINT_DEFERRABLE = @as(i32, 262144);
pub const SQL_AT_CONSTRAINT_NON_DEFERRABLE = @as(i32, 524288);
pub const SQL_CVT_CHAR = @as(i32, 1);
pub const SQL_CVT_NUMERIC = @as(i32, 2);
pub const SQL_CVT_DECIMAL = @as(i32, 4);
pub const SQL_CVT_INTEGER = @as(i32, 8);
pub const SQL_CVT_SMALLINT = @as(i32, 16);
pub const SQL_CVT_FLOAT = @as(i32, 32);
pub const SQL_CVT_REAL = @as(i32, 64);
pub const SQL_CVT_DOUBLE = @as(i32, 128);
pub const SQL_CVT_VARCHAR = @as(i32, 256);
pub const SQL_CVT_LONGVARCHAR = @as(i32, 512);
pub const SQL_CVT_BINARY = @as(i32, 1024);
pub const SQL_CVT_VARBINARY = @as(i32, 2048);
pub const SQL_CVT_BIT = @as(i32, 4096);
pub const SQL_CVT_TINYINT = @as(i32, 8192);
pub const SQL_CVT_BIGINT = @as(i32, 16384);
pub const SQL_CVT_DATE = @as(i32, 32768);
pub const SQL_CVT_TIME = @as(i32, 65536);
pub const SQL_CVT_TIMESTAMP = @as(i32, 131072);
pub const SQL_CVT_LONGVARBINARY = @as(i32, 262144);
pub const SQL_CVT_INTERVAL_YEAR_MONTH = @as(i32, 524288);
pub const SQL_CVT_INTERVAL_DAY_TIME = @as(i32, 1048576);
pub const SQL_CVT_WCHAR = @as(i32, 2097152);
pub const SQL_CVT_WLONGVARCHAR = @as(i32, 4194304);
pub const SQL_CVT_WVARCHAR = @as(i32, 8388608);
pub const SQL_CVT_GUID = @as(i32, 16777216);
pub const SQL_FN_CVT_CONVERT = @as(i32, 1);
pub const SQL_FN_CVT_CAST = @as(i32, 2);
pub const SQL_FN_STR_CONCAT = @as(i32, 1);
pub const SQL_FN_STR_INSERT = @as(i32, 2);
pub const SQL_FN_STR_LEFT = @as(i32, 4);
pub const SQL_FN_STR_LTRIM = @as(i32, 8);
pub const SQL_FN_STR_LENGTH = @as(i32, 16);
pub const SQL_FN_STR_LOCATE = @as(i32, 32);
pub const SQL_FN_STR_LCASE = @as(i32, 64);
pub const SQL_FN_STR_REPEAT = @as(i32, 128);
pub const SQL_FN_STR_REPLACE = @as(i32, 256);
pub const SQL_FN_STR_RIGHT = @as(i32, 512);
pub const SQL_FN_STR_RTRIM = @as(i32, 1024);
pub const SQL_FN_STR_SUBSTRING = @as(i32, 2048);
pub const SQL_FN_STR_UCASE = @as(i32, 4096);
pub const SQL_FN_STR_ASCII = @as(i32, 8192);
pub const SQL_FN_STR_CHAR = @as(i32, 16384);
pub const SQL_FN_STR_DIFFERENCE = @as(i32, 32768);
pub const SQL_FN_STR_LOCATE_2 = @as(i32, 65536);
pub const SQL_FN_STR_SOUNDEX = @as(i32, 131072);
pub const SQL_FN_STR_SPACE = @as(i32, 262144);
pub const SQL_FN_STR_BIT_LENGTH = @as(i32, 524288);
pub const SQL_FN_STR_CHAR_LENGTH = @as(i32, 1048576);
pub const SQL_FN_STR_CHARACTER_LENGTH = @as(i32, 2097152);
pub const SQL_FN_STR_OCTET_LENGTH = @as(i32, 4194304);
pub const SQL_FN_STR_POSITION = @as(i32, 8388608);
pub const SQL_SSF_CONVERT = @as(i32, 1);
pub const SQL_SSF_LOWER = @as(i32, 2);
pub const SQL_SSF_UPPER = @as(i32, 4);
pub const SQL_SSF_SUBSTRING = @as(i32, 8);
pub const SQL_SSF_TRANSLATE = @as(i32, 16);
pub const SQL_SSF_TRIM_BOTH = @as(i32, 32);
pub const SQL_SSF_TRIM_LEADING = @as(i32, 64);
pub const SQL_SSF_TRIM_TRAILING = @as(i32, 128);
pub const SQL_FN_NUM_ABS = @as(i32, 1);
pub const SQL_FN_NUM_ACOS = @as(i32, 2);
pub const SQL_FN_NUM_ASIN = @as(i32, 4);
pub const SQL_FN_NUM_ATAN = @as(i32, 8);
pub const SQL_FN_NUM_ATAN2 = @as(i32, 16);
pub const SQL_FN_NUM_CEILING = @as(i32, 32);
pub const SQL_FN_NUM_COS = @as(i32, 64);
pub const SQL_FN_NUM_COT = @as(i32, 128);
pub const SQL_FN_NUM_EXP = @as(i32, 256);
pub const SQL_FN_NUM_FLOOR = @as(i32, 512);
pub const SQL_FN_NUM_LOG = @as(i32, 1024);
pub const SQL_FN_NUM_MOD = @as(i32, 2048);
pub const SQL_FN_NUM_SIGN = @as(i32, 4096);
pub const SQL_FN_NUM_SIN = @as(i32, 8192);
pub const SQL_FN_NUM_SQRT = @as(i32, 16384);
pub const SQL_FN_NUM_TAN = @as(i32, 32768);
pub const SQL_FN_NUM_PI = @as(i32, 65536);
pub const SQL_FN_NUM_RAND = @as(i32, 131072);
pub const SQL_FN_NUM_DEGREES = @as(i32, 262144);
pub const SQL_FN_NUM_LOG10 = @as(i32, 524288);
pub const SQL_FN_NUM_POWER = @as(i32, 1048576);
pub const SQL_FN_NUM_RADIANS = @as(i32, 2097152);
pub const SQL_FN_NUM_ROUND = @as(i32, 4194304);
pub const SQL_FN_NUM_TRUNCATE = @as(i32, 8388608);
pub const SQL_SNVF_BIT_LENGTH = @as(i32, 1);
pub const SQL_SNVF_CHAR_LENGTH = @as(i32, 2);
pub const SQL_SNVF_CHARACTER_LENGTH = @as(i32, 4);
pub const SQL_SNVF_EXTRACT = @as(i32, 8);
pub const SQL_SNVF_OCTET_LENGTH = @as(i32, 16);
pub const SQL_SNVF_POSITION = @as(i32, 32);
pub const SQL_FN_TD_NOW = @as(i32, 1);
pub const SQL_FN_TD_CURDATE = @as(i32, 2);
pub const SQL_FN_TD_DAYOFMONTH = @as(i32, 4);
pub const SQL_FN_TD_DAYOFWEEK = @as(i32, 8);
pub const SQL_FN_TD_DAYOFYEAR = @as(i32, 16);
pub const SQL_FN_TD_MONTH = @as(i32, 32);
pub const SQL_FN_TD_QUARTER = @as(i32, 64);
pub const SQL_FN_TD_WEEK = @as(i32, 128);
pub const SQL_FN_TD_YEAR = @as(i32, 256);
pub const SQL_FN_TD_CURTIME = @as(i32, 512);
pub const SQL_FN_TD_HOUR = @as(i32, 1024);
pub const SQL_FN_TD_MINUTE = @as(i32, 2048);
pub const SQL_FN_TD_SECOND = @as(i32, 4096);
pub const SQL_FN_TD_TIMESTAMPADD = @as(i32, 8192);
pub const SQL_FN_TD_TIMESTAMPDIFF = @as(i32, 16384);
pub const SQL_FN_TD_DAYNAME = @as(i32, 32768);
pub const SQL_FN_TD_MONTHNAME = @as(i32, 65536);
pub const SQL_FN_TD_CURRENT_DATE = @as(i32, 131072);
pub const SQL_FN_TD_CURRENT_TIME = @as(i32, 262144);
pub const SQL_FN_TD_CURRENT_TIMESTAMP = @as(i32, 524288);
pub const SQL_FN_TD_EXTRACT = @as(i32, 1048576);
pub const SQL_SDF_CURRENT_DATE = @as(i32, 1);
pub const SQL_SDF_CURRENT_TIME = @as(i32, 2);
pub const SQL_SDF_CURRENT_TIMESTAMP = @as(i32, 4);
pub const SQL_FN_SYS_USERNAME = @as(i32, 1);
pub const SQL_FN_SYS_DBNAME = @as(i32, 2);
pub const SQL_FN_SYS_IFNULL = @as(i32, 4);
pub const SQL_FN_TSI_FRAC_SECOND = @as(i32, 1);
pub const SQL_FN_TSI_SECOND = @as(i32, 2);
pub const SQL_FN_TSI_MINUTE = @as(i32, 4);
pub const SQL_FN_TSI_HOUR = @as(i32, 8);
pub const SQL_FN_TSI_DAY = @as(i32, 16);
pub const SQL_FN_TSI_WEEK = @as(i32, 32);
pub const SQL_FN_TSI_MONTH = @as(i32, 64);
pub const SQL_FN_TSI_QUARTER = @as(i32, 128);
pub const SQL_FN_TSI_YEAR = @as(i32, 256);
pub const SQL_CA1_NEXT = @as(i32, 1);
pub const SQL_CA1_ABSOLUTE = @as(i32, 2);
pub const SQL_CA1_RELATIVE = @as(i32, 4);
pub const SQL_CA1_BOOKMARK = @as(i32, 8);
pub const SQL_CA1_LOCK_NO_CHANGE = @as(i32, 64);
pub const SQL_CA1_LOCK_EXCLUSIVE = @as(i32, 128);
pub const SQL_CA1_LOCK_UNLOCK = @as(i32, 256);
pub const SQL_CA1_POS_POSITION = @as(i32, 512);
pub const SQL_CA1_POS_UPDATE = @as(i32, 1024);
pub const SQL_CA1_POS_DELETE = @as(i32, 2048);
pub const SQL_CA1_POS_REFRESH = @as(i32, 4096);
pub const SQL_CA1_POSITIONED_UPDATE = @as(i32, 8192);
pub const SQL_CA1_POSITIONED_DELETE = @as(i32, 16384);
pub const SQL_CA1_SELECT_FOR_UPDATE = @as(i32, 32768);
pub const SQL_CA1_BULK_ADD = @as(i32, 65536);
pub const SQL_CA1_BULK_UPDATE_BY_BOOKMARK = @as(i32, 131072);
pub const SQL_CA1_BULK_DELETE_BY_BOOKMARK = @as(i32, 262144);
pub const SQL_CA1_BULK_FETCH_BY_BOOKMARK = @as(i32, 524288);
pub const SQL_CA2_READ_ONLY_CONCURRENCY = @as(i32, 1);
pub const SQL_CA2_LOCK_CONCURRENCY = @as(i32, 2);
pub const SQL_CA2_OPT_ROWVER_CONCURRENCY = @as(i32, 4);
pub const SQL_CA2_OPT_VALUES_CONCURRENCY = @as(i32, 8);
pub const SQL_CA2_SENSITIVITY_ADDITIONS = @as(i32, 16);
pub const SQL_CA2_SENSITIVITY_DELETIONS = @as(i32, 32);
pub const SQL_CA2_SENSITIVITY_UPDATES = @as(i32, 64);
pub const SQL_CA2_MAX_ROWS_SELECT = @as(i32, 128);
pub const SQL_CA2_MAX_ROWS_INSERT = @as(i32, 256);
pub const SQL_CA2_MAX_ROWS_DELETE = @as(i32, 512);
pub const SQL_CA2_MAX_ROWS_UPDATE = @as(i32, 1024);
pub const SQL_CA2_MAX_ROWS_CATALOG = @as(i32, 2048);
pub const SQL_CA2_CRC_EXACT = @as(i32, 4096);
pub const SQL_CA2_CRC_APPROXIMATE = @as(i32, 8192);
pub const SQL_CA2_SIMULATE_NON_UNIQUE = @as(i32, 16384);
pub const SQL_CA2_SIMULATE_TRY_UNIQUE = @as(i32, 32768);
pub const SQL_CA2_SIMULATE_UNIQUE = @as(i32, 65536);
pub const SQL_OAC_NONE = @as(u32, 0);
pub const SQL_OAC_LEVEL1 = @as(u32, 1);
pub const SQL_OAC_LEVEL2 = @as(u32, 2);
pub const SQL_OSCC_NOT_COMPLIANT = @as(u32, 0);
pub const SQL_OSCC_COMPLIANT = @as(u32, 1);
pub const SQL_OSC_MINIMUM = @as(u32, 0);
pub const SQL_OSC_CORE = @as(u32, 1);
pub const SQL_OSC_EXTENDED = @as(u32, 2);
pub const SQL_CB_NULL = @as(u32, 0);
pub const SQL_CB_NON_NULL = @as(u32, 1);
pub const SQL_SO_FORWARD_ONLY = @as(i32, 1);
pub const SQL_SO_KEYSET_DRIVEN = @as(i32, 2);
pub const SQL_SO_DYNAMIC = @as(i32, 4);
pub const SQL_SO_MIXED = @as(i32, 8);
pub const SQL_SO_STATIC = @as(i32, 16);
pub const SQL_FD_FETCH_RESUME = @as(i32, 64);
pub const SQL_FD_FETCH_BOOKMARK = @as(i32, 128);
pub const SQL_TXN_VERSIONING = @as(i32, 16);
pub const SQL_CN_NONE = @as(u32, 0);
pub const SQL_CN_DIFFERENT = @as(u32, 1);
pub const SQL_CN_ANY = @as(u32, 2);
pub const SQL_NNC_NULL = @as(u32, 0);
pub const SQL_NNC_NON_NULL = @as(u32, 1);
pub const SQL_NC_START = @as(u32, 2);
pub const SQL_NC_END = @as(u32, 4);
pub const SQL_FILE_NOT_SUPPORTED = @as(u32, 0);
pub const SQL_FILE_TABLE = @as(u32, 1);
pub const SQL_FILE_QUALIFIER = @as(u32, 2);
pub const SQL_FILE_CATALOG = @as(u32, 2);
pub const SQL_GD_BLOCK = @as(i32, 4);
pub const SQL_GD_BOUND = @as(i32, 8);
pub const SQL_GD_OUTPUT_PARAMS = @as(i32, 16);
pub const SQL_PS_POSITIONED_DELETE = @as(i32, 1);
pub const SQL_PS_POSITIONED_UPDATE = @as(i32, 2);
pub const SQL_PS_SELECT_FOR_UPDATE = @as(i32, 4);
pub const SQL_GB_NOT_SUPPORTED = @as(u32, 0);
pub const SQL_GB_GROUP_BY_EQUALS_SELECT = @as(u32, 1);
pub const SQL_GB_GROUP_BY_CONTAINS_SELECT = @as(u32, 2);
pub const SQL_GB_NO_RELATION = @as(u32, 3);
pub const SQL_GB_COLLATE = @as(u32, 4);
pub const SQL_OU_DML_STATEMENTS = @as(i32, 1);
pub const SQL_OU_PROCEDURE_INVOCATION = @as(i32, 2);
pub const SQL_OU_TABLE_DEFINITION = @as(i32, 4);
pub const SQL_OU_INDEX_DEFINITION = @as(i32, 8);
pub const SQL_OU_PRIVILEGE_DEFINITION = @as(i32, 16);
pub const SQL_SU_DML_STATEMENTS = @as(i32, 1);
pub const SQL_SU_PROCEDURE_INVOCATION = @as(i32, 2);
pub const SQL_SU_TABLE_DEFINITION = @as(i32, 4);
pub const SQL_SU_INDEX_DEFINITION = @as(i32, 8);
pub const SQL_SU_PRIVILEGE_DEFINITION = @as(i32, 16);
pub const SQL_QU_DML_STATEMENTS = @as(i32, 1);
pub const SQL_QU_PROCEDURE_INVOCATION = @as(i32, 2);
pub const SQL_QU_TABLE_DEFINITION = @as(i32, 4);
pub const SQL_QU_INDEX_DEFINITION = @as(i32, 8);
pub const SQL_QU_PRIVILEGE_DEFINITION = @as(i32, 16);
pub const SQL_CU_DML_STATEMENTS = @as(i32, 1);
pub const SQL_CU_PROCEDURE_INVOCATION = @as(i32, 2);
pub const SQL_CU_TABLE_DEFINITION = @as(i32, 4);
pub const SQL_CU_INDEX_DEFINITION = @as(i32, 8);
pub const SQL_CU_PRIVILEGE_DEFINITION = @as(i32, 16);
pub const SQL_SQ_COMPARISON = @as(i32, 1);
pub const SQL_SQ_EXISTS = @as(i32, 2);
pub const SQL_SQ_IN = @as(i32, 4);
pub const SQL_SQ_QUANTIFIED = @as(i32, 8);
pub const SQL_SQ_CORRELATED_SUBQUERIES = @as(i32, 16);
pub const SQL_U_UNION = @as(i32, 1);
pub const SQL_U_UNION_ALL = @as(i32, 2);
pub const SQL_BP_CLOSE = @as(i32, 1);
pub const SQL_BP_DELETE = @as(i32, 2);
pub const SQL_BP_DROP = @as(i32, 4);
pub const SQL_BP_TRANSACTION = @as(i32, 8);
pub const SQL_BP_UPDATE = @as(i32, 16);
pub const SQL_BP_OTHER_HSTMT = @as(i32, 32);
pub const SQL_BP_SCROLL = @as(i32, 64);
pub const SQL_SS_ADDITIONS = @as(i32, 1);
pub const SQL_SS_DELETIONS = @as(i32, 2);
pub const SQL_SS_UPDATES = @as(i32, 4);
pub const SQL_CV_CREATE_VIEW = @as(i32, 1);
pub const SQL_CV_CHECK_OPTION = @as(i32, 2);
pub const SQL_CV_CASCADED = @as(i32, 4);
pub const SQL_CV_LOCAL = @as(i32, 8);
pub const SQL_LCK_NO_CHANGE = @as(i32, 1);
pub const SQL_LCK_EXCLUSIVE = @as(i32, 2);
pub const SQL_LCK_UNLOCK = @as(i32, 4);
pub const SQL_POS_POSITION = @as(i32, 1);
pub const SQL_POS_REFRESH = @as(i32, 2);
pub const SQL_POS_UPDATE = @as(i32, 4);
pub const SQL_POS_DELETE = @as(i32, 8);
pub const SQL_POS_ADD = @as(i32, 16);
pub const SQL_QL_START = @as(u32, 1);
pub const SQL_QL_END = @as(u32, 2);
pub const SQL_AF_AVG = @as(i32, 1);
pub const SQL_AF_COUNT = @as(i32, 2);
pub const SQL_AF_MAX = @as(i32, 4);
pub const SQL_AF_MIN = @as(i32, 8);
pub const SQL_AF_SUM = @as(i32, 16);
pub const SQL_AF_DISTINCT = @as(i32, 32);
pub const SQL_AF_ALL = @as(i32, 64);
pub const SQL_SC_SQL92_ENTRY = @as(i32, 1);
pub const SQL_SC_FIPS127_2_TRANSITIONAL = @as(i32, 2);
pub const SQL_SC_SQL92_INTERMEDIATE = @as(i32, 4);
pub const SQL_SC_SQL92_FULL = @as(i32, 8);
pub const SQL_DL_SQL92_DATE = @as(i32, 1);
pub const SQL_DL_SQL92_TIME = @as(i32, 2);
pub const SQL_DL_SQL92_TIMESTAMP = @as(i32, 4);
pub const SQL_DL_SQL92_INTERVAL_YEAR = @as(i32, 8);
pub const SQL_DL_SQL92_INTERVAL_MONTH = @as(i32, 16);
pub const SQL_DL_SQL92_INTERVAL_DAY = @as(i32, 32);
pub const SQL_DL_SQL92_INTERVAL_HOUR = @as(i32, 64);
pub const SQL_DL_SQL92_INTERVAL_MINUTE = @as(i32, 128);
pub const SQL_DL_SQL92_INTERVAL_SECOND = @as(i32, 256);
pub const SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH = @as(i32, 512);
pub const SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR = @as(i32, 1024);
pub const SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE = @as(i32, 2048);
pub const SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND = @as(i32, 4096);
pub const SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE = @as(i32, 8192);
pub const SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND = @as(i32, 16384);
pub const SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND = @as(i32, 32768);
pub const SQL_CL_START = @as(u32, 1);
pub const SQL_CL_END = @as(u32, 2);
pub const SQL_BRC_PROCEDURES = @as(u32, 1);
pub const SQL_BRC_EXPLICIT = @as(u32, 2);
pub const SQL_BRC_ROLLED_UP = @as(u32, 4);
pub const SQL_BS_SELECT_EXPLICIT = @as(i32, 1);
pub const SQL_BS_ROW_COUNT_EXPLICIT = @as(i32, 2);
pub const SQL_BS_SELECT_PROC = @as(i32, 4);
pub const SQL_BS_ROW_COUNT_PROC = @as(i32, 8);
pub const SQL_PARC_BATCH = @as(u32, 1);
pub const SQL_PARC_NO_BATCH = @as(u32, 2);
pub const SQL_PAS_BATCH = @as(u32, 1);
pub const SQL_PAS_NO_BATCH = @as(u32, 2);
pub const SQL_PAS_NO_SELECT = @as(u32, 3);
pub const SQL_IK_NONE = @as(i32, 0);
pub const SQL_IK_ASC = @as(i32, 1);
pub const SQL_IK_DESC = @as(i32, 2);
pub const SQL_ISV_ASSERTIONS = @as(i32, 1);
pub const SQL_ISV_CHARACTER_SETS = @as(i32, 2);
pub const SQL_ISV_CHECK_CONSTRAINTS = @as(i32, 4);
pub const SQL_ISV_COLLATIONS = @as(i32, 8);
pub const SQL_ISV_COLUMN_DOMAIN_USAGE = @as(i32, 16);
pub const SQL_ISV_COLUMN_PRIVILEGES = @as(i32, 32);
pub const SQL_ISV_COLUMNS = @as(i32, 64);
pub const SQL_ISV_CONSTRAINT_COLUMN_USAGE = @as(i32, 128);
pub const SQL_ISV_CONSTRAINT_TABLE_USAGE = @as(i32, 256);
pub const SQL_ISV_DOMAIN_CONSTRAINTS = @as(i32, 512);
pub const SQL_ISV_DOMAINS = @as(i32, 1024);
pub const SQL_ISV_KEY_COLUMN_USAGE = @as(i32, 2048);
pub const SQL_ISV_REFERENTIAL_CONSTRAINTS = @as(i32, 4096);
pub const SQL_ISV_SCHEMATA = @as(i32, 8192);
pub const SQL_ISV_SQL_LANGUAGES = @as(i32, 16384);
pub const SQL_ISV_TABLE_CONSTRAINTS = @as(i32, 32768);
pub const SQL_ISV_TABLE_PRIVILEGES = @as(i32, 65536);
pub const SQL_ISV_TABLES = @as(i32, 131072);
pub const SQL_ISV_TRANSLATIONS = @as(i32, 262144);
pub const SQL_ISV_USAGE_PRIVILEGES = @as(i32, 524288);
pub const SQL_ISV_VIEW_COLUMN_USAGE = @as(i32, 1048576);
pub const SQL_ISV_VIEW_TABLE_USAGE = @as(i32, 2097152);
pub const SQL_ISV_VIEWS = @as(i32, 4194304);
pub const SQL_AD_CONSTRAINT_NAME_DEFINITION = @as(i32, 1);
pub const SQL_AD_ADD_DOMAIN_CONSTRAINT = @as(i32, 2);
pub const SQL_AD_DROP_DOMAIN_CONSTRAINT = @as(i32, 4);
pub const SQL_AD_ADD_DOMAIN_DEFAULT = @as(i32, 8);
pub const SQL_AD_DROP_DOMAIN_DEFAULT = @as(i32, 16);
pub const SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED = @as(i32, 32);
pub const SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE = @as(i32, 64);
pub const SQL_AD_ADD_CONSTRAINT_DEFERRABLE = @as(i32, 128);
pub const SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE = @as(i32, 256);
pub const SQL_CS_CREATE_SCHEMA = @as(i32, 1);
pub const SQL_CS_AUTHORIZATION = @as(i32, 2);
pub const SQL_CS_DEFAULT_CHARACTER_SET = @as(i32, 4);
pub const SQL_CTR_CREATE_TRANSLATION = @as(i32, 1);
pub const SQL_CA_CREATE_ASSERTION = @as(i32, 1);
pub const SQL_CA_CONSTRAINT_INITIALLY_DEFERRED = @as(i32, 16);
pub const SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE = @as(i32, 32);
pub const SQL_CA_CONSTRAINT_DEFERRABLE = @as(i32, 64);
pub const SQL_CA_CONSTRAINT_NON_DEFERRABLE = @as(i32, 128);
pub const SQL_CCS_CREATE_CHARACTER_SET = @as(i32, 1);
pub const SQL_CCS_COLLATE_CLAUSE = @as(i32, 2);
pub const SQL_CCS_LIMITED_COLLATION = @as(i32, 4);
pub const SQL_CCOL_CREATE_COLLATION = @as(i32, 1);
pub const SQL_CDO_CREATE_DOMAIN = @as(i32, 1);
pub const SQL_CDO_DEFAULT = @as(i32, 2);
pub const SQL_CDO_CONSTRAINT = @as(i32, 4);
pub const SQL_CDO_COLLATION = @as(i32, 8);
pub const SQL_CDO_CONSTRAINT_NAME_DEFINITION = @as(i32, 16);
pub const SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED = @as(i32, 32);
pub const SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE = @as(i32, 64);
pub const SQL_CDO_CONSTRAINT_DEFERRABLE = @as(i32, 128);
pub const SQL_CDO_CONSTRAINT_NON_DEFERRABLE = @as(i32, 256);
pub const SQL_CT_CREATE_TABLE = @as(i32, 1);
pub const SQL_CT_COMMIT_PRESERVE = @as(i32, 2);
pub const SQL_CT_COMMIT_DELETE = @as(i32, 4);
pub const SQL_CT_GLOBAL_TEMPORARY = @as(i32, 8);
pub const SQL_CT_LOCAL_TEMPORARY = @as(i32, 16);
pub const SQL_CT_CONSTRAINT_INITIALLY_DEFERRED = @as(i32, 32);
pub const SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE = @as(i32, 64);
pub const SQL_CT_CONSTRAINT_DEFERRABLE = @as(i32, 128);
pub const SQL_CT_CONSTRAINT_NON_DEFERRABLE = @as(i32, 256);
pub const SQL_CT_COLUMN_CONSTRAINT = @as(i32, 512);
pub const SQL_CT_COLUMN_DEFAULT = @as(i32, 1024);
pub const SQL_CT_COLUMN_COLLATION = @as(i32, 2048);
pub const SQL_CT_TABLE_CONSTRAINT = @as(i32, 4096);
pub const SQL_CT_CONSTRAINT_NAME_DEFINITION = @as(i32, 8192);
pub const SQL_DI_CREATE_INDEX = @as(i32, 1);
pub const SQL_DI_DROP_INDEX = @as(i32, 2);
pub const SQL_DC_DROP_COLLATION = @as(i32, 1);
pub const SQL_DD_DROP_DOMAIN = @as(i32, 1);
pub const SQL_DD_RESTRICT = @as(i32, 2);
pub const SQL_DD_CASCADE = @as(i32, 4);
pub const SQL_DS_DROP_SCHEMA = @as(i32, 1);
pub const SQL_DS_RESTRICT = @as(i32, 2);
pub const SQL_DS_CASCADE = @as(i32, 4);
pub const SQL_DCS_DROP_CHARACTER_SET = @as(i32, 1);
pub const SQL_DA_DROP_ASSERTION = @as(i32, 1);
pub const SQL_DT_DROP_TABLE = @as(i32, 1);
pub const SQL_DT_RESTRICT = @as(i32, 2);
pub const SQL_DT_CASCADE = @as(i32, 4);
pub const SQL_DTR_DROP_TRANSLATION = @as(i32, 1);
pub const SQL_DV_DROP_VIEW = @as(i32, 1);
pub const SQL_DV_RESTRICT = @as(i32, 2);
pub const SQL_DV_CASCADE = @as(i32, 4);
pub const SQL_IS_INSERT_LITERALS = @as(i32, 1);
pub const SQL_IS_INSERT_SEARCHED = @as(i32, 2);
pub const SQL_IS_SELECT_INTO = @as(i32, 4);
pub const SQL_OIC_CORE = @as(u32, 1);
pub const SQL_OIC_LEVEL1 = @as(u32, 2);
pub const SQL_OIC_LEVEL2 = @as(u32, 3);
pub const SQL_SFKD_CASCADE = @as(i32, 1);
pub const SQL_SFKD_NO_ACTION = @as(i32, 2);
pub const SQL_SFKD_SET_DEFAULT = @as(i32, 4);
pub const SQL_SFKD_SET_NULL = @as(i32, 8);
pub const SQL_SFKU_CASCADE = @as(i32, 1);
pub const SQL_SFKU_NO_ACTION = @as(i32, 2);
pub const SQL_SFKU_SET_DEFAULT = @as(i32, 4);
pub const SQL_SFKU_SET_NULL = @as(i32, 8);
pub const SQL_SG_USAGE_ON_DOMAIN = @as(i32, 1);
pub const SQL_SG_USAGE_ON_CHARACTER_SET = @as(i32, 2);
pub const SQL_SG_USAGE_ON_COLLATION = @as(i32, 4);
pub const SQL_SG_USAGE_ON_TRANSLATION = @as(i32, 8);
pub const SQL_SG_WITH_GRANT_OPTION = @as(i32, 16);
pub const SQL_SG_DELETE_TABLE = @as(i32, 32);
pub const SQL_SG_INSERT_TABLE = @as(i32, 64);
pub const SQL_SG_INSERT_COLUMN = @as(i32, 128);
pub const SQL_SG_REFERENCES_TABLE = @as(i32, 256);
pub const SQL_SG_REFERENCES_COLUMN = @as(i32, 512);
pub const SQL_SG_SELECT_TABLE = @as(i32, 1024);
pub const SQL_SG_UPDATE_TABLE = @as(i32, 2048);
pub const SQL_SG_UPDATE_COLUMN = @as(i32, 4096);
pub const SQL_SP_EXISTS = @as(i32, 1);
pub const SQL_SP_ISNOTNULL = @as(i32, 2);
pub const SQL_SP_ISNULL = @as(i32, 4);
pub const SQL_SP_MATCH_FULL = @as(i32, 8);
pub const SQL_SP_MATCH_PARTIAL = @as(i32, 16);
pub const SQL_SP_MATCH_UNIQUE_FULL = @as(i32, 32);
pub const SQL_SP_MATCH_UNIQUE_PARTIAL = @as(i32, 64);
pub const SQL_SP_OVERLAPS = @as(i32, 128);
pub const SQL_SP_UNIQUE = @as(i32, 256);
pub const SQL_SP_LIKE = @as(i32, 512);
pub const SQL_SP_IN = @as(i32, 1024);
pub const SQL_SP_BETWEEN = @as(i32, 2048);
pub const SQL_SP_COMPARISON = @as(i32, 4096);
pub const SQL_SP_QUANTIFIED_COMPARISON = @as(i32, 8192);
pub const SQL_SRJO_CORRESPONDING_CLAUSE = @as(i32, 1);
pub const SQL_SRJO_CROSS_JOIN = @as(i32, 2);
pub const SQL_SRJO_EXCEPT_JOIN = @as(i32, 4);
pub const SQL_SRJO_FULL_OUTER_JOIN = @as(i32, 8);
pub const SQL_SRJO_INNER_JOIN = @as(i32, 16);
pub const SQL_SRJO_INTERSECT_JOIN = @as(i32, 32);
pub const SQL_SRJO_LEFT_OUTER_JOIN = @as(i32, 64);
pub const SQL_SRJO_NATURAL_JOIN = @as(i32, 128);
pub const SQL_SRJO_RIGHT_OUTER_JOIN = @as(i32, 256);
pub const SQL_SRJO_UNION_JOIN = @as(i32, 512);
pub const SQL_SR_USAGE_ON_DOMAIN = @as(i32, 1);
pub const SQL_SR_USAGE_ON_CHARACTER_SET = @as(i32, 2);
pub const SQL_SR_USAGE_ON_COLLATION = @as(i32, 4);
pub const SQL_SR_USAGE_ON_TRANSLATION = @as(i32, 8);
pub const SQL_SR_GRANT_OPTION_FOR = @as(i32, 16);
pub const SQL_SR_CASCADE = @as(i32, 32);
pub const SQL_SR_RESTRICT = @as(i32, 64);
pub const SQL_SR_DELETE_TABLE = @as(i32, 128);
pub const SQL_SR_INSERT_TABLE = @as(i32, 256);
pub const SQL_SR_INSERT_COLUMN = @as(i32, 512);
pub const SQL_SR_REFERENCES_TABLE = @as(i32, 1024);
pub const SQL_SR_REFERENCES_COLUMN = @as(i32, 2048);
pub const SQL_SR_SELECT_TABLE = @as(i32, 4096);
pub const SQL_SR_UPDATE_TABLE = @as(i32, 8192);
pub const SQL_SR_UPDATE_COLUMN = @as(i32, 16384);
pub const SQL_SRVC_VALUE_EXPRESSION = @as(i32, 1);
pub const SQL_SRVC_NULL = @as(i32, 2);
pub const SQL_SRVC_DEFAULT = @as(i32, 4);
pub const SQL_SRVC_ROW_SUBQUERY = @as(i32, 8);
pub const SQL_SVE_CASE = @as(i32, 1);
pub const SQL_SVE_CAST = @as(i32, 2);
pub const SQL_SVE_COALESCE = @as(i32, 4);
pub const SQL_SVE_NULLIF = @as(i32, 8);
pub const SQL_SCC_XOPEN_CLI_VERSION1 = @as(i32, 1);
pub const SQL_SCC_ISO92_CLI = @as(i32, 2);
pub const SQL_US_UNION = @as(i32, 1);
pub const SQL_US_UNION_ALL = @as(i32, 2);
pub const SQL_DRIVER_AWARE_POOLING_NOT_CAPABLE = @as(i32, 0);
pub const SQL_DRIVER_AWARE_POOLING_CAPABLE = @as(i32, 1);
pub const SQL_DTC_ENLIST_EXPENSIVE = @as(i32, 1);
pub const SQL_DTC_UNENLIST_EXPENSIVE = @as(i32, 2);
pub const SQL_ASYNC_DBC_NOT_CAPABLE = @as(i32, 0);
pub const SQL_ASYNC_DBC_CAPABLE = @as(i32, 1);
pub const SQL_FETCH_FIRST_USER = @as(u32, 31);
pub const SQL_FETCH_FIRST_SYSTEM = @as(u32, 32);
pub const SQL_ENTIRE_ROWSET = @as(u32, 0);
pub const SQL_POSITION = @as(u32, 0);
pub const SQL_REFRESH = @as(u32, 1);
pub const SQL_UPDATE = @as(u32, 2);
pub const SQL_DELETE = @as(u32, 3);
pub const SQL_ADD = @as(u32, 4);
pub const SQL_SETPOS_MAX_OPTION_VALUE = @as(u32, 4);
pub const SQL_UPDATE_BY_BOOKMARK = @as(u32, 5);
pub const SQL_DELETE_BY_BOOKMARK = @as(u32, 6);
pub const SQL_FETCH_BY_BOOKMARK = @as(u32, 7);
pub const SQL_LOCK_NO_CHANGE = @as(u32, 0);
pub const SQL_LOCK_EXCLUSIVE = @as(u32, 1);
pub const SQL_LOCK_UNLOCK = @as(u32, 2);
pub const SQL_SETPOS_MAX_LOCK_VALUE = @as(u32, 2);
pub const SQL_BEST_ROWID = @as(u32, 1);
pub const SQL_ROWVER = @as(u32, 2);
pub const SQL_PC_NOT_PSEUDO = @as(u32, 1);
pub const SQL_QUICK = @as(u32, 0);
pub const SQL_ENSURE = @as(u32, 1);
pub const SQL_TABLE_STAT = @as(u32, 0);
pub const SQL_DRIVER_NOPROMPT = @as(u32, 0);
pub const SQL_DRIVER_COMPLETE = @as(u32, 1);
pub const SQL_DRIVER_PROMPT = @as(u32, 2);
pub const SQL_DRIVER_COMPLETE_REQUIRED = @as(u32, 3);
pub const SQL_FETCH_BOOKMARK = @as(u32, 8);
pub const SQL_ROW_SUCCESS = @as(u32, 0);
pub const SQL_ROW_DELETED = @as(u32, 1);
pub const SQL_ROW_UPDATED = @as(u32, 2);
pub const SQL_ROW_NOROW = @as(u32, 3);
pub const SQL_ROW_ADDED = @as(u32, 4);
pub const SQL_ROW_ERROR = @as(u32, 5);
pub const SQL_ROW_SUCCESS_WITH_INFO = @as(u32, 6);
pub const SQL_ROW_PROCEED = @as(u32, 0);
pub const SQL_ROW_IGNORE = @as(u32, 1);
pub const SQL_PARAM_SUCCESS = @as(u32, 0);
pub const SQL_PARAM_SUCCESS_WITH_INFO = @as(u32, 6);
pub const SQL_PARAM_ERROR = @as(u32, 5);
pub const SQL_PARAM_UNUSED = @as(u32, 7);
pub const SQL_PARAM_DIAG_UNAVAILABLE = @as(u32, 1);
pub const SQL_PARAM_PROCEED = @as(u32, 0);
pub const SQL_PARAM_IGNORE = @as(u32, 1);
pub const SQL_CASCADE = @as(u32, 0);
pub const SQL_RESTRICT = @as(u32, 1);
pub const SQL_SET_NULL = @as(u32, 2);
pub const SQL_NO_ACTION = @as(u32, 3);
pub const SQL_SET_DEFAULT = @as(u32, 4);
pub const SQL_INITIALLY_DEFERRED = @as(u32, 5);
pub const SQL_INITIALLY_IMMEDIATE = @as(u32, 6);
pub const SQL_NOT_DEFERRABLE = @as(u32, 7);
pub const SQL_PARAM_TYPE_UNKNOWN = @as(u32, 0);
pub const SQL_PARAM_INPUT = @as(u32, 1);
pub const SQL_PARAM_INPUT_OUTPUT = @as(u32, 2);
pub const SQL_RESULT_COL = @as(u32, 3);
pub const SQL_PARAM_OUTPUT = @as(u32, 4);
pub const SQL_RETURN_VALUE = @as(u32, 5);
pub const SQL_PARAM_INPUT_OUTPUT_STREAM = @as(u32, 8);
pub const SQL_PARAM_OUTPUT_STREAM = @as(u32, 16);
pub const SQL_PT_UNKNOWN = @as(u32, 0);
pub const SQL_PT_PROCEDURE = @as(u32, 1);
pub const SQL_PT_FUNCTION = @as(u32, 2);
pub const SQL_YEAR = @as(u32, 1);
pub const SQL_MONTH = @as(u32, 2);
pub const SQL_DAY = @as(u32, 3);
pub const SQL_HOUR = @as(u32, 4);
pub const SQL_MINUTE = @as(u32, 5);
pub const SQL_SECOND = @as(u32, 6);
pub const SQL_YEAR_TO_MONTH = @as(u32, 7);
pub const SQL_DAY_TO_HOUR = @as(u32, 8);
pub const SQL_DAY_TO_MINUTE = @as(u32, 9);
pub const SQL_DAY_TO_SECOND = @as(u32, 10);
pub const SQL_HOUR_TO_MINUTE = @as(u32, 11);
pub const SQL_HOUR_TO_SECOND = @as(u32, 12);
pub const SQL_MINUTE_TO_SECOND = @as(u32, 13);
pub const SQL_DATABASE_NAME = @as(u32, 16);
pub const SQL_FD_FETCH_PREV = @as(i32, 8);
pub const SQL_FETCH_PREV = @as(u32, 4);
pub const SQL_CONCUR_TIMESTAMP = @as(u32, 3);
pub const SQL_SCCO_OPT_TIMESTAMP = @as(i32, 4);
pub const SQL_CC_DELETE = @as(u32, 0);
pub const SQL_CR_DELETE = @as(u32, 0);
pub const SQL_CC_CLOSE = @as(u32, 1);
pub const SQL_CR_CLOSE = @as(u32, 1);
pub const SQL_CC_PRESERVE = @as(u32, 2);
pub const SQL_CR_PRESERVE = @as(u32, 2);
pub const SQL_FETCH_RESUME = @as(u32, 7);
pub const SQL_SCROLL_FORWARD_ONLY = @as(i32, 0);
pub const SQL_SCROLL_KEYSET_DRIVEN = @as(i32, -1);
pub const SQL_SCROLL_DYNAMIC = @as(i32, -2);
pub const SQL_SCROLL_STATIC = @as(i32, -3);
pub const TRACE_VERSION = @as(u32, 1000);
pub const TRACE_ON = @as(i32, 1);
pub const TRACE_VS_EVENT_ON = @as(i32, 2);
pub const ODBC_VS_FLAG_UNICODE_ARG = @as(i32, 1);
pub const ODBC_VS_FLAG_UNICODE_COR = @as(i32, 2);
pub const ODBC_VS_FLAG_RETCODE = @as(i32, 4);
pub const ODBC_VS_FLAG_STOP = @as(i32, 8);
pub const CRESTRICTIONS_DBSCHEMA_LINKEDSERVERS = @as(u32, 1);
pub const SSPROP_ENABLEFASTLOAD = @as(u32, 2);
pub const SSPROP_UNICODELCID = @as(u32, 2);
pub const SSPROP_UNICODECOMPARISONSTYLE = @as(u32, 3);
pub const SSPROP_COLUMNLEVELCOLLATION = @as(u32, 4);
pub const SSPROP_CHARACTERSET = @as(u32, 5);
pub const SSPROP_SORTORDER = @as(u32, 6);
pub const SSPROP_CURRENTCOLLATION = @as(u32, 7);
pub const SSPROP_INIT_CURRENTLANGUAGE = @as(u32, 4);
pub const SSPROP_INIT_NETWORKADDRESS = @as(u32, 5);
pub const SSPROP_INIT_NETWORKLIBRARY = @as(u32, 6);
pub const SSPROP_INIT_USEPROCFORPREP = @as(u32, 7);
pub const SSPROP_INIT_AUTOTRANSLATE = @as(u32, 8);
pub const SSPROP_INIT_PACKETSIZE = @as(u32, 9);
pub const SSPROP_INIT_APPNAME = @as(u32, 10);
pub const SSPROP_INIT_WSID = @as(u32, 11);
pub const SSPROP_INIT_FILENAME = @as(u32, 12);
pub const SSPROP_INIT_ENCRYPT = @as(u32, 13);
pub const SSPROP_AUTH_REPL_SERVER_NAME = @as(u32, 14);
pub const SSPROP_INIT_TAGCOLUMNCOLLATION = @as(u32, 15);
pub const SSPROPVAL_USEPROCFORPREP_OFF = @as(u32, 0);
pub const SSPROPVAL_USEPROCFORPREP_ON = @as(u32, 1);
pub const SSPROPVAL_USEPROCFORPREP_ON_DROP = @as(u32, 2);
pub const SSPROP_QUOTEDCATALOGNAMES = @as(u32, 2);
pub const SSPROP_ALLOWNATIVEVARIANT = @as(u32, 3);
pub const SSPROP_SQLXMLXPROGID = @as(u32, 4);
pub const SSPROP_MAXBLOBLENGTH = @as(u32, 8);
pub const SSPROP_FASTLOADOPTIONS = @as(u32, 9);
pub const SSPROP_FASTLOADKEEPNULLS = @as(u32, 10);
pub const SSPROP_FASTLOADKEEPIDENTITY = @as(u32, 11);
pub const SSPROP_CURSORAUTOFETCH = @as(u32, 12);
pub const SSPROP_DEFERPREPARE = @as(u32, 13);
pub const SSPROP_IRowsetFastLoad = @as(u32, 14);
pub const SSPROP_COL_COLLATIONNAME = @as(u32, 14);
pub const SSPROP_STREAM_MAPPINGSCHEMA = @as(u32, 15);
pub const SSPROP_STREAM_XSL = @as(u32, 16);
pub const SSPROP_STREAM_BASEPATH = @as(u32, 17);
pub const SSPROP_STREAM_COMMANDTYPE = @as(u32, 18);
pub const SSPROP_STREAM_XMLROOT = @as(u32, 19);
pub const SSPROP_STREAM_FLAGS = @as(u32, 20);
pub const SSPROP_STREAM_CONTENTTYPE = @as(u32, 23);
pub const STREAM_FLAGS_DISALLOW_URL = @as(u32, 1);
pub const STREAM_FLAGS_DISALLOW_ABSOLUTE_PATH = @as(u32, 2);
pub const STREAM_FLAGS_DISALLOW_QUERY = @as(u32, 4);
pub const STREAM_FLAGS_DONTCACHEMAPPINGSCHEMA = @as(u32, 8);
pub const STREAM_FLAGS_DONTCACHETEMPLATE = @as(u32, 16);
pub const STREAM_FLAGS_DONTCACHEXSL = @as(u32, 32);
pub const STREAM_FLAGS_DISALLOW_UPDATEGRAMS = @as(u32, 64);
pub const STREAM_FLAGS_RESERVED = @as(u32, 4294901760);
pub const SSPROPVAL_COMMANDTYPE_REGULAR = @as(u32, 21);
pub const SSPROPVAL_COMMANDTYPE_BULKLOAD = @as(u32, 22);
pub const DBTYPE_SQLVARIANT = @as(u32, 144);
pub const SQL_HANDLE_DBC_INFO_TOKEN = @as(u32, 6);
pub const SQL_CONN_POOL_RATING_BEST = @as(u32, 100);
pub const SQL_CONN_POOL_RATING_GOOD_ENOUGH = @as(u32, 99);
pub const SQL_CONN_POOL_RATING_USELESS = @as(u32, 0);
pub const SQL_ATTR_DBC_INFO_TOKEN = @as(u32, 118);
pub const SQL_ATTR_ASYNC_DBC_NOTIFICATION_CALLBACK = @as(u32, 120);
pub const SQL_ATTR_ASYNC_DBC_NOTIFICATION_CONTEXT = @as(u32, 121);
pub const SQL_ATTR_ASYNC_STMT_NOTIFICATION_CALLBACK = @as(u32, 30);
pub const SQL_ATTR_ASYNC_STMT_NOTIFICATION_CONTEXT = @as(u32, 31);
pub const SQL_MAX_NUMERIC_LEN = @as(u32, 16);
pub const SQL_WCHAR = @as(i32, -8);
pub const SQL_WVARCHAR = @as(i32, -9);
pub const SQL_WLONGVARCHAR = @as(i32, -10);
pub const SQL_C_WCHAR = @as(i32, -8);
pub const SQL_C_TCHAR = @as(i32, -8);
pub const SQL_SQLSTATE_SIZEW = @as(u32, 10);
pub const CSTORAGEPROPERTY = @as(u32, 23);
pub const CATEGORY_SEARCH = @as(i32, 1);
pub const CATEGORY_COLLATOR = @as(i32, 2);
pub const CATEGORY_GATHERER = @as(i32, 3);
pub const CATEGORY_INDEXER = @as(i32, 4);
pub const EVENT_SSSEARCH_STARTED = @as(i32, 1073742827);
pub const EVENT_SSSEARCH_STARTING_SETUP = @as(i32, 1073742828);
pub const EVENT_SSSEARCH_SETUP_SUCCEEDED = @as(i32, 1073742829);
pub const EVENT_SSSEARCH_SETUP_FAILED = @as(i32, -1073740818);
pub const EVENT_OUTOFMEMORY = @as(i32, -1073740817);
pub const EVENT_SSSEARCH_SETUP_CLEANUP_STARTED = @as(i32, -2147482640);
pub const EVENT_EXCEPTION = @as(i32, -1073740815);
pub const EVENT_SSSEARCH_SETUP_CLEANUP_SUCCEEDED = @as(i32, 1073742834);
pub const EVENT_SSSEARCH_SETUP_CLEANUP_FAILED = @as(i32, -1073740813);
pub const EVENT_SSSEARCH_STOPPED = @as(i32, 1073742837);
pub const EVENT_SSSEARCH_CREATE_PATH_RULES_FAILED = @as(i32, -2147482634);
pub const EVENT_SSSEARCH_DROPPED_EVENTS = @as(i32, -2147482633);
pub const EVENT_SSSEARCH_DATAFILES_MOVE_FAILED = @as(i32, -1073740808);
pub const EVENT_SSSEARCH_DATAFILES_MOVE_SUCCEEDED = @as(i32, 1073742841);
pub const EVENT_SSSEARCH_DATAFILES_MOVE_ROLLBACK_ERRORS = @as(i32, -2147482630);
pub const EVENT_SSSEARCH_CSM_SAVE_FAILED = @as(i32, -1073740805);
pub const EVENT_CONFIG_SYNTAX = @as(i32, -2147482604);
pub const EVENT_UNPRIVILEGED_SERVICE_ACCOUNT = @as(i32, -2147482596);
pub const EVENT_SYSTEM_EXCEPTION = @as(i32, -2147482595);
pub const EVENT_CONFIG_ERROR = @as(i32, -1073738821);
pub const EVENT_GATHERSVC_PERFMON = @as(i32, -1073738818);
pub const EVENT_GATHERER_PERFMON = @as(i32, -1073738817);
pub const EVENT_HASHMAP_INSERT = @as(i32, -1073738816);
pub const EVENT_TRANSLOG_CREATE_TRX = @as(i32, -1073738815);
pub const EVENT_TRANSLOG_APPEND = @as(i32, -1073738814);
pub const EVENT_TRANSLOG_UPDATE = @as(i32, -1073738813);
pub const EVENT_HASHMAP_UPDATE = @as(i32, -1073738811);
pub const EVENT_GATHER_EXCEPTION = @as(i32, -1073738810);
pub const EVENT_TRANSACTION_READ = @as(i32, -1073738809);
pub const EVENT_GATHER_END_CRAWL = @as(i32, 1073744842);
pub const EVENT_GATHER_START_CRAWL = @as(i32, 1073744843);
pub const EVENT_GATHER_INTERNAL = @as(i32, -1073738804);
pub const EVENT_GATHER_CRAWL_NOT_STARTED = @as(i32, -2147480625);
pub const EVENT_GATHER_CRAWL_SEED_ERROR = @as(i32, -2147480624);
pub const EVENT_GATHER_CRITICAL_ERROR = @as(i32, -1073738799);
pub const EVENT_GATHER_ADVISE_FAILED = @as(i32, -1073738798);
pub const EVENT_GATHER_TRANSACTION_FAIL = @as(i32, -1073738797);
pub const EVENT_GATHER_OBJ_INIT_FAILED = @as(i32, -1073738796);
pub const EVENT_GATHER_PLUGIN_INIT_FAILED = @as(i32, -1073738795);
pub const EVENT_GATHER_SERVICE_INIT = @as(i32, -1073738794);
pub const EVENT_GATHER_CANT_CREATE_DOCID = @as(i32, -1073738793);
pub const EVENT_GATHER_CANT_DELETE_DOCID = @as(i32, -1073738792);
pub const EVENT_TRANSLOG_CREATE = @as(i32, -1073738791);
pub const EVENT_REG_VERSION = @as(i32, -1073738790);
pub const EVENT_GATHER_CRAWL_SEED_FAILED = @as(i32, -2147480612);
pub const EVENT_GATHER_CRAWL_SEED_FAILED_INIT = @as(i32, -2147480611);
pub const EVENT_GATHER_REG_MISSING = @as(i32, -2147480610);
pub const EVENT_GATHER_CRAWL_IN_PROGRESS = @as(i32, -2147480609);
pub const EVENT_GATHER_LOCK_FAILED = @as(i32, -1073738784);
pub const EVENT_GATHER_RESET_START = @as(i32, 1073744865);
pub const EVENT_GATHER_START_PAUSE = @as(i32, -2147480606);
pub const EVENT_GATHER_THROTTLE = @as(i32, 1073744867);
pub const EVENT_GATHER_RESUME = @as(i32, 1073744868);
pub const EVENT_GATHER_AUTODESCLEN_ADJUSTED = @as(i32, -2147480603);
pub const EVENT_GATHER_NO_CRAWL_SEEDS = @as(i32, -2147480602);
pub const EVENT_GATHER_END_INCREMENTAL = @as(i32, 1073744871);
pub const EVENT_GATHER_FROM_NOT_SET = @as(i32, -1073738776);
pub const EVENT_GATHER_DELETING_HISTORY_ITEMS = @as(i32, -1073738774);
pub const EVENT_GATHER_STOP_START = @as(i32, 1073744876);
pub const EVENT_GATHER_START_CRAWL_IF_RESET = @as(i32, -2147480595);
pub const EVENT_GATHER_DISK_FULL = @as(i32, -2147480594);
pub const EVENT_GATHER_NO_SCHEMA = @as(i32, -2147480593);
pub const EVENT_GATHER_AUTODESCENCODE_INVALID = @as(i32, -2147480592);
pub const EVENT_GATHER_PLUGINMGR_INIT_FAILED = @as(i32, -1073738767);
pub const EVENT_GATHER_APP_INIT_FAILED = @as(i32, -1073738766);
pub const EVENT_FAILED_INITIALIZE_CRAWL = @as(i32, -1073738765);
pub const EVENT_CRAWL_SCHEDULED = @as(i32, 1073744884);
pub const EVENT_FAILED_CREATE_GATHERER_LOG = @as(i32, -2147480587);
pub const EVENT_WBREAKER_NOT_LOADED = @as(i32, -2147480586);
pub const EVENT_LEARN_PROPAGATION_COPY_FAILED = @as(i32, -2147480585);
pub const EVENT_LEARN_CREATE_DB_FAILED = @as(i32, -2147480584);
pub const EVENT_LEARN_COMPILE_FAILED = @as(i32, -2147480583);
pub const EVENT_LEARN_PROPAGATION_FAILED = @as(i32, -2147480582);
pub const EVENT_GATHER_END_ADAPTIVE = @as(i32, 1073744891);
pub const EVENT_USING_DIFFERENT_WORD_BREAKER = @as(i32, -2147480580);
pub const EVENT_GATHER_RESTORE_COMPLETE = @as(i32, 3069);
pub const EVENT_GATHER_RESTORE_ERROR = @as(i32, -1073738754);
pub const EVENT_AUTOCAT_PERFMON = @as(i32, -1073738753);
pub const EVENT_GATHER_DIRTY_STARTUP = @as(i32, -2147480576);
pub const EVENT_GATHER_HISTORY_CORRUPTION_DETECTED = @as(i32, -2147480575);
pub const EVENT_GATHER_RESTOREAPP_ERROR = @as(i32, -1073738750);
pub const EVENT_GATHER_RESTOREAPP_COMPLETE = @as(i32, 3075);
pub const EVENT_GATHER_BACKUPAPP_ERROR = @as(i32, -1073738748);
pub const EVENT_GATHER_BACKUPAPP_COMPLETE = @as(i32, 3077);
pub const EVENT_GATHER_DAEMON_TERMINATED = @as(i32, -2147480570);
pub const EVENT_NOTIFICATION_FAILURE = @as(i32, -1073738745);
pub const EVENT_NOTIFICATION_FAILURE_SCOPE_EXCEEDED_LOGGING = @as(i32, -2147480568);
pub const EVENT_NOTIFICATION_RESTORED = @as(i32, 1073744905);
pub const EVENT_NOTIFICATION_RESTORED_SCOPE_EXCEEDED_LOGGING = @as(i32, -2147480566);
pub const EVENT_GATHER_PROTOCOLHANDLER_LOAD_FAILED = @as(i32, -1073738741);
pub const EVENT_GATHER_PROTOCOLHANDLER_INIT_FAILED = @as(i32, -1073738740);
pub const EVENT_GATHER_INVALID_NETWORK_ACCESS_ACCOUNT = @as(i32, -1073738739);
pub const EVENT_GATHER_SYSTEM_LCID_CHANGED = @as(i32, -2147480562);
pub const EVENT_GATHER_FLUSH_FAILED = @as(i32, -1073738737);
pub const EVENT_GATHER_CHECKPOINT_FAILED = @as(i32, -1073738736);
pub const EVENT_GATHER_SAVE_FAILED = @as(i32, -1073738735);
pub const EVENT_GATHER_RESTORE_CHECKPOINT_FAILED = @as(i32, -1073738734);
pub const EVENT_GATHER_READ_CHECKPOINT_FAILED = @as(i32, -1073738733);
pub const EVENT_GATHER_CHECKPOINT_CORRUPT = @as(i32, -1073738732);
pub const EVENT_GATHER_CHECKPOINT_FILE_MISSING = @as(i32, -1073738731);
pub const EVENT_STS_INIT_SECURITY_FAILED = @as(i32, -2147480554);
pub const EVENT_LOCAL_GROUP_NOT_EXPANDED = @as(i32, 1073744919);
pub const EVENT_LOCAL_GROUPS_CACHE_FLUSHED = @as(i32, 1073744920);
pub const EVENT_GATHERER_DATASOURCE = @as(i32, -1073738727);
pub const EVENT_AUTOCAT_CANT_CREATE_FILE_SHARE = @as(i32, -1073738726);
pub const EVENT_NOTIFICATION_THREAD_EXIT_FAILED = @as(i32, -1073738725);
pub const EVENT_FILTER_HOST_NOT_INITIALIZED = @as(i32, -1073738724);
pub const EVENT_FILTER_HOST_NOT_TERMINATED = @as(i32, -1073738723);
pub const EVENT_FILTERPOOL_ADD_FAILED = @as(i32, -1073738722);
pub const EVENT_FILTERPOOL_DELETE_FAILED = @as(i32, -1073738721);
pub const EVENT_ENUMERATE_SESSIONS_FAILED = @as(i32, -1073738720);
pub const EVENT_DETAILED_FILTERPOOL_ADD_FAILED = @as(i32, -1073738719);
pub const EVENT_AUDIENCECOMPUTATION_CANNOTSTART = @as(i32, -1073738223);
pub const EVENT_GATHER_RECOVERY_FAILURE = @as(i32, -1073738222);
pub const EVENT_INDEXER_STARTED = @as(i32, 1073748824);
pub const EVENT_INDEXER_SCHEMA_COPY_ERROR = @as(i32, -1073734823);
pub const EVENT_INDEXER_INIT_ERROR = @as(i32, -1073734814);
pub const EVENT_INDEXER_INVALID_DIRECTORY = @as(i32, -1073734813);
pub const EVENT_INDEXER_PROP_ERROR = @as(i32, -1073734812);
pub const EVENT_INDEXER_PAUSED_FOR_DISKFULL = @as(i32, -1073734811);
pub const EVENT_INDEXER_PROP_STOPPED = @as(i32, -2147476633);
pub const EVENT_INDEXER_PROP_SUCCEEDED = @as(i32, 7016);
pub const EVENT_INDEXER_PROP_STARTED = @as(i32, 1073748841);
pub const EVENT_INDEXER_NO_SEARCH_SERVERS = @as(i32, -2147476630);
pub const EVENT_INDEXER_ADD_DSS_SUCCEEDED = @as(i32, 7019);
pub const EVENT_INDEXER_REMOVE_DSS_SUCCEEDED = @as(i32, 7020);
pub const EVENT_INDEXER_ADD_DSS_FAILED = @as(i32, -2147476627);
pub const EVENT_INDEXER_REMOVE_DSS_FAILED = @as(i32, -1073734801);
pub const EVENT_INDEXER_DSS_CONTACT_FAILED = @as(i32, -1073734800);
pub const EVENT_INDEXER_BUILD_FAILED = @as(i32, -1073734797);
pub const EVENT_INDEXER_REG_MISSING = @as(i32, -1073734796);
pub const EVENT_INDEXER_PROPSTORE_INIT_FAILED = @as(i32, -1073734787);
pub const EVENT_INDEXER_CI_LOAD_ERROR = @as(i32, -1073734785);
pub const EVENT_INDEXER_RESET_FOR_CORRUPTION = @as(i32, -1073734784);
pub const EVENT_INDEXER_SHUTDOWN = @as(i32, 1073748866);
pub const EVENT_INDEXER_LOAD_FAIL = @as(i32, -1073734781);
pub const EVENT_INDEXER_PROP_STATE_CORRUPT = @as(i32, -1073734780);
pub const EVENT_INDEXER_DSS_ALREADY_ADDED = @as(i32, 1073748870);
pub const EVENT_INDEXER_BUILD_START = @as(i32, 1073748872);
pub const EVENT_INDEXER_BUILD_ENDED = @as(i32, 1073748873);
pub const EVENT_INDEXER_VERIFY_PROP_ACCOUNT = @as(i32, -1073734768);
pub const EVENT_INDEXER_ADD_DSS_DISCONNECT = @as(i32, -2147476585);
pub const EVENT_INDEXER_PERFMON = @as(i32, -1073734760);
pub const EVENT_INDEXER_MISSING_APP_DIRECTORY = @as(i32, -1073734758);
pub const EVENT_INDEXER_REG_ERROR = @as(i32, -1073734756);
pub const EVENT_INDEXER_DSS_UNABLE_TO_REMOVE = @as(i32, -1073734755);
pub const EVENT_INDEXER_NEW_PROJECT = @as(i32, -1073734754);
pub const EVENT_INDEXER_REMOVED_PROJECT = @as(i32, -1073734753);
pub const EVENT_INDEXER_PROP_COMMITTED = @as(i32, 1073748898);
pub const EVENT_INDEXER_PROP_ABORTED = @as(i32, 1073748899);
pub const EVENT_DSS_NOT_ENABLED = @as(i32, -2147476572);
pub const EVENT_INDEXER_PROP_COMMIT_FAILED = @as(i32, -1073734747);
pub const JET_INIT_ERROR = @as(i32, -1073732824);
pub const JET_NEW_PROP_STORE_ERROR = @as(i32, -1073732823);
pub const JET_GET_PROP_STORE_ERROR = @as(i32, -1073732822);
pub const JET_MULTIINSTANCE_DISABLED = @as(i32, -2147474645);
pub const EVENT_WARNING_CANNOT_UPGRADE_NOISE_FILES = @as(i32, -2147473635);
pub const EVENT_WARNING_CANNOT_UPGRADE_NOISE_FILE = @as(i32, -2147473634);
pub const EVENT_WIN32_ERROR = @as(i32, -2147473633);
pub const EVENT_PERF_COUNTERS_NOT_LOADED = @as(i32, -2147473628);
pub const EVENT_PERF_COUNTERS_REGISTRY_TROUBLE = @as(i32, -2147473627);
pub const EVENT_PERF_COUNTERS_ALREADY_EXISTS = @as(i32, -2147473626);
pub const EVENT_PROTOCOL_HOST_FORCE_TERMINATE = @as(i32, -2147473625);
pub const EVENT_FILTER_HOST_FORCE_TERMINATE = @as(i32, -2147473624);
pub const EVENT_INDEXER_OUT_OF_DATABASE_INSTANCE = @as(i32, -1073731799);
pub const EVENT_INDEXER_FAIL_TO_SET_MAX_JETINSTANCE = @as(i32, -1073731798);
pub const EVENT_INDEXER_FAIL_TO_CREATE_PER_USER_CATALOG = @as(i32, -1073731797);
pub const EVENT_INDEXER_FAIL_TO_UNLOAD_PER_USER_CATALOG = @as(i32, -1073731796);
pub const ERROR_SOURCE_NETWORKING = @as(u32, 768);
pub const ERROR_SOURCE_DATASOURCE = @as(u32, 1024);
pub const ERROR_SOURCE_COLLATOR = @as(u32, 1280);
pub const ERROR_SOURCE_CONNMGR = @as(u32, 1536);
pub const ERROR_SOURCE_QUERY = @as(u32, 1792);
pub const ERROR_SOURCE_SCHEMA = @as(u32, 3072);
pub const ERROR_SOURCE_GATHERER = @as(u32, 3328);
pub const ERROR_SOURCE_INDEXER = @as(u32, 4352);
pub const ERROR_SOURCE_SETUP = @as(u32, 4864);
pub const ERROR_SOURCE_SECURITY = @as(u32, 5120);
pub const ERROR_SOURCE_CMDLINE = @as(u32, 5376);
pub const ERROR_SOURCE_NLADMIN = @as(u32, 6400);
pub const ERROR_SOURCE_SCRIPTPI = @as(u32, 8192);
pub const ERROR_SOURCE_MSS = @as(u32, 8448);
pub const ERROR_SOURCE_XML = @as(u32, 8704);
pub const ERROR_SOURCE_DAV = @as(u32, 8960);
pub const ERROR_SOURCE_FLTRDMN = @as(u32, 9216);
pub const ERROR_SOURCE_OLEDB_BINDER = @as(u32, 9472);
pub const ERROR_SOURCE_NOTESPH = @as(u32, 9728);
pub const ERROR_SOURCE_EXSTOREPH = @as(u32, 9984);
pub const ERROR_SOURCE_SRCH_SCHEMA_CACHE = @as(u32, 13056);
pub const ERROR_SOURCE_CONTENT_SOURCE = @as(u32, 13312);
pub const ERROR_SOURCE_REMOTE_EXSTOREPH = @as(u32, 13568);
pub const ERROR_SOURCE_PEOPLE_IMPORT = @as(u32, 16384);
pub const ERROR_FTE = @as(u32, 13824);
pub const ERROR_FTE_CB = @as(u32, 51968);
pub const ERROR_FTE_FD = @as(u32, 64768);
pub const XML_E_NODEFAULTNS = @as(i32, -2147212800);
pub const XML_E_BADSXQL = @as(i32, -2147212799);
pub const MSS_E_INVALIDAPPNAME = @as(i32, -2147213056);
pub const MSS_E_APPNOTFOUND = @as(i32, -2147213055);
pub const MSS_E_APPALREADYEXISTS = @as(i32, -2147213054);
pub const MSS_E_CATALOGNOTFOUND = @as(i32, -2147213053);
pub const MSS_E_CATALOGSTOPPING = @as(i32, -2147213052);
pub const MSS_E_UNICODEFILEHEADERMISSING = @as(i32, -2147213051);
pub const MSS_E_CATALOGALREADYEXISTS = @as(i32, -2147213050);
pub const NET_E_GENERAL = @as(i32, -2147220736);
pub const NET_E_DISCONNECTED = @as(i32, -2147220733);
pub const NET_E_INVALIDPARAMS = @as(i32, -2147220728);
pub const NET_E_OPERATIONINPROGRESS = @as(i32, -2147220727);
pub const SEC_E_INVALIDCONTEXT = @as(i32, -2147216381);
pub const SEC_E_INITFAILED = @as(i32, -2147216383);
pub const SEC_E_NOTINITIALIZED = @as(i32, -2147216382);
pub const SEC_E_ACCESSDENIED = @as(i32, -2147216129);
pub const DS_E_NOMOREDATA = @as(i32, -2147220480);
pub const DS_E_INVALIDDATASOURCE = @as(i32, -2147220479);
pub const DS_E_DATASOURCENOTAVAILABLE = @as(i32, -2147220478);
pub const DS_E_QUERYCANCELED = @as(i32, -2147220477);
pub const DS_E_UNKNOWNREQUEST = @as(i32, -2147220476);
pub const DS_E_BADREQUEST = @as(i32, -2147220475);
pub const DS_E_SERVERCAPACITY = @as(i32, -2147220474);
pub const DS_E_BADSEQUENCE = @as(i32, -2147220473);
pub const DS_E_MESSAGETOOLONG = @as(i32, -2147220472);
pub const DS_E_SERVERERROR = @as(i32, -2147220471);
pub const DS_E_CONFIGBAD = @as(i32, -2147220470);
pub const DS_E_DATANOTPRESENT = @as(i32, -2147220464);
pub const DS_E_SETSTATUSINPROGRESS = @as(i32, -2147220463);
pub const DS_E_DUPLICATEID = @as(i32, -2147220462);
pub const DS_E_TOOMANYDATASOURCES = @as(i32, -2147220461);
pub const DS_E_REGISTRY = @as(i32, -2147220460);
pub const DS_E_DATASOURCENOTDISABLED = @as(i32, -2147220459);
pub const DS_E_INVALIDTAGDB = @as(i32, -2147220458);
pub const DS_E_INVALIDCATALOGNAME = @as(i32, -2147220457);
pub const DS_E_CONFIGNOTRIGHTTYPE = @as(i32, -2147220456);
pub const DS_E_PROTOCOLVERSION = @as(i32, -2147220455);
pub const DS_E_ALREADYENABLED = @as(i32, -2147220454);
pub const DS_E_INDEXDIRECTORY = @as(i32, -2147220452);
pub const DS_E_VALUETOOLARGE = @as(i32, -2147220451);
pub const DS_E_UNKNOWNPARAM = @as(i32, -2147220450);
pub const DS_E_BUFFERTOOSMALL = @as(i32, -2147220449);
pub const DS_E_PARAMOUTOFRANGE = @as(i32, -2147220448);
pub const DS_E_ALREADYDISABLED = @as(i32, -2147220447);
pub const DS_E_QUERYHUNG = @as(i32, -2147220446);
pub const DS_E_BADRESULT = @as(i32, -2147220445);
pub const DS_E_CANNOTWRITEREGISTRY = @as(i32, -2147220444);
pub const DS_E_CANNOTREMOVECONCURRENT = @as(i32, -2147220443);
pub const DS_E_SEARCHCATNAMECOLLISION = @as(i32, -2147220442);
pub const DS_E_PROPVERSIONMISMATCH = @as(i32, -2147220441);
pub const DS_E_MISSINGCATALOG = @as(i32, -2147220440);
pub const COLL_E_BADSEQUENCE = @as(i32, -2147220223);
pub const COLL_E_NOMOREDATA = @as(i32, -2147220222);
pub const COLL_E_INCOMPATIBLECOLUMNS = @as(i32, -2147220221);
pub const COLL_E_BUFFERTOOSMALL = @as(i32, -2147220220);
pub const COLL_E_BADRESULT = @as(i32, -2147220218);
pub const COLL_E_NOSORTCOLUMN = @as(i32, -2147220217);
pub const COLL_E_DUPLICATEDBID = @as(i32, -2147220216);
pub const COLL_E_TOOMANYMERGECOLUMNS = @as(i32, -2147220215);
pub const COLL_E_NODEFAULTCATALOG = @as(i32, -2147220214);
pub const COLL_E_MAXCONNEXCEEDED = @as(i32, -2147220213);
pub const CM_E_TOOMANYDATASERVERS = @as(i32, -2147219967);
pub const CM_E_TOOMANYDATASOURCES = @as(i32, -2147219966);
pub const CM_E_NOQUERYCONNECTIONS = @as(i32, -2147219965);
pub const CM_E_DATASOURCENOTAVAILABLE = @as(i32, -2147219964);
pub const CM_E_CONNECTIONTIMEOUT = @as(i32, -2147219963);
pub const CM_E_SERVERNOTFOUND = @as(i32, -2147219962);
pub const CM_S_NODATASERVERS = @as(i32, 263687);
pub const CM_E_REGISTRY = @as(i32, -2147219960);
pub const CM_E_INVALIDDATASOURCE = @as(i32, -2147219959);
pub const CM_E_TIMEOUT = @as(i32, -2147219958);
pub const CM_E_INSUFFICIENTBUFFER = @as(i32, -2147219957);
pub const QRY_E_QUERYSYNTAX = @as(i32, -2147219711);
pub const QRY_E_TYPEMISMATCH = @as(i32, -2147219710);
pub const QRY_E_UNHANDLEDTYPE = @as(i32, -2147219709);
pub const QRY_S_NOROWSFOUND = @as(i32, 263940);
pub const QRY_E_TOOMANYCOLUMNS = @as(i32, -2147219707);
pub const QRY_E_TOOMANYDATABASES = @as(i32, -2147219706);
pub const QRY_E_STARTHITTOBIG = @as(i32, -2147219705);
pub const QRY_E_TOOMANYQUERYTERMS = @as(i32, -2147219704);
pub const QRY_E_NODATASOURCES = @as(i32, -2147219703);
pub const QRY_E_TIMEOUT = @as(i32, -2147219702);
pub const QRY_E_COLUMNNOTSORTABLE = @as(i32, -2147219701);
pub const QRY_E_COLUMNNOTSEARCHABLE = @as(i32, -2147219700);
pub const QRY_E_INVALIDCOLUMN = @as(i32, -2147219699);
pub const QRY_E_QUERYCORRUPT = @as(i32, -2147219698);
pub const QRY_E_PREFIXWILDCARD = @as(i32, -2147219697);
pub const QRY_E_INFIXWILDCARD = @as(i32, -2147219696);
pub const QRY_E_WILDCARDPREFIXLENGTH = @as(i32, -2147219695);
pub const QRY_S_TERMIGNORED = @as(i32, 263954);
pub const QRY_E_ENGINEFAILED = @as(i32, -2147219693);
pub const QRY_E_SEARCHTOOBIG = @as(i32, -2147219692);
pub const QRY_E_NULLQUERY = @as(i32, -2147219691);
pub const QRY_S_INEXACTRESULTS = @as(i32, 263958);
pub const QRY_E_NOCOLUMNS = @as(i32, -2147219689);
pub const QRY_E_INVALIDSCOPES = @as(i32, -2147219688);
pub const QRY_E_INVALIDCATALOG = @as(i32, -2147219687);
pub const QRY_E_SCOPECARDINALIDY = @as(i32, -2147219686);
pub const QRY_E_UNEXPECTED = @as(i32, -2147219685);
pub const QRY_E_INVALIDPATH = @as(i32, -2147219684);
pub const QRY_E_LMNOTINITIALIZED = @as(i32, -2147219683);
pub const QRY_E_INVALIDINTERVAL = @as(i32, -2147219682);
pub const QRY_E_NOLOGMANAGER = @as(i32, -2147219681);
pub const SCHEMA_E_LOAD_SPECIAL = @as(i32, -2147218431);
pub const SCHEMA_E_FILENOTFOUND = @as(i32, -2147218430);
pub const SCHEMA_E_NESTEDTAG = @as(i32, -2147218429);
pub const SCHEMA_E_UNEXPECTEDTAG = @as(i32, -2147218428);
pub const SCHEMA_E_VERSIONMISMATCH = @as(i32, -2147218427);
pub const SCHEMA_E_CANNOTCREATEFILE = @as(i32, -2147218426);
pub const SCHEMA_E_CANNOTWRITEFILE = @as(i32, -2147218425);
pub const SCHEMA_E_EMPTYFILE = @as(i32, -2147218424);
pub const SCHEMA_E_INVALIDFILETYPE = @as(i32, -2147218423);
pub const SCHEMA_E_INVALIDDATATYPE = @as(i32, -2147218422);
pub const SCHEMA_E_CANNOTCREATENOISEWORDFILE = @as(i32, -2147218421);
pub const SCHEMA_E_ADDSTOPWORDS = @as(i32, -2147218420);
pub const SCHEMA_E_NAMEEXISTS = @as(i32, -2147218419);
pub const SCHEMA_E_INVALIDVALUE = @as(i32, -2147218418);
pub const SCHEMA_E_BADPROPSPEC = @as(i32, -2147218417);
pub const SCHEMA_E_NOMORECOLUMNS = @as(i32, -2147218416);
pub const SCHEMA_E_FILECHANGED = @as(i32, -2147218415);
pub const SCHEMA_E_BADCOLUMNNAME = @as(i32, -2147218414);
pub const SCHEMA_E_BADPROPPID = @as(i32, -2147218413);
pub const SCHEMA_E_BADATTRIBUTE = @as(i32, -2147218412);
pub const SCHEMA_E_BADFILENAME = @as(i32, -2147218411);
pub const SCHEMA_E_PROPEXISTS = @as(i32, -2147218410);
pub const SCHEMA_E_DUPLICATENOISE = @as(i32, -2147218409);
pub const GTHR_E_DUPLICATE_OBJECT = @as(i32, -2147218174);
pub const GTHR_E_UNABLE_TO_READ_REGISTRY = @as(i32, -2147218173);
pub const GTHR_E_ERROR_WRITING_REGISTRY = @as(i32, -2147218172);
pub const GTHR_E_ERROR_INITIALIZING_PERFMON = @as(i32, -2147218171);
pub const GTHR_E_ERROR_OBJECT_NOT_FOUND = @as(i32, -2147218170);
pub const GTHR_E_URL_EXCLUDED = @as(i32, -2147218169);
pub const GTHR_E_CONFIG_DUP_PROJECT = @as(i32, -2147218166);
pub const GTHR_E_CONFIG_DUP_EXTENSION = @as(i32, -2147218165);
pub const GTHR_E_DUPLICATE_URL = @as(i32, -2147218163);
pub const GTHR_E_TOO_MANY_PLUGINS = @as(i32, -2147218162);
pub const GTHR_E_INVALIDFUNCTION = @as(i32, -2147218161);
pub const GTHR_E_NOFILTERSINK = @as(i32, -2147218160);
pub const GTHR_E_FILTER_PROCESS_TERMINATED = @as(i32, -2147218159);
pub const GTHR_E_FILTER_INVALID_MESSAGE = @as(i32, -2147218158);
pub const GTHR_E_UNSUPPORTED_PROPERTY_TYPE = @as(i32, -2147218157);
pub const GTHR_E_NAME_TOO_LONG = @as(i32, -2147218156);
pub const GTHR_E_NO_IDENTITY = @as(i32, -2147218155);
pub const GTHR_E_FILTER_NOT_FOUND = @as(i32, -2147218154);
pub const GTHR_E_FILTER_NO_MORE_THREADS = @as(i32, -2147218153);
pub const GTHR_E_PRT_HNDLR_PROGID_MISSING = @as(i32, -2147218152);
pub const GTHR_E_FILTER_PROCESS_TERMINATED_QUOTA = @as(i32, -2147218151);
pub const GTHR_E_UNKNOWN_PROTOCOL = @as(i32, -2147218150);
pub const GTHR_E_PROJECT_NOT_INITIALIZED = @as(i32, -2147218149);
pub const GTHR_S_STATUS_CHANGE_IGNORED = @as(i32, 265500);
pub const GTHR_S_STATUS_END_CRAWL = @as(i32, 265501);
pub const GTHR_S_STATUS_RESET = @as(i32, 265502);
pub const GTHR_S_STATUS_THROTTLE = @as(i32, 265503);
pub const GTHR_S_STATUS_RESUME = @as(i32, 265504);
pub const GTHR_S_STATUS_PAUSE = @as(i32, 265505);
pub const GTHR_E_INVALID_PROJECT_NAME = @as(i32, -2147218142);
pub const GTHR_E_SHUTTING_DOWN = @as(i32, -2147218141);
pub const GTHR_S_END_STD_CHUNKS = @as(i32, 265508);
pub const GTHR_E_VALUE_NOT_AVAILABLE = @as(i32, -2147218139);
pub const GTHR_E_OUT_OF_DOC_ID = @as(i32, -2147218138);
pub const GTHR_E_NOTIFICATION_START_PAGE = @as(i32, -2147218137);
pub const GTHR_E_DUP_PROPERTY_MAPPING = @as(i32, -2147218134);
pub const GTHR_S_NO_CRAWL_SEEDS = @as(i32, 265515);
pub const GTHR_E_INVALID_ACCOUNT = @as(i32, -2147218132);
pub const GTHR_E_FILTER_INIT = @as(i32, -2147218130);
pub const GTHR_E_INVALID_ACCOUNT_SYNTAX = @as(i32, -2147218129);
pub const GTHR_S_CANNOT_FILTER = @as(i32, 265520);
pub const GTHR_E_PROXY_NAME = @as(i32, -2147218127);
pub const GTHR_E_SERVER_UNAVAILABLE = @as(i32, -2147218126);
pub const GTHR_S_STATUS_STOP = @as(i32, 265523);
pub const GTHR_E_INVALID_PATH = @as(i32, -2147218124);
pub const GTHR_E_FILTER_NO_CODEPAGE = @as(i32, -2147218123);
pub const GTHR_S_STATUS_START = @as(i32, 265526);
pub const GTHR_E_NO_PRTCLHNLR = @as(i32, -2147218121);
pub const GTHR_E_IE_OFFLINE = @as(i32, -2147218120);
pub const GTHR_E_BAD_FILTER_DAEMON = @as(i32, -2147218119);
pub const GTHR_E_INVALID_MAPPING = @as(i32, -2147218112);
pub const GTHR_E_USER_AGENT_NOT_SPECIFIED = @as(i32, -2147218111);
pub const GTHR_E_FROM_NOT_SPECIFIED = @as(i32, -2147218109);
pub const GTHR_E_INVALID_STREAM_LOGS_COUNT = @as(i32, -2147218108);
pub const GTHR_E_INVALID_EXTENSION = @as(i32, -2147218107);
pub const GTHR_E_INVALID_GROW_FACTOR = @as(i32, -2147218106);
pub const GTHR_E_INVALID_TIME_OUT = @as(i32, -2147218105);
pub const GTHR_E_INVALID_RETRIES = @as(i32, -2147218104);
pub const GTHR_E_INVALID_LOG_FILE_NAME = @as(i32, -2147218103);
pub const GTHR_E_INVALID_HOST_NAME = @as(i32, -2147218096);
pub const GTHR_E_INVALID_START_PAGE = @as(i32, -2147218095);
pub const GTHR_E_DUPLICATE_PROJECT = @as(i32, -2147218094);
pub const GTHR_E_INVALID_DIRECTORY = @as(i32, -2147218093);
pub const GTHR_E_FILTER_INTERRUPTED = @as(i32, -2147218092);
pub const GTHR_E_INVALID_PROXY_PORT = @as(i32, -2147218091);
pub const GTHR_S_CONFIG_HAS_ACCOUNTS = @as(i32, 265558);
pub const GTHR_E_SECRET_NOT_FOUND = @as(i32, -2147218089);
pub const GTHR_E_INVALID_PATH_EXPRESSION = @as(i32, -2147218088);
pub const GTHR_E_INVALID_START_PAGE_HOST = @as(i32, -2147218087);
pub const GTHR_E_INVALID_START_PAGE_PATH = @as(i32, -2147218080);
pub const GTHR_E_APPLICATION_NOT_FOUND = @as(i32, -2147218079);
pub const GTHR_E_CANNOT_REMOVE_PLUGINMGR = @as(i32, -2147218078);
pub const GTHR_E_INVALID_APPLICATION_NAME = @as(i32, -2147218077);
pub const GTHR_E_FILTER_FAULT = @as(i32, -2147218075);
pub const GTHR_E_NON_FIXED_DRIVE = @as(i32, -2147218074);
pub const GTHR_S_PROB_NOT_MODIFIED = @as(i32, 265575);
pub const GTHR_S_CRAWL_SCHEDULED = @as(i32, 265576);
pub const GTHR_S_TRANSACTION_IGNORED = @as(i32, 265577);
pub const GTHR_S_START_FILTER_FROM_PROTOCOL = @as(i32, 265578);
pub const GTHR_E_FILTER_SINGLE_THREADED = @as(i32, -2147218069);
pub const GTHR_S_BAD_FILE_LINK = @as(i32, 265580);
pub const GTHR_E_URL_UNIDENTIFIED = @as(i32, -2147218067);
pub const GTHR_S_NOT_ALL_PARTS = @as(i32, 265582);
pub const GTHR_E_FORCE_NOTIFICATION_RESET = @as(i32, -2147218065);
pub const GTHR_S_END_PROCESS_LOOP_NOTIFY_QUEUE = @as(i32, 265584);
pub const GTHR_S_START_FILTER_FROM_BODY = @as(i32, 265585);
pub const GTHR_E_CONTENT_ID_CONFLICT = @as(i32, -2147218062);
pub const GTHR_E_UNABLE_TO_READ_EXCHANGE_STORE = @as(i32, -2147218061);
pub const GTHR_E_RECOVERABLE_EXOLEDB_ERROR = @as(i32, -2147218060);
pub const GTHR_E_INVALID_CALL_FROM_WBREAKER = @as(i32, -2147218058);
pub const GTHR_E_PROPERTY_LIST_NOT_INITIALIZED = @as(i32, -2147218057);
pub const GTHR_S_MODIFIED_PARTS = @as(i32, 265592);
pub const GHTR_E_LOCAL_SERVER_UNAVAILABLE = @as(i32, -2147218055);
pub const GTHR_E_SCHEMA_ERRORS_OCCURRED = @as(i32, -2147218054);
pub const GTHR_E_TIMEOUT = @as(i32, -2147218053);
pub const GTHR_S_CRAWL_FULL = @as(i32, 265603);
pub const GTHR_S_CRAWL_INCREMENTAL = @as(i32, 265604);
pub const GTHR_S_CRAWL_ADAPTIVE = @as(i32, 265605);
pub const GTHR_E_NOTIFICATION_START_ADDRESS_INVALID = @as(i32, -2147218042);
pub const GTHR_E_NOTIFICATION_TYPE_NOT_SUPPORTED = @as(i32, -2147218041);
pub const GTHR_E_NOTIFICATION_FILE_SHARE_INFO_NOT_AVAILABLE = @as(i32, -2147218040);
pub const GTHR_E_NOTIFICATION_LOCAL_PATH_MUST_USE_FIXED_DRIVE = @as(i32, -2147218039);
pub const GHTR_E_INSUFFICIENT_DISK_SPACE = @as(i32, -2147218037);
pub const GTHR_E_INVALID_RESOURCE_ID = @as(i32, -2147218035);
pub const GTHR_E_NESTED_HIERARCHICAL_START_ADDRESSES = @as(i32, -2147218034);
pub const GTHR_S_NO_INDEX = @as(i32, 265616);
pub const GTHR_S_PAUSE_REASON_EXTERNAL = @as(i32, 265618);
pub const GTHR_S_PAUSE_REASON_UPGRADING = @as(i32, 265619);
pub const GTHR_S_PAUSE_REASON_BACKOFF = @as(i32, 265620);
pub const GTHR_E_RETRY = @as(i32, -2147218027);
pub const GTHR_E_JET_BACKUP_ERROR = @as(i32, -2147218026);
pub const GTHR_E_JET_RESTORE_ERROR = @as(i32, -2147218025);
pub const GTHR_S_OFFICE_CHILD = @as(i32, 265626);
pub const GTHR_E_PLUGIN_NOT_REGISTERED = @as(i32, -2147218021);
pub const GTHR_E_NOTIF_ACCESS_TOKEN_UPDATED = @as(i32, -2147218020);
pub const GTHR_E_DIRMON_NOT_INITIALZED = @as(i32, -2147218019);
pub const GTHR_E_NOTIF_BEING_REMOVED = @as(i32, -2147218018);
pub const GTHR_E_NOTIF_EXCESSIVE_THROUGHPUT = @as(i32, -2147218017);
pub const GTHR_E_INVALID_PATH_SPEC = @as(i32, -2147218016);
pub const GTHR_E_INSUFFICIENT_FEATURE_TERMS = @as(i32, -2147218015);
pub const GTHR_E_INSUFFICIENT_EXAMPLE_CATEGORIES = @as(i32, -2147218014);
pub const GTHR_E_INSUFFICIENT_EXAMPLE_DOCUMENTS = @as(i32, -2147218013);
pub const GTHR_E_AUTOCAT_UNEXPECTED = @as(i32, -2147218012);
pub const GTHR_E_SINGLE_THREADED_EMBEDDING = @as(i32, -2147218011);
pub const GTHR_S_CANNOT_WORDBREAK = @as(i32, 265638);
pub const GTHR_S_USE_MIME_FILTER = @as(i32, 265639);
pub const GTHR_E_FOLDER_CRAWLED_BY_ANOTHER_WORKSPACE = @as(i32, -2147218007);
pub const GTHR_E_EMPTY_DACL = @as(i32, -2147218006);
pub const GTHR_E_OBJECT_NOT_VALID = @as(i32, -2147218005);
pub const GTHR_E_CANNOT_ENABLE_CHECKPOINT = @as(i32, -2147218002);
pub const GTHR_E_SCOPES_EXCEEDED = @as(i32, -2147218001);
pub const GTHR_E_PROPERTIES_EXCEEDED = @as(i32, -2147218000);
pub const GTHR_E_INVALID_START_ADDRESS = @as(i32, -2147217998);
pub const GTHR_S_PAUSE_REASON_PROFILE_IMPORT = @as(i32, 265651);
pub const GTHR_E_PIPE_NOT_CONNECTTED = @as(i32, -2147217996);
pub const GTHR_E_BACKUP_VALIDATION_FAIL = @as(i32, -2147217994);
pub const GTHR_E_BAD_FILTER_HOST = @as(i32, -2147217993);
pub const GTHR_E_NTF_CLIENT_NOT_SUBSCRIBED = @as(i32, -1073476167);
pub const GTHR_E_FILTERPOOL_NOTFOUND = @as(i32, -2147217990);
pub const GTHR_E_ADDLINKS_FAILED_WILL_RETRY_PARENT = @as(i32, -2147217989);
pub const IDX_E_INVALIDTAG = @as(i32, -2147217151);
pub const IDX_E_METAFILE_CORRUPT = @as(i32, -2147217150);
pub const IDX_E_TOO_MANY_SEARCH_SERVERS = @as(i32, -2147217149);
pub const IDX_E_SEARCH_SERVER_ALREADY_EXISTS = @as(i32, -2147217148);
pub const IDX_E_BUILD_IN_PROGRESS = @as(i32, -2147217147);
pub const IDX_E_IDXLSTFILE_CORRUPT = @as(i32, -2147217146);
pub const IDX_E_REGISTRY_ENTRY = @as(i32, -2147217145);
pub const IDX_E_OBJECT_NOT_FOUND = @as(i32, -2147217144);
pub const IDX_E_SEARCH_SERVER_NOT_FOUND = @as(i32, -2147217143);
pub const IDX_E_WB_NOTFOUND = @as(i32, -2147217142);
pub const IDX_E_NOISELIST_NOTFOUND = @as(i32, -2147217141);
pub const IDX_E_STEMMER_NOTFOUND = @as(i32, -2147217140);
pub const IDX_E_PROP_STOPPED = @as(i32, -2147217139);
pub const IDX_E_DISKFULL = @as(i32, -2147217138);
pub const IDX_E_INVALID_INDEX = @as(i32, -2147217137);
pub const IDX_E_CORRUPT_INDEX = @as(i32, -2147217136);
pub const IDX_E_PROPSTORE_INIT_FAILED = @as(i32, -2147217134);
pub const IDX_E_PROP_STATE_CORRUPT = @as(i32, -2147217133);
pub const IDX_S_NO_BUILD_IN_PROGRESS = @as(i32, 266516);
pub const IDX_S_SEARCH_SERVER_ALREADY_EXISTS = @as(i32, 266517);
pub const IDX_S_SEARCH_SERVER_DOES_NOT_EXIST = @as(i32, 266518);
pub const IDX_E_NOT_LOADED = @as(i32, -2147217129);
pub const IDX_E_PROP_MAJOR_VERSION_MISMATCH = @as(i32, -2147217128);
pub const IDX_E_PROP_MINOR_VERSION_MISMATCH = @as(i32, -2147217127);
pub const IDX_E_DSS_NOT_CONNECTED = @as(i32, -2147217126);
pub const IDX_E_DOCUMENT_ABORTED = @as(i32, -2147217125);
pub const IDX_E_CATALOG_DISMOUNTED = @as(i32, -2147217124);
pub const IDX_S_DSS_NOT_AVAILABLE = @as(i32, 266525);
pub const IDX_E_USE_DEFAULT_CONTENTCLASS = @as(i32, -2147217121);
pub const IDX_E_USE_APPGLOBAL_PROPTABLE = @as(i32, -2147217120);
pub const JPS_E_JET_ERR = @as(i32, -2147217025);
pub const JPS_S_DUPLICATE_DOC_DETECTED = @as(i32, 266624);
pub const JPS_E_CATALOG_DECSRIPTION_MISSING = @as(i32, -2147217023);
pub const JPS_E_MISSING_INFORMATION = @as(i32, -2147217022);
pub const JPS_E_INSUFFICIENT_VERSION_STORAGE = @as(i32, -2147217021);
pub const JPS_E_INSUFFICIENT_DATABASE_SESSIONS = @as(i32, -2147217020);
pub const JPS_E_INSUFFICIENT_DATABASE_RESOURCES = @as(i32, -2147217019);
pub const JPS_E_SCHEMA_ERROR = @as(i32, -2147217018);
pub const JPS_E_PROPAGATION_FILE = @as(i32, -2147217017);
pub const JPS_E_PROPAGATION_CORRUPTION = @as(i32, -2147217016);
pub const JPS_E_PROPAGATION_VERSION_MISMATCH = @as(i32, -2147217015);
pub const JPS_E_SHARING_VIOLATION = @as(i32, -2147217014);
pub const EXCI_E_NO_CONFIG = @as(i32, -2147216992);
pub const EXCI_E_INVALID_SERVER_CONFIG = @as(i32, -2147216991);
pub const EXCI_E_ACCESS_DENIED = @as(i32, -2147216990);
pub const EXCI_E_INVALID_EXCHANGE_SERVER = @as(i32, -2147216989);
pub const EXCI_E_BADCONFIG_OR_ACCESSDENIED = @as(i32, -2147216988);
pub const EXCI_E_WRONG_SERVER_OR_ACCT = @as(i32, -2147216987);
pub const EXCI_E_NOT_ADMIN_OR_WRONG_SITE = @as(i32, -2147216986);
pub const EXCI_E_NO_MAPI = @as(i32, -2147216985);
pub const EXCI_E_INVALID_ACCOUNT_INFO = @as(i32, -2147216984);
pub const PRTH_E_INTERNAL_ERROR = @as(i32, -2147216892);
pub const PRTH_S_MAX_GROWTH = @as(i32, 266761);
pub const PRTH_E_WININET = @as(i32, -2147216886);
pub const PRTH_E_RETRY = @as(i32, -2147216885);
pub const PRTH_S_MAX_DOWNLOAD = @as(i32, 266764);
pub const PRTH_E_MIME_EXCLUDED = @as(i32, -2147216883);
pub const PRTH_E_CANT_TRANSFORM_EXTERNAL_ACL = @as(i32, -2147216882);
pub const PRTH_E_CANT_TRANSFORM_DENIED_ACE = @as(i32, -2147216881);
pub const PRTH_E_NO_PROPERTY = @as(i32, -2147216877);
pub const PRTH_S_USE_ROSEBUD = @as(i32, 266772);
pub const PRTH_E_DATABASE_OPEN_ERROR = @as(i32, -2147216875);
pub const PRTH_E_OPLOCK_BROKEN = @as(i32, -2147216874);
pub const PRTH_E_LOAD_FAILED = @as(i32, -2147216873);
pub const PRTH_E_INIT_FAILED = @as(i32, -2147216872);
pub const PRTH_E_VOLUME_MOUNT_POINT = @as(i32, -2147216871);
pub const PRTH_E_TRUNCATED = @as(i32, -2147216870);
pub const GTHR_E_LOCAL_GROUPS_EXPANSION_INTERNAL_ERROR = @as(i32, -2147216867);
pub const PRTH_E_HTTPS_CERTIFICATE_ERROR = @as(i32, -2147216861);
pub const PRTH_E_HTTPS_REQUIRE_CERTIFICATE = @as(i32, -2147216860);
pub const PRTH_S_TRY_IMPERSONATING = @as(i32, 266789);
pub const CMDLINE_E_UNEXPECTED = @as(i32, -2147216127);
pub const CMDLINE_E_PAREN = @as(i32, -2147216126);
pub const CMDLINE_E_PARAM_SIZE = @as(i32, -2147216125);
pub const CMDLINE_E_NOT_INIT = @as(i32, -2147216124);
pub const CMDLINE_E_ALREADY_INIT = @as(i32, -2147216123);
pub const CMDLINE_E_NUM_PARAMS = @as(i32, -2147216122);
pub const NLADMIN_E_DUPLICATE_CATALOG = @as(i32, -2147215103);
pub const NLADMIN_S_NOT_ALL_BUILD_CATALOGS_INITIALIZED = @as(i32, 268546);
pub const NLADMIN_E_FAILED_TO_GIVE_ACCOUNT_PRIVILEGE = @as(i32, -2147215101);
pub const NLADMIN_E_BUILD_CATALOG_NOT_INITIALIZED = @as(i32, -2147215100);
pub const SCRIPTPI_E_CHUNK_NOT_TEXT = @as(i32, -2147213312);
pub const SCRIPTPI_E_PID_NOT_NAME = @as(i32, -2147213311);
pub const SCRIPTPI_E_PID_NOT_NUMERIC = @as(i32, -2147213310);
pub const SCRIPTPI_E_CHUNK_NOT_VALUE = @as(i32, -2147213309);
pub const SCRIPTPI_E_CANNOT_ALTER_CHUNK = @as(i32, -2147213308);
pub const SCRIPTPI_E_ALREADY_COMPLETED = @as(i32, -2147213307);
pub const _MAPI_E_NO_SUPPORT = @as(i32, -2147221246);
pub const _MAPI_E_BAD_CHARWIDTH = @as(i32, -2147221245);
pub const _MAPI_E_STRING_TOO_LONG = @as(i32, -2147221243);
pub const _MAPI_E_UNKNOWN_FLAGS = @as(i32, -2147221242);
pub const _MAPI_E_INVALID_ENTRYID = @as(i32, -2147221241);
pub const _MAPI_E_INVALID_OBJECT = @as(i32, -2147221240);
pub const _MAPI_E_OBJECT_CHANGED = @as(i32, -2147221239);
pub const _MAPI_E_OBJECT_DELETED = @as(i32, -2147221238);
pub const _MAPI_E_BUSY = @as(i32, -2147221237);
pub const _MAPI_E_NOT_ENOUGH_DISK = @as(i32, -2147221235);
pub const _MAPI_E_NOT_ENOUGH_RESOURCES = @as(i32, -2147221234);
pub const _MAPI_E_NOT_FOUND = @as(i32, -2147221233);
pub const _MAPI_E_VERSION = @as(i32, -2147221232);
pub const _MAPI_E_LOGON_FAILED = @as(i32, -2147221231);
pub const _MAPI_E_SESSION_LIMIT = @as(i32, -2147221230);
pub const _MAPI_E_USER_CANCEL = @as(i32, -2147221229);
pub const _MAPI_E_UNABLE_TO_ABORT = @as(i32, -2147221228);
pub const _MAPI_E_NETWORK_ERROR = @as(i32, -2147221227);
pub const _MAPI_E_DISK_ERROR = @as(i32, -2147221226);
pub const _MAPI_E_TOO_COMPLEX = @as(i32, -2147221225);
pub const _MAPI_E_BAD_COLUMN = @as(i32, -2147221224);
pub const _MAPI_E_EXTENDED_ERROR = @as(i32, -2147221223);
pub const _MAPI_E_COMPUTED = @as(i32, -2147221222);
pub const _MAPI_E_CORRUPT_DATA = @as(i32, -2147221221);
pub const _MAPI_E_UNCONFIGURED = @as(i32, -2147221220);
pub const _MAPI_E_FAILONEPROVIDER = @as(i32, -2147221219);
pub const _MAPI_E_UNKNOWN_CPID = @as(i32, -2147221218);
pub const _MAPI_E_UNKNOWN_LCID = @as(i32, -2147221217);
pub const _MAPI_E_PASSWORD_CHANGE_REQUIRED = @as(i32, -2147221216);
pub const _MAPI_E_PASSWORD_EXPIRED = @as(i32, -2147221215);
pub const _MAPI_E_INVALID_WORKSTATION_ACCOUNT = @as(i32, -2147221214);
pub const _MAPI_E_INVALID_ACCESS_TIME = @as(i32, -2147221213);
pub const _MAPI_E_ACCOUNT_DISABLED = @as(i32, -2147221212);
pub const _MAPI_E_END_OF_SESSION = @as(i32, -2147220992);
pub const _MAPI_E_UNKNOWN_ENTRYID = @as(i32, -2147220991);
pub const _MAPI_E_MISSING_REQUIRED_COLUMN = @as(i32, -2147220990);
pub const _MAPI_W_NO_SERVICE = @as(i32, 262659);
pub const MSG_TEST_MESSAGE = @as(i32, 1074008064);
pub const FLTRDMN_E_UNEXPECTED = @as(i32, -2147212287);
pub const FLTRDMN_E_QI_FILTER_FAILED = @as(i32, -2147212286);
pub const FLTRDMN_E_FILTER_INIT_FAILED = @as(i32, -2147212284);
pub const FLTRDMN_E_ENCRYPTED_DOCUMENT = @as(i32, -2147212283);
pub const FLTRDMN_E_CANNOT_DECRYPT_PASSWORD = @as(i32, -2147212282);
pub const OLEDB_BINDER_CUSTOM_ERROR = @as(i32, -2147212032);
pub const NOTESPH_E_UNEXPECTED_STATE = @as(i32, -2147211775);
pub const NOTESPH_S_IGNORE_ID = @as(i32, 271874);
pub const NOTESPH_E_UNSUPPORTED_CONTENT_FIELD_TYPE = @as(i32, -2147211773);
pub const NOTESPH_E_ITEM_NOT_FOUND = @as(i32, -2147211772);
pub const NOTESPH_E_SERVER_CONFIG = @as(i32, -2147211771);
pub const NOTESPH_E_ATTACHMENTS = @as(i32, -2147211770);
pub const NOTESPH_E_NO_NTID = @as(i32, -2147211769);
pub const NOTESPH_E_DB_ACCESS_DENIED = @as(i32, -2147211768);
pub const NOTESPH_E_NOTESSETUP_ID_MAPPING_ERROR = @as(i32, -2147211767);
pub const NOTESPH_S_LISTKNOWNFIELDS = @as(i32, 271888);
pub const NOTESPH_E_FAIL = @as(i32, -2147211759);
pub const STS_ABORTXMLPARSE = @as(i32, -2147211756);
pub const STS_WS_ERROR = @as(i32, -2147211754);
pub const SPS_WS_ERROR = @as(i32, -2147211753);
pub const EXSTOREPH_E_UNEXPECTED = @as(i32, -2147211519);
pub const CERT_E_NOT_FOUND_OR_NO_PERMISSSION = @as(i32, -2147211263);
pub const SRCH_SCHEMA_CACHE_E_UNEXPECTED = @as(i32, -2147208447);
pub const CONTENT_SOURCE_E_PROPERTY_MAPPING_READ = @as(i32, -2147208191);
pub const CONTENT_SOURCE_E_UNEXPECTED_NULL_POINTER = @as(i32, -2147208190);
pub const CONTENT_SOURCE_E_PROPERTY_MAPPING_BAD_VECTOR_SIZE = @as(i32, -2147208189);
pub const CONTENT_SOURCE_E_CONTENT_CLASS_READ = @as(i32, -2147208188);
pub const CONTENT_SOURCE_E_UNEXPECTED_EXCEPTION = @as(i32, -2147208187);
pub const CONTENT_SOURCE_E_NULL_CONTENT_CLASS_BSTR = @as(i32, -2147208186);
pub const CONTENT_SOURCE_E_CONTENT_SOURCE_COLUMN_TYPE = @as(i32, -2147208185);
pub const CONTENT_SOURCE_E_OUT_OF_RANGE = @as(i32, -2147208184);
pub const CONTENT_SOURCE_E_NULL_URI = @as(i32, -2147208183);
pub const REXSPH_E_INVALID_CALL = @as(i32, -2147207936);
pub const REXSPH_S_REDIRECTED = @as(i32, 275713);
pub const REXSPH_E_REDIRECT_ON_SECURITY_UPDATE = @as(i32, -2147207934);
pub const REXSPH_E_MULTIPLE_REDIRECT = @as(i32, -2147207933);
pub const REXSPH_E_NO_PROPERTY_ON_ROW = @as(i32, -2147207932);
pub const REXSPH_E_TYPE_MISMATCH_ON_READ = @as(i32, -2147207931);
pub const REXSPH_E_UNEXPECTED_DATA_STATUS = @as(i32, -2147207930);
pub const REXSPH_E_UNKNOWN_DATA_TYPE = @as(i32, -2147207929);
pub const REXSPH_E_UNEXPECTED_FILTER_STATE = @as(i32, -2147207928);
pub const REXSPH_E_DUPLICATE_PROPERTY = @as(i32, -2147207927);
pub const PEOPLE_IMPORT_E_DBCONNFAIL = @as(i32, -2147205120);
pub const PEOPLE_IMPORT_NODSDEFINED = @as(i32, -2147205119);
pub const PEOPLE_IMPORT_E_FAILTOGETDSDEF = @as(i32, -2147205118);
pub const PEOPLE_IMPORT_NOMAPPINGDEFINED = @as(i32, -2147205117);
pub const PEOPLE_IMPORT_E_FAILTOGETDSMAPPING = @as(i32, -2147205116);
pub const PEOPLE_IMPORT_E_DATATYPENOTSUPPORTED = @as(i32, -2147205115);
pub const PEOPLE_IMPORT_E_NOCASTINGSUPPORTED = @as(i32, -2147205114);
pub const PEOPLE_IMPORT_E_UPDATE_DIRSYNC_COOKIE = @as(i32, -2147205113);
pub const PEOPLE_IMPORT_E_DIRSYNC_ZERO_COOKIE = @as(i32, -2147205112);
pub const PEOPLE_IMPORT_E_LDAPPATH_TOOLONG = @as(i32, -2147205111);
pub const PEOPLE_IMPORT_E_CANONICALURL_TOOLONG = @as(i32, -2147205110);
pub const PEOPLE_IMPORT_E_USERNAME_NOTRESOLVED = @as(i32, -2147205109);
pub const PEOPLE_IMPORT_E_DC_NOT_AVAILABLE = @as(i32, -2147205108);
pub const PEOPLE_IMPORT_E_DOMAIN_DISCOVER_FAILED = @as(i32, -2147205107);
pub const PEOPLE_IMPORT_E_FAILTOGETLCID = @as(i32, -2147205106);
pub const PEOPLE_IMPORT_E_DOMAIN_REMOVED = @as(i32, -2147205105);
pub const PEOPLE_IMPORT_E_ENUM_ACCESSDENIED = @as(i32, -2147205104);
pub const PEOPLE_IMPORT_E_DIRSYNC_NOTREFRESHED = @as(i32, -2147205103);
pub const FTE_E_SECRET_NOT_FOUND = @as(i32, -2147207678);
pub const FTE_E_PIPE_NOT_CONNECTED = @as(i32, -2147207677);
pub const FTE_E_ADMIN_BLOB_CORRUPT = @as(i32, -2147207676);
pub const FTE_E_FILTER_SINGLE_THREADED = @as(i32, -2147207675);
pub const FTE_E_ERROR_WRITING_REGISTRY = @as(i32, -2147207674);
pub const FTE_E_PROJECT_SHUTDOWN = @as(i32, -2147207673);
pub const FTE_E_PROJECT_NOT_INITALIZED = @as(i32, -2147207672);
pub const FTE_E_PIPE_DATA_CORRUPTED = @as(i32, -2147207671);
pub const FTE_E_URB_TOO_BIG = @as(i32, -2147207664);
pub const FTE_E_INVALID_DOCID = @as(i32, -2147207663);
pub const FTE_E_PAUSE_EXTERNAL = @as(i32, -2147207662);
pub const FTE_E_REJECTED_DUE_TO_PROJECT_STATUS = @as(i32, -2147207661);
pub const FTE_E_FD_DID_NOT_CONNECT = @as(i32, -2147207660);
pub const FTE_E_PROGID_REQUIRED = @as(i32, -2147207658);
pub const FTE_E_STATIC_THREAD_INVALID_ARGUMENTS = @as(i32, -2147207657);
pub const FTE_E_CATALOG_ALREADY_EXISTS = @as(i32, -2147207656);
pub const FTE_S_RESOURCES_STARTING_TO_GET_LOW = @as(i32, 275993);
pub const FTE_E_PATH_TOO_LONG = @as(i32, -2147207654);
pub const FTE_INVALID_ADMIN_CLIENT = @as(i32, -2147207653);
pub const FTE_E_COM_SIGNATURE_VALIDATION = @as(i32, -2147207652);
pub const FTE_E_AFFINITY_MASK = @as(i32, -2147207651);
pub const FTE_E_FD_OWNERSHIP_OBSOLETE = @as(i32, -2147207650);
pub const FTE_E_EXCEEDED_MAX_PLUGINS = @as(i32, -2147207647);
pub const FTE_S_BEYOND_QUOTA = @as(i32, 276002);
pub const FTE_E_DUPLICATE_OBJECT = @as(i32, -2147207644);
pub const FTE_S_REDUNDANT = @as(i32, 276005);
pub const FTE_E_REDUNDANT_TRAN_FAILURE = @as(i32, -2147207642);
pub const FTE_E_DEPENDENT_TRAN_FAILED_TO_PERSIST = @as(i32, -2147207641);
pub const FTE_E_FD_SHUTDOWN = @as(i32, -2147207640);
pub const FTE_E_CATALOG_DOES_NOT_EXIST = @as(i32, -2147207639);
pub const FTE_E_NO_PLUGINS = @as(i32, -2147207638);
pub const FTE_S_STATUS_CHANGE_REQUEST = @as(i32, 276011);
pub const FTE_E_BATCH_ABORTED = @as(i32, -2147207636);
pub const FTE_E_ANOTHER_STATUS_CHANGE_IS_ALREADY_ACTIVE = @as(i32, -2147207635);
pub const FTE_S_RESUME = @as(i32, 276014);
pub const FTE_E_NOT_PROCESSED_DUE_TO_PREVIOUS_ERRORS = @as(i32, -2147207633);
pub const FTE_E_FD_TIMEOUT = @as(i32, -2147207632);
pub const FTE_E_RESOURCE_SHUTDOWN = @as(i32, -2147207631);
pub const FTE_E_INVALID_PROPERTY = @as(i32, -2147207630);
pub const FTE_E_NO_MORE_PROPERTIES = @as(i32, -2147207629);
pub const FTE_E_UNKNOWN_PLUGIN = @as(i32, -2147207628);
pub const FTE_E_LIBRARY_NOT_LOADED = @as(i32, -2147207627);
pub const FTE_E_PERFMON_FULL = @as(i32, -2147207626);
pub const FTE_E_FAILED_TO_CREATE_ACCESSOR = @as(i32, -2147207625);
pub const FTE_E_INVALID_TYPE = @as(i32, -2147207624);
pub const FTE_E_OUT_OF_RANGE = @as(i32, -2147207623);
pub const FTE_E_CORRUPT_PROPERTY_STORE = @as(i32, -2147207622);
pub const FTE_E_PROPERTY_STORE_WORKID_NOTVALID = @as(i32, -2147207621);
pub const FTE_S_PROPERTY_STORE_END_OF_ENUMERATION = @as(i32, 276028);
pub const FTE_E_CORRUPT_GATHERER_HASH_MAP = @as(i32, -2147207619);
pub const FTE_E_KEY_NOT_CACHED = @as(i32, -2147207618);
pub const FTE_E_UPGRADE_INTERFACE_ALREADY_SHUTDOWN = @as(i32, -2147207617);
pub const FTE_E_UPGRADE_INTERFACE_ALREADY_INSTANTIATED = @as(i32, -2147207616);
pub const FTE_E_STACK_CORRUPTED = @as(i32, -2147207615);
pub const FTE_E_INVALID_PROG_ID = @as(i32, -2147207614);
pub const FTE_E_SERIAL_STREAM_CORRUPT = @as(i32, -2147207613);
pub const FTE_E_READONLY_CATALOG = @as(i32, -2147207612);
pub const FTE_E_PERF_NOT_LOADED = @as(i32, -2147207611);
pub const FTE_S_READONLY_CATALOG = @as(i32, 276038);
pub const FTE_E_RETRY_HUGE_DOC = @as(i32, -2147207608);
pub const FTE_E_UNKNOWN_FD_TYPE = @as(i32, -2147207607);
pub const FTE_E_DOC_TOO_HUGE = @as(i32, -2147207606);
pub const FTE_E_DATATYPE_MISALIGNMENT = @as(i32, -2147207605);
pub const FTE_E_ALREADY_INITIALIZED = @as(i32, -2147207604);
pub const FTE_E_FD_USED_TOO_MUCH_MEMORY = @as(i32, -2147207603);
pub const FTE_E_UNEXPECTED_EXIT = @as(i32, -2147207602);
pub const FTE_E_HIGH_MEMORY_PRESSURE = @as(i32, -2147207601);
pub const FTE_E_INVALID_ISOLATE_ERROR_BATCH = @as(i32, -2147207600);
pub const FTE_E_RETRY_SINGLE_DOC_PER_BATCH = @as(i32, -2147207599);
pub const FTE_E_INVALID_PROJECT_ID = @as(i32, -2147207598);
pub const FTE_E_FAILURE_TO_POST_SETCOMPLETION_STATUS = @as(i32, -2147207597);
pub const FTE_E_INVALID_CODEPAGE = @as(i32, -2147207596);
pub const FTE_E_FD_IDLE = @as(i32, -2147207595);
pub const FTE_E_FD_UNRESPONSIVE = @as(i32, -2147207594);
pub const FTE_S_TRY_TO_FLUSH = @as(i32, 276055);
pub const FTE_S_CATALOG_BLOB_MISMATCHED = @as(i32, 276056);
pub const FTE_S_PROPERTY_RESET = @as(i32, 276057);
pub const FTE_E_NO_PROPERTY_STORE = @as(i32, -1073465766);
pub const FTE_E_CB_OUT_OF_MEMORY = @as(i32, -2147169536);
pub const FTE_E_CB_CBID_OUT_OF_BOUND = @as(i32, -2147169535);
pub const FTE_E_CB_NOT_ENOUGH_AVAIL_PHY_MEM = @as(i32, -2147169534);
pub const FTE_E_CB_NOT_ENOUGH_OCC_BUFFER = @as(i32, -2147169533);
pub const FTE_E_CORRUPT_WORDLIST = @as(i32, -2147169532);
pub const FTE_E_FD_NO_IPERSIST_INTERFACE = @as(i32, -2147156736);
pub const FTE_E_FD_IFILTER_INIT_FAILED = @as(i32, -2147156735);
pub const FTE_E_FD_FAILED_TO_LOAD_IFILTER = @as(i32, -2147156734);
pub const FTE_E_FD_DOC_TIMEOUT = @as(i32, -2147156733);
pub const FTE_E_FD_UNEXPECTED_EXIT = @as(i32, -2147156732);
pub const FTE_E_FD_DOC_UNEXPECTED_EXIT = @as(i32, -2147156731);
pub const FTE_E_FD_NOISE_NO_TEXT_FILTER = @as(i32, -2147156730);
pub const FTE_E_FD_NOISE_NO_IPERSISTSTREAM_ON_TEXT_FILTER = @as(i32, -2147156729);
pub const FTE_E_FD_NOISE_TEXT_FILTER_LOAD_FAILED = @as(i32, -2147156728);
pub const FTE_E_FD_NOISE_TEXT_FILTER_INIT_FAILED = @as(i32, -2147156727);
pub const FTE_E_FD_OCCURRENCE_OVERFLOW = @as(i32, -2147156726);
pub const FTE_E_FD_FILTER_CAUSED_SHARING_VIOLATION = @as(i32, -2147156725);
pub const ERROR_SOURCE_PROTHNDLR = @as(u32, 4608);
pub const QUERY_E_ALLNOISE_AND_NO_RELDOC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215859));
pub const QUERY_E_NO_RELDOC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215858));
pub const QUERY_E_ALLNOISE_AND_NO_RELPROP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215857));
pub const QUERY_E_NO_RELPROP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215856));
pub const QUERY_E_REPEATED_RELDOC = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215855));
pub const QUERY_E_RELDOC_SYNTAX_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215854));
pub const QUERY_E_INVALID_DOCUMENT_IDENTIFIER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215853));
pub const QUERY_E_INCORRECT_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215852));
pub const QUERY_E_INVALIDSCOPE_COALESCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215851));
pub const QUERY_E_INVALIDSORT_COALESCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215850));
pub const QUERY_E_INVALIDCOALESCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215849));
pub const QUERY_E_UPGRADEINPROGRESS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215848));
pub const QUERY_E_AGGREGATE_NOT_SUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215847));
pub const QUERY_E_TOP_LEVEL_IN_GROUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215846));
pub const QUERY_E_DUPLICATE_RANGE_NAME = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215845));
pub const CI_S_NEW_AUXMETADATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, 268329));
pub const CI_E_NO_AUXMETADATA = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215318));
pub const CI_S_CLIENT_REQUESTED_ABORT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 268331));
pub const CI_S_RETRY_DOCUMENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 268332));
pub const CI_E_CORRUPT_FWIDX = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473491));
pub const CI_E_DIACRITIC_SETTINGS_DIFFER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473490));
pub const CI_E_INVALID_CATALOG_LIST_VERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147215313));
pub const CI_S_CATALOG_RESET = @import("../zig.zig").typedConst(HRESULT, @as(i32, 268336));
pub const CI_E_NO_CATALOG_MANAGER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473487));
pub const CI_E_INCONSISTENT_TRANSACTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473486));
pub const CI_E_PROTECTED_CATALOG_NOT_AVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473485));
pub const CI_E_NO_PROTECTED_USER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473484));
pub const CI_E_MULTIPLE_PROTECTED_USERS_UNSUPPORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473483));
pub const CI_E_PROTECTED_CATALOG_SID_MISMATCH = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473482));
pub const CI_E_PROTECTED_CATALOG_NON_INTERACTIVE_USER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073473481));
pub const MSG_CI_MASTER_MERGE_STARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745926));
pub const MSG_CI_MASTER_MERGE_COMPLETED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745927));
pub const MSG_CI_MASTER_MERGE_ABORTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745928));
pub const MSG_CI_MASTER_MERGE_CANT_START = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073737719));
pub const MSG_CI_MASTER_MERGE_CANT_RESTART = @import("../zig.zig").typedConst(HRESULT, @as(i32, -1073737718));
pub const MSG_CI_MASTER_MERGE_RESTARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745945));
pub const MSG_CI_CORRUPT_INDEX_COMPONENT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745962));
pub const MSG_CI_MASTER_MERGE_ABORTED_LOW_DISK = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745987));
pub const MSG_CI_MASTER_MERGE_REASON_EXTERNAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745988));
pub const MSG_CI_MASTER_MERGE_REASON_INDEX_LIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745989));
pub const MSG_CI_MASTER_MERGE_REASON_EXPECTED_DOCS = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745990));
pub const MSG_CI_MASTER_MERGE_REASON_NUMBER = @import("../zig.zig").typedConst(HRESULT, @as(i32, 1073745991));
pub const MSG_CI_CREATE_SEVER_ITEM_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147479480));
pub const NOT_N_PARSE_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, 526638));
pub const IDS_MON_DEFAULT_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264495));
pub const IDS_MON_ILLEGAL_PASSTHROUGH = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264496));
pub const IDS_MON_PARSE_ERR_1_PARAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264497));
pub const IDS_MON_PARSE_ERR_2_PARAM = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264498));
pub const IDS_MON_SEMI_COLON = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264499));
pub const IDS_MON_ORDINAL_OUT_OF_RANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264500));
pub const IDS_MON_VIEW_NOT_DEFINED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264501));
pub const IDS_MON_COLUMN_NOT_DEFINED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264502));
pub const IDS_MON_BUILTIN_VIEW = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264503));
pub const IDS_MON_OUT_OF_MEMORY = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264504));
pub const IDS_MON_SELECT_STAR = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264505));
pub const IDS_MON_OR_NOT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264506));
pub const IDS_MON_CANNOT_CONVERT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264507));
pub const IDS_MON_OUT_OF_RANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264508));
pub const IDS_MON_RELATIVE_INTERVAL = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264509));
pub const IDS_MON_NOT_COLUMN_OF_VIEW = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264510));
pub const IDS_MON_BUILTIN_PROPERTY = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264511));
pub const IDS_MON_WEIGHT_OUT_OF_RANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264512));
pub const IDS_MON_MATCH_STRING = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264513));
pub const IDS_MON_PROPERTY_NAME_IN_VIEW = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264514));
pub const IDS_MON_VIEW_ALREADY_DEFINED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264515));
pub const IDS_MON_INVALID_CATALOG = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264516));
pub const IDS_MON_INVALIDSELECT_COALESCE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264517));
pub const IDS_MON_CANNOT_CAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264518));
pub const IDS_MON_DATE_OUT_OF_RANGE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264519));
pub const IDS_MON_INVALID_IN_GROUP_CLAUSE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 264520));
pub const DBPROPSET_MSDAORA_ROWSET = Guid.initString("e8cc4cbd-fdff-11d0-b865-00a0c9081c1d");
pub const DBPROPSET_MSDAORA8_ROWSET = Guid.initString("7f06a375-dd6a-43db-b4e0-1fc121e5e62b");
pub const CLSID_MSDASQL = Guid.initString("c8b522cb-5cf3-11ce-ade5-00aa0044773d");
pub const CLSID_MSDASQL_ENUMERATOR = Guid.initString("c8b522cd-5cf3-11ce-ade5-00aa0044773d");
pub const DBPROPSET_PROVIDERDATASOURCEINFO = Guid.initString("497c60e0-7123-11cf-b171-00aa0057599e");
pub const DBPROPSET_PROVIDERROWSET = Guid.initString("497c60e1-7123-11cf-b171-00aa0057599e");
pub const DBPROPSET_PROVIDERDBINIT = Guid.initString("497c60e2-7123-11cf-b171-00aa0057599e");
pub const DBPROPSET_PROVIDERSTMTATTR = Guid.initString("497c60e3-7123-11cf-b171-00aa0057599e");
pub const DBPROPSET_PROVIDERCONNATTR = Guid.initString("497c60e4-7123-11cf-b171-00aa0057599e");
pub const CLSID_DataShapeProvider = Guid.initString("3449a1c8-c56c-11d0-ad72-00c04fc29863");
pub const DBPROPSET_MSDSDBINIT = Guid.initString("55cb91a8-5c7a-11d1-adad-00c04fc29863");
pub const DBPROPSET_MSDSSESSION = Guid.initString("edf17536-afbf-11d1-8847-0000f879f98c");
pub const CLSID_MSPersist = Guid.initString("7c07e0d0-4418-11d2-9212-00c04fbbbfb3");
pub const DBPROPSET_PERSIST = Guid.initString("4d7839a0-5b8e-11d1-a6b3-00a0c9138c66");
pub const PROGID_MSPersist_W = "MSPersist";
pub const PROGID_MSPersist_Version_W = "MSPersist.1";
pub const CLSID_SQLOLEDB = Guid.initString("0c7ff16c-38e3-11d0-97ab-00c04fc2ad98");
pub const CLSID_SQLOLEDB_ERROR = Guid.initString("c0932c62-38e5-11d0-97ab-00c04fc2ad98");
pub const CLSID_SQLOLEDB_ENUMERATOR = Guid.initString("dfa22b8e-e68d-11d0-97e4-00c04fc2ad98");
pub const DBGUID_MSSQLXML = Guid.initString("5d531cb2-e6ed-11d2-b252-00c04f681b71");
pub const DBGUID_XPATH = Guid.initString("ec2a4293-e898-11d2-b1b7-00c04f680c56");
pub const DBSCHEMA_LINKEDSERVERS = Guid.initString("9093caf4-2eac-11d1-9809-00c04fc2ad98");
pub const DBPROPSET_SQLSERVERDATASOURCE = Guid.initString("28efaee4-2d2c-11d1-9807-00c04fc2ad98");
pub const DBPROPSET_SQLSERVERDATASOURCEINFO = Guid.initString("df10cb94-35f6-11d2-9c54-00c04f7971d3");
pub const DBPROPSET_SQLSERVERDBINIT = Guid.initString("5cf4ca10-ef21-11d0-97e7-00c04fc2ad98");
pub const DBPROPSET_SQLSERVERROWSET = Guid.initString("5cf4ca11-ef21-11d0-97e7-00c04fc2ad98");
pub const DBPROPSET_SQLSERVERSESSION = Guid.initString("28efaee5-2d2c-11d1-9807-00c04fc2ad98");
pub const DBPROPSET_SQLSERVERCOLUMN = Guid.initString("3b63fb5e-3fbb-11d3-9f29-00c04f8ee9dc");
pub const DBPROPSET_SQLSERVERSTREAM = Guid.initString("9f79c073-8a6d-4bca-a8a8-c9b79a9b962d");
//--------------------------------------------------------------------------------
// Section: Types (437)
//--------------------------------------------------------------------------------
pub const IRowsetExactScroll = extern struct {
placeholder: usize, // TODO: why is this type empty?
};
const IID_IWordSink_Value = Guid.initString("cc907054-c058-101a-b554-08002b33b0e6");
pub const IID_IWordSink = &IID_IWordSink_Value;
pub const IWordSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
PutWord: fn(
self: *const IWordSink,
cwc: u32,
pwcInBuf: ?[*:0]const u16,
cwcSrcLen: u32,
cwcSrcPos: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PutAltWord: fn(
self: *const IWordSink,
cwc: u32,
pwcInBuf: ?[*:0]const u16,
cwcSrcLen: u32,
cwcSrcPos: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StartAltPhrase: fn(
self: *const IWordSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndAltPhrase: fn(
self: *const IWordSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PutBreak: fn(
self: *const IWordSink,
breakType: WORDREP_BREAK_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordSink_PutWord(self: *const T, cwc: u32, pwcInBuf: ?[*:0]const u16, cwcSrcLen: u32, cwcSrcPos: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordSink.VTable, self.vtable).PutWord(@ptrCast(*const IWordSink, self), cwc, pwcInBuf, cwcSrcLen, cwcSrcPos);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordSink_PutAltWord(self: *const T, cwc: u32, pwcInBuf: ?[*:0]const u16, cwcSrcLen: u32, cwcSrcPos: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordSink.VTable, self.vtable).PutAltWord(@ptrCast(*const IWordSink, self), cwc, pwcInBuf, cwcSrcLen, cwcSrcPos);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordSink_StartAltPhrase(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordSink.VTable, self.vtable).StartAltPhrase(@ptrCast(*const IWordSink, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordSink_EndAltPhrase(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordSink.VTable, self.vtable).EndAltPhrase(@ptrCast(*const IWordSink, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordSink_PutBreak(self: *const T, breakType: WORDREP_BREAK_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordSink.VTable, self.vtable).PutBreak(@ptrCast(*const IWordSink, self), breakType);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const PFNFILLTEXTBUFFER = fn(
pTextSource: ?*TEXT_SOURCE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub const TEXT_SOURCE = extern struct {
pfnFillTextBuffer: ?PFNFILLTEXTBUFFER,
awcBuffer: ?[*:0]const u16,
iEnd: u32,
iCur: u32,
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IWordBreaker_Value = Guid.initString("d53552c8-77e3-101a-b552-08002b33b0e6");
pub const IID_IWordBreaker = &IID_IWordBreaker_Value;
pub const IWordBreaker = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Init: fn(
self: *const IWordBreaker,
fQuery: BOOL,
ulMaxTokenSize: u32,
pfLicense: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BreakText: fn(
self: *const IWordBreaker,
pTextSource: ?*TEXT_SOURCE,
pWordSink: ?*IWordSink,
pPhraseSink: ?*IPhraseSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ComposePhrase: fn(
self: *const IWordBreaker,
pwcNoun: ?[*:0]const u16,
cwcNoun: u32,
pwcModifier: ?[*:0]const u16,
cwcModifier: u32,
ulAttachmentType: u32,
pwcPhrase: ?PWSTR,
pcwcPhrase: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLicenseToUse: fn(
self: *const IWordBreaker,
ppwcsLicense: ?*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 IWordBreaker_Init(self: *const T, fQuery: BOOL, ulMaxTokenSize: u32, pfLicense: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordBreaker.VTable, self.vtable).Init(@ptrCast(*const IWordBreaker, self), fQuery, ulMaxTokenSize, pfLicense);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordBreaker_BreakText(self: *const T, pTextSource: ?*TEXT_SOURCE, pWordSink: ?*IWordSink, pPhraseSink: ?*IPhraseSink) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordBreaker.VTable, self.vtable).BreakText(@ptrCast(*const IWordBreaker, self), pTextSource, pWordSink, pPhraseSink);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordBreaker_ComposePhrase(self: *const T, pwcNoun: ?[*:0]const u16, cwcNoun: u32, pwcModifier: ?[*:0]const u16, cwcModifier: u32, ulAttachmentType: u32, pwcPhrase: ?PWSTR, pcwcPhrase: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordBreaker.VTable, self.vtable).ComposePhrase(@ptrCast(*const IWordBreaker, self), pwcNoun, cwcNoun, pwcModifier, cwcModifier, ulAttachmentType, pwcPhrase, pcwcPhrase);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordBreaker_GetLicenseToUse(self: *const T, ppwcsLicense: ?*const ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordBreaker.VTable, self.vtable).GetLicenseToUse(@ptrCast(*const IWordBreaker, self), ppwcsLicense);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IWordFormSink_Value = Guid.initString("fe77c330-7f42-11ce-be57-00aa0051fe20");
pub const IID_IWordFormSink = &IID_IWordFormSink_Value;
pub const IWordFormSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
PutAltWord: fn(
self: *const IWordFormSink,
pwcInBuf: ?[*:0]const u16,
cwc: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PutWord: fn(
self: *const IWordFormSink,
pwcInBuf: ?[*:0]const u16,
cwc: 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 IWordFormSink_PutAltWord(self: *const T, pwcInBuf: ?[*:0]const u16, cwc: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordFormSink.VTable, self.vtable).PutAltWord(@ptrCast(*const IWordFormSink, self), pwcInBuf, cwc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWordFormSink_PutWord(self: *const T, pwcInBuf: ?[*:0]const u16, cwc: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWordFormSink.VTable, self.vtable).PutWord(@ptrCast(*const IWordFormSink, self), pwcInBuf, cwc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.0'
const IID_IStemmer_Value = Guid.initString("efbaf140-7f42-11ce-be57-00aa0051fe20");
pub const IID_IStemmer = &IID_IStemmer_Value;
pub const IStemmer = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Init: fn(
self: *const IStemmer,
ulMaxTokenSize: u32,
pfLicense: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GenerateWordForms: fn(
self: *const IStemmer,
pwcInBuf: ?[*:0]const u16,
cwc: u32,
pStemSink: ?*IWordFormSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLicenseToUse: fn(
self: *const IStemmer,
ppwcsLicense: ?*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 IStemmer_Init(self: *const T, ulMaxTokenSize: u32, pfLicense: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IStemmer.VTable, self.vtable).Init(@ptrCast(*const IStemmer, self), ulMaxTokenSize, pfLicense);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStemmer_GenerateWordForms(self: *const T, pwcInBuf: ?[*:0]const u16, cwc: u32, pStemSink: ?*IWordFormSink) callconv(.Inline) HRESULT {
return @ptrCast(*const IStemmer.VTable, self.vtable).GenerateWordForms(@ptrCast(*const IStemmer, self), pwcInBuf, cwc, pStemSink);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IStemmer_GetLicenseToUse(self: *const T, ppwcsLicense: ?*const ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IStemmer.VTable, self.vtable).GetLicenseToUse(@ptrCast(*const IStemmer, self), ppwcsLicense);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISimpleCommandCreator_Value = Guid.initString("5e341ab7-02d0-11d1-900c-00a0c9063796");
pub const IID_ISimpleCommandCreator = &IID_ISimpleCommandCreator_Value;
pub const ISimpleCommandCreator = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateICommand: fn(
self: *const ISimpleCommandCreator,
ppIUnknown: ?*?*IUnknown,
pOuterUnk: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
VerifyCatalog: fn(
self: *const ISimpleCommandCreator,
pwszMachine: ?[*:0]const u16,
pwszCatalogName: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDefaultCatalog: fn(
self: *const ISimpleCommandCreator,
pwszCatalogName: ?PWSTR,
cwcIn: u32,
pcwcOut: ?*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 ISimpleCommandCreator_CreateICommand(self: *const T, ppIUnknown: ?*?*IUnknown, pOuterUnk: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISimpleCommandCreator.VTable, self.vtable).CreateICommand(@ptrCast(*const ISimpleCommandCreator, self), ppIUnknown, pOuterUnk);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISimpleCommandCreator_VerifyCatalog(self: *const T, pwszMachine: ?[*:0]const u16, pwszCatalogName: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISimpleCommandCreator.VTable, self.vtable).VerifyCatalog(@ptrCast(*const ISimpleCommandCreator, self), pwszMachine, pwszCatalogName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISimpleCommandCreator_GetDefaultCatalog(self: *const T, pwszCatalogName: ?PWSTR, cwcIn: u32, pcwcOut: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISimpleCommandCreator.VTable, self.vtable).GetDefaultCatalog(@ptrCast(*const ISimpleCommandCreator, self), pwszCatalogName, cwcIn, pcwcOut);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IColumnMapper_Value = Guid.initString("0b63e37a-9ccc-11d0-bcdb-00805fccce04");
pub const IID_IColumnMapper = &IID_IColumnMapper_Value;
pub const IColumnMapper = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetPropInfoFromName: fn(
self: *const IColumnMapper,
wcsPropName: ?[*:0]const u16,
ppPropId: ?*?*DBID,
pPropType: ?*u16,
puiWidth: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropInfoFromId: fn(
self: *const IColumnMapper,
pPropId: ?*const DBID,
pwcsName: ?*?*u16,
pPropType: ?*u16,
puiWidth: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumPropInfo: fn(
self: *const IColumnMapper,
iEntry: u32,
pwcsName: ?*const ?*u16,
ppPropId: ?*?*DBID,
pPropType: ?*u16,
puiWidth: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsMapUpToDate: fn(
self: *const IColumnMapper,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnMapper_GetPropInfoFromName(self: *const T, wcsPropName: ?[*:0]const u16, ppPropId: ?*?*DBID, pPropType: ?*u16, puiWidth: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnMapper.VTable, self.vtable).GetPropInfoFromName(@ptrCast(*const IColumnMapper, self), wcsPropName, ppPropId, pPropType, puiWidth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnMapper_GetPropInfoFromId(self: *const T, pPropId: ?*const DBID, pwcsName: ?*?*u16, pPropType: ?*u16, puiWidth: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnMapper.VTable, self.vtable).GetPropInfoFromId(@ptrCast(*const IColumnMapper, self), pPropId, pwcsName, pPropType, puiWidth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnMapper_EnumPropInfo(self: *const T, iEntry: u32, pwcsName: ?*const ?*u16, ppPropId: ?*?*DBID, pPropType: ?*u16, puiWidth: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnMapper.VTable, self.vtable).EnumPropInfo(@ptrCast(*const IColumnMapper, self), iEntry, pwcsName, ppPropId, pPropType, puiWidth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnMapper_IsMapUpToDate(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnMapper.VTable, self.vtable).IsMapUpToDate(@ptrCast(*const IColumnMapper, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IColumnMapperCreator_Value = Guid.initString("0b63e37b-9ccc-11d0-bcdb-00805fccce04");
pub const IID_IColumnMapperCreator = &IID_IColumnMapperCreator_Value;
pub const IColumnMapperCreator = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetColumnMapper: fn(
self: *const IColumnMapperCreator,
wcsMachineName: ?[*:0]const u16,
wcsCatalogName: ?[*:0]const u16,
ppColumnMapper: ?*?*IColumnMapper,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnMapperCreator_GetColumnMapper(self: *const T, wcsMachineName: ?[*:0]const u16, wcsCatalogName: ?[*:0]const u16, ppColumnMapper: ?*?*IColumnMapper) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnMapperCreator.VTable, self.vtable).GetColumnMapper(@ptrCast(*const IColumnMapperCreator, self), wcsMachineName, wcsCatalogName, ppColumnMapper);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_CSearchManager_Value = Guid.initString("7d096c5f-ac08-4f1f-beb7-5c22c517ce39");
pub const CLSID_CSearchManager = &CLSID_CSearchManager_Value;
const CLSID_CSearchRoot_Value = Guid.initString("30766bd2-ea1c-4f28-bf27-0b44e2f68db7");
pub const CLSID_CSearchRoot = &CLSID_CSearchRoot_Value;
const CLSID_CSearchScopeRule_Value = Guid.initString("e63de750-3bd7-4be5-9c84-6b4281988c44");
pub const CLSID_CSearchScopeRule = &CLSID_CSearchScopeRule_Value;
const CLSID_FilterRegistration_Value = Guid.initString("9e175b8d-f52a-11d8-b9a5-505054503030");
pub const CLSID_FilterRegistration = &CLSID_FilterRegistration_Value;
pub const FILTERED_DATA_SOURCES = extern struct {
pwcsExtension: ?[*:0]const u16,
pwcsMime: ?[*:0]const u16,
pClsid: ?*const Guid,
pwcsOverride: ?[*:0]const u16,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ILoadFilter_Value = Guid.initString("c7310722-ac80-11d1-8df3-00c04fb6ef4f");
pub const IID_ILoadFilter = &IID_ILoadFilter_Value;
pub const ILoadFilter = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
LoadIFilter: fn(
self: *const ILoadFilter,
pwcsPath: ?[*:0]const u16,
pFilteredSources: ?*FILTERED_DATA_SOURCES,
pUnkOuter: ?*IUnknown,
fUseDefault: BOOL,
pFilterClsid: ?*Guid,
SearchDecSize: ?*i32,
pwcsSearchDesc: ?*?*u16,
ppIFilt: ?*?*IFilter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadIFilterFromStorage: fn(
self: *const ILoadFilter,
pStg: ?*IStorage,
pUnkOuter: ?*IUnknown,
pwcsOverride: ?[*:0]const u16,
fUseDefault: BOOL,
pFilterClsid: ?*Guid,
SearchDecSize: ?*i32,
pwcsSearchDesc: ?*?*u16,
ppIFilt: ?*?*IFilter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadIFilterFromStream: fn(
self: *const ILoadFilter,
pStm: ?*IStream,
pFilteredSources: ?*FILTERED_DATA_SOURCES,
pUnkOuter: ?*IUnknown,
fUseDefault: BOOL,
pFilterClsid: ?*Guid,
SearchDecSize: ?*i32,
pwcsSearchDesc: ?*?*u16,
ppIFilt: ?*?*IFilter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILoadFilter_LoadIFilter(self: *const T, pwcsPath: ?[*:0]const u16, pFilteredSources: ?*FILTERED_DATA_SOURCES, pUnkOuter: ?*IUnknown, fUseDefault: BOOL, pFilterClsid: ?*Guid, SearchDecSize: ?*i32, pwcsSearchDesc: ?*?*u16, ppIFilt: ?*?*IFilter) callconv(.Inline) HRESULT {
return @ptrCast(*const ILoadFilter.VTable, self.vtable).LoadIFilter(@ptrCast(*const ILoadFilter, self), pwcsPath, pFilteredSources, pUnkOuter, fUseDefault, pFilterClsid, SearchDecSize, pwcsSearchDesc, ppIFilt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILoadFilter_LoadIFilterFromStorage(self: *const T, pStg: ?*IStorage, pUnkOuter: ?*IUnknown, pwcsOverride: ?[*:0]const u16, fUseDefault: BOOL, pFilterClsid: ?*Guid, SearchDecSize: ?*i32, pwcsSearchDesc: ?*?*u16, ppIFilt: ?*?*IFilter) callconv(.Inline) HRESULT {
return @ptrCast(*const ILoadFilter.VTable, self.vtable).LoadIFilterFromStorage(@ptrCast(*const ILoadFilter, self), pStg, pUnkOuter, pwcsOverride, fUseDefault, pFilterClsid, SearchDecSize, pwcsSearchDesc, ppIFilt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILoadFilter_LoadIFilterFromStream(self: *const T, pStm: ?*IStream, pFilteredSources: ?*FILTERED_DATA_SOURCES, pUnkOuter: ?*IUnknown, fUseDefault: BOOL, pFilterClsid: ?*Guid, SearchDecSize: ?*i32, pwcsSearchDesc: ?*?*u16, ppIFilt: ?*?*IFilter) callconv(.Inline) HRESULT {
return @ptrCast(*const ILoadFilter.VTable, self.vtable).LoadIFilterFromStream(@ptrCast(*const ILoadFilter, self), pStm, pFilteredSources, pUnkOuter, fUseDefault, pFilterClsid, SearchDecSize, pwcsSearchDesc, ppIFilt);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ILoadFilterWithPrivateComActivation_Value = Guid.initString("40bdbd34-780b-48d3-9bb6-12ebd4ad2e75");
pub const IID_ILoadFilterWithPrivateComActivation = &IID_ILoadFilterWithPrivateComActivation_Value;
pub const ILoadFilterWithPrivateComActivation = extern struct {
pub const VTable = extern struct {
base: ILoadFilter.VTable,
LoadIFilterWithPrivateComActivation: fn(
self: *const ILoadFilterWithPrivateComActivation,
filteredSources: ?*FILTERED_DATA_SOURCES,
useDefault: BOOL,
filterClsid: ?*Guid,
isFilterPrivateComActivated: ?*BOOL,
filterObj: ?*?*IFilter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ILoadFilter.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ILoadFilterWithPrivateComActivation_LoadIFilterWithPrivateComActivation(self: *const T, filteredSources: ?*FILTERED_DATA_SOURCES, useDefault: BOOL, filterClsid: ?*Guid, isFilterPrivateComActivated: ?*BOOL, filterObj: ?*?*IFilter) callconv(.Inline) HRESULT {
return @ptrCast(*const ILoadFilterWithPrivateComActivation.VTable, self.vtable).LoadIFilterWithPrivateComActivation(@ptrCast(*const ILoadFilterWithPrivateComActivation, self), filteredSources, useDefault, filterClsid, isFilterPrivateComActivated, filterObj);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IRichChunk_Value = Guid.initString("4fdef69c-dbc9-454e-9910-b34f3c64b510");
pub const IID_IRichChunk = &IID_IRichChunk_Value;
pub const IRichChunk = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetData: fn(
self: *const IRichChunk,
pFirstPos: ?*u32,
pLength: ?*u32,
ppsz: ?*?PWSTR,
pValue: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRichChunk_GetData(self: *const T, pFirstPos: ?*u32, pLength: ?*u32, ppsz: ?*?PWSTR, pValue: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IRichChunk.VTable, self.vtable).GetData(@ptrCast(*const IRichChunk, self), pFirstPos, pLength, ppsz, pValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ICondition_Value = Guid.initString("0fc988d4-c935-4b97-a973-46282ea175c8");
pub const IID_ICondition = &IID_ICondition_Value;
pub const ICondition = extern struct {
pub const VTable = extern struct {
base: IPersistStream.VTable,
GetConditionType: fn(
self: *const ICondition,
pNodeType: ?*CONDITION_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSubConditions: fn(
self: *const ICondition,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetComparisonInfo: fn(
self: *const ICondition,
ppszPropertyName: ?*?PWSTR,
pcop: ?*CONDITION_OPERATION,
ppropvar: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetValueType: fn(
self: *const ICondition,
ppszValueTypeName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetValueNormalization: fn(
self: *const ICondition,
ppszNormalization: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInputTerms: fn(
self: *const ICondition,
ppPropertyTerm: ?*?*IRichChunk,
ppOperationTerm: ?*?*IRichChunk,
ppValueTerm: ?*?*IRichChunk,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const ICondition,
ppc: ?*?*ICondition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IPersistStream.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_GetConditionType(self: *const T, pNodeType: ?*CONDITION_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).GetConditionType(@ptrCast(*const ICondition, self), pNodeType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_GetSubConditions(self: *const T, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).GetSubConditions(@ptrCast(*const ICondition, self), riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_GetComparisonInfo(self: *const T, ppszPropertyName: ?*?PWSTR, pcop: ?*CONDITION_OPERATION, ppropvar: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).GetComparisonInfo(@ptrCast(*const ICondition, self), ppszPropertyName, pcop, ppropvar);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_GetValueType(self: *const T, ppszValueTypeName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).GetValueType(@ptrCast(*const ICondition, self), ppszValueTypeName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_GetValueNormalization(self: *const T, ppszNormalization: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).GetValueNormalization(@ptrCast(*const ICondition, self), ppszNormalization);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_GetInputTerms(self: *const T, ppPropertyTerm: ?*?*IRichChunk, ppOperationTerm: ?*?*IRichChunk, ppValueTerm: ?*?*IRichChunk) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).GetInputTerms(@ptrCast(*const ICondition, self), ppPropertyTerm, ppOperationTerm, ppValueTerm);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition_Clone(self: *const T, ppc: ?*?*ICondition) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition.VTable, self.vtable).Clone(@ptrCast(*const ICondition, self), ppc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ICondition2_Value = Guid.initString("0db8851d-2e5b-47eb-9208-d28c325a01d7");
pub const IID_ICondition2 = &IID_ICondition2_Value;
pub const ICondition2 = extern struct {
pub const VTable = extern struct {
base: ICondition.VTable,
GetLocale: fn(
self: *const ICondition2,
ppszLocaleName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLeafConditionInfo: fn(
self: *const ICondition2,
ppropkey: ?*PROPERTYKEY,
pcop: ?*CONDITION_OPERATION,
ppropvar: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ICondition.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition2_GetLocale(self: *const T, ppszLocaleName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition2.VTable, self.vtable).GetLocale(@ptrCast(*const ICondition2, self), ppszLocaleName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICondition2_GetLeafConditionInfo(self: *const T, ppropkey: ?*PROPERTYKEY, pcop: ?*CONDITION_OPERATION, ppropvar: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ICondition2.VTable, self.vtable).GetLeafConditionInfo(@ptrCast(*const ICondition2, self), ppropkey, pcop, ppropvar);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DB_NUMERIC = extern struct {
precision: u8,
scale: u8,
sign: u8,
val: [16]u8,
};
pub const DBDATE = extern struct {
year: i16,
month: u16,
day: u16,
};
pub const DBTIME = extern struct {
hour: u16,
minute: u16,
second: u16,
};
pub const DB_VARNUMERIC = extern struct {
precision: u8,
scale: i8,
sign: u8,
val: [1]u8,
};
pub const DBTYPEENUM = enum(i32) {
EMPTY = 0,
NULL = 1,
I2 = 2,
I4 = 3,
R4 = 4,
R8 = 5,
CY = 6,
DATE = 7,
BSTR = 8,
IDISPATCH = 9,
ERROR = 10,
BOOL = 11,
VARIANT = 12,
IUNKNOWN = 13,
DECIMAL = 14,
UI1 = 17,
ARRAY = 8192,
BYREF = 16384,
I1 = 16,
UI2 = 18,
UI4 = 19,
I8 = 20,
UI8 = 21,
GUID = 72,
VECTOR = 4096,
RESERVED = 32768,
BYTES = 128,
STR = 129,
WSTR = 130,
NUMERIC = 131,
UDT = 132,
DBDATE = 133,
DBTIME = 134,
DBTIMESTAMP = 135,
};
pub const DBTYPE_EMPTY = DBTYPEENUM.EMPTY;
pub const DBTYPE_NULL = DBTYPEENUM.NULL;
pub const DBTYPE_I2 = DBTYPEENUM.I2;
pub const DBTYPE_I4 = DBTYPEENUM.I4;
pub const DBTYPE_R4 = DBTYPEENUM.R4;
pub const DBTYPE_R8 = DBTYPEENUM.R8;
pub const DBTYPE_CY = DBTYPEENUM.CY;
pub const DBTYPE_DATE = DBTYPEENUM.DATE;
pub const DBTYPE_BSTR = DBTYPEENUM.BSTR;
pub const DBTYPE_IDISPATCH = DBTYPEENUM.IDISPATCH;
pub const DBTYPE_ERROR = DBTYPEENUM.ERROR;
pub const DBTYPE_BOOL = DBTYPEENUM.BOOL;
pub const DBTYPE_VARIANT = DBTYPEENUM.VARIANT;
pub const DBTYPE_IUNKNOWN = DBTYPEENUM.IUNKNOWN;
pub const DBTYPE_DECIMAL = DBTYPEENUM.DECIMAL;
pub const DBTYPE_UI1 = DBTYPEENUM.UI1;
pub const DBTYPE_ARRAY = DBTYPEENUM.ARRAY;
pub const DBTYPE_BYREF = DBTYPEENUM.BYREF;
pub const DBTYPE_I1 = DBTYPEENUM.I1;
pub const DBTYPE_UI2 = DBTYPEENUM.UI2;
pub const DBTYPE_UI4 = DBTYPEENUM.UI4;
pub const DBTYPE_I8 = DBTYPEENUM.I8;
pub const DBTYPE_UI8 = DBTYPEENUM.UI8;
pub const DBTYPE_GUID = DBTYPEENUM.GUID;
pub const DBTYPE_VECTOR = DBTYPEENUM.VECTOR;
pub const DBTYPE_RESERVED = DBTYPEENUM.RESERVED;
pub const DBTYPE_BYTES = DBTYPEENUM.BYTES;
pub const DBTYPE_STR = DBTYPEENUM.STR;
pub const DBTYPE_WSTR = DBTYPEENUM.WSTR;
pub const DBTYPE_NUMERIC = DBTYPEENUM.NUMERIC;
pub const DBTYPE_UDT = DBTYPEENUM.UDT;
pub const DBTYPE_DBDATE = DBTYPEENUM.DBDATE;
pub const DBTYPE_DBTIME = DBTYPEENUM.DBTIME;
pub const DBTYPE_DBTIMESTAMP = DBTYPEENUM.DBTIMESTAMP;
pub const DBTYPEENUM15 = enum(i32) {
R = 136,
};
pub const DBTYPE_HCHAPTER = DBTYPEENUM15.R;
pub const DBTYPEENUM20 = enum(i32) {
FILETIME = 64,
PROPVARIANT = 138,
VARNUMERIC = 139,
};
pub const DBTYPE_FILETIME = DBTYPEENUM20.FILETIME;
pub const DBTYPE_PROPVARIANT = DBTYPEENUM20.PROPVARIANT;
pub const DBTYPE_VARNUMERIC = DBTYPEENUM20.VARNUMERIC;
pub const DBPARTENUM = enum(i32) {
INVALID = 0,
VALUE = 1,
LENGTH = 2,
STATUS = 4,
};
pub const DBPART_INVALID = DBPARTENUM.INVALID;
pub const DBPART_VALUE = DBPARTENUM.VALUE;
pub const DBPART_LENGTH = DBPARTENUM.LENGTH;
pub const DBPART_STATUS = DBPARTENUM.STATUS;
pub const DBPARAMIOENUM = enum(i32) {
NOTPARAM = 0,
INPUT = 1,
OUTPUT = 2,
};
pub const DBPARAMIO_NOTPARAM = DBPARAMIOENUM.NOTPARAM;
pub const DBPARAMIO_INPUT = DBPARAMIOENUM.INPUT;
pub const DBPARAMIO_OUTPUT = DBPARAMIOENUM.OUTPUT;
pub const DBBINDFLAGENUM = enum(i32) {
L = 1,
};
pub const DBBINDFLAG_HTML = DBBINDFLAGENUM.L;
pub const DBMEMOWNERENUM = enum(i32) {
CLIENTOWNED = 0,
PROVIDEROWNED = 1,
};
pub const DBMEMOWNER_CLIENTOWNED = DBMEMOWNERENUM.CLIENTOWNED;
pub const DBMEMOWNER_PROVIDEROWNED = DBMEMOWNERENUM.PROVIDEROWNED;
pub const DBSTATUSENUM = enum(i32) {
S_OK = 0,
E_BADACCESSOR = 1,
E_CANTCONVERTVALUE = 2,
S_ISNULL = 3,
S_TRUNCATED = 4,
E_SIGNMISMATCH = 5,
E_DATAOVERFLOW = 6,
E_CANTCREATE = 7,
E_UNAVAILABLE = 8,
E_PERMISSIONDENIED = 9,
E_INTEGRITYVIOLATION = 10,
E_SCHEMAVIOLATION = 11,
E_BADSTATUS = 12,
S_DEFAULT = 13,
};
pub const DBSTATUS_S_OK = DBSTATUSENUM.S_OK;
pub const DBSTATUS_E_BADACCESSOR = DBSTATUSENUM.E_BADACCESSOR;
pub const DBSTATUS_E_CANTCONVERTVALUE = DBSTATUSENUM.E_CANTCONVERTVALUE;
pub const DBSTATUS_S_ISNULL = DBSTATUSENUM.S_ISNULL;
pub const DBSTATUS_S_TRUNCATED = DBSTATUSENUM.S_TRUNCATED;
pub const DBSTATUS_E_SIGNMISMATCH = DBSTATUSENUM.E_SIGNMISMATCH;
pub const DBSTATUS_E_DATAOVERFLOW = DBSTATUSENUM.E_DATAOVERFLOW;
pub const DBSTATUS_E_CANTCREATE = DBSTATUSENUM.E_CANTCREATE;
pub const DBSTATUS_E_UNAVAILABLE = DBSTATUSENUM.E_UNAVAILABLE;
pub const DBSTATUS_E_PERMISSIONDENIED = DBSTATUSENUM.E_PERMISSIONDENIED;
pub const DBSTATUS_E_INTEGRITYVIOLATION = DBSTATUSENUM.E_INTEGRITYVIOLATION;
pub const DBSTATUS_E_SCHEMAVIOLATION = DBSTATUSENUM.E_SCHEMAVIOLATION;
pub const DBSTATUS_E_BADSTATUS = DBSTATUSENUM.E_BADSTATUS;
pub const DBSTATUS_S_DEFAULT = DBSTATUSENUM.S_DEFAULT;
pub const DBSTATUSENUM20 = enum(i32) {
MDSTATUS_S_CELLEMPTY = 14,
DBSTATUS_S_IGNORE = 15,
};
pub const MDSTATUS_S_CELLEMPTY = DBSTATUSENUM20.MDSTATUS_S_CELLEMPTY;
pub const DBSTATUS_S_IGNORE = DBSTATUSENUM20.DBSTATUS_S_IGNORE;
pub const DBSTATUSENUM21 = enum(i32) {
E_DOESNOTEXIST = 16,
E_INVALIDURL = 17,
E_RESOURCELOCKED = 18,
E_RESOURCEEXISTS = 19,
E_CANNOTCOMPLETE = 20,
E_VOLUMENOTFOUND = 21,
E_OUTOFSPACE = 22,
S_CANNOTDELETESOURCE = 23,
E_READONLY = 24,
E_RESOURCEOUTOFSCOPE = 25,
S_ALREADYEXISTS = 26,
};
pub const DBSTATUS_E_DOESNOTEXIST = DBSTATUSENUM21.E_DOESNOTEXIST;
pub const DBSTATUS_E_INVALIDURL = DBSTATUSENUM21.E_INVALIDURL;
pub const DBSTATUS_E_RESOURCELOCKED = DBSTATUSENUM21.E_RESOURCELOCKED;
pub const DBSTATUS_E_RESOURCEEXISTS = DBSTATUSENUM21.E_RESOURCEEXISTS;
pub const DBSTATUS_E_CANNOTCOMPLETE = DBSTATUSENUM21.E_CANNOTCOMPLETE;
pub const DBSTATUS_E_VOLUMENOTFOUND = DBSTATUSENUM21.E_VOLUMENOTFOUND;
pub const DBSTATUS_E_OUTOFSPACE = DBSTATUSENUM21.E_OUTOFSPACE;
pub const DBSTATUS_S_CANNOTDELETESOURCE = DBSTATUSENUM21.S_CANNOTDELETESOURCE;
pub const DBSTATUS_E_READONLY = DBSTATUSENUM21.E_READONLY;
pub const DBSTATUS_E_RESOURCEOUTOFSCOPE = DBSTATUSENUM21.E_RESOURCEOUTOFSCOPE;
pub const DBSTATUS_S_ALREADYEXISTS = DBSTATUSENUM21.S_ALREADYEXISTS;
pub const DBBINDURLFLAGENUM = enum(i32) {
READ = 1,
WRITE = 2,
READWRITE = 3,
SHARE_DENY_READ = 4,
SHARE_DENY_WRITE = 8,
SHARE_EXCLUSIVE = 12,
SHARE_DENY_NONE = 16,
ASYNCHRONOUS = 4096,
COLLECTION = 8192,
DELAYFETCHSTREAM = 16384,
DELAYFETCHCOLUMNS = 32768,
RECURSIVE = 4194304,
OUTPUT = 8388608,
WAITFORINIT = 16777216,
OPENIFEXISTS = 33554432,
OVERWRITE = 67108864,
ISSTRUCTUREDDOCUMENT = 134217728,
};
pub const DBBINDURLFLAG_READ = DBBINDURLFLAGENUM.READ;
pub const DBBINDURLFLAG_WRITE = DBBINDURLFLAGENUM.WRITE;
pub const DBBINDURLFLAG_READWRITE = DBBINDURLFLAGENUM.READWRITE;
pub const DBBINDURLFLAG_SHARE_DENY_READ = DBBINDURLFLAGENUM.SHARE_DENY_READ;
pub const DBBINDURLFLAG_SHARE_DENY_WRITE = DBBINDURLFLAGENUM.SHARE_DENY_WRITE;
pub const DBBINDURLFLAG_SHARE_EXCLUSIVE = DBBINDURLFLAGENUM.SHARE_EXCLUSIVE;
pub const DBBINDURLFLAG_SHARE_DENY_NONE = DBBINDURLFLAGENUM.SHARE_DENY_NONE;
pub const DBBINDURLFLAG_ASYNCHRONOUS = DBBINDURLFLAGENUM.ASYNCHRONOUS;
pub const DBBINDURLFLAG_COLLECTION = DBBINDURLFLAGENUM.COLLECTION;
pub const DBBINDURLFLAG_DELAYFETCHSTREAM = DBBINDURLFLAGENUM.DELAYFETCHSTREAM;
pub const DBBINDURLFLAG_DELAYFETCHCOLUMNS = DBBINDURLFLAGENUM.DELAYFETCHCOLUMNS;
pub const DBBINDURLFLAG_RECURSIVE = DBBINDURLFLAGENUM.RECURSIVE;
pub const DBBINDURLFLAG_OUTPUT = DBBINDURLFLAGENUM.OUTPUT;
pub const DBBINDURLFLAG_WAITFORINIT = DBBINDURLFLAGENUM.WAITFORINIT;
pub const DBBINDURLFLAG_OPENIFEXISTS = DBBINDURLFLAGENUM.OPENIFEXISTS;
pub const DBBINDURLFLAG_OVERWRITE = DBBINDURLFLAGENUM.OVERWRITE;
pub const DBBINDURLFLAG_ISSTRUCTUREDDOCUMENT = DBBINDURLFLAGENUM.ISSTRUCTUREDDOCUMENT;
pub const DBBINDURLSTATUSENUM = enum(i32) {
OK = 0,
DENYNOTSUPPORTED = 1,
DENYTYPENOTSUPPORTED = 4,
REDIRECTED = 8,
};
pub const DBBINDURLSTATUS_S_OK = DBBINDURLSTATUSENUM.OK;
pub const DBBINDURLSTATUS_S_DENYNOTSUPPORTED = DBBINDURLSTATUSENUM.DENYNOTSUPPORTED;
pub const DBBINDURLSTATUS_S_DENYTYPENOTSUPPORTED = DBBINDURLSTATUSENUM.DENYTYPENOTSUPPORTED;
pub const DBBINDURLSTATUS_S_REDIRECTED = DBBINDURLSTATUSENUM.REDIRECTED;
pub const DBSTATUSENUM25 = enum(i32) {
CANCELED = 27,
NOTCOLLECTION = 28,
};
pub const DBSTATUS_E_CANCELED = DBSTATUSENUM25.CANCELED;
pub const DBSTATUS_E_NOTCOLLECTION = DBSTATUSENUM25.NOTCOLLECTION;
pub const DBROWSTATUSENUM = enum(i32) {
S_OK = 0,
S_MULTIPLECHANGES = 2,
S_PENDINGCHANGES = 3,
E_CANCELED = 4,
E_CANTRELEASE = 6,
E_CONCURRENCYVIOLATION = 7,
E_DELETED = 8,
E_PENDINGINSERT = 9,
E_NEWLYINSERTED = 10,
E_INTEGRITYVIOLATION = 11,
E_INVALID = 12,
E_MAXPENDCHANGESEXCEEDED = 13,
E_OBJECTOPEN = 14,
E_OUTOFMEMORY = 15,
E_PERMISSIONDENIED = 16,
E_LIMITREACHED = 17,
E_SCHEMAVIOLATION = 18,
E_FAIL = 19,
};
pub const DBROWSTATUS_S_OK = DBROWSTATUSENUM.S_OK;
pub const DBROWSTATUS_S_MULTIPLECHANGES = DBROWSTATUSENUM.S_MULTIPLECHANGES;
pub const DBROWSTATUS_S_PENDINGCHANGES = DBROWSTATUSENUM.S_PENDINGCHANGES;
pub const DBROWSTATUS_E_CANCELED = DBROWSTATUSENUM.E_CANCELED;
pub const DBROWSTATUS_E_CANTRELEASE = DBROWSTATUSENUM.E_CANTRELEASE;
pub const DBROWSTATUS_E_CONCURRENCYVIOLATION = DBROWSTATUSENUM.E_CONCURRENCYVIOLATION;
pub const DBROWSTATUS_E_DELETED = DBROWSTATUSENUM.E_DELETED;
pub const DBROWSTATUS_E_PENDINGINSERT = DBROWSTATUSENUM.E_PENDINGINSERT;
pub const DBROWSTATUS_E_NEWLYINSERTED = DBROWSTATUSENUM.E_NEWLYINSERTED;
pub const DBROWSTATUS_E_INTEGRITYVIOLATION = DBROWSTATUSENUM.E_INTEGRITYVIOLATION;
pub const DBROWSTATUS_E_INVALID = DBROWSTATUSENUM.E_INVALID;
pub const DBROWSTATUS_E_MAXPENDCHANGESEXCEEDED = DBROWSTATUSENUM.E_MAXPENDCHANGESEXCEEDED;
pub const DBROWSTATUS_E_OBJECTOPEN = DBROWSTATUSENUM.E_OBJECTOPEN;
pub const DBROWSTATUS_E_OUTOFMEMORY = DBROWSTATUSENUM.E_OUTOFMEMORY;
pub const DBROWSTATUS_E_PERMISSIONDENIED = DBROWSTATUSENUM.E_PERMISSIONDENIED;
pub const DBROWSTATUS_E_LIMITREACHED = DBROWSTATUSENUM.E_LIMITREACHED;
pub const DBROWSTATUS_E_SCHEMAVIOLATION = DBROWSTATUSENUM.E_SCHEMAVIOLATION;
pub const DBROWSTATUS_E_FAIL = DBROWSTATUSENUM.E_FAIL;
pub const DBROWSTATUSENUM20 = enum(i32) {
E = 20,
};
pub const DBROWSTATUS_S_NOCHANGE = DBROWSTATUSENUM20.E;
pub const DBSTATUSENUM26 = enum(i32) {
N = 29,
};
pub const DBSTATUS_S_ROWSETCOLUMN = DBSTATUSENUM26.N;
pub const DBCOLUMNFLAGSENUM = enum(i32) {
ISBOOKMARK = 1,
MAYDEFER = 2,
WRITE = 4,
WRITEUNKNOWN = 8,
ISFIXEDLENGTH = 16,
ISNULLABLE = 32,
MAYBENULL = 64,
ISLONG = 128,
ISROWID = 256,
ISROWVER = 512,
CACHEDEFERRED = 4096,
};
pub const DBCOLUMNFLAGS_ISBOOKMARK = DBCOLUMNFLAGSENUM.ISBOOKMARK;
pub const DBCOLUMNFLAGS_MAYDEFER = DBCOLUMNFLAGSENUM.MAYDEFER;
pub const DBCOLUMNFLAGS_WRITE = DBCOLUMNFLAGSENUM.WRITE;
pub const DBCOLUMNFLAGS_WRITEUNKNOWN = DBCOLUMNFLAGSENUM.WRITEUNKNOWN;
pub const DBCOLUMNFLAGS_ISFIXEDLENGTH = DBCOLUMNFLAGSENUM.ISFIXEDLENGTH;
pub const DBCOLUMNFLAGS_ISNULLABLE = DBCOLUMNFLAGSENUM.ISNULLABLE;
pub const DBCOLUMNFLAGS_MAYBENULL = DBCOLUMNFLAGSENUM.MAYBENULL;
pub const DBCOLUMNFLAGS_ISLONG = DBCOLUMNFLAGSENUM.ISLONG;
pub const DBCOLUMNFLAGS_ISROWID = DBCOLUMNFLAGSENUM.ISROWID;
pub const DBCOLUMNFLAGS_ISROWVER = DBCOLUMNFLAGSENUM.ISROWVER;
pub const DBCOLUMNFLAGS_CACHEDEFERRED = DBCOLUMNFLAGSENUM.CACHEDEFERRED;
pub const DBCOLUMNFLAGSENUM20 = enum(i32) {
SCALEISNEGATIVE = 16384,
RESERVED = 32768,
};
pub const DBCOLUMNFLAGS_SCALEISNEGATIVE = DBCOLUMNFLAGSENUM20.SCALEISNEGATIVE;
pub const DBCOLUMNFLAGS_RESERVED = DBCOLUMNFLAGSENUM20.RESERVED;
pub const DBCOLUMNFLAGS15ENUM = enum(i32) {
R = 8192,
};
pub const DBCOLUMNFLAGS_ISCHAPTER = DBCOLUMNFLAGS15ENUM.R;
pub const DBCOLUMNFLAGSENUM21 = enum(i32) {
ROWURL = 65536,
DEFAULTSTREAM = 131072,
COLLECTION = 262144,
};
pub const DBCOLUMNFLAGS_ISROWURL = DBCOLUMNFLAGSENUM21.ROWURL;
pub const DBCOLUMNFLAGS_ISDEFAULTSTREAM = DBCOLUMNFLAGSENUM21.DEFAULTSTREAM;
pub const DBCOLUMNFLAGS_ISCOLLECTION = DBCOLUMNFLAGSENUM21.COLLECTION;
pub const DBCOLUMNFLAGSENUM26 = enum(i32) {
ISSTREAM = 524288,
ISROWSET = 1048576,
ISROW = 2097152,
ROWSPECIFICCOLUMN = 4194304,
};
pub const DBCOLUMNFLAGS_ISSTREAM = DBCOLUMNFLAGSENUM26.ISSTREAM;
pub const DBCOLUMNFLAGS_ISROWSET = DBCOLUMNFLAGSENUM26.ISROWSET;
pub const DBCOLUMNFLAGS_ISROW = DBCOLUMNFLAGSENUM26.ISROW;
pub const DBCOLUMNFLAGS_ROWSPECIFICCOLUMN = DBCOLUMNFLAGSENUM26.ROWSPECIFICCOLUMN;
pub const DBTABLESTATISTICSTYPE26 = enum(i32) {
HISTOGRAM = 1,
COLUMN_CARDINALITY = 2,
TUPLE_CARDINALITY = 4,
};
pub const DBSTAT_HISTOGRAM = DBTABLESTATISTICSTYPE26.HISTOGRAM;
pub const DBSTAT_COLUMN_CARDINALITY = DBTABLESTATISTICSTYPE26.COLUMN_CARDINALITY;
pub const DBSTAT_TUPLE_CARDINALITY = DBTABLESTATISTICSTYPE26.TUPLE_CARDINALITY;
pub const DBBOOKMARK = enum(i32) {
INVALID = 0,
FIRST = 1,
LAST = 2,
};
pub const DBBMK_INVALID = DBBOOKMARK.INVALID;
pub const DBBMK_FIRST = DBBOOKMARK.FIRST;
pub const DBBMK_LAST = DBBOOKMARK.LAST;
pub const DBPROPENUM = enum(i32) {
ABORTPRESERVE = 2,
ACTIVESESSIONS = 3,
APPENDONLY = 187,
ASYNCTXNABORT = 168,
ASYNCTXNCOMMIT = 4,
AUTH_CACHE_AUTHINFO = 5,
AUTH_ENCRYPT_PASSWORD = 6,
AUTH_INTEGRATED = 7,
AUTH_MASK_PASSWORD = 8,
AUTH_PASSWORD = 9,
AUTH_PERSIST_ENCRYPTED = 10,
AUTH_PERSIST_SENSITIVE_AUTHINFO = 11,
AUTH_USERID = 12,
BLOCKINGSTORAGEOBJECTS = 13,
BOOKMARKS = 14,
BOOKMARKSKIPPED = 15,
BOOKMARKTYPE = 16,
BYREFACCESSORS = 120,
CACHEDEFERRED = 17,
CANFETCHBACKWARDS = 18,
CANHOLDROWS = 19,
CANSCROLLBACKWARDS = 21,
CATALOGLOCATION = 22,
CATALOGTERM = 23,
CATALOGUSAGE = 24,
CHANGEINSERTEDROWS = 188,
COL_AUTOINCREMENT = 26,
COL_DEFAULT = 27,
COL_DESCRIPTION = 28,
COL_FIXEDLENGTH = 167,
COL_NULLABLE = 29,
COL_PRIMARYKEY = 30,
COL_UNIQUE = 31,
COLUMNDEFINITION = 32,
COLUMNRESTRICT = 33,
COMMANDTIMEOUT = 34,
COMMITPRESERVE = 35,
CONCATNULLBEHAVIOR = 36,
CURRENTCATALOG = 37,
DATASOURCENAME = 38,
DATASOURCEREADONLY = 39,
DBMSNAME = 40,
DBMSVER = 41,
DEFERRED = 42,
DELAYSTORAGEOBJECTS = 43,
DSOTHREADMODEL = 169,
GROUPBY = 44,
HETEROGENEOUSTABLES = 45,
IAccessor = 121,
IColumnsInfo = 122,
IColumnsRowset = 123,
IConnectionPointContainer = 124,
IConvertType = 194,
IRowset = 126,
IRowsetChange = 127,
IRowsetIdentity = 128,
IRowsetIndex = 159,
IRowsetInfo = 129,
IRowsetLocate = 130,
IRowsetResynch = 132,
IRowsetScroll = 133,
IRowsetUpdate = 134,
ISupportErrorInfo = 135,
ILockBytes = 136,
ISequentialStream = 137,
IStorage = 138,
IStream = 139,
IDENTIFIERCASE = 46,
IMMOBILEROWS = 47,
INDEX_AUTOUPDATE = 48,
INDEX_CLUSTERED = 49,
INDEX_FILLFACTOR = 50,
INDEX_INITIALSIZE = 51,
INDEX_NULLCOLLATION = 52,
INDEX_NULLS = 53,
INDEX_PRIMARYKEY = 54,
INDEX_SORTBOOKMARKS = 55,
INDEX_TEMPINDEX = 163,
INDEX_TYPE = 56,
INDEX_UNIQUE = 57,
INIT_DATASOURCE = 59,
INIT_HWND = 60,
INIT_IMPERSONATION_LEVEL = 61,
INIT_LCID = 186,
INIT_LOCATION = 62,
INIT_MODE = 63,
INIT_PROMPT = 64,
INIT_PROTECTION_LEVEL = 65,
INIT_PROVIDERSTRING = 160,
INIT_TIMEOUT = 66,
LITERALBOOKMARKS = 67,
LITERALIDENTITY = 68,
MAXINDEXSIZE = 70,
MAXOPENROWS = 71,
MAXPENDINGROWS = 72,
MAXROWS = 73,
MAXROWSIZE = 74,
MAXROWSIZEINCLUDESBLOB = 75,
MAXTABLESINSELECT = 76,
MAYWRITECOLUMN = 77,
MEMORYUSAGE = 78,
MULTIPLEPARAMSETS = 191,
MULTIPLERESULTS = 196,
MULTIPLESTORAGEOBJECTS = 80,
MULTITABLEUPDATE = 81,
NOTIFICATIONGRANULARITY = 198,
NOTIFICATIONPHASES = 82,
NOTIFYCOLUMNSET = 171,
NOTIFYROWDELETE = 173,
NOTIFYROWFIRSTCHANGE = 174,
NOTIFYROWINSERT = 175,
NOTIFYROWRESYNCH = 177,
NOTIFYROWSETCHANGED = 211,
NOTIFYROWSETRELEASE = 178,
NOTIFYROWSETFETCHPOSITIONCHANGE = 179,
NOTIFYROWUNDOCHANGE = 180,
NOTIFYROWUNDODELETE = 181,
NOTIFYROWUNDOINSERT = 182,
NOTIFYROWUPDATE = 183,
NULLCOLLATION = 83,
OLEOBJECTS = 84,
ORDERBYCOLUMNSINSELECT = 85,
ORDEREDBOOKMARKS = 86,
OTHERINSERT = 87,
OTHERUPDATEDELETE = 88,
OUTPUTPARAMETERAVAILABILITY = 184,
OWNINSERT = 89,
OWNUPDATEDELETE = 90,
PERSISTENTIDTYPE = 185,
PREPAREABORTBEHAVIOR = 91,
PREPARECOMMITBEHAVIOR = 92,
PROCEDURETERM = 93,
PROVIDERNAME = 96,
PROVIDEROLEDBVER = 97,
PROVIDERVER = 98,
QUICKRESTART = 99,
QUOTEDIDENTIFIERCASE = 100,
REENTRANTEVENTS = 101,
REMOVEDELETED = 102,
REPORTMULTIPLECHANGES = 103,
RETURNPENDINGINSERTS = 189,
ROWRESTRICT = 104,
ROWSETCONVERSIONSONCOMMAND = 192,
ROWTHREADMODEL = 105,
SCHEMATERM = 106,
SCHEMAUSAGE = 107,
SERVERCURSOR = 108,
SESS_AUTOCOMMITISOLEVELS = 190,
SQLSUPPORT = 109,
STRONGIDENTITY = 119,
STRUCTUREDSTORAGE = 111,
SUBQUERIES = 112,
SUPPORTEDTXNDDL = 161,
SUPPORTEDTXNISOLEVELS = 113,
SUPPORTEDTXNISORETAIN = 114,
TABLETERM = 115,
TBL_TEMPTABLE = 140,
TRANSACTEDOBJECT = 116,
UPDATABILITY = 117,
USERNAME = 118,
};
pub const DBPROP_ABORTPRESERVE = DBPROPENUM.ABORTPRESERVE;
pub const DBPROP_ACTIVESESSIONS = DBPROPENUM.ACTIVESESSIONS;
pub const DBPROP_APPENDONLY = DBPROPENUM.APPENDONLY;
pub const DBPROP_ASYNCTXNABORT = DBPROPENUM.ASYNCTXNABORT;
pub const DBPROP_ASYNCTXNCOMMIT = DBPROPENUM.ASYNCTXNCOMMIT;
pub const DBPROP_AUTH_CACHE_AUTHINFO = DBPROPENUM.AUTH_CACHE_AUTHINFO;
pub const DBPROP_AUTH_ENCRYPT_PASSWORD = DBPROPENUM.AUTH_ENCRYPT_PASSWORD;
pub const DBPROP_AUTH_INTEGRATED = DBPROPENUM.AUTH_INTEGRATED;
pub const DBPROP_AUTH_MASK_PASSWORD = DBPROPENUM.AUTH_MASK_PASSWORD;
pub const DBPROP_AUTH_PASSWORD = DBPROPENUM.AUTH_PASSWORD;
pub const DBPROP_AUTH_PERSIST_ENCRYPTED = DBPROPENUM.AUTH_PERSIST_ENCRYPTED;
pub const DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO = DBPROPENUM.AUTH_PERSIST_SENSITIVE_AUTHINFO;
pub const DBPROP_AUTH_USERID = DBPROPENUM.AUTH_USERID;
pub const DBPROP_BLOCKINGSTORAGEOBJECTS = DBPROPENUM.BLOCKINGSTORAGEOBJECTS;
pub const DBPROP_BOOKMARKS = DBPROPENUM.BOOKMARKS;
pub const DBPROP_BOOKMARKSKIPPED = DBPROPENUM.BOOKMARKSKIPPED;
pub const DBPROP_BOOKMARKTYPE = DBPROPENUM.BOOKMARKTYPE;
pub const DBPROP_BYREFACCESSORS = DBPROPENUM.BYREFACCESSORS;
pub const DBPROP_CACHEDEFERRED = DBPROPENUM.CACHEDEFERRED;
pub const DBPROP_CANFETCHBACKWARDS = DBPROPENUM.CANFETCHBACKWARDS;
pub const DBPROP_CANHOLDROWS = DBPROPENUM.CANHOLDROWS;
pub const DBPROP_CANSCROLLBACKWARDS = DBPROPENUM.CANSCROLLBACKWARDS;
pub const DBPROP_CATALOGLOCATION = DBPROPENUM.CATALOGLOCATION;
pub const DBPROP_CATALOGTERM = DBPROPENUM.CATALOGTERM;
pub const DBPROP_CATALOGUSAGE = DBPROPENUM.CATALOGUSAGE;
pub const DBPROP_CHANGEINSERTEDROWS = DBPROPENUM.CHANGEINSERTEDROWS;
pub const DBPROP_COL_AUTOINCREMENT = DBPROPENUM.COL_AUTOINCREMENT;
pub const DBPROP_COL_DEFAULT = DBPROPENUM.COL_DEFAULT;
pub const DBPROP_COL_DESCRIPTION = DBPROPENUM.COL_DESCRIPTION;
pub const DBPROP_COL_FIXEDLENGTH = DBPROPENUM.COL_FIXEDLENGTH;
pub const DBPROP_COL_NULLABLE = DBPROPENUM.COL_NULLABLE;
pub const DBPROP_COL_PRIMARYKEY = DBPROPENUM.COL_PRIMARYKEY;
pub const DBPROP_COL_UNIQUE = DBPROPENUM.COL_UNIQUE;
pub const DBPROP_COLUMNDEFINITION = DBPROPENUM.COLUMNDEFINITION;
pub const DBPROP_COLUMNRESTRICT = DBPROPENUM.COLUMNRESTRICT;
pub const DBPROP_COMMANDTIMEOUT = DBPROPENUM.COMMANDTIMEOUT;
pub const DBPROP_COMMITPRESERVE = DBPROPENUM.COMMITPRESERVE;
pub const DBPROP_CONCATNULLBEHAVIOR = DBPROPENUM.CONCATNULLBEHAVIOR;
pub const DBPROP_CURRENTCATALOG = DBPROPENUM.CURRENTCATALOG;
pub const DBPROP_DATASOURCENAME = DBPROPENUM.DATASOURCENAME;
pub const DBPROP_DATASOURCEREADONLY = DBPROPENUM.DATASOURCEREADONLY;
pub const DBPROP_DBMSNAME = DBPROPENUM.DBMSNAME;
pub const DBPROP_DBMSVER = DBPROPENUM.DBMSVER;
pub const DBPROP_DEFERRED = DBPROPENUM.DEFERRED;
pub const DBPROP_DELAYSTORAGEOBJECTS = DBPROPENUM.DELAYSTORAGEOBJECTS;
pub const DBPROP_DSOTHREADMODEL = DBPROPENUM.DSOTHREADMODEL;
pub const DBPROP_GROUPBY = DBPROPENUM.GROUPBY;
pub const DBPROP_HETEROGENEOUSTABLES = DBPROPENUM.HETEROGENEOUSTABLES;
pub const DBPROP_IAccessor = DBPROPENUM.IAccessor;
pub const DBPROP_IColumnsInfo = DBPROPENUM.IColumnsInfo;
pub const DBPROP_IColumnsRowset = DBPROPENUM.IColumnsRowset;
pub const DBPROP_IConnectionPointContainer = DBPROPENUM.IConnectionPointContainer;
pub const DBPROP_IConvertType = DBPROPENUM.IConvertType;
pub const DBPROP_IRowset = DBPROPENUM.IRowset;
pub const DBPROP_IRowsetChange = DBPROPENUM.IRowsetChange;
pub const DBPROP_IRowsetIdentity = DBPROPENUM.IRowsetIdentity;
pub const DBPROP_IRowsetIndex = DBPROPENUM.IRowsetIndex;
pub const DBPROP_IRowsetInfo = DBPROPENUM.IRowsetInfo;
pub const DBPROP_IRowsetLocate = DBPROPENUM.IRowsetLocate;
pub const DBPROP_IRowsetResynch = DBPROPENUM.IRowsetResynch;
pub const DBPROP_IRowsetScroll = DBPROPENUM.IRowsetScroll;
pub const DBPROP_IRowsetUpdate = DBPROPENUM.IRowsetUpdate;
pub const DBPROP_ISupportErrorInfo = DBPROPENUM.ISupportErrorInfo;
pub const DBPROP_ILockBytes = DBPROPENUM.ILockBytes;
pub const DBPROP_ISequentialStream = DBPROPENUM.ISequentialStream;
pub const DBPROP_IStorage = DBPROPENUM.IStorage;
pub const DBPROP_IStream = DBPROPENUM.IStream;
pub const DBPROP_IDENTIFIERCASE = DBPROPENUM.IDENTIFIERCASE;
pub const DBPROP_IMMOBILEROWS = DBPROPENUM.IMMOBILEROWS;
pub const DBPROP_INDEX_AUTOUPDATE = DBPROPENUM.INDEX_AUTOUPDATE;
pub const DBPROP_INDEX_CLUSTERED = DBPROPENUM.INDEX_CLUSTERED;
pub const DBPROP_INDEX_FILLFACTOR = DBPROPENUM.INDEX_FILLFACTOR;
pub const DBPROP_INDEX_INITIALSIZE = DBPROPENUM.INDEX_INITIALSIZE;
pub const DBPROP_INDEX_NULLCOLLATION = DBPROPENUM.INDEX_NULLCOLLATION;
pub const DBPROP_INDEX_NULLS = DBPROPENUM.INDEX_NULLS;
pub const DBPROP_INDEX_PRIMARYKEY = DBPROPENUM.INDEX_PRIMARYKEY;
pub const DBPROP_INDEX_SORTBOOKMARKS = DBPROPENUM.INDEX_SORTBOOKMARKS;
pub const DBPROP_INDEX_TEMPINDEX = DBPROPENUM.INDEX_TEMPINDEX;
pub const DBPROP_INDEX_TYPE = DBPROPENUM.INDEX_TYPE;
pub const DBPROP_INDEX_UNIQUE = DBPROPENUM.INDEX_UNIQUE;
pub const DBPROP_INIT_DATASOURCE = DBPROPENUM.INIT_DATASOURCE;
pub const DBPROP_INIT_HWND = DBPROPENUM.INIT_HWND;
pub const DBPROP_INIT_IMPERSONATION_LEVEL = DBPROPENUM.INIT_IMPERSONATION_LEVEL;
pub const DBPROP_INIT_LCID = DBPROPENUM.INIT_LCID;
pub const DBPROP_INIT_LOCATION = DBPROPENUM.INIT_LOCATION;
pub const DBPROP_INIT_MODE = DBPROPENUM.INIT_MODE;
pub const DBPROP_INIT_PROMPT = DBPROPENUM.INIT_PROMPT;
pub const DBPROP_INIT_PROTECTION_LEVEL = DBPROPENUM.INIT_PROTECTION_LEVEL;
pub const DBPROP_INIT_PROVIDERSTRING = DBPROPENUM.INIT_PROVIDERSTRING;
pub const DBPROP_INIT_TIMEOUT = DBPROPENUM.INIT_TIMEOUT;
pub const DBPROP_LITERALBOOKMARKS = DBPROPENUM.LITERALBOOKMARKS;
pub const DBPROP_LITERALIDENTITY = DBPROPENUM.LITERALIDENTITY;
pub const DBPROP_MAXINDEXSIZE = DBPROPENUM.MAXINDEXSIZE;
pub const DBPROP_MAXOPENROWS = DBPROPENUM.MAXOPENROWS;
pub const DBPROP_MAXPENDINGROWS = DBPROPENUM.MAXPENDINGROWS;
pub const DBPROP_MAXROWS = DBPROPENUM.MAXROWS;
pub const DBPROP_MAXROWSIZE = DBPROPENUM.MAXROWSIZE;
pub const DBPROP_MAXROWSIZEINCLUDESBLOB = DBPROPENUM.MAXROWSIZEINCLUDESBLOB;
pub const DBPROP_MAXTABLESINSELECT = DBPROPENUM.MAXTABLESINSELECT;
pub const DBPROP_MAYWRITECOLUMN = DBPROPENUM.MAYWRITECOLUMN;
pub const DBPROP_MEMORYUSAGE = DBPROPENUM.MEMORYUSAGE;
pub const DBPROP_MULTIPLEPARAMSETS = DBPROPENUM.MULTIPLEPARAMSETS;
pub const DBPROP_MULTIPLERESULTS = DBPROPENUM.MULTIPLERESULTS;
pub const DBPROP_MULTIPLESTORAGEOBJECTS = DBPROPENUM.MULTIPLESTORAGEOBJECTS;
pub const DBPROP_MULTITABLEUPDATE = DBPROPENUM.MULTITABLEUPDATE;
pub const DBPROP_NOTIFICATIONGRANULARITY = DBPROPENUM.NOTIFICATIONGRANULARITY;
pub const DBPROP_NOTIFICATIONPHASES = DBPROPENUM.NOTIFICATIONPHASES;
pub const DBPROP_NOTIFYCOLUMNSET = DBPROPENUM.NOTIFYCOLUMNSET;
pub const DBPROP_NOTIFYROWDELETE = DBPROPENUM.NOTIFYROWDELETE;
pub const DBPROP_NOTIFYROWFIRSTCHANGE = DBPROPENUM.NOTIFYROWFIRSTCHANGE;
pub const DBPROP_NOTIFYROWINSERT = DBPROPENUM.NOTIFYROWINSERT;
pub const DBPROP_NOTIFYROWRESYNCH = DBPROPENUM.NOTIFYROWRESYNCH;
pub const DBPROP_NOTIFYROWSETCHANGED = DBPROPENUM.NOTIFYROWSETCHANGED;
pub const DBPROP_NOTIFYROWSETRELEASE = DBPROPENUM.NOTIFYROWSETRELEASE;
pub const DBPROP_NOTIFYROWSETFETCHPOSITIONCHANGE = DBPROPENUM.NOTIFYROWSETFETCHPOSITIONCHANGE;
pub const DBPROP_NOTIFYROWUNDOCHANGE = DBPROPENUM.NOTIFYROWUNDOCHANGE;
pub const DBPROP_NOTIFYROWUNDODELETE = DBPROPENUM.NOTIFYROWUNDODELETE;
pub const DBPROP_NOTIFYROWUNDOINSERT = DBPROPENUM.NOTIFYROWUNDOINSERT;
pub const DBPROP_NOTIFYROWUPDATE = DBPROPENUM.NOTIFYROWUPDATE;
pub const DBPROP_NULLCOLLATION = DBPROPENUM.NULLCOLLATION;
pub const DBPROP_OLEOBJECTS = DBPROPENUM.OLEOBJECTS;
pub const DBPROP_ORDERBYCOLUMNSINSELECT = DBPROPENUM.ORDERBYCOLUMNSINSELECT;
pub const DBPROP_ORDEREDBOOKMARKS = DBPROPENUM.ORDEREDBOOKMARKS;
pub const DBPROP_OTHERINSERT = DBPROPENUM.OTHERINSERT;
pub const DBPROP_OTHERUPDATEDELETE = DBPROPENUM.OTHERUPDATEDELETE;
pub const DBPROP_OUTPUTPARAMETERAVAILABILITY = DBPROPENUM.OUTPUTPARAMETERAVAILABILITY;
pub const DBPROP_OWNINSERT = DBPROPENUM.OWNINSERT;
pub const DBPROP_OWNUPDATEDELETE = DBPROPENUM.OWNUPDATEDELETE;
pub const DBPROP_PERSISTENTIDTYPE = DBPROPENUM.PERSISTENTIDTYPE;
pub const DBPROP_PREPAREABORTBEHAVIOR = DBPROPENUM.PREPAREABORTBEHAVIOR;
pub const DBPROP_PREPARECOMMITBEHAVIOR = DBPROPENUM.PREPARECOMMITBEHAVIOR;
pub const DBPROP_PROCEDURETERM = DBPROPENUM.PROCEDURETERM;
pub const DBPROP_PROVIDERNAME = DBPROPENUM.PROVIDERNAME;
pub const DBPROP_PROVIDEROLEDBVER = DBPROPENUM.PROVIDEROLEDBVER;
pub const DBPROP_PROVIDERVER = DBPROPENUM.PROVIDERVER;
pub const DBPROP_QUICKRESTART = DBPROPENUM.QUICKRESTART;
pub const DBPROP_QUOTEDIDENTIFIERCASE = DBPROPENUM.QUOTEDIDENTIFIERCASE;
pub const DBPROP_REENTRANTEVENTS = DBPROPENUM.REENTRANTEVENTS;
pub const DBPROP_REMOVEDELETED = DBPROPENUM.REMOVEDELETED;
pub const DBPROP_REPORTMULTIPLECHANGES = DBPROPENUM.REPORTMULTIPLECHANGES;
pub const DBPROP_RETURNPENDINGINSERTS = DBPROPENUM.RETURNPENDINGINSERTS;
pub const DBPROP_ROWRESTRICT = DBPROPENUM.ROWRESTRICT;
pub const DBPROP_ROWSETCONVERSIONSONCOMMAND = DBPROPENUM.ROWSETCONVERSIONSONCOMMAND;
pub const DBPROP_ROWTHREADMODEL = DBPROPENUM.ROWTHREADMODEL;
pub const DBPROP_SCHEMATERM = DBPROPENUM.SCHEMATERM;
pub const DBPROP_SCHEMAUSAGE = DBPROPENUM.SCHEMAUSAGE;
pub const DBPROP_SERVERCURSOR = DBPROPENUM.SERVERCURSOR;
pub const DBPROP_SESS_AUTOCOMMITISOLEVELS = DBPROPENUM.SESS_AUTOCOMMITISOLEVELS;
pub const DBPROP_SQLSUPPORT = DBPROPENUM.SQLSUPPORT;
pub const DBPROP_STRONGIDENTITY = DBPROPENUM.STRONGIDENTITY;
pub const DBPROP_STRUCTUREDSTORAGE = DBPROPENUM.STRUCTUREDSTORAGE;
pub const DBPROP_SUBQUERIES = DBPROPENUM.SUBQUERIES;
pub const DBPROP_SUPPORTEDTXNDDL = DBPROPENUM.SUPPORTEDTXNDDL;
pub const DBPROP_SUPPORTEDTXNISOLEVELS = DBPROPENUM.SUPPORTEDTXNISOLEVELS;
pub const DBPROP_SUPPORTEDTXNISORETAIN = DBPROPENUM.SUPPORTEDTXNISORETAIN;
pub const DBPROP_TABLETERM = DBPROPENUM.TABLETERM;
pub const DBPROP_TBL_TEMPTABLE = DBPROPENUM.TBL_TEMPTABLE;
pub const DBPROP_TRANSACTEDOBJECT = DBPROPENUM.TRANSACTEDOBJECT;
pub const DBPROP_UPDATABILITY = DBPROPENUM.UPDATABILITY;
pub const DBPROP_USERNAME = DBPROPENUM.USERNAME;
pub const DBPROPENUM15 = enum(i32) {
FILTERCOMPAREOPS = 209,
FINDCOMPAREOPS = 210,
IChapteredRowset = 202,
IDBAsynchStatus = 203,
IRowsetFind = 204,
IRowsetView = 212,
IViewChapter = 213,
IViewFilter = 214,
IViewRowset = 215,
IViewSort = 216,
INIT_ASYNCH = 200,
MAXOPENCHAPTERS = 199,
MAXORSINFILTER = 205,
MAXSORTCOLUMNS = 206,
ROWSET_ASYNCH = 201,
SORTONINDEX = 207,
};
pub const DBPROP_FILTERCOMPAREOPS = DBPROPENUM15.FILTERCOMPAREOPS;
pub const DBPROP_FINDCOMPAREOPS = DBPROPENUM15.FINDCOMPAREOPS;
pub const DBPROP_IChapteredRowset = DBPROPENUM15.IChapteredRowset;
pub const DBPROP_IDBAsynchStatus = DBPROPENUM15.IDBAsynchStatus;
pub const DBPROP_IRowsetFind = DBPROPENUM15.IRowsetFind;
pub const DBPROP_IRowsetView = DBPROPENUM15.IRowsetView;
pub const DBPROP_IViewChapter = DBPROPENUM15.IViewChapter;
pub const DBPROP_IViewFilter = DBPROPENUM15.IViewFilter;
pub const DBPROP_IViewRowset = DBPROPENUM15.IViewRowset;
pub const DBPROP_IViewSort = DBPROPENUM15.IViewSort;
pub const DBPROP_INIT_ASYNCH = DBPROPENUM15.INIT_ASYNCH;
pub const DBPROP_MAXOPENCHAPTERS = DBPROPENUM15.MAXOPENCHAPTERS;
pub const DBPROP_MAXORSINFILTER = DBPROPENUM15.MAXORSINFILTER;
pub const DBPROP_MAXSORTCOLUMNS = DBPROPENUM15.MAXSORTCOLUMNS;
pub const DBPROP_ROWSET_ASYNCH = DBPROPENUM15.ROWSET_ASYNCH;
pub const DBPROP_SORTONINDEX = DBPROPENUM15.SORTONINDEX;
pub const DBPROPENUM20 = enum(i32) {
DBPROP_IMultipleResults = 217,
DBPROP_DATASOURCE_TYPE = 251,
MDPROP_AXES = 252,
MDPROP_FLATTENING_SUPPORT = 253,
MDPROP_MDX_JOINCUBES = 254,
MDPROP_NAMED_LEVELS = 255,
MDPROP_RANGEROWSET = 256,
MDPROP_MDX_SLICER = 218,
MDPROP_MDX_CUBEQUALIFICATION = 219,
MDPROP_MDX_OUTERREFERENCE = 220,
MDPROP_MDX_QUERYBYPROPERTY = 221,
MDPROP_MDX_CASESUPPORT = 222,
MDPROP_MDX_STRING_COMPOP = 224,
MDPROP_MDX_DESCFLAGS = 225,
MDPROP_MDX_SET_FUNCTIONS = 226,
MDPROP_MDX_MEMBER_FUNCTIONS = 227,
MDPROP_MDX_NUMERIC_FUNCTIONS = 228,
MDPROP_MDX_FORMULAS = 229,
MDPROP_AGGREGATECELL_UPDATE = 230,
// MDPROP_MDX_AGGREGATECELL_UPDATE = 230, this enum value conflicts with MDPROP_AGGREGATECELL_UPDATE
MDPROP_MDX_OBJQUALIFICATION = 261,
MDPROP_MDX_NONMEASURE_EXPRESSIONS = 262,
DBPROP_ACCESSORDER = 231,
DBPROP_BOOKMARKINFO = 232,
DBPROP_INIT_CATALOG = 233,
DBPROP_ROW_BULKOPS = 234,
DBPROP_PROVIDERFRIENDLYNAME = 235,
DBPROP_LOCKMODE = 236,
DBPROP_MULTIPLECONNECTIONS = 237,
DBPROP_UNIQUEROWS = 238,
DBPROP_SERVERDATAONINSERT = 239,
DBPROP_STORAGEFLAGS = 240,
DBPROP_CONNECTIONSTATUS = 244,
DBPROP_ALTERCOLUMN = 245,
DBPROP_COLUMNLCID = 246,
DBPROP_RESETDATASOURCE = 247,
DBPROP_INIT_OLEDBSERVICES = 248,
DBPROP_IRowsetRefresh = 249,
DBPROP_SERVERNAME = 250,
DBPROP_IParentRowset = 257,
DBPROP_HIDDENCOLUMNS = 258,
DBPROP_PROVIDERMEMORY = 259,
DBPROP_CLIENTCURSOR = 260,
};
pub const DBPROP_IMultipleResults = DBPROPENUM20.DBPROP_IMultipleResults;
pub const DBPROP_DATASOURCE_TYPE = DBPROPENUM20.DBPROP_DATASOURCE_TYPE;
pub const MDPROP_AXES = DBPROPENUM20.MDPROP_AXES;
pub const MDPROP_FLATTENING_SUPPORT = DBPROPENUM20.MDPROP_FLATTENING_SUPPORT;
pub const MDPROP_MDX_JOINCUBES = DBPROPENUM20.MDPROP_MDX_JOINCUBES;
pub const MDPROP_NAMED_LEVELS = DBPROPENUM20.MDPROP_NAMED_LEVELS;
pub const MDPROP_RANGEROWSET = DBPROPENUM20.MDPROP_RANGEROWSET;
pub const MDPROP_MDX_SLICER = DBPROPENUM20.MDPROP_MDX_SLICER;
pub const MDPROP_MDX_CUBEQUALIFICATION = DBPROPENUM20.MDPROP_MDX_CUBEQUALIFICATION;
pub const MDPROP_MDX_OUTERREFERENCE = DBPROPENUM20.MDPROP_MDX_OUTERREFERENCE;
pub const MDPROP_MDX_QUERYBYPROPERTY = DBPROPENUM20.MDPROP_MDX_QUERYBYPROPERTY;
pub const MDPROP_MDX_CASESUPPORT = DBPROPENUM20.MDPROP_MDX_CASESUPPORT;
pub const MDPROP_MDX_STRING_COMPOP = DBPROPENUM20.MDPROP_MDX_STRING_COMPOP;
pub const MDPROP_MDX_DESCFLAGS = DBPROPENUM20.MDPROP_MDX_DESCFLAGS;
pub const MDPROP_MDX_SET_FUNCTIONS = DBPROPENUM20.MDPROP_MDX_SET_FUNCTIONS;
pub const MDPROP_MDX_MEMBER_FUNCTIONS = DBPROPENUM20.MDPROP_MDX_MEMBER_FUNCTIONS;
pub const MDPROP_MDX_NUMERIC_FUNCTIONS = DBPROPENUM20.MDPROP_MDX_NUMERIC_FUNCTIONS;
pub const MDPROP_MDX_FORMULAS = DBPROPENUM20.MDPROP_MDX_FORMULAS;
pub const MDPROP_AGGREGATECELL_UPDATE = DBPROPENUM20.MDPROP_AGGREGATECELL_UPDATE;
pub const MDPROP_MDX_AGGREGATECELL_UPDATE = DBPROPENUM20.MDPROP_AGGREGATECELL_UPDATE;
pub const MDPROP_MDX_OBJQUALIFICATION = DBPROPENUM20.MDPROP_MDX_OBJQUALIFICATION;
pub const MDPROP_MDX_NONMEASURE_EXPRESSIONS = DBPROPENUM20.MDPROP_MDX_NONMEASURE_EXPRESSIONS;
pub const DBPROP_ACCESSORDER = DBPROPENUM20.DBPROP_ACCESSORDER;
pub const DBPROP_BOOKMARKINFO = DBPROPENUM20.DBPROP_BOOKMARKINFO;
pub const DBPROP_INIT_CATALOG = DBPROPENUM20.DBPROP_INIT_CATALOG;
pub const DBPROP_ROW_BULKOPS = DBPROPENUM20.DBPROP_ROW_BULKOPS;
pub const DBPROP_PROVIDERFRIENDLYNAME = DBPROPENUM20.DBPROP_PROVIDERFRIENDLYNAME;
pub const DBPROP_LOCKMODE = DBPROPENUM20.DBPROP_LOCKMODE;
pub const DBPROP_MULTIPLECONNECTIONS = DBPROPENUM20.DBPROP_MULTIPLECONNECTIONS;
pub const DBPROP_UNIQUEROWS = DBPROPENUM20.DBPROP_UNIQUEROWS;
pub const DBPROP_SERVERDATAONINSERT = DBPROPENUM20.DBPROP_SERVERDATAONINSERT;
pub const DBPROP_STORAGEFLAGS = DBPROPENUM20.DBPROP_STORAGEFLAGS;
pub const DBPROP_CONNECTIONSTATUS = DBPROPENUM20.DBPROP_CONNECTIONSTATUS;
pub const DBPROP_ALTERCOLUMN = DBPROPENUM20.DBPROP_ALTERCOLUMN;
pub const DBPROP_COLUMNLCID = DBPROPENUM20.DBPROP_COLUMNLCID;
pub const DBPROP_RESETDATASOURCE = DBPROPENUM20.DBPROP_RESETDATASOURCE;
pub const DBPROP_INIT_OLEDBSERVICES = DBPROPENUM20.DBPROP_INIT_OLEDBSERVICES;
pub const DBPROP_IRowsetRefresh = DBPROPENUM20.DBPROP_IRowsetRefresh;
pub const DBPROP_SERVERNAME = DBPROPENUM20.DBPROP_SERVERNAME;
pub const DBPROP_IParentRowset = DBPROPENUM20.DBPROP_IParentRowset;
pub const DBPROP_HIDDENCOLUMNS = DBPROPENUM20.DBPROP_HIDDENCOLUMNS;
pub const DBPROP_PROVIDERMEMORY = DBPROPENUM20.DBPROP_PROVIDERMEMORY;
pub const DBPROP_CLIENTCURSOR = DBPROPENUM20.DBPROP_CLIENTCURSOR;
pub const DBPROPENUM21 = enum(i32) {
TRUSTEE_USERNAME = 241,
TRUSTEE_AUTHENTICATION = 242,
TRUSTEE_NEWAUTHENTICATION = 243,
IRow = 263,
IRowChange = 264,
IRowSchemaChange = 265,
IGetRow = 266,
IScopedOperations = 267,
IBindResource = 268,
ICreateRow = 269,
INIT_BINDFLAGS = 270,
INIT_LOCKOWNER = 271,
GENERATEURL = 273,
IDBBinderProperties = 274,
IColumnsInfo2 = 275,
IRegisterProvider = 276,
IGetSession = 277,
IGetSourceRow = 278,
IRowsetCurrentIndex = 279,
OPENROWSETSUPPORT = 280,
COL_ISLONG = 281,
};
pub const DBPROP_TRUSTEE_USERNAME = DBPROPENUM21.TRUSTEE_USERNAME;
pub const DBPROP_TRUSTEE_AUTHENTICATION = DBPROPENUM21.TRUSTEE_AUTHENTICATION;
pub const DBPROP_TRUSTEE_NEWAUTHENTICATION = DBPROPENUM21.TRUSTEE_NEWAUTHENTICATION;
pub const DBPROP_IRow = DBPROPENUM21.IRow;
pub const DBPROP_IRowChange = DBPROPENUM21.IRowChange;
pub const DBPROP_IRowSchemaChange = DBPROPENUM21.IRowSchemaChange;
pub const DBPROP_IGetRow = DBPROPENUM21.IGetRow;
pub const DBPROP_IScopedOperations = DBPROPENUM21.IScopedOperations;
pub const DBPROP_IBindResource = DBPROPENUM21.IBindResource;
pub const DBPROP_ICreateRow = DBPROPENUM21.ICreateRow;
pub const DBPROP_INIT_BINDFLAGS = DBPROPENUM21.INIT_BINDFLAGS;
pub const DBPROP_INIT_LOCKOWNER = DBPROPENUM21.INIT_LOCKOWNER;
pub const DBPROP_GENERATEURL = DBPROPENUM21.GENERATEURL;
pub const DBPROP_IDBBinderProperties = DBPROPENUM21.IDBBinderProperties;
pub const DBPROP_IColumnsInfo2 = DBPROPENUM21.IColumnsInfo2;
pub const DBPROP_IRegisterProvider = DBPROPENUM21.IRegisterProvider;
pub const DBPROP_IGetSession = DBPROPENUM21.IGetSession;
pub const DBPROP_IGetSourceRow = DBPROPENUM21.IGetSourceRow;
pub const DBPROP_IRowsetCurrentIndex = DBPROPENUM21.IRowsetCurrentIndex;
pub const DBPROP_OPENROWSETSUPPORT = DBPROPENUM21.OPENROWSETSUPPORT;
pub const DBPROP_COL_ISLONG = DBPROPENUM21.COL_ISLONG;
pub const DBPROPENUM25 = enum(i32) {
COL_SEED = 282,
COL_INCREMENT = 283,
INIT_GENERALTIMEOUT = 284,
COMSERVICES = 285,
};
pub const DBPROP_COL_SEED = DBPROPENUM25.COL_SEED;
pub const DBPROP_COL_INCREMENT = DBPROPENUM25.COL_INCREMENT;
pub const DBPROP_INIT_GENERALTIMEOUT = DBPROPENUM25.INIT_GENERALTIMEOUT;
pub const DBPROP_COMSERVICES = DBPROPENUM25.COMSERVICES;
pub const DBPROPENUM26 = enum(i32) {
DBPROP_OUTPUTSTREAM = 286,
DBPROP_OUTPUTENCODING = 287,
DBPROP_TABLESTATISTICS = 288,
DBPROP_SKIPROWCOUNTRESULTS = 291,
DBPROP_IRowsetBookmark = 292,
MDPROP_VISUALMODE = 293,
};
pub const DBPROP_OUTPUTSTREAM = DBPROPENUM26.DBPROP_OUTPUTSTREAM;
pub const DBPROP_OUTPUTENCODING = DBPROPENUM26.DBPROP_OUTPUTENCODING;
pub const DBPROP_TABLESTATISTICS = DBPROPENUM26.DBPROP_TABLESTATISTICS;
pub const DBPROP_SKIPROWCOUNTRESULTS = DBPROPENUM26.DBPROP_SKIPROWCOUNTRESULTS;
pub const DBPROP_IRowsetBookmark = DBPROPENUM26.DBPROP_IRowsetBookmark;
pub const MDPROP_VISUALMODE = DBPROPENUM26.MDPROP_VISUALMODE;
pub const DBPARAMFLAGSENUM = enum(i32) {
INPUT = 1,
OUTPUT = 2,
SIGNED = 16,
NULLABLE = 64,
LONG = 128,
};
pub const DBPARAMFLAGS_ISINPUT = DBPARAMFLAGSENUM.INPUT;
pub const DBPARAMFLAGS_ISOUTPUT = DBPARAMFLAGSENUM.OUTPUT;
pub const DBPARAMFLAGS_ISSIGNED = DBPARAMFLAGSENUM.SIGNED;
pub const DBPARAMFLAGS_ISNULLABLE = DBPARAMFLAGSENUM.NULLABLE;
pub const DBPARAMFLAGS_ISLONG = DBPARAMFLAGSENUM.LONG;
pub const DBPARAMFLAGSENUM20 = enum(i32) {
E = 256,
};
pub const DBPARAMFLAGS_SCALEISNEGATIVE = DBPARAMFLAGSENUM20.E;
pub const DBPROPFLAGSENUM = enum(i32) {
NOTSUPPORTED = 0,
COLUMN = 1,
DATASOURCE = 2,
DATASOURCECREATE = 4,
DATASOURCEINFO = 8,
DBINIT = 16,
INDEX = 32,
ROWSET = 64,
TABLE = 128,
COLUMNOK = 256,
READ = 512,
WRITE = 1024,
REQUIRED = 2048,
SESSION = 4096,
};
pub const DBPROPFLAGS_NOTSUPPORTED = DBPROPFLAGSENUM.NOTSUPPORTED;
pub const DBPROPFLAGS_COLUMN = DBPROPFLAGSENUM.COLUMN;
pub const DBPROPFLAGS_DATASOURCE = DBPROPFLAGSENUM.DATASOURCE;
pub const DBPROPFLAGS_DATASOURCECREATE = DBPROPFLAGSENUM.DATASOURCECREATE;
pub const DBPROPFLAGS_DATASOURCEINFO = DBPROPFLAGSENUM.DATASOURCEINFO;
pub const DBPROPFLAGS_DBINIT = DBPROPFLAGSENUM.DBINIT;
pub const DBPROPFLAGS_INDEX = DBPROPFLAGSENUM.INDEX;
pub const DBPROPFLAGS_ROWSET = DBPROPFLAGSENUM.ROWSET;
pub const DBPROPFLAGS_TABLE = DBPROPFLAGSENUM.TABLE;
pub const DBPROPFLAGS_COLUMNOK = DBPROPFLAGSENUM.COLUMNOK;
pub const DBPROPFLAGS_READ = DBPROPFLAGSENUM.READ;
pub const DBPROPFLAGS_WRITE = DBPROPFLAGSENUM.WRITE;
pub const DBPROPFLAGS_REQUIRED = DBPROPFLAGSENUM.REQUIRED;
pub const DBPROPFLAGS_SESSION = DBPROPFLAGSENUM.SESSION;
pub const DBPROPFLAGSENUM21 = enum(i32) {
E = 8192,
};
pub const DBPROPFLAGS_TRUSTEE = DBPROPFLAGSENUM21.E;
pub const DBPROPFLAGSENUM25 = enum(i32) {
W = 16384,
};
pub const DBPROPFLAGS_VIEW = DBPROPFLAGSENUM25.W;
pub const DBPROPFLAGSENUM26 = enum(i32) {
M = 32768,
};
pub const DBPROPFLAGS_STREAM = DBPROPFLAGSENUM26.M;
pub const DBPROPOPTIONSENUM = enum(i32) {
REQUIRED = 0,
SETIFCHEAP = 1,
// OPTIONAL = 1, this enum value conflicts with SETIFCHEAP
};
pub const DBPROPOPTIONS_REQUIRED = DBPROPOPTIONSENUM.REQUIRED;
pub const DBPROPOPTIONS_SETIFCHEAP = DBPROPOPTIONSENUM.SETIFCHEAP;
pub const DBPROPOPTIONS_OPTIONAL = DBPROPOPTIONSENUM.SETIFCHEAP;
pub const DBPROPSTATUSENUM = enum(i32) {
OK = 0,
NOTSUPPORTED = 1,
BADVALUE = 2,
BADOPTION = 3,
BADCOLUMN = 4,
NOTALLSETTABLE = 5,
NOTSETTABLE = 6,
NOTSET = 7,
CONFLICTING = 8,
};
pub const DBPROPSTATUS_OK = DBPROPSTATUSENUM.OK;
pub const DBPROPSTATUS_NOTSUPPORTED = DBPROPSTATUSENUM.NOTSUPPORTED;
pub const DBPROPSTATUS_BADVALUE = DBPROPSTATUSENUM.BADVALUE;
pub const DBPROPSTATUS_BADOPTION = DBPROPSTATUSENUM.BADOPTION;
pub const DBPROPSTATUS_BADCOLUMN = DBPROPSTATUSENUM.BADCOLUMN;
pub const DBPROPSTATUS_NOTALLSETTABLE = DBPROPSTATUSENUM.NOTALLSETTABLE;
pub const DBPROPSTATUS_NOTSETTABLE = DBPROPSTATUSENUM.NOTSETTABLE;
pub const DBPROPSTATUS_NOTSET = DBPROPSTATUSENUM.NOTSET;
pub const DBPROPSTATUS_CONFLICTING = DBPROPSTATUSENUM.CONFLICTING;
pub const DBPROPSTATUSENUM21 = enum(i32) {
E = 9,
};
pub const DBPROPSTATUS_NOTAVAILABLE = DBPROPSTATUSENUM21.E;
pub const DBINDEX_COL_ORDERENUM = enum(i32) {
ASC = 0,
DESC = 1,
};
pub const DBINDEX_COL_ORDER_ASC = DBINDEX_COL_ORDERENUM.ASC;
pub const DBINDEX_COL_ORDER_DESC = DBINDEX_COL_ORDERENUM.DESC;
pub const DBCOLUMNDESCFLAGSENUM = enum(i32) {
TYPENAME = 1,
ITYPEINFO = 2,
PROPERTIES = 4,
CLSID = 8,
COLSIZE = 16,
DBCID = 32,
WTYPE = 64,
PRECISION = 128,
SCALE = 256,
};
pub const DBCOLUMNDESCFLAGS_TYPENAME = DBCOLUMNDESCFLAGSENUM.TYPENAME;
pub const DBCOLUMNDESCFLAGS_ITYPEINFO = DBCOLUMNDESCFLAGSENUM.ITYPEINFO;
pub const DBCOLUMNDESCFLAGS_PROPERTIES = DBCOLUMNDESCFLAGSENUM.PROPERTIES;
pub const DBCOLUMNDESCFLAGS_CLSID = DBCOLUMNDESCFLAGSENUM.CLSID;
pub const DBCOLUMNDESCFLAGS_COLSIZE = DBCOLUMNDESCFLAGSENUM.COLSIZE;
pub const DBCOLUMNDESCFLAGS_DBCID = DBCOLUMNDESCFLAGSENUM.DBCID;
pub const DBCOLUMNDESCFLAGS_WTYPE = DBCOLUMNDESCFLAGSENUM.WTYPE;
pub const DBCOLUMNDESCFLAGS_PRECISION = DBCOLUMNDESCFLAGSENUM.PRECISION;
pub const DBCOLUMNDESCFLAGS_SCALE = DBCOLUMNDESCFLAGSENUM.SCALE;
pub const DBEVENTPHASEENUM = enum(i32) {
OKTODO = 0,
ABOUTTODO = 1,
SYNCHAFTER = 2,
FAILEDTODO = 3,
DIDEVENT = 4,
};
pub const DBEVENTPHASE_OKTODO = DBEVENTPHASEENUM.OKTODO;
pub const DBEVENTPHASE_ABOUTTODO = DBEVENTPHASEENUM.ABOUTTODO;
pub const DBEVENTPHASE_SYNCHAFTER = DBEVENTPHASEENUM.SYNCHAFTER;
pub const DBEVENTPHASE_FAILEDTODO = DBEVENTPHASEENUM.FAILEDTODO;
pub const DBEVENTPHASE_DIDEVENT = DBEVENTPHASEENUM.DIDEVENT;
pub const DBREASONENUM = enum(i32) {
ROWSET_FETCHPOSITIONCHANGE = 0,
ROWSET_RELEASE = 1,
COLUMN_SET = 2,
COLUMN_RECALCULATED = 3,
ROW_ACTIVATE = 4,
ROW_RELEASE = 5,
ROW_DELETE = 6,
ROW_FIRSTCHANGE = 7,
ROW_INSERT = 8,
ROW_RESYNCH = 9,
ROW_UNDOCHANGE = 10,
ROW_UNDOINSERT = 11,
ROW_UNDODELETE = 12,
ROW_UPDATE = 13,
ROWSET_CHANGED = 14,
};
pub const DBREASON_ROWSET_FETCHPOSITIONCHANGE = DBREASONENUM.ROWSET_FETCHPOSITIONCHANGE;
pub const DBREASON_ROWSET_RELEASE = DBREASONENUM.ROWSET_RELEASE;
pub const DBREASON_COLUMN_SET = DBREASONENUM.COLUMN_SET;
pub const DBREASON_COLUMN_RECALCULATED = DBREASONENUM.COLUMN_RECALCULATED;
pub const DBREASON_ROW_ACTIVATE = DBREASONENUM.ROW_ACTIVATE;
pub const DBREASON_ROW_RELEASE = DBREASONENUM.ROW_RELEASE;
pub const DBREASON_ROW_DELETE = DBREASONENUM.ROW_DELETE;
pub const DBREASON_ROW_FIRSTCHANGE = DBREASONENUM.ROW_FIRSTCHANGE;
pub const DBREASON_ROW_INSERT = DBREASONENUM.ROW_INSERT;
pub const DBREASON_ROW_RESYNCH = DBREASONENUM.ROW_RESYNCH;
pub const DBREASON_ROW_UNDOCHANGE = DBREASONENUM.ROW_UNDOCHANGE;
pub const DBREASON_ROW_UNDOINSERT = DBREASONENUM.ROW_UNDOINSERT;
pub const DBREASON_ROW_UNDODELETE = DBREASONENUM.ROW_UNDODELETE;
pub const DBREASON_ROW_UPDATE = DBREASONENUM.ROW_UPDATE;
pub const DBREASON_ROWSET_CHANGED = DBREASONENUM.ROWSET_CHANGED;
pub const DBREASONENUM15 = enum(i32) {
POSITION_CHANGED = 15,
POSITION_CHAPTERCHANGED = 16,
POSITION_CLEARED = 17,
_ASYNCHINSERT = 18,
};
pub const DBREASON_ROWPOSITION_CHANGED = DBREASONENUM15.POSITION_CHANGED;
pub const DBREASON_ROWPOSITION_CHAPTERCHANGED = DBREASONENUM15.POSITION_CHAPTERCHANGED;
pub const DBREASON_ROWPOSITION_CLEARED = DBREASONENUM15.POSITION_CLEARED;
pub const DBREASON_ROW_ASYNCHINSERT = DBREASONENUM15._ASYNCHINSERT;
pub const DBCOMPAREOPSENUM = enum(i32) {
LT = 0,
LE = 1,
EQ = 2,
GE = 3,
GT = 4,
BEGINSWITH = 5,
CONTAINS = 6,
NE = 7,
IGNORE = 8,
CASESENSITIVE = 4096,
CASEINSENSITIVE = 8192,
};
pub const DBCOMPAREOPS_LT = DBCOMPAREOPSENUM.LT;
pub const DBCOMPAREOPS_LE = DBCOMPAREOPSENUM.LE;
pub const DBCOMPAREOPS_EQ = DBCOMPAREOPSENUM.EQ;
pub const DBCOMPAREOPS_GE = DBCOMPAREOPSENUM.GE;
pub const DBCOMPAREOPS_GT = DBCOMPAREOPSENUM.GT;
pub const DBCOMPAREOPS_BEGINSWITH = DBCOMPAREOPSENUM.BEGINSWITH;
pub const DBCOMPAREOPS_CONTAINS = DBCOMPAREOPSENUM.CONTAINS;
pub const DBCOMPAREOPS_NE = DBCOMPAREOPSENUM.NE;
pub const DBCOMPAREOPS_IGNORE = DBCOMPAREOPSENUM.IGNORE;
pub const DBCOMPAREOPS_CASESENSITIVE = DBCOMPAREOPSENUM.CASESENSITIVE;
pub const DBCOMPAREOPS_CASEINSENSITIVE = DBCOMPAREOPSENUM.CASEINSENSITIVE;
pub const DBCOMPAREOPSENUM20 = enum(i32) {
BEGINSWITH = 9,
CONTAINS = 10,
};
pub const DBCOMPAREOPS_NOTBEGINSWITH = DBCOMPAREOPSENUM20.BEGINSWITH;
pub const DBCOMPAREOPS_NOTCONTAINS = DBCOMPAREOPSENUM20.CONTAINS;
pub const DBASYNCHOPENUM = enum(i32) {
N = 0,
};
pub const DBASYNCHOP_OPEN = DBASYNCHOPENUM.N;
pub const DBASYNCHPHASEENUM = enum(i32) {
INITIALIZATION = 0,
POPULATION = 1,
COMPLETE = 2,
CANCELED = 3,
};
pub const DBASYNCHPHASE_INITIALIZATION = DBASYNCHPHASEENUM.INITIALIZATION;
pub const DBASYNCHPHASE_POPULATION = DBASYNCHPHASEENUM.POPULATION;
pub const DBASYNCHPHASE_COMPLETE = DBASYNCHPHASEENUM.COMPLETE;
pub const DBASYNCHPHASE_CANCELED = DBASYNCHPHASEENUM.CANCELED;
pub const DBSORTENUM = enum(i32) {
ASCENDING = 0,
DESCENDING = 1,
};
pub const DBSORT_ASCENDING = DBSORTENUM.ASCENDING;
pub const DBSORT_DESCENDING = DBSORTENUM.DESCENDING;
pub const DBCOMMANDPERSISTFLAGENUM = enum(i32) {
E = 1,
};
pub const DBCOMMANDPERSISTFLAG_NOSAVE = DBCOMMANDPERSISTFLAGENUM.E;
pub const DBCOMMANDPERSISTFLAGENUM21 = enum(i32) {
DEFAULT = 0,
PERSISTVIEW = 2,
PERSISTPROCEDURE = 4,
};
pub const DBCOMMANDPERSISTFLAG_DEFAULT = DBCOMMANDPERSISTFLAGENUM21.DEFAULT;
pub const DBCOMMANDPERSISTFLAG_PERSISTVIEW = DBCOMMANDPERSISTFLAGENUM21.PERSISTVIEW;
pub const DBCOMMANDPERSISTFLAG_PERSISTPROCEDURE = DBCOMMANDPERSISTFLAGENUM21.PERSISTPROCEDURE;
pub const DBCONSTRAINTTYPEENUM = enum(i32) {
UNIQUE = 0,
FOREIGNKEY = 1,
PRIMARYKEY = 2,
CHECK = 3,
};
pub const DBCONSTRAINTTYPE_UNIQUE = DBCONSTRAINTTYPEENUM.UNIQUE;
pub const DBCONSTRAINTTYPE_FOREIGNKEY = DBCONSTRAINTTYPEENUM.FOREIGNKEY;
pub const DBCONSTRAINTTYPE_PRIMARYKEY = DBCONSTRAINTTYPEENUM.PRIMARYKEY;
pub const DBCONSTRAINTTYPE_CHECK = DBCONSTRAINTTYPEENUM.CHECK;
pub const DBUPDELRULEENUM = enum(i32) {
NOACTION = 0,
CASCADE = 1,
SETNULL = 2,
SETDEFAULT = 3,
};
pub const DBUPDELRULE_NOACTION = DBUPDELRULEENUM.NOACTION;
pub const DBUPDELRULE_CASCADE = DBUPDELRULEENUM.CASCADE;
pub const DBUPDELRULE_SETNULL = DBUPDELRULEENUM.SETNULL;
pub const DBUPDELRULE_SETDEFAULT = DBUPDELRULEENUM.SETDEFAULT;
pub const DBMATCHTYPEENUM = enum(i32) {
FULL = 0,
NONE = 1,
PARTIAL = 2,
};
pub const DBMATCHTYPE_FULL = DBMATCHTYPEENUM.FULL;
pub const DBMATCHTYPE_NONE = DBMATCHTYPEENUM.NONE;
pub const DBMATCHTYPE_PARTIAL = DBMATCHTYPEENUM.PARTIAL;
pub const DBDEFERRABILITYENUM = enum(i32) {
ED = 1,
ABLE = 2,
};
pub const DBDEFERRABILITY_DEFERRED = DBDEFERRABILITYENUM.ED;
pub const DBDEFERRABILITY_DEFERRABLE = DBDEFERRABILITYENUM.ABLE;
pub const DBACCESSORFLAGSENUM = enum(i32) {
INVALID = 0,
PASSBYREF = 1,
ROWDATA = 2,
PARAMETERDATA = 4,
OPTIMIZED = 8,
INHERITED = 16,
};
pub const DBACCESSOR_INVALID = DBACCESSORFLAGSENUM.INVALID;
pub const DBACCESSOR_PASSBYREF = DBACCESSORFLAGSENUM.PASSBYREF;
pub const DBACCESSOR_ROWDATA = DBACCESSORFLAGSENUM.ROWDATA;
pub const DBACCESSOR_PARAMETERDATA = DBACCESSORFLAGSENUM.PARAMETERDATA;
pub const DBACCESSOR_OPTIMIZED = DBACCESSORFLAGSENUM.OPTIMIZED;
pub const DBACCESSOR_INHERITED = DBACCESSORFLAGSENUM.INHERITED;
pub const DBBINDSTATUSENUM = enum(i32) {
OK = 0,
BADORDINAL = 1,
UNSUPPORTEDCONVERSION = 2,
BADBINDINFO = 3,
BADSTORAGEFLAGS = 4,
NOINTERFACE = 5,
MULTIPLESTORAGE = 6,
};
pub const DBBINDSTATUS_OK = DBBINDSTATUSENUM.OK;
pub const DBBINDSTATUS_BADORDINAL = DBBINDSTATUSENUM.BADORDINAL;
pub const DBBINDSTATUS_UNSUPPORTEDCONVERSION = DBBINDSTATUSENUM.UNSUPPORTEDCONVERSION;
pub const DBBINDSTATUS_BADBINDINFO = DBBINDSTATUSENUM.BADBINDINFO;
pub const DBBINDSTATUS_BADSTORAGEFLAGS = DBBINDSTATUSENUM.BADSTORAGEFLAGS;
pub const DBBINDSTATUS_NOINTERFACE = DBBINDSTATUSENUM.NOINTERFACE;
pub const DBBINDSTATUS_MULTIPLESTORAGE = DBBINDSTATUSENUM.MULTIPLESTORAGE;
const IID_IAccessor_Value = Guid.initString("0c733a8c-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IAccessor = &IID_IAccessor_Value;
pub const IAccessor = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddRefAccessor: fn(
self: *const IAccessor,
hAccessor: usize,
pcRefCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAccessor: fn(
self: *const IAccessor,
dwAccessorFlags: u32,
cBindings: usize,
rgBindings: [*]const DBBINDING,
cbRowSize: usize,
phAccessor: ?*usize,
rgStatus: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBindings: fn(
self: *const IAccessor,
hAccessor: usize,
pdwAccessorFlags: ?*u32,
pcBindings: ?*usize,
prgBindings: ?*?*DBBINDING,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseAccessor: fn(
self: *const IAccessor,
hAccessor: usize,
pcRefCount: ?*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 IAccessor_AddRefAccessor(self: *const T, hAccessor: usize, pcRefCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAccessor.VTable, self.vtable).AddRefAccessor(@ptrCast(*const IAccessor, self), hAccessor, pcRefCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAccessor_CreateAccessor(self: *const T, dwAccessorFlags: u32, cBindings: usize, rgBindings: [*]const DBBINDING, cbRowSize: usize, phAccessor: ?*usize, rgStatus: ?[*]u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAccessor.VTable, self.vtable).CreateAccessor(@ptrCast(*const IAccessor, self), dwAccessorFlags, cBindings, rgBindings, cbRowSize, phAccessor, rgStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAccessor_GetBindings(self: *const T, hAccessor: usize, pdwAccessorFlags: ?*u32, pcBindings: ?*usize, prgBindings: ?*?*DBBINDING) callconv(.Inline) HRESULT {
return @ptrCast(*const IAccessor.VTable, self.vtable).GetBindings(@ptrCast(*const IAccessor, self), hAccessor, pdwAccessorFlags, pcBindings, prgBindings);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAccessor_ReleaseAccessor(self: *const T, hAccessor: usize, pcRefCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IAccessor.VTable, self.vtable).ReleaseAccessor(@ptrCast(*const IAccessor, self), hAccessor, pcRefCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowset_Value = Guid.initString("0c733a7c-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowset = &IID_IRowset_Value;
pub const IRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddRefRows: fn(
self: *const IRowset,
cRows: usize,
rghRows: ?*const usize,
rgRefCounts: ?*u32,
rgRowStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetData: fn(
self: *const IRowset,
hRow: usize,
hAccessor: usize,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNextRows: fn(
self: *const IRowset,
hReserved: usize,
lRowsOffset: isize,
cRows: isize,
pcRowsObtained: ?*usize,
prghRows: ?*?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseRows: fn(
self: *const IRowset,
cRows: usize,
rghRows: ?*const usize,
rgRowOptions: ?*u32,
rgRefCounts: ?*u32,
rgRowStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RestartPosition: fn(
self: *const IRowset,
hReserved: usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowset_AddRefRows(self: *const T, cRows: usize, rghRows: ?*const usize, rgRefCounts: ?*u32, rgRowStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowset.VTable, self.vtable).AddRefRows(@ptrCast(*const IRowset, self), cRows, rghRows, rgRefCounts, rgRowStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowset_GetData(self: *const T, hRow: usize, hAccessor: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowset.VTable, self.vtable).GetData(@ptrCast(*const IRowset, self), hRow, hAccessor, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowset_GetNextRows(self: *const T, hReserved: usize, lRowsOffset: isize, cRows: isize, pcRowsObtained: ?*usize, prghRows: ?*?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowset.VTable, self.vtable).GetNextRows(@ptrCast(*const IRowset, self), hReserved, lRowsOffset, cRows, pcRowsObtained, prghRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowset_ReleaseRows(self: *const T, cRows: usize, rghRows: ?*const usize, rgRowOptions: ?*u32, rgRefCounts: ?*u32, rgRowStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowset.VTable, self.vtable).ReleaseRows(@ptrCast(*const IRowset, self), cRows, rghRows, rgRowOptions, rgRefCounts, rgRowStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowset_RestartPosition(self: *const T, hReserved: usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowset.VTable, self.vtable).RestartPosition(@ptrCast(*const IRowset, self), hReserved);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetInfo_Value = Guid.initString("0c733a55-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetInfo = &IID_IRowsetInfo_Value;
pub const IRowsetInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetProperties: fn(
self: *const IRowsetInfo,
cPropertyIDSets: u32,
rgPropertyIDSets: ?[*]const DBPROPIDSET,
pcPropertySets: ?*u32,
prgPropertySets: ?*?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetReferencedRowset: fn(
self: *const IRowsetInfo,
iOrdinal: usize,
riid: ?*const Guid,
ppReferencedRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSpecification: fn(
self: *const IRowsetInfo,
riid: ?*const Guid,
ppSpecification: ?*?*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 IRowsetInfo_GetProperties(self: *const T, cPropertyIDSets: u32, rgPropertyIDSets: ?[*]const DBPROPIDSET, pcPropertySets: ?*u32, prgPropertySets: ?*?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetInfo.VTable, self.vtable).GetProperties(@ptrCast(*const IRowsetInfo, self), cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetInfo_GetReferencedRowset(self: *const T, iOrdinal: usize, riid: ?*const Guid, ppReferencedRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetInfo.VTable, self.vtable).GetReferencedRowset(@ptrCast(*const IRowsetInfo, self), iOrdinal, riid, ppReferencedRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetInfo_GetSpecification(self: *const T, riid: ?*const Guid, ppSpecification: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetInfo.VTable, self.vtable).GetSpecification(@ptrCast(*const IRowsetInfo, self), riid, ppSpecification);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBCOMPAREENUM = enum(i32) {
LT = 0,
EQ = 1,
GT = 2,
NE = 3,
NOTCOMPARABLE = 4,
};
pub const DBCOMPARE_LT = DBCOMPAREENUM.LT;
pub const DBCOMPARE_EQ = DBCOMPAREENUM.EQ;
pub const DBCOMPARE_GT = DBCOMPAREENUM.GT;
pub const DBCOMPARE_NE = DBCOMPAREENUM.NE;
pub const DBCOMPARE_NOTCOMPARABLE = DBCOMPAREENUM.NOTCOMPARABLE;
const IID_IRowsetLocate_Value = Guid.initString("0c733a7d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetLocate = &IID_IRowsetLocate_Value;
pub const IRowsetLocate = extern struct {
pub const VTable = extern struct {
base: IRowset.VTable,
Compare: fn(
self: *const IRowsetLocate,
hReserved: usize,
cbBookmark1: usize,
pBookmark1: ?*const u8,
cbBookmark2: usize,
pBookmark2: ?*const u8,
pComparison: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRowsAt: fn(
self: *const IRowsetLocate,
hReserved1: usize,
hReserved2: usize,
cbBookmark: usize,
pBookmark: ?*const u8,
lRowsOffset: isize,
cRows: isize,
pcRowsObtained: ?*usize,
prghRows: ?*?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRowsByBookmark: fn(
self: *const IRowsetLocate,
hReserved: usize,
cRows: usize,
rgcbBookmarks: ?*const usize,
rgpBookmarks: ?*const ?*u8,
rghRows: ?*usize,
rgRowStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Hash: fn(
self: *const IRowsetLocate,
hReserved: usize,
cBookmarks: usize,
rgcbBookmarks: ?*const usize,
rgpBookmarks: ?*const ?*u8,
rgHashedValues: ?*usize,
rgBookmarkStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IRowset.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetLocate_Compare(self: *const T, hReserved: usize, cbBookmark1: usize, pBookmark1: ?*const u8, cbBookmark2: usize, pBookmark2: ?*const u8, pComparison: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetLocate.VTable, self.vtable).Compare(@ptrCast(*const IRowsetLocate, self), hReserved, cbBookmark1, pBookmark1, cbBookmark2, pBookmark2, pComparison);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetLocate_GetRowsAt(self: *const T, hReserved1: usize, hReserved2: usize, cbBookmark: usize, pBookmark: ?*const u8, lRowsOffset: isize, cRows: isize, pcRowsObtained: ?*usize, prghRows: ?*?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetLocate.VTable, self.vtable).GetRowsAt(@ptrCast(*const IRowsetLocate, self), hReserved1, hReserved2, cbBookmark, pBookmark, lRowsOffset, cRows, pcRowsObtained, prghRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetLocate_GetRowsByBookmark(self: *const T, hReserved: usize, cRows: usize, rgcbBookmarks: ?*const usize, rgpBookmarks: ?*const ?*u8, rghRows: ?*usize, rgRowStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetLocate.VTable, self.vtable).GetRowsByBookmark(@ptrCast(*const IRowsetLocate, self), hReserved, cRows, rgcbBookmarks, rgpBookmarks, rghRows, rgRowStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetLocate_Hash(self: *const T, hReserved: usize, cBookmarks: usize, rgcbBookmarks: ?*const usize, rgpBookmarks: ?*const ?*u8, rgHashedValues: ?*usize, rgBookmarkStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetLocate.VTable, self.vtable).Hash(@ptrCast(*const IRowsetLocate, self), hReserved, cBookmarks, rgcbBookmarks, rgpBookmarks, rgHashedValues, rgBookmarkStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetResynch_Value = Guid.initString("0c733a84-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetResynch = &IID_IRowsetResynch_Value;
pub const IRowsetResynch = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetVisibleData: fn(
self: *const IRowsetResynch,
hRow: usize,
hAccessor: usize,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResynchRows: fn(
self: *const IRowsetResynch,
cRows: usize,
rghRows: ?*const usize,
pcRowsResynched: ?*usize,
prghRowsResynched: ?*?*usize,
prgRowStatus: ?*?*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 IRowsetResynch_GetVisibleData(self: *const T, hRow: usize, hAccessor: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetResynch.VTable, self.vtable).GetVisibleData(@ptrCast(*const IRowsetResynch, self), hRow, hAccessor, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetResynch_ResynchRows(self: *const T, cRows: usize, rghRows: ?*const usize, pcRowsResynched: ?*usize, prghRowsResynched: ?*?*usize, prgRowStatus: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetResynch.VTable, self.vtable).ResynchRows(@ptrCast(*const IRowsetResynch, self), cRows, rghRows, pcRowsResynched, prghRowsResynched, prgRowStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetScroll_Value = Guid.initString("0c733a7e-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetScroll = &IID_IRowsetScroll_Value;
pub const IRowsetScroll = extern struct {
pub const VTable = extern struct {
base: IRowsetLocate.VTable,
GetApproximatePosition: fn(
self: *const IRowsetScroll,
hReserved: usize,
cbBookmark: usize,
pBookmark: ?*const u8,
pulPosition: ?*usize,
pcRows: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRowsAtRatio: fn(
self: *const IRowsetScroll,
hReserved1: usize,
hReserved2: usize,
ulNumerator: usize,
ulDenominator: usize,
cRows: isize,
pcRowsObtained: ?*usize,
prghRows: ?*?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IRowsetLocate.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetScroll_GetApproximatePosition(self: *const T, hReserved: usize, cbBookmark: usize, pBookmark: ?*const u8, pulPosition: ?*usize, pcRows: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetScroll.VTable, self.vtable).GetApproximatePosition(@ptrCast(*const IRowsetScroll, self), hReserved, cbBookmark, pBookmark, pulPosition, pcRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetScroll_GetRowsAtRatio(self: *const T, hReserved1: usize, hReserved2: usize, ulNumerator: usize, ulDenominator: usize, cRows: isize, pcRowsObtained: ?*usize, prghRows: ?*?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetScroll.VTable, self.vtable).GetRowsAtRatio(@ptrCast(*const IRowsetScroll, self), hReserved1, hReserved2, ulNumerator, ulDenominator, cRows, pcRowsObtained, prghRows);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IChapteredRowset_Value = Guid.initString("0c733a93-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IChapteredRowset = &IID_IChapteredRowset_Value;
pub const IChapteredRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddRefChapter: fn(
self: *const IChapteredRowset,
hChapter: usize,
pcRefCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseChapter: fn(
self: *const IChapteredRowset,
hChapter: usize,
pcRefCount: ?*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 IChapteredRowset_AddRefChapter(self: *const T, hChapter: usize, pcRefCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IChapteredRowset.VTable, self.vtable).AddRefChapter(@ptrCast(*const IChapteredRowset, self), hChapter, pcRefCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IChapteredRowset_ReleaseChapter(self: *const T, hChapter: usize, pcRefCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IChapteredRowset.VTable, self.vtable).ReleaseChapter(@ptrCast(*const IChapteredRowset, self), hChapter, pcRefCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetFind_Value = Guid.initString("0c733a9d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetFind = &IID_IRowsetFind_Value;
pub const IRowsetFind = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
FindNextRow: fn(
self: *const IRowsetFind,
hChapter: usize,
hAccessor: usize,
pFindValue: ?*anyopaque,
CompareOp: u32,
cbBookmark: usize,
pBookmark: ?*const u8,
lRowsOffset: isize,
cRows: isize,
pcRowsObtained: ?*usize,
prghRows: ?*?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetFind_FindNextRow(self: *const T, hChapter: usize, hAccessor: usize, pFindValue: ?*anyopaque, CompareOp: u32, cbBookmark: usize, pBookmark: ?*const u8, lRowsOffset: isize, cRows: isize, pcRowsObtained: ?*usize, prghRows: ?*?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetFind.VTable, self.vtable).FindNextRow(@ptrCast(*const IRowsetFind, self), hChapter, hAccessor, pFindValue, CompareOp, cbBookmark, pBookmark, lRowsOffset, cRows, pcRowsObtained, prghRows);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBPOSITIONFLAGSENUM = enum(i32) {
OK = 0,
NOROW = 1,
BOF = 2,
EOF = 3,
};
pub const DBPOSITION_OK = DBPOSITIONFLAGSENUM.OK;
pub const DBPOSITION_NOROW = DBPOSITIONFLAGSENUM.NOROW;
pub const DBPOSITION_BOF = DBPOSITIONFLAGSENUM.BOF;
pub const DBPOSITION_EOF = DBPOSITIONFLAGSENUM.EOF;
const IID_IRowPosition_Value = Guid.initString("0c733a94-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowPosition = &IID_IRowPosition_Value;
pub const IRowPosition = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ClearRowPosition: fn(
self: *const IRowPosition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRowPosition: fn(
self: *const IRowPosition,
phChapter: ?*usize,
phRow: ?*usize,
pdwPositionFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRowset: fn(
self: *const IRowPosition,
riid: ?*const Guid,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Initialize: fn(
self: *const IRowPosition,
pRowset: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRowPosition: fn(
self: *const IRowPosition,
hChapter: usize,
hRow: usize,
dwPositionFlags: 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 IRowPosition_ClearRowPosition(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowPosition.VTable, self.vtable).ClearRowPosition(@ptrCast(*const IRowPosition, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowPosition_GetRowPosition(self: *const T, phChapter: ?*usize, phRow: ?*usize, pdwPositionFlags: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowPosition.VTable, self.vtable).GetRowPosition(@ptrCast(*const IRowPosition, self), phChapter, phRow, pdwPositionFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowPosition_GetRowset(self: *const T, riid: ?*const Guid, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowPosition.VTable, self.vtable).GetRowset(@ptrCast(*const IRowPosition, self), riid, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowPosition_Initialize(self: *const T, pRowset: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowPosition.VTable, self.vtable).Initialize(@ptrCast(*const IRowPosition, self), pRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowPosition_SetRowPosition(self: *const T, hChapter: usize, hRow: usize, dwPositionFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowPosition.VTable, self.vtable).SetRowPosition(@ptrCast(*const IRowPosition, self), hChapter, hRow, dwPositionFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowPositionChange_Value = Guid.initString("0997a571-126e-11d0-9f8a-00a0c9a0631e");
pub const IID_IRowPositionChange = &IID_IRowPositionChange_Value;
pub const IRowPositionChange = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnRowPositionChange: fn(
self: *const IRowPositionChange,
eReason: u32,
ePhase: u32,
fCantDeny: 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 IRowPositionChange_OnRowPositionChange(self: *const T, eReason: u32, ePhase: u32, fCantDeny: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowPositionChange.VTable, self.vtable).OnRowPositionChange(@ptrCast(*const IRowPositionChange, self), eReason, ePhase, fCantDeny);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IViewRowset_Value = Guid.initString("0c733a97-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IViewRowset = &IID_IViewRowset_Value;
pub const IViewRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSpecification: fn(
self: *const IViewRowset,
riid: ?*const Guid,
ppObject: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenViewRowset: fn(
self: *const IViewRowset,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
ppRowset: ?*?*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 IViewRowset_GetSpecification(self: *const T, riid: ?*const Guid, ppObject: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewRowset.VTable, self.vtable).GetSpecification(@ptrCast(*const IViewRowset, self), riid, ppObject);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IViewRowset_OpenViewRowset(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewRowset.VTable, self.vtable).OpenViewRowset(@ptrCast(*const IViewRowset, self), pUnkOuter, riid, ppRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IViewChapter_Value = Guid.initString("0c733a98-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IViewChapter = &IID_IViewChapter_Value;
pub const IViewChapter = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSpecification: fn(
self: *const IViewChapter,
riid: ?*const Guid,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenViewChapter: fn(
self: *const IViewChapter,
hSource: usize,
phViewChapter: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IViewChapter_GetSpecification(self: *const T, riid: ?*const Guid, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewChapter.VTable, self.vtable).GetSpecification(@ptrCast(*const IViewChapter, self), riid, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IViewChapter_OpenViewChapter(self: *const T, hSource: usize, phViewChapter: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewChapter.VTable, self.vtable).OpenViewChapter(@ptrCast(*const IViewChapter, self), hSource, phViewChapter);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IViewSort_Value = Guid.initString("0c733a9a-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IViewSort = &IID_IViewSort_Value;
pub const IViewSort = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSortOrder: fn(
self: *const IViewSort,
pcValues: ?*usize,
prgColumns: ?*?*usize,
prgOrders: ?*?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSortOrder: fn(
self: *const IViewSort,
cValues: usize,
rgColumns: [*]const usize,
rgOrders: [*]const 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 IViewSort_GetSortOrder(self: *const T, pcValues: ?*usize, prgColumns: ?*?*usize, prgOrders: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewSort.VTable, self.vtable).GetSortOrder(@ptrCast(*const IViewSort, self), pcValues, prgColumns, prgOrders);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IViewSort_SetSortOrder(self: *const T, cValues: usize, rgColumns: [*]const usize, rgOrders: [*]const u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewSort.VTable, self.vtable).SetSortOrder(@ptrCast(*const IViewSort, self), cValues, rgColumns, rgOrders);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IViewFilter_Value = Guid.initString("0c733a9b-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IViewFilter = &IID_IViewFilter_Value;
pub const IViewFilter = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetFilter: fn(
self: *const IViewFilter,
hAccessor: usize,
pcRows: ?*usize,
pCompareOps: [*]?*u32,
pCriteriaData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFilterBindings: fn(
self: *const IViewFilter,
pcBindings: ?*usize,
prgBindings: ?*?*DBBINDING,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetFilter: fn(
self: *const IViewFilter,
hAccessor: usize,
cRows: usize,
CompareOps: [*]u32,
pCriteriaData: ?*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 IViewFilter_GetFilter(self: *const T, hAccessor: usize, pcRows: ?*usize, pCompareOps: [*]?*u32, pCriteriaData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewFilter.VTable, self.vtable).GetFilter(@ptrCast(*const IViewFilter, self), hAccessor, pcRows, pCompareOps, pCriteriaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IViewFilter_GetFilterBindings(self: *const T, pcBindings: ?*usize, prgBindings: ?*?*DBBINDING) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewFilter.VTable, self.vtable).GetFilterBindings(@ptrCast(*const IViewFilter, self), pcBindings, prgBindings);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IViewFilter_SetFilter(self: *const T, hAccessor: usize, cRows: usize, CompareOps: [*]u32, pCriteriaData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IViewFilter.VTable, self.vtable).SetFilter(@ptrCast(*const IViewFilter, self), hAccessor, cRows, CompareOps, pCriteriaData);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetView_Value = Guid.initString("0c733a99-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetView = &IID_IRowsetView_Value;
pub const IRowsetView = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateView: fn(
self: *const IRowsetView,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
ppView: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetView: fn(
self: *const IRowsetView,
hChapter: usize,
riid: ?*const Guid,
phChapterSource: ?*usize,
ppView: ?*?*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 IRowsetView_CreateView(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppView: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetView.VTable, self.vtable).CreateView(@ptrCast(*const IRowsetView, self), pUnkOuter, riid, ppView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetView_GetView(self: *const T, hChapter: usize, riid: ?*const Guid, phChapterSource: ?*usize, ppView: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetView.VTable, self.vtable).GetView(@ptrCast(*const IRowsetView, self), hChapter, riid, phChapterSource, ppView);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetChange_Value = Guid.initString("0c733a05-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetChange = &IID_IRowsetChange_Value;
pub const IRowsetChange = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
DeleteRows: fn(
self: *const IRowsetChange,
hReserved: usize,
cRows: usize,
rghRows: ?*const usize,
rgRowStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetData: fn(
self: *const IRowsetChange,
hRow: usize,
hAccessor: usize,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InsertRow: fn(
self: *const IRowsetChange,
hReserved: usize,
hAccessor: usize,
pData: ?*anyopaque,
phRow: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetChange_DeleteRows(self: *const T, hReserved: usize, cRows: usize, rghRows: ?*const usize, rgRowStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetChange.VTable, self.vtable).DeleteRows(@ptrCast(*const IRowsetChange, self), hReserved, cRows, rghRows, rgRowStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetChange_SetData(self: *const T, hRow: usize, hAccessor: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetChange.VTable, self.vtable).SetData(@ptrCast(*const IRowsetChange, self), hRow, hAccessor, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetChange_InsertRow(self: *const T, hReserved: usize, hAccessor: usize, pData: ?*anyopaque, phRow: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetChange.VTable, self.vtable).InsertRow(@ptrCast(*const IRowsetChange, self), hReserved, hAccessor, pData, phRow);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBPENDINGSTATUSENUM = enum(i32) {
NEW = 1,
CHANGED = 2,
DELETED = 4,
UNCHANGED = 8,
INVALIDROW = 16,
};
pub const DBPENDINGSTATUS_NEW = DBPENDINGSTATUSENUM.NEW;
pub const DBPENDINGSTATUS_CHANGED = DBPENDINGSTATUSENUM.CHANGED;
pub const DBPENDINGSTATUS_DELETED = DBPENDINGSTATUSENUM.DELETED;
pub const DBPENDINGSTATUS_UNCHANGED = DBPENDINGSTATUSENUM.UNCHANGED;
pub const DBPENDINGSTATUS_INVALIDROW = DBPENDINGSTATUSENUM.INVALIDROW;
const IID_IRowsetUpdate_Value = Guid.initString("0c733a6d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetUpdate = &IID_IRowsetUpdate_Value;
pub const IRowsetUpdate = extern struct {
pub const VTable = extern struct {
base: IRowsetChange.VTable,
GetOriginalData: fn(
self: *const IRowsetUpdate,
hRow: usize,
hAccessor: usize,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPendingRows: fn(
self: *const IRowsetUpdate,
hReserved: usize,
dwRowStatus: u32,
pcPendingRows: ?*usize,
prgPendingRows: ?*?*usize,
prgPendingStatus: ?*?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRowStatus: fn(
self: *const IRowsetUpdate,
hReserved: usize,
cRows: usize,
rghRows: ?*const usize,
rgPendingStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Undo: fn(
self: *const IRowsetUpdate,
hReserved: usize,
cRows: usize,
rghRows: ?*const usize,
pcRowsUndone: ?*usize,
prgRowsUndone: ?*?*usize,
prgRowStatus: ?*?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Update: fn(
self: *const IRowsetUpdate,
hReserved: usize,
cRows: usize,
rghRows: ?*const usize,
pcRows: ?*usize,
prgRows: ?*?*usize,
prgRowStatus: ?*?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IRowsetChange.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetUpdate_GetOriginalData(self: *const T, hRow: usize, hAccessor: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetUpdate.VTable, self.vtable).GetOriginalData(@ptrCast(*const IRowsetUpdate, self), hRow, hAccessor, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetUpdate_GetPendingRows(self: *const T, hReserved: usize, dwRowStatus: u32, pcPendingRows: ?*usize, prgPendingRows: ?*?*usize, prgPendingStatus: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetUpdate.VTable, self.vtable).GetPendingRows(@ptrCast(*const IRowsetUpdate, self), hReserved, dwRowStatus, pcPendingRows, prgPendingRows, prgPendingStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetUpdate_GetRowStatus(self: *const T, hReserved: usize, cRows: usize, rghRows: ?*const usize, rgPendingStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetUpdate.VTable, self.vtable).GetRowStatus(@ptrCast(*const IRowsetUpdate, self), hReserved, cRows, rghRows, rgPendingStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetUpdate_Undo(self: *const T, hReserved: usize, cRows: usize, rghRows: ?*const usize, pcRowsUndone: ?*usize, prgRowsUndone: ?*?*usize, prgRowStatus: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetUpdate.VTable, self.vtable).Undo(@ptrCast(*const IRowsetUpdate, self), hReserved, cRows, rghRows, pcRowsUndone, prgRowsUndone, prgRowStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetUpdate_Update(self: *const T, hReserved: usize, cRows: usize, rghRows: ?*const usize, pcRows: ?*usize, prgRows: ?*?*usize, prgRowStatus: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetUpdate.VTable, self.vtable).Update(@ptrCast(*const IRowsetUpdate, self), hReserved, cRows, rghRows, pcRows, prgRows, prgRowStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetIdentity_Value = Guid.initString("0c733a09-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetIdentity = &IID_IRowsetIdentity_Value;
pub const IRowsetIdentity = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
IsSameRow: fn(
self: *const IRowsetIdentity,
hThisRow: usize,
hThatRow: usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetIdentity_IsSameRow(self: *const T, hThisRow: usize, hThatRow: usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetIdentity.VTable, self.vtable).IsSameRow(@ptrCast(*const IRowsetIdentity, self), hThisRow, hThatRow);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetNotify_Value = Guid.initString("0c733a83-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetNotify = &IID_IRowsetNotify_Value;
pub const IRowsetNotify = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnFieldChange: fn(
self: *const IRowsetNotify,
pRowset: ?*IRowset,
hRow: usize,
cColumns: usize,
rgColumns: [*]usize,
eReason: u32,
ePhase: u32,
fCantDeny: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnRowChange: fn(
self: *const IRowsetNotify,
pRowset: ?*IRowset,
cRows: usize,
rghRows: [*]const usize,
eReason: u32,
ePhase: u32,
fCantDeny: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnRowsetChange: fn(
self: *const IRowsetNotify,
pRowset: ?*IRowset,
eReason: u32,
ePhase: u32,
fCantDeny: 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 IRowsetNotify_OnFieldChange(self: *const T, pRowset: ?*IRowset, hRow: usize, cColumns: usize, rgColumns: [*]usize, eReason: u32, ePhase: u32, fCantDeny: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetNotify.VTable, self.vtable).OnFieldChange(@ptrCast(*const IRowsetNotify, self), pRowset, hRow, cColumns, rgColumns, eReason, ePhase, fCantDeny);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetNotify_OnRowChange(self: *const T, pRowset: ?*IRowset, cRows: usize, rghRows: [*]const usize, eReason: u32, ePhase: u32, fCantDeny: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetNotify.VTable, self.vtable).OnRowChange(@ptrCast(*const IRowsetNotify, self), pRowset, cRows, rghRows, eReason, ePhase, fCantDeny);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetNotify_OnRowsetChange(self: *const T, pRowset: ?*IRowset, eReason: u32, ePhase: u32, fCantDeny: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetNotify.VTable, self.vtable).OnRowsetChange(@ptrCast(*const IRowsetNotify, self), pRowset, eReason, ePhase, fCantDeny);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBSEEKENUM = enum(i32) {
INVALID = 0,
FIRSTEQ = 1,
LASTEQ = 2,
AFTEREQ = 4,
AFTER = 8,
BEFOREEQ = 16,
BEFORE = 32,
};
pub const DBSEEK_INVALID = DBSEEKENUM.INVALID;
pub const DBSEEK_FIRSTEQ = DBSEEKENUM.FIRSTEQ;
pub const DBSEEK_LASTEQ = DBSEEKENUM.LASTEQ;
pub const DBSEEK_AFTEREQ = DBSEEKENUM.AFTEREQ;
pub const DBSEEK_AFTER = DBSEEKENUM.AFTER;
pub const DBSEEK_BEFOREEQ = DBSEEKENUM.BEFOREEQ;
pub const DBSEEK_BEFORE = DBSEEKENUM.BEFORE;
pub const DBRANGEENUM = enum(i32) {
INCLUSIVESTART = 0,
// INCLUSIVEEND = 0, this enum value conflicts with INCLUSIVESTART
EXCLUSIVESTART = 1,
EXCLUSIVEEND = 2,
EXCLUDENULLS = 4,
PREFIX = 8,
MATCH = 16,
};
pub const DBRANGE_INCLUSIVESTART = DBRANGEENUM.INCLUSIVESTART;
pub const DBRANGE_INCLUSIVEEND = DBRANGEENUM.INCLUSIVESTART;
pub const DBRANGE_EXCLUSIVESTART = DBRANGEENUM.EXCLUSIVESTART;
pub const DBRANGE_EXCLUSIVEEND = DBRANGEENUM.EXCLUSIVEEND;
pub const DBRANGE_EXCLUDENULLS = DBRANGEENUM.EXCLUDENULLS;
pub const DBRANGE_PREFIX = DBRANGEENUM.PREFIX;
pub const DBRANGE_MATCH = DBRANGEENUM.MATCH;
pub const DBRANGEENUM20 = enum(i32) {
SHIFT = 24,
MASK = 255,
};
pub const DBRANGE_MATCH_N_SHIFT = DBRANGEENUM20.SHIFT;
pub const DBRANGE_MATCH_N_MASK = DBRANGEENUM20.MASK;
const IID_IRowsetIndex_Value = Guid.initString("0c733a82-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetIndex = &IID_IRowsetIndex_Value;
pub const IRowsetIndex = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetIndexInfo: fn(
self: *const IRowsetIndex,
pcKeyColumns: ?*usize,
prgIndexColumnDesc: ?*?*DBINDEXCOLUMNDESC,
pcIndexPropertySets: ?*u32,
prgIndexPropertySets: ?*?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Seek: fn(
self: *const IRowsetIndex,
hAccessor: usize,
cKeyValues: usize,
pData: ?*anyopaque,
dwSeekOptions: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRange: fn(
self: *const IRowsetIndex,
hAccessor: usize,
cStartKeyColumns: usize,
pStartData: ?*anyopaque,
cEndKeyColumns: usize,
pEndData: ?*anyopaque,
dwRangeOptions: 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 IRowsetIndex_GetIndexInfo(self: *const T, pcKeyColumns: ?*usize, prgIndexColumnDesc: ?*?*DBINDEXCOLUMNDESC, pcIndexPropertySets: ?*u32, prgIndexPropertySets: ?*?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetIndex.VTable, self.vtable).GetIndexInfo(@ptrCast(*const IRowsetIndex, self), pcKeyColumns, prgIndexColumnDesc, pcIndexPropertySets, prgIndexPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetIndex_Seek(self: *const T, hAccessor: usize, cKeyValues: usize, pData: ?*anyopaque, dwSeekOptions: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetIndex.VTable, self.vtable).Seek(@ptrCast(*const IRowsetIndex, self), hAccessor, cKeyValues, pData, dwSeekOptions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetIndex_SetRange(self: *const T, hAccessor: usize, cStartKeyColumns: usize, pStartData: ?*anyopaque, cEndKeyColumns: usize, pEndData: ?*anyopaque, dwRangeOptions: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetIndex.VTable, self.vtable).SetRange(@ptrCast(*const IRowsetIndex, self), hAccessor, cStartKeyColumns, pStartData, cEndKeyColumns, pEndData, dwRangeOptions);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommand_Value = Guid.initString("0c733a63-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommand = &IID_ICommand_Value;
pub const ICommand = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Cancel: fn(
self: *const ICommand,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Execute: fn(
self: *const ICommand,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
pParams: ?*DBPARAMS,
pcRowsAffected: ?*isize,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDBSession: fn(
self: *const ICommand,
riid: ?*const Guid,
ppSession: ?*?*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 ICommand_Cancel(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommand.VTable, self.vtable).Cancel(@ptrCast(*const ICommand, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommand_Execute(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, pParams: ?*DBPARAMS, pcRowsAffected: ?*isize, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommand.VTable, self.vtable).Execute(@ptrCast(*const ICommand, self), pUnkOuter, riid, pParams, pcRowsAffected, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommand_GetDBSession(self: *const T, riid: ?*const Guid, ppSession: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommand.VTable, self.vtable).GetDBSession(@ptrCast(*const ICommand, self), riid, ppSession);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBRESULTFLAGENUM = enum(i32) {
DEFAULT = 0,
ROWSET = 1,
ROW = 2,
};
pub const DBRESULTFLAG_DEFAULT = DBRESULTFLAGENUM.DEFAULT;
pub const DBRESULTFLAG_ROWSET = DBRESULTFLAGENUM.ROWSET;
pub const DBRESULTFLAG_ROW = DBRESULTFLAGENUM.ROW;
const IID_IMultipleResults_Value = Guid.initString("0c733a90-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IMultipleResults = &IID_IMultipleResults_Value;
pub const IMultipleResults = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetResult: fn(
self: *const IMultipleResults,
pUnkOuter: ?*IUnknown,
lResultFlag: isize,
riid: ?*const Guid,
pcRowsAffected: ?*isize,
ppRowset: ?*?*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 IMultipleResults_GetResult(self: *const T, pUnkOuter: ?*IUnknown, lResultFlag: isize, riid: ?*const Guid, pcRowsAffected: ?*isize, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IMultipleResults.VTable, self.vtable).GetResult(@ptrCast(*const IMultipleResults, self), pUnkOuter, lResultFlag, riid, pcRowsAffected, ppRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBCONVERTFLAGSENUM = enum(i32) {
COLUMN = 0,
PARAMETER = 1,
};
pub const DBCONVERTFLAGS_COLUMN = DBCONVERTFLAGSENUM.COLUMN;
pub const DBCONVERTFLAGS_PARAMETER = DBCONVERTFLAGSENUM.PARAMETER;
pub const DBCONVERTFLAGSENUM20 = enum(i32) {
ISLONG = 2,
ISFIXEDLENGTH = 4,
FROMVARIANT = 8,
};
pub const DBCONVERTFLAGS_ISLONG = DBCONVERTFLAGSENUM20.ISLONG;
pub const DBCONVERTFLAGS_ISFIXEDLENGTH = DBCONVERTFLAGSENUM20.ISFIXEDLENGTH;
pub const DBCONVERTFLAGS_FROMVARIANT = DBCONVERTFLAGSENUM20.FROMVARIANT;
const IID_IConvertType_Value = Guid.initString("0c733a88-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IConvertType = &IID_IConvertType_Value;
pub const IConvertType = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CanConvert: fn(
self: *const IConvertType,
wFromType: u16,
wToType: u16,
dwConvertFlags: 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 IConvertType_CanConvert(self: *const T, wFromType: u16, wToType: u16, dwConvertFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IConvertType.VTable, self.vtable).CanConvert(@ptrCast(*const IConvertType, self), wFromType, wToType, dwConvertFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandPrepare_Value = Guid.initString("0c733a26-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandPrepare = &IID_ICommandPrepare_Value;
pub const ICommandPrepare = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Prepare: fn(
self: *const ICommandPrepare,
cExpectedRuns: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unprepare: fn(
self: *const ICommandPrepare,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandPrepare_Prepare(self: *const T, cExpectedRuns: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandPrepare.VTable, self.vtable).Prepare(@ptrCast(*const ICommandPrepare, self), cExpectedRuns);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandPrepare_Unprepare(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandPrepare.VTable, self.vtable).Unprepare(@ptrCast(*const ICommandPrepare, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandProperties_Value = Guid.initString("0c733a79-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandProperties = &IID_ICommandProperties_Value;
pub const ICommandProperties = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetProperties: fn(
self: *const ICommandProperties,
cPropertyIDSets: u32,
rgPropertyIDSets: ?[*]const DBPROPIDSET,
pcPropertySets: ?*u32,
prgPropertySets: ?*?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetProperties: fn(
self: *const ICommandProperties,
cPropertySets: u32,
rgPropertySets: [*]DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandProperties_GetProperties(self: *const T, cPropertyIDSets: u32, rgPropertyIDSets: ?[*]const DBPROPIDSET, pcPropertySets: ?*u32, prgPropertySets: ?*?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandProperties.VTable, self.vtable).GetProperties(@ptrCast(*const ICommandProperties, self), cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandProperties_SetProperties(self: *const T, cPropertySets: u32, rgPropertySets: [*]DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandProperties.VTable, self.vtable).SetProperties(@ptrCast(*const ICommandProperties, self), cPropertySets, rgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandText_Value = Guid.initString("0c733a27-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandText = &IID_ICommandText_Value;
pub const ICommandText = extern struct {
pub const VTable = extern struct {
base: ICommand.VTable,
GetCommandText: fn(
self: *const ICommandText,
pguidDialect: ?*Guid,
ppwszCommand: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCommandText: fn(
self: *const ICommandText,
rguidDialect: ?*const Guid,
pwszCommand: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ICommand.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandText_GetCommandText(self: *const T, pguidDialect: ?*Guid, ppwszCommand: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandText.VTable, self.vtable).GetCommandText(@ptrCast(*const ICommandText, self), pguidDialect, ppwszCommand);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandText_SetCommandText(self: *const T, rguidDialect: ?*const Guid, pwszCommand: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandText.VTable, self.vtable).SetCommandText(@ptrCast(*const ICommandText, self), rguidDialect, pwszCommand);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandWithParameters_Value = Guid.initString("0c733a64-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandWithParameters = &IID_ICommandWithParameters_Value;
pub const ICommandWithParameters = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetParameterInfo: fn(
self: *const ICommandWithParameters,
pcParams: ?*usize,
prgParamInfo: ?*?*DBPARAMINFO,
ppNamesBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MapParameterNames: fn(
self: *const ICommandWithParameters,
cParamNames: usize,
rgParamNames: [*]?PWSTR,
rgParamOrdinals: [*]isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetParameterInfo: fn(
self: *const ICommandWithParameters,
cParams: usize,
rgParamOrdinals: ?[*]const usize,
rgParamBindInfo: ?[*]const DBPARAMBINDINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandWithParameters_GetParameterInfo(self: *const T, pcParams: ?*usize, prgParamInfo: ?*?*DBPARAMINFO, ppNamesBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandWithParameters.VTable, self.vtable).GetParameterInfo(@ptrCast(*const ICommandWithParameters, self), pcParams, prgParamInfo, ppNamesBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandWithParameters_MapParameterNames(self: *const T, cParamNames: usize, rgParamNames: [*]?PWSTR, rgParamOrdinals: [*]isize) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandWithParameters.VTable, self.vtable).MapParameterNames(@ptrCast(*const ICommandWithParameters, self), cParamNames, rgParamNames, rgParamOrdinals);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandWithParameters_SetParameterInfo(self: *const T, cParams: usize, rgParamOrdinals: ?[*]const usize, rgParamBindInfo: ?[*]const DBPARAMBINDINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandWithParameters.VTable, self.vtable).SetParameterInfo(@ptrCast(*const ICommandWithParameters, self), cParams, rgParamOrdinals, rgParamBindInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IColumnsRowset_Value = Guid.initString("0c733a10-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IColumnsRowset = &IID_IColumnsRowset_Value;
pub const IColumnsRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetAvailableColumns: fn(
self: *const IColumnsRowset,
pcOptColumns: ?*usize,
prgOptColumns: ?*?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetColumnsRowset: fn(
self: *const IColumnsRowset,
pUnkOuter: ?*IUnknown,
cOptColumns: usize,
rgOptColumns: [*]const DBID,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
ppColRowset: ?*?*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 IColumnsRowset_GetAvailableColumns(self: *const T, pcOptColumns: ?*usize, prgOptColumns: ?*?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnsRowset.VTable, self.vtable).GetAvailableColumns(@ptrCast(*const IColumnsRowset, self), pcOptColumns, prgOptColumns);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnsRowset_GetColumnsRowset(self: *const T, pUnkOuter: ?*IUnknown, cOptColumns: usize, rgOptColumns: [*]const DBID, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET, ppColRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnsRowset.VTable, self.vtable).GetColumnsRowset(@ptrCast(*const IColumnsRowset, self), pUnkOuter, cOptColumns, rgOptColumns, riid, cPropertySets, rgPropertySets, ppColRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IColumnsInfo_Value = Guid.initString("0c733a11-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IColumnsInfo = &IID_IColumnsInfo_Value;
pub const IColumnsInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetColumnInfo: fn(
self: *const IColumnsInfo,
pcColumns: ?*usize,
prgInfo: ?*?*DBCOLUMNINFO,
ppStringsBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MapColumnIDs: fn(
self: *const IColumnsInfo,
cColumnIDs: usize,
rgColumnIDs: ?[*]const DBID,
rgColumns: ?[*]usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnsInfo_GetColumnInfo(self: *const T, pcColumns: ?*usize, prgInfo: ?*?*DBCOLUMNINFO, ppStringsBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnsInfo.VTable, self.vtable).GetColumnInfo(@ptrCast(*const IColumnsInfo, self), pcColumns, prgInfo, ppStringsBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnsInfo_MapColumnIDs(self: *const T, cColumnIDs: usize, rgColumnIDs: ?[*]const DBID, rgColumns: ?[*]usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnsInfo.VTable, self.vtable).MapColumnIDs(@ptrCast(*const IColumnsInfo, self), cColumnIDs, rgColumnIDs, rgColumns);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBCreateCommand_Value = Guid.initString("0c733a1d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBCreateCommand = &IID_IDBCreateCommand_Value;
pub const IDBCreateCommand = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateCommand: fn(
self: *const IDBCreateCommand,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
ppCommand: ?*?*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 IDBCreateCommand_CreateCommand(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppCommand: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBCreateCommand.VTable, self.vtable).CreateCommand(@ptrCast(*const IDBCreateCommand, self), pUnkOuter, riid, ppCommand);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBCreateSession_Value = Guid.initString("0c733a5d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBCreateSession = &IID_IDBCreateSession_Value;
pub const IDBCreateSession = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateSession: fn(
self: *const IDBCreateSession,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
ppDBSession: ?*?*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 IDBCreateSession_CreateSession(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppDBSession: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBCreateSession.VTable, self.vtable).CreateSession(@ptrCast(*const IDBCreateSession, self), pUnkOuter, riid, ppDBSession);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBSOURCETYPEENUM = enum(i32) {
DATASOURCE = 1,
ENUMERATOR = 2,
};
pub const DBSOURCETYPE_DATASOURCE = DBSOURCETYPEENUM.DATASOURCE;
pub const DBSOURCETYPE_ENUMERATOR = DBSOURCETYPEENUM.ENUMERATOR;
pub const DBSOURCETYPEENUM20 = enum(i32) {
TDP = 1,
MDP = 3,
};
pub const DBSOURCETYPE_DATASOURCE_TDP = DBSOURCETYPEENUM20.TDP;
pub const DBSOURCETYPE_DATASOURCE_MDP = DBSOURCETYPEENUM20.MDP;
pub const DBSOURCETYPEENUM25 = enum(i32) {
R = 4,
};
pub const DBSOURCETYPE_BINDER = DBSOURCETYPEENUM25.R;
const IID_ISourcesRowset_Value = Guid.initString("0c733a1e-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ISourcesRowset = &IID_ISourcesRowset_Value;
pub const ISourcesRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSourcesRowset: fn(
self: *const ISourcesRowset,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
cPropertySets: u32,
rgProperties: ?[*]DBPROPSET,
ppSourcesRowset: ?*?*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 ISourcesRowset_GetSourcesRowset(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, cPropertySets: u32, rgProperties: ?[*]DBPROPSET, ppSourcesRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISourcesRowset.VTable, self.vtable).GetSourcesRowset(@ptrCast(*const ISourcesRowset, self), pUnkOuter, riid, cPropertySets, rgProperties, ppSourcesRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBProperties_Value = Guid.initString("0c733a8a-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBProperties = &IID_IDBProperties_Value;
pub const IDBProperties = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetProperties: fn(
self: *const IDBProperties,
cPropertyIDSets: u32,
rgPropertyIDSets: ?[*]const DBPROPIDSET,
pcPropertySets: ?*u32,
prgPropertySets: ?*?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPropertyInfo: fn(
self: *const IDBProperties,
cPropertyIDSets: u32,
rgPropertyIDSets: ?[*]const DBPROPIDSET,
pcPropertyInfoSets: ?*u32,
prgPropertyInfoSets: ?*?*DBPROPINFOSET,
ppDescBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetProperties: fn(
self: *const IDBProperties,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBProperties_GetProperties(self: *const T, cPropertyIDSets: u32, rgPropertyIDSets: ?[*]const DBPROPIDSET, pcPropertySets: ?*u32, prgPropertySets: ?*?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBProperties.VTable, self.vtable).GetProperties(@ptrCast(*const IDBProperties, self), cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBProperties_GetPropertyInfo(self: *const T, cPropertyIDSets: u32, rgPropertyIDSets: ?[*]const DBPROPIDSET, pcPropertyInfoSets: ?*u32, prgPropertyInfoSets: ?*?*DBPROPINFOSET, ppDescBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBProperties.VTable, self.vtable).GetPropertyInfo(@ptrCast(*const IDBProperties, self), cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets, prgPropertyInfoSets, ppDescBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBProperties_SetProperties(self: *const T, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBProperties.VTable, self.vtable).SetProperties(@ptrCast(*const IDBProperties, self), cPropertySets, rgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBInitialize_Value = Guid.initString("0c733a8b-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBInitialize = &IID_IDBInitialize_Value;
pub const IDBInitialize = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Initialize: fn(
self: *const IDBInitialize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Uninitialize: fn(
self: *const IDBInitialize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBInitialize_Initialize(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBInitialize.VTable, self.vtable).Initialize(@ptrCast(*const IDBInitialize, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBInitialize_Uninitialize(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBInitialize.VTable, self.vtable).Uninitialize(@ptrCast(*const IDBInitialize, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBLITERALENUM = enum(i32) {
INVALID = 0,
BINARY_LITERAL = 1,
CATALOG_NAME = 2,
CATALOG_SEPARATOR = 3,
CHAR_LITERAL = 4,
COLUMN_ALIAS = 5,
COLUMN_NAME = 6,
CORRELATION_NAME = 7,
CURSOR_NAME = 8,
ESCAPE_PERCENT = 9,
ESCAPE_UNDERSCORE = 10,
INDEX_NAME = 11,
LIKE_PERCENT = 12,
LIKE_UNDERSCORE = 13,
PROCEDURE_NAME = 14,
QUOTE = 15,
SCHEMA_NAME = 16,
TABLE_NAME = 17,
TEXT_COMMAND = 18,
USER_NAME = 19,
VIEW_NAME = 20,
};
pub const DBLITERAL_INVALID = DBLITERALENUM.INVALID;
pub const DBLITERAL_BINARY_LITERAL = DBLITERALENUM.BINARY_LITERAL;
pub const DBLITERAL_CATALOG_NAME = DBLITERALENUM.CATALOG_NAME;
pub const DBLITERAL_CATALOG_SEPARATOR = DBLITERALENUM.CATALOG_SEPARATOR;
pub const DBLITERAL_CHAR_LITERAL = DBLITERALENUM.CHAR_LITERAL;
pub const DBLITERAL_COLUMN_ALIAS = DBLITERALENUM.COLUMN_ALIAS;
pub const DBLITERAL_COLUMN_NAME = DBLITERALENUM.COLUMN_NAME;
pub const DBLITERAL_CORRELATION_NAME = DBLITERALENUM.CORRELATION_NAME;
pub const DBLITERAL_CURSOR_NAME = DBLITERALENUM.CURSOR_NAME;
pub const DBLITERAL_ESCAPE_PERCENT = DBLITERALENUM.ESCAPE_PERCENT;
pub const DBLITERAL_ESCAPE_UNDERSCORE = DBLITERALENUM.ESCAPE_UNDERSCORE;
pub const DBLITERAL_INDEX_NAME = DBLITERALENUM.INDEX_NAME;
pub const DBLITERAL_LIKE_PERCENT = DBLITERALENUM.LIKE_PERCENT;
pub const DBLITERAL_LIKE_UNDERSCORE = DBLITERALENUM.LIKE_UNDERSCORE;
pub const DBLITERAL_PROCEDURE_NAME = DBLITERALENUM.PROCEDURE_NAME;
pub const DBLITERAL_QUOTE = DBLITERALENUM.QUOTE;
pub const DBLITERAL_SCHEMA_NAME = DBLITERALENUM.SCHEMA_NAME;
pub const DBLITERAL_TABLE_NAME = DBLITERALENUM.TABLE_NAME;
pub const DBLITERAL_TEXT_COMMAND = DBLITERALENUM.TEXT_COMMAND;
pub const DBLITERAL_USER_NAME = DBLITERALENUM.USER_NAME;
pub const DBLITERAL_VIEW_NAME = DBLITERALENUM.VIEW_NAME;
pub const DBLITERALENUM20 = enum(i32) {
CUBE_NAME = 21,
DIMENSION_NAME = 22,
HIERARCHY_NAME = 23,
LEVEL_NAME = 24,
MEMBER_NAME = 25,
PROPERTY_NAME = 26,
SCHEMA_SEPARATOR = 27,
QUOTE_SUFFIX = 28,
};
pub const DBLITERAL_CUBE_NAME = DBLITERALENUM20.CUBE_NAME;
pub const DBLITERAL_DIMENSION_NAME = DBLITERALENUM20.DIMENSION_NAME;
pub const DBLITERAL_HIERARCHY_NAME = DBLITERALENUM20.HIERARCHY_NAME;
pub const DBLITERAL_LEVEL_NAME = DBLITERALENUM20.LEVEL_NAME;
pub const DBLITERAL_MEMBER_NAME = DBLITERALENUM20.MEMBER_NAME;
pub const DBLITERAL_PROPERTY_NAME = DBLITERALENUM20.PROPERTY_NAME;
pub const DBLITERAL_SCHEMA_SEPARATOR = DBLITERALENUM20.SCHEMA_SEPARATOR;
pub const DBLITERAL_QUOTE_SUFFIX = DBLITERALENUM20.QUOTE_SUFFIX;
pub const DBLITERALENUM21 = enum(i32) {
PERCENT_SUFFIX = 29,
UNDERSCORE_SUFFIX = 30,
};
pub const DBLITERAL_ESCAPE_PERCENT_SUFFIX = DBLITERALENUM21.PERCENT_SUFFIX;
pub const DBLITERAL_ESCAPE_UNDERSCORE_SUFFIX = DBLITERALENUM21.UNDERSCORE_SUFFIX;
const IID_IDBInfo_Value = Guid.initString("0c733a89-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBInfo = &IID_IDBInfo_Value;
pub const IDBInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetKeywords: fn(
self: *const IDBInfo,
ppwszKeywords: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLiteralInfo: fn(
self: *const IDBInfo,
cLiterals: u32,
rgLiterals: ?[*]const u32,
pcLiteralInfo: ?*u32,
prgLiteralInfo: ?*?*DBLITERALINFO,
ppCharBuffer: ?*?*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 IDBInfo_GetKeywords(self: *const T, ppwszKeywords: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBInfo.VTable, self.vtable).GetKeywords(@ptrCast(*const IDBInfo, self), ppwszKeywords);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBInfo_GetLiteralInfo(self: *const T, cLiterals: u32, rgLiterals: ?[*]const u32, pcLiteralInfo: ?*u32, prgLiteralInfo: ?*?*DBLITERALINFO, ppCharBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBInfo.VTable, self.vtable).GetLiteralInfo(@ptrCast(*const IDBInfo, self), cLiterals, rgLiterals, pcLiteralInfo, prgLiteralInfo, ppCharBuffer);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBDataSourceAdmin_Value = Guid.initString("0c733a7a-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBDataSourceAdmin = &IID_IDBDataSourceAdmin_Value;
pub const IDBDataSourceAdmin = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateDataSource: fn(
self: *const IDBDataSourceAdmin,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
ppDBSession: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DestroyDataSource: fn(
self: *const IDBDataSourceAdmin,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCreationProperties: fn(
self: *const IDBDataSourceAdmin,
cPropertyIDSets: u32,
rgPropertyIDSets: ?[*]const DBPROPIDSET,
pcPropertyInfoSets: ?*u32,
prgPropertyInfoSets: ?*?*DBPROPINFOSET,
ppDescBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ModifyDataSource: fn(
self: *const IDBDataSourceAdmin,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBDataSourceAdmin_CreateDataSource(self: *const T, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppDBSession: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBDataSourceAdmin.VTable, self.vtable).CreateDataSource(@ptrCast(*const IDBDataSourceAdmin, self), cPropertySets, rgPropertySets, pUnkOuter, riid, ppDBSession);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBDataSourceAdmin_DestroyDataSource(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBDataSourceAdmin.VTable, self.vtable).DestroyDataSource(@ptrCast(*const IDBDataSourceAdmin, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBDataSourceAdmin_GetCreationProperties(self: *const T, cPropertyIDSets: u32, rgPropertyIDSets: ?[*]const DBPROPIDSET, pcPropertyInfoSets: ?*u32, prgPropertyInfoSets: ?*?*DBPROPINFOSET, ppDescBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBDataSourceAdmin.VTable, self.vtable).GetCreationProperties(@ptrCast(*const IDBDataSourceAdmin, self), cPropertyIDSets, rgPropertyIDSets, pcPropertyInfoSets, prgPropertyInfoSets, ppDescBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBDataSourceAdmin_ModifyDataSource(self: *const T, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBDataSourceAdmin.VTable, self.vtable).ModifyDataSource(@ptrCast(*const IDBDataSourceAdmin, self), cPropertySets, rgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBAsynchNotify_Value = Guid.initString("0c733a96-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBAsynchNotify = &IID_IDBAsynchNotify_Value;
pub const IDBAsynchNotify = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnLowResource: fn(
self: *const IDBAsynchNotify,
dwReserved: usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnProgress: fn(
self: *const IDBAsynchNotify,
hChapter: usize,
eOperation: u32,
ulProgress: usize,
ulProgressMax: usize,
eAsynchPhase: u32,
pwszStatusText: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnStop: fn(
self: *const IDBAsynchNotify,
hChapter: usize,
eOperation: u32,
hrStatus: HRESULT,
pwszStatusText: ?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 IDBAsynchNotify_OnLowResource(self: *const T, dwReserved: usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBAsynchNotify.VTable, self.vtable).OnLowResource(@ptrCast(*const IDBAsynchNotify, self), dwReserved);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBAsynchNotify_OnProgress(self: *const T, hChapter: usize, eOperation: u32, ulProgress: usize, ulProgressMax: usize, eAsynchPhase: u32, pwszStatusText: ?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBAsynchNotify.VTable, self.vtable).OnProgress(@ptrCast(*const IDBAsynchNotify, self), hChapter, eOperation, ulProgress, ulProgressMax, eAsynchPhase, pwszStatusText);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBAsynchNotify_OnStop(self: *const T, hChapter: usize, eOperation: u32, hrStatus: HRESULT, pwszStatusText: ?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBAsynchNotify.VTable, self.vtable).OnStop(@ptrCast(*const IDBAsynchNotify, self), hChapter, eOperation, hrStatus, pwszStatusText);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBAsynchStatus_Value = Guid.initString("0c733a95-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBAsynchStatus = &IID_IDBAsynchStatus_Value;
pub const IDBAsynchStatus = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Abort: fn(
self: *const IDBAsynchStatus,
hChapter: usize,
eOperation: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatus: fn(
self: *const IDBAsynchStatus,
hChapter: usize,
eOperation: u32,
pulProgress: ?*usize,
pulProgressMax: ?*usize,
peAsynchPhase: ?*u32,
ppwszStatusText: ?*?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 IDBAsynchStatus_Abort(self: *const T, hChapter: usize, eOperation: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBAsynchStatus.VTable, self.vtable).Abort(@ptrCast(*const IDBAsynchStatus, self), hChapter, eOperation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBAsynchStatus_GetStatus(self: *const T, hChapter: usize, eOperation: u32, pulProgress: ?*usize, pulProgressMax: ?*usize, peAsynchPhase: ?*u32, ppwszStatusText: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBAsynchStatus.VTable, self.vtable).GetStatus(@ptrCast(*const IDBAsynchStatus, self), hChapter, eOperation, pulProgress, pulProgressMax, peAsynchPhase, ppwszStatusText);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISessionProperties_Value = Guid.initString("0c733a85-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ISessionProperties = &IID_ISessionProperties_Value;
pub const ISessionProperties = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetProperties: fn(
self: *const ISessionProperties,
cPropertyIDSets: u32,
rgPropertyIDSets: ?[*]const DBPROPIDSET,
pcPropertySets: ?*u32,
prgPropertySets: ?*?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetProperties: fn(
self: *const ISessionProperties,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISessionProperties_GetProperties(self: *const T, cPropertyIDSets: u32, rgPropertyIDSets: ?[*]const DBPROPIDSET, pcPropertySets: ?*u32, prgPropertySets: ?*?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ISessionProperties.VTable, self.vtable).GetProperties(@ptrCast(*const ISessionProperties, self), cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISessionProperties_SetProperties(self: *const T, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ISessionProperties.VTable, self.vtable).SetProperties(@ptrCast(*const ISessionProperties, self), cPropertySets, rgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IIndexDefinition_Value = Guid.initString("0c733a68-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IIndexDefinition = &IID_IIndexDefinition_Value;
pub const IIndexDefinition = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateIndex: fn(
self: *const IIndexDefinition,
pTableID: ?*DBID,
pIndexID: ?*DBID,
cIndexColumnDescs: usize,
rgIndexColumnDescs: [*]const DBINDEXCOLUMNDESC,
cPropertySets: u32,
rgPropertySets: [*]DBPROPSET,
ppIndexID: ?*?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DropIndex: fn(
self: *const IIndexDefinition,
pTableID: ?*DBID,
pIndexID: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IIndexDefinition_CreateIndex(self: *const T, pTableID: ?*DBID, pIndexID: ?*DBID, cIndexColumnDescs: usize, rgIndexColumnDescs: [*]const DBINDEXCOLUMNDESC, cPropertySets: u32, rgPropertySets: [*]DBPROPSET, ppIndexID: ?*?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const IIndexDefinition.VTable, self.vtable).CreateIndex(@ptrCast(*const IIndexDefinition, self), pTableID, pIndexID, cIndexColumnDescs, rgIndexColumnDescs, cPropertySets, rgPropertySets, ppIndexID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IIndexDefinition_DropIndex(self: *const T, pTableID: ?*DBID, pIndexID: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const IIndexDefinition.VTable, self.vtable).DropIndex(@ptrCast(*const IIndexDefinition, self), pTableID, pIndexID);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITableDefinition_Value = Guid.initString("0c733a86-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITableDefinition = &IID_ITableDefinition_Value;
pub const ITableDefinition = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateTable: fn(
self: *const ITableDefinition,
pUnkOuter: ?*IUnknown,
pTableID: ?*DBID,
cColumnDescs: usize,
rgColumnDescs: ?[*]const DBCOLUMNDESC,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
ppTableID: ?*?*DBID,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DropTable: fn(
self: *const ITableDefinition,
pTableID: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddColumn: fn(
self: *const ITableDefinition,
pTableID: ?*DBID,
pColumnDesc: ?*DBCOLUMNDESC,
ppColumnID: ?*?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DropColumn: fn(
self: *const ITableDefinition,
pTableID: ?*DBID,
pColumnID: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinition_CreateTable(self: *const T, pUnkOuter: ?*IUnknown, pTableID: ?*DBID, cColumnDescs: usize, rgColumnDescs: ?[*]const DBCOLUMNDESC, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET, ppTableID: ?*?*DBID, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinition.VTable, self.vtable).CreateTable(@ptrCast(*const ITableDefinition, self), pUnkOuter, pTableID, cColumnDescs, rgColumnDescs, riid, cPropertySets, rgPropertySets, ppTableID, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinition_DropTable(self: *const T, pTableID: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinition.VTable, self.vtable).DropTable(@ptrCast(*const ITableDefinition, self), pTableID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinition_AddColumn(self: *const T, pTableID: ?*DBID, pColumnDesc: ?*DBCOLUMNDESC, ppColumnID: ?*?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinition.VTable, self.vtable).AddColumn(@ptrCast(*const ITableDefinition, self), pTableID, pColumnDesc, ppColumnID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinition_DropColumn(self: *const T, pTableID: ?*DBID, pColumnID: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinition.VTable, self.vtable).DropColumn(@ptrCast(*const ITableDefinition, self), pTableID, pColumnID);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IOpenRowset_Value = Guid.initString("0c733a69-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IOpenRowset = &IID_IOpenRowset_Value;
pub const IOpenRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OpenRowset: fn(
self: *const IOpenRowset,
pUnkOuter: ?*IUnknown,
pTableID: ?*DBID,
pIndexID: ?*DBID,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
ppRowset: ?*?*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 IOpenRowset_OpenRowset(self: *const T, pUnkOuter: ?*IUnknown, pTableID: ?*DBID, pIndexID: ?*DBID, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IOpenRowset.VTable, self.vtable).OpenRowset(@ptrCast(*const IOpenRowset, self), pUnkOuter, pTableID, pIndexID, riid, cPropertySets, rgPropertySets, ppRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBSchemaRowset_Value = Guid.initString("0c733a7b-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBSchemaRowset = &IID_IDBSchemaRowset_Value;
pub const IDBSchemaRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetRowset: fn(
self: *const IDBSchemaRowset,
pUnkOuter: ?*IUnknown,
rguidSchema: ?*const Guid,
cRestrictions: u32,
rgRestrictions: ?[*]const VARIANT,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?[*]DBPROPSET,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSchemas: fn(
self: *const IDBSchemaRowset,
pcSchemas: ?*u32,
prgSchemas: ?*?*Guid,
prgRestrictionSupport: ?*?*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 IDBSchemaRowset_GetRowset(self: *const T, pUnkOuter: ?*IUnknown, rguidSchema: ?*const Guid, cRestrictions: u32, rgRestrictions: ?[*]const VARIANT, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?[*]DBPROPSET, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBSchemaRowset.VTable, self.vtable).GetRowset(@ptrCast(*const IDBSchemaRowset, self), pUnkOuter, rguidSchema, cRestrictions, rgRestrictions, riid, cPropertySets, rgPropertySets, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBSchemaRowset_GetSchemas(self: *const T, pcSchemas: ?*u32, prgSchemas: ?*?*Guid, prgRestrictionSupport: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBSchemaRowset.VTable, self.vtable).GetSchemas(@ptrCast(*const IDBSchemaRowset, self), pcSchemas, prgSchemas, prgRestrictionSupport);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IMDDataset_Value = Guid.initString("a07cccd1-8148-11d0-87bb-00c04fc33942");
pub const IID_IMDDataset = &IID_IMDDataset_Value;
pub const IMDDataset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
FreeAxisInfo: fn(
self: *const IMDDataset,
cAxes: usize,
rgAxisInfo: ?*MDAXISINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAxisInfo: fn(
self: *const IMDDataset,
pcAxes: ?*usize,
prgAxisInfo: ?*?*MDAXISINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAxisRowset: fn(
self: *const IMDDataset,
pUnkOuter: ?*IUnknown,
iAxis: usize,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCellData: fn(
self: *const IMDDataset,
hAccessor: usize,
ulStartCell: usize,
ulEndCell: usize,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSpecification: fn(
self: *const IMDDataset,
riid: ?*const Guid,
ppSpecification: ?*?*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 IMDDataset_FreeAxisInfo(self: *const T, cAxes: usize, rgAxisInfo: ?*MDAXISINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDDataset.VTable, self.vtable).FreeAxisInfo(@ptrCast(*const IMDDataset, self), cAxes, rgAxisInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IMDDataset_GetAxisInfo(self: *const T, pcAxes: ?*usize, prgAxisInfo: ?*?*MDAXISINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDDataset.VTable, self.vtable).GetAxisInfo(@ptrCast(*const IMDDataset, self), pcAxes, prgAxisInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IMDDataset_GetAxisRowset(self: *const T, pUnkOuter: ?*IUnknown, iAxis: usize, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?*DBPROPSET, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDDataset.VTable, self.vtable).GetAxisRowset(@ptrCast(*const IMDDataset, self), pUnkOuter, iAxis, riid, cPropertySets, rgPropertySets, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IMDDataset_GetCellData(self: *const T, hAccessor: usize, ulStartCell: usize, ulEndCell: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDDataset.VTable, self.vtable).GetCellData(@ptrCast(*const IMDDataset, self), hAccessor, ulStartCell, ulEndCell, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IMDDataset_GetSpecification(self: *const T, riid: ?*const Guid, ppSpecification: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDDataset.VTable, self.vtable).GetSpecification(@ptrCast(*const IMDDataset, self), riid, ppSpecification);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IMDFind_Value = Guid.initString("a07cccd2-8148-11d0-87bb-00c04fc33942");
pub const IID_IMDFind = &IID_IMDFind_Value;
pub const IMDFind = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
FindCell: fn(
self: *const IMDFind,
ulStartingOrdinal: usize,
cMembers: usize,
rgpwszMember: ?*?PWSTR,
pulCellOrdinal: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
FindTuple: fn(
self: *const IMDFind,
ulAxisIdentifier: u32,
ulStartingOrdinal: usize,
cMembers: usize,
rgpwszMember: ?*?PWSTR,
pulTupleOrdinal: ?*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 IMDFind_FindCell(self: *const T, ulStartingOrdinal: usize, cMembers: usize, rgpwszMember: ?*?PWSTR, pulCellOrdinal: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDFind.VTable, self.vtable).FindCell(@ptrCast(*const IMDFind, self), ulStartingOrdinal, cMembers, rgpwszMember, pulCellOrdinal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IMDFind_FindTuple(self: *const T, ulAxisIdentifier: u32, ulStartingOrdinal: usize, cMembers: usize, rgpwszMember: ?*?PWSTR, pulTupleOrdinal: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDFind.VTable, self.vtable).FindTuple(@ptrCast(*const IMDFind, self), ulAxisIdentifier, ulStartingOrdinal, cMembers, rgpwszMember, pulTupleOrdinal);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IMDRangeRowset_Value = Guid.initString("0c733aa0-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IMDRangeRowset = &IID_IMDRangeRowset_Value;
pub const IMDRangeRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetRangeRowset: fn(
self: *const IMDRangeRowset,
pUnkOuter: ?*IUnknown,
ulStartCell: usize,
ulEndCell: usize,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
ppRowset: ?*?*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 IMDRangeRowset_GetRangeRowset(self: *const T, pUnkOuter: ?*IUnknown, ulStartCell: usize, ulEndCell: usize, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?*DBPROPSET, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IMDRangeRowset.VTable, self.vtable).GetRangeRowset(@ptrCast(*const IMDRangeRowset, self), pUnkOuter, ulStartCell, ulEndCell, riid, cPropertySets, rgPropertySets, ppRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAlterTable_Value = Guid.initString("0c733aa5-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IAlterTable = &IID_IAlterTable_Value;
pub const IAlterTable = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AlterColumn: fn(
self: *const IAlterTable,
pTableId: ?*DBID,
pColumnId: ?*DBID,
dwColumnDescFlags: u32,
pColumnDesc: ?*DBCOLUMNDESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AlterTable: fn(
self: *const IAlterTable,
pTableId: ?*DBID,
pNewTableId: ?*DBID,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAlterTable_AlterColumn(self: *const T, pTableId: ?*DBID, pColumnId: ?*DBID, dwColumnDescFlags: u32, pColumnDesc: ?*DBCOLUMNDESC) callconv(.Inline) HRESULT {
return @ptrCast(*const IAlterTable.VTable, self.vtable).AlterColumn(@ptrCast(*const IAlterTable, self), pTableId, pColumnId, dwColumnDescFlags, pColumnDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAlterTable_AlterTable(self: *const T, pTableId: ?*DBID, pNewTableId: ?*DBID, cPropertySets: u32, rgPropertySets: ?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IAlterTable.VTable, self.vtable).AlterTable(@ptrCast(*const IAlterTable, self), pTableId, pNewTableId, cPropertySets, rgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IAlterIndex_Value = Guid.initString("0c733aa6-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IAlterIndex = &IID_IAlterIndex_Value;
pub const IAlterIndex = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AlterIndex: fn(
self: *const IAlterIndex,
pTableId: ?*DBID,
pIndexId: ?*DBID,
pNewIndexId: ?*DBID,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IAlterIndex_AlterIndex(self: *const T, pTableId: ?*DBID, pIndexId: ?*DBID, pNewIndexId: ?*DBID, cPropertySets: u32, rgPropertySets: ?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const IAlterIndex.VTable, self.vtable).AlterIndex(@ptrCast(*const IAlterIndex, self), pTableId, pIndexId, pNewIndexId, cPropertySets, rgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetChapterMember_Value = Guid.initString("0c733aa8-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetChapterMember = &IID_IRowsetChapterMember_Value;
pub const IRowsetChapterMember = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
IsRowInChapter: fn(
self: *const IRowsetChapterMember,
hChapter: usize,
hRow: usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetChapterMember_IsRowInChapter(self: *const T, hChapter: usize, hRow: usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetChapterMember.VTable, self.vtable).IsRowInChapter(@ptrCast(*const IRowsetChapterMember, self), hChapter, hRow);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandPersist_Value = Guid.initString("0c733aa7-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandPersist = &IID_ICommandPersist_Value;
pub const ICommandPersist = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
DeleteCommand: fn(
self: *const ICommandPersist,
pCommandID: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCurrentCommand: fn(
self: *const ICommandPersist,
ppCommandID: ?*?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadCommand: fn(
self: *const ICommandPersist,
pCommandID: ?*DBID,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveCommand: fn(
self: *const ICommandPersist,
pCommandID: ?*DBID,
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 ICommandPersist_DeleteCommand(self: *const T, pCommandID: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandPersist.VTable, self.vtable).DeleteCommand(@ptrCast(*const ICommandPersist, self), pCommandID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandPersist_GetCurrentCommand(self: *const T, ppCommandID: ?*?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandPersist.VTable, self.vtable).GetCurrentCommand(@ptrCast(*const ICommandPersist, self), ppCommandID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandPersist_LoadCommand(self: *const T, pCommandID: ?*DBID, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandPersist.VTable, self.vtable).LoadCommand(@ptrCast(*const ICommandPersist, self), pCommandID, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandPersist_SaveCommand(self: *const T, pCommandID: ?*DBID, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandPersist.VTable, self.vtable).SaveCommand(@ptrCast(*const ICommandPersist, self), pCommandID, dwFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetRefresh_Value = Guid.initString("0c733aa9-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetRefresh = &IID_IRowsetRefresh_Value;
pub const IRowsetRefresh = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
RefreshVisibleData: fn(
self: *const IRowsetRefresh,
hChapter: usize,
cRows: usize,
rghRows: ?*const usize,
fOverWrite: BOOL,
pcRowsRefreshed: ?*usize,
prghRowsRefreshed: ?*?*usize,
prgRowStatus: ?*?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLastVisibleData: fn(
self: *const IRowsetRefresh,
hRow: usize,
hAccessor: usize,
pData: ?*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 IRowsetRefresh_RefreshVisibleData(self: *const T, hChapter: usize, cRows: usize, rghRows: ?*const usize, fOverWrite: BOOL, pcRowsRefreshed: ?*usize, prghRowsRefreshed: ?*?*usize, prgRowStatus: ?*?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetRefresh.VTable, self.vtable).RefreshVisibleData(@ptrCast(*const IRowsetRefresh, self), hChapter, cRows, rghRows, fOverWrite, pcRowsRefreshed, prghRowsRefreshed, prgRowStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetRefresh_GetLastVisibleData(self: *const T, hRow: usize, hAccessor: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetRefresh.VTable, self.vtable).GetLastVisibleData(@ptrCast(*const IRowsetRefresh, self), hRow, hAccessor, pData);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IParentRowset_Value = Guid.initString("0c733aaa-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IParentRowset = &IID_IParentRowset_Value;
pub const IParentRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetChildRowset: fn(
self: *const IParentRowset,
pUnkOuter: ?*IUnknown,
iOrdinal: usize,
riid: ?*const Guid,
ppRowset: ?*?*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 IParentRowset_GetChildRowset(self: *const T, pUnkOuter: ?*IUnknown, iOrdinal: usize, riid: ?*const Guid, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IParentRowset.VTable, self.vtable).GetChildRowset(@ptrCast(*const IParentRowset, self), pUnkOuter, iOrdinal, riid, ppRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IErrorRecords_Value = Guid.initString("0c733a67-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IErrorRecords = &IID_IErrorRecords_Value;
pub const IErrorRecords = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddErrorRecord: fn(
self: *const IErrorRecords,
pErrorInfo: ?*ERRORINFO,
dwLookupID: u32,
pdispparams: ?*DISPPARAMS,
punkCustomError: ?*IUnknown,
dwDynamicErrorID: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBasicErrorInfo: fn(
self: *const IErrorRecords,
ulRecordNum: u32,
pErrorInfo: ?*ERRORINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCustomErrorObject: fn(
self: *const IErrorRecords,
ulRecordNum: u32,
riid: ?*const Guid,
ppObject: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetErrorInfo: fn(
self: *const IErrorRecords,
ulRecordNum: u32,
lcid: u32,
ppErrorInfo: ?*?*IErrorInfo,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetErrorParameters: fn(
self: *const IErrorRecords,
ulRecordNum: u32,
pdispparams: ?*DISPPARAMS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRecordCount: fn(
self: *const IErrorRecords,
pcRecords: ?*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 IErrorRecords_AddErrorRecord(self: *const T, pErrorInfo: ?*ERRORINFO, dwLookupID: u32, pdispparams: ?*DISPPARAMS, punkCustomError: ?*IUnknown, dwDynamicErrorID: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorRecords.VTable, self.vtable).AddErrorRecord(@ptrCast(*const IErrorRecords, self), pErrorInfo, dwLookupID, pdispparams, punkCustomError, dwDynamicErrorID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorRecords_GetBasicErrorInfo(self: *const T, ulRecordNum: u32, pErrorInfo: ?*ERRORINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorRecords.VTable, self.vtable).GetBasicErrorInfo(@ptrCast(*const IErrorRecords, self), ulRecordNum, pErrorInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorRecords_GetCustomErrorObject(self: *const T, ulRecordNum: u32, riid: ?*const Guid, ppObject: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorRecords.VTable, self.vtable).GetCustomErrorObject(@ptrCast(*const IErrorRecords, self), ulRecordNum, riid, ppObject);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorRecords_GetErrorInfo(self: *const T, ulRecordNum: u32, lcid: u32, ppErrorInfo: ?*?*IErrorInfo) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorRecords.VTable, self.vtable).GetErrorInfo(@ptrCast(*const IErrorRecords, self), ulRecordNum, lcid, ppErrorInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorRecords_GetErrorParameters(self: *const T, ulRecordNum: u32, pdispparams: ?*DISPPARAMS) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorRecords.VTable, self.vtable).GetErrorParameters(@ptrCast(*const IErrorRecords, self), ulRecordNum, pdispparams);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorRecords_GetRecordCount(self: *const T, pcRecords: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorRecords.VTable, self.vtable).GetRecordCount(@ptrCast(*const IErrorRecords, self), pcRecords);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IErrorLookup_Value = Guid.initString("0c733a66-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IErrorLookup = &IID_IErrorLookup_Value;
pub const IErrorLookup = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetErrorDescription: fn(
self: *const IErrorLookup,
hrError: HRESULT,
dwLookupID: u32,
pdispparams: ?*DISPPARAMS,
lcid: u32,
pbstrSource: ?*?BSTR,
pbstrDescription: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetHelpInfo: fn(
self: *const IErrorLookup,
hrError: HRESULT,
dwLookupID: u32,
lcid: u32,
pbstrHelpFile: ?*?BSTR,
pdwHelpContext: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseErrors: fn(
self: *const IErrorLookup,
dwDynamicErrorID: 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 IErrorLookup_GetErrorDescription(self: *const T, hrError: HRESULT, dwLookupID: u32, pdispparams: ?*DISPPARAMS, lcid: u32, pbstrSource: ?*?BSTR, pbstrDescription: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorLookup.VTable, self.vtable).GetErrorDescription(@ptrCast(*const IErrorLookup, self), hrError, dwLookupID, pdispparams, lcid, pbstrSource, pbstrDescription);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorLookup_GetHelpInfo(self: *const T, hrError: HRESULT, dwLookupID: u32, lcid: u32, pbstrHelpFile: ?*?BSTR, pdwHelpContext: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorLookup.VTable, self.vtable).GetHelpInfo(@ptrCast(*const IErrorLookup, self), hrError, dwLookupID, lcid, pbstrHelpFile, pdwHelpContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IErrorLookup_ReleaseErrors(self: *const T, dwDynamicErrorID: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IErrorLookup.VTable, self.vtable).ReleaseErrors(@ptrCast(*const IErrorLookup, self), dwDynamicErrorID);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISQLErrorInfo_Value = Guid.initString("0c733a74-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ISQLErrorInfo = &IID_ISQLErrorInfo_Value;
pub const ISQLErrorInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSQLInfo: fn(
self: *const ISQLErrorInfo,
pbstrSQLState: ?*?BSTR,
plNativeError: ?*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 ISQLErrorInfo_GetSQLInfo(self: *const T, pbstrSQLState: ?*?BSTR, plNativeError: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISQLErrorInfo.VTable, self.vtable).GetSQLInfo(@ptrCast(*const ISQLErrorInfo, self), pbstrSQLState, plNativeError);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IGetDataSource_Value = Guid.initString("0c733a75-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IGetDataSource = &IID_IGetDataSource_Value;
pub const IGetDataSource = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDataSource: fn(
self: *const IGetDataSource,
riid: ?*const Guid,
ppDataSource: ?*?*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 IGetDataSource_GetDataSource(self: *const T, riid: ?*const Guid, ppDataSource: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IGetDataSource.VTable, self.vtable).GetDataSource(@ptrCast(*const IGetDataSource, self), riid, ppDataSource);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITransactionLocal_Value = Guid.initString("0c733a5f-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITransactionLocal = &IID_ITransactionLocal_Value;
pub const ITransactionLocal = extern struct {
pub const VTable = extern struct {
base: ITransaction.VTable,
GetOptionsObject: fn(
self: *const ITransactionLocal,
ppOptions: ?*?*ITransactionOptions,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StartTransaction: fn(
self: *const ITransactionLocal,
isoLevel: i32,
isoFlags: u32,
pOtherOptions: ?*ITransactionOptions,
pulTransactionLevel: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ITransaction.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITransactionLocal_GetOptionsObject(self: *const T, ppOptions: ?*?*ITransactionOptions) callconv(.Inline) HRESULT {
return @ptrCast(*const ITransactionLocal.VTable, self.vtable).GetOptionsObject(@ptrCast(*const ITransactionLocal, self), ppOptions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITransactionLocal_StartTransaction(self: *const T, isoLevel: i32, isoFlags: u32, pOtherOptions: ?*ITransactionOptions, pulTransactionLevel: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ITransactionLocal.VTable, self.vtable).StartTransaction(@ptrCast(*const ITransactionLocal, self), isoLevel, isoFlags, pOtherOptions, pulTransactionLevel);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITransactionJoin_Value = Guid.initString("0c733a5e-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITransactionJoin = &IID_ITransactionJoin_Value;
pub const ITransactionJoin = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetOptionsObject: fn(
self: *const ITransactionJoin,
ppOptions: ?*?*ITransactionOptions,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
JoinTransaction: fn(
self: *const ITransactionJoin,
punkTransactionCoord: ?*IUnknown,
isoLevel: i32,
isoFlags: u32,
pOtherOptions: ?*ITransactionOptions,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITransactionJoin_GetOptionsObject(self: *const T, ppOptions: ?*?*ITransactionOptions) callconv(.Inline) HRESULT {
return @ptrCast(*const ITransactionJoin.VTable, self.vtable).GetOptionsObject(@ptrCast(*const ITransactionJoin, self), ppOptions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITransactionJoin_JoinTransaction(self: *const T, punkTransactionCoord: ?*IUnknown, isoLevel: i32, isoFlags: u32, pOtherOptions: ?*ITransactionOptions) callconv(.Inline) HRESULT {
return @ptrCast(*const ITransactionJoin.VTable, self.vtable).JoinTransaction(@ptrCast(*const ITransactionJoin, self), punkTransactionCoord, isoLevel, isoFlags, pOtherOptions);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITransactionObject_Value = Guid.initString("0c733a60-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITransactionObject = &IID_ITransactionObject_Value;
pub const ITransactionObject = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetTransactionObject: fn(
self: *const ITransactionObject,
ulTransactionLevel: u32,
ppTransactionObject: ?*?*ITransaction,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITransactionObject_GetTransactionObject(self: *const T, ulTransactionLevel: u32, ppTransactionObject: ?*?*ITransaction) callconv(.Inline) HRESULT {
return @ptrCast(*const ITransactionObject.VTable, self.vtable).GetTransactionObject(@ptrCast(*const ITransactionObject, self), ulTransactionLevel, ppTransactionObject);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITrusteeAdmin_Value = Guid.initString("0c733aa1-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITrusteeAdmin = &IID_ITrusteeAdmin_Value;
pub const ITrusteeAdmin = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CompareTrustees: fn(
self: *const ITrusteeAdmin,
pTrustee1: ?*TRUSTEE_W,
pTrustee2: ?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTrustee: fn(
self: *const ITrusteeAdmin,
pTrustee: ?*TRUSTEE_W,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteTrustee: fn(
self: *const ITrusteeAdmin,
pTrustee: ?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTrusteeProperties: fn(
self: *const ITrusteeAdmin,
pTrustee: ?*TRUSTEE_W,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetTrusteeProperties: fn(
self: *const ITrusteeAdmin,
pTrustee: ?*TRUSTEE_W,
cPropertyIDSets: u32,
rgPropertyIDSets: ?*const DBPROPIDSET,
pcPropertySets: ?*u32,
prgPropertySets: ?*?*DBPROPSET,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeAdmin_CompareTrustees(self: *const T, pTrustee1: ?*TRUSTEE_W, pTrustee2: ?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeAdmin.VTable, self.vtable).CompareTrustees(@ptrCast(*const ITrusteeAdmin, self), pTrustee1, pTrustee2);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeAdmin_CreateTrustee(self: *const T, pTrustee: ?*TRUSTEE_W, cPropertySets: u32, rgPropertySets: ?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeAdmin.VTable, self.vtable).CreateTrustee(@ptrCast(*const ITrusteeAdmin, self), pTrustee, cPropertySets, rgPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeAdmin_DeleteTrustee(self: *const T, pTrustee: ?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeAdmin.VTable, self.vtable).DeleteTrustee(@ptrCast(*const ITrusteeAdmin, self), pTrustee);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeAdmin_SetTrusteeProperties(self: *const T, pTrustee: ?*TRUSTEE_W, cPropertySets: u32, rgPropertySets: ?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeAdmin.VTable, self.vtable).SetTrusteeProperties(@ptrCast(*const ITrusteeAdmin, self), pTrustee, cPropertySets, rgPropertySets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeAdmin_GetTrusteeProperties(self: *const T, pTrustee: ?*TRUSTEE_W, cPropertyIDSets: u32, rgPropertyIDSets: ?*const DBPROPIDSET, pcPropertySets: ?*u32, prgPropertySets: ?*?*DBPROPSET) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeAdmin.VTable, self.vtable).GetTrusteeProperties(@ptrCast(*const ITrusteeAdmin, self), pTrustee, cPropertyIDSets, rgPropertyIDSets, pcPropertySets, prgPropertySets);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITrusteeGroupAdmin_Value = Guid.initString("0c733aa2-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITrusteeGroupAdmin = &IID_ITrusteeGroupAdmin_Value;
pub const ITrusteeGroupAdmin = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddMember: fn(
self: *const ITrusteeGroupAdmin,
pMembershipTrustee: ?*TRUSTEE_W,
pMemberTrustee: ?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteMember: fn(
self: *const ITrusteeGroupAdmin,
pMembershipTrustee: ?*TRUSTEE_W,
pMemberTrustee: ?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsMember: fn(
self: *const ITrusteeGroupAdmin,
pMembershipTrustee: ?*TRUSTEE_W,
pMemberTrustee: ?*TRUSTEE_W,
pfStatus: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMembers: fn(
self: *const ITrusteeGroupAdmin,
pMembershipTrustee: ?*TRUSTEE_W,
pcMembers: ?*u32,
prgMembers: ?*?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMemberships: fn(
self: *const ITrusteeGroupAdmin,
pTrustee: ?*TRUSTEE_W,
pcMemberships: ?*u32,
prgMemberships: ?*?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeGroupAdmin_AddMember(self: *const T, pMembershipTrustee: ?*TRUSTEE_W, pMemberTrustee: ?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeGroupAdmin.VTable, self.vtable).AddMember(@ptrCast(*const ITrusteeGroupAdmin, self), pMembershipTrustee, pMemberTrustee);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeGroupAdmin_DeleteMember(self: *const T, pMembershipTrustee: ?*TRUSTEE_W, pMemberTrustee: ?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeGroupAdmin.VTable, self.vtable).DeleteMember(@ptrCast(*const ITrusteeGroupAdmin, self), pMembershipTrustee, pMemberTrustee);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeGroupAdmin_IsMember(self: *const T, pMembershipTrustee: ?*TRUSTEE_W, pMemberTrustee: ?*TRUSTEE_W, pfStatus: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeGroupAdmin.VTable, self.vtable).IsMember(@ptrCast(*const ITrusteeGroupAdmin, self), pMembershipTrustee, pMemberTrustee, pfStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeGroupAdmin_GetMembers(self: *const T, pMembershipTrustee: ?*TRUSTEE_W, pcMembers: ?*u32, prgMembers: ?*?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeGroupAdmin.VTable, self.vtable).GetMembers(@ptrCast(*const ITrusteeGroupAdmin, self), pMembershipTrustee, pcMembers, prgMembers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITrusteeGroupAdmin_GetMemberships(self: *const T, pTrustee: ?*TRUSTEE_W, pcMemberships: ?*u32, prgMemberships: ?*?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ITrusteeGroupAdmin.VTable, self.vtable).GetMemberships(@ptrCast(*const ITrusteeGroupAdmin, self), pTrustee, pcMemberships, prgMemberships);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IObjectAccessControl_Value = Guid.initString("0c733aa3-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IObjectAccessControl = &IID_IObjectAccessControl_Value;
pub const IObjectAccessControl = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetObjectAccessRights: fn(
self: *const IObjectAccessControl,
pObject: ?*SEC_OBJECT,
pcAccessEntries: ?*u32,
prgAccessEntries: ?*?*EXPLICIT_ACCESS_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetObjectOwner: fn(
self: *const IObjectAccessControl,
pObject: ?*SEC_OBJECT,
ppOwner: ?*?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsObjectAccessAllowed: fn(
self: *const IObjectAccessControl,
pObject: ?*SEC_OBJECT,
pAccessEntry: ?*EXPLICIT_ACCESS_W,
pfResult: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetObjectAccessRights: fn(
self: *const IObjectAccessControl,
pObject: ?*SEC_OBJECT,
cAccessEntries: u32,
prgAccessEntries: ?*EXPLICIT_ACCESS_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetObjectOwner: fn(
self: *const IObjectAccessControl,
pObject: ?*SEC_OBJECT,
pOwner: ?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IObjectAccessControl_GetObjectAccessRights(self: *const T, pObject: ?*SEC_OBJECT, pcAccessEntries: ?*u32, prgAccessEntries: ?*?*EXPLICIT_ACCESS_W) callconv(.Inline) HRESULT {
return @ptrCast(*const IObjectAccessControl.VTable, self.vtable).GetObjectAccessRights(@ptrCast(*const IObjectAccessControl, self), pObject, pcAccessEntries, prgAccessEntries);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IObjectAccessControl_GetObjectOwner(self: *const T, pObject: ?*SEC_OBJECT, ppOwner: ?*?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const IObjectAccessControl.VTable, self.vtable).GetObjectOwner(@ptrCast(*const IObjectAccessControl, self), pObject, ppOwner);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IObjectAccessControl_IsObjectAccessAllowed(self: *const T, pObject: ?*SEC_OBJECT, pAccessEntry: ?*EXPLICIT_ACCESS_W, pfResult: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IObjectAccessControl.VTable, self.vtable).IsObjectAccessAllowed(@ptrCast(*const IObjectAccessControl, self), pObject, pAccessEntry, pfResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IObjectAccessControl_SetObjectAccessRights(self: *const T, pObject: ?*SEC_OBJECT, cAccessEntries: u32, prgAccessEntries: ?*EXPLICIT_ACCESS_W) callconv(.Inline) HRESULT {
return @ptrCast(*const IObjectAccessControl.VTable, self.vtable).SetObjectAccessRights(@ptrCast(*const IObjectAccessControl, self), pObject, cAccessEntries, prgAccessEntries);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IObjectAccessControl_SetObjectOwner(self: *const T, pObject: ?*SEC_OBJECT, pOwner: ?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const IObjectAccessControl.VTable, self.vtable).SetObjectOwner(@ptrCast(*const IObjectAccessControl, self), pObject, pOwner);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const ACCESS_MASKENUM = enum(i32) {
EXCLUSIVE = 512,
READDESIGN = 1024,
WRITEDESIGN = 2048,
WITHGRANT = 4096,
REFERENCE = 8192,
CREATE = 16384,
INSERT = 32768,
DELETE = 65536,
READCONTROL = 131072,
WRITEPERMISSIONS = 262144,
WRITEOWNER = 524288,
MAXIMUM_ALLOWED = 33554432,
ALL = 268435456,
EXECUTE = 536870912,
READ = -2147483648,
UPDATE = 1073741824,
DROP = 256,
};
pub const PERM_EXCLUSIVE = ACCESS_MASKENUM.EXCLUSIVE;
pub const PERM_READDESIGN = ACCESS_MASKENUM.READDESIGN;
pub const PERM_WRITEDESIGN = ACCESS_MASKENUM.WRITEDESIGN;
pub const PERM_WITHGRANT = ACCESS_MASKENUM.WITHGRANT;
pub const PERM_REFERENCE = ACCESS_MASKENUM.REFERENCE;
pub const PERM_CREATE = ACCESS_MASKENUM.CREATE;
pub const PERM_INSERT = ACCESS_MASKENUM.INSERT;
pub const PERM_DELETE = ACCESS_MASKENUM.DELETE;
pub const PERM_READCONTROL = ACCESS_MASKENUM.READCONTROL;
pub const PERM_WRITEPERMISSIONS = ACCESS_MASKENUM.WRITEPERMISSIONS;
pub const PERM_WRITEOWNER = ACCESS_MASKENUM.WRITEOWNER;
pub const PERM_MAXIMUM_ALLOWED = ACCESS_MASKENUM.MAXIMUM_ALLOWED;
pub const PERM_ALL = ACCESS_MASKENUM.ALL;
pub const PERM_EXECUTE = ACCESS_MASKENUM.EXECUTE;
pub const PERM_READ = ACCESS_MASKENUM.READ;
pub const PERM_UPDATE = ACCESS_MASKENUM.UPDATE;
pub const PERM_DROP = ACCESS_MASKENUM.DROP;
const IID_ISecurityInfo_Value = Guid.initString("0c733aa4-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ISecurityInfo = &IID_ISecurityInfo_Value;
pub const ISecurityInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetCurrentTrustee: fn(
self: *const ISecurityInfo,
ppTrustee: ?*?*TRUSTEE_W,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetObjectTypes: fn(
self: *const ISecurityInfo,
cObjectTypes: ?*u32,
rgObjectTypes: ?*?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPermissions: fn(
self: *const ISecurityInfo,
ObjectType: Guid,
pPermissions: ?*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 ISecurityInfo_GetCurrentTrustee(self: *const T, ppTrustee: ?*?*TRUSTEE_W) callconv(.Inline) HRESULT {
return @ptrCast(*const ISecurityInfo.VTable, self.vtable).GetCurrentTrustee(@ptrCast(*const ISecurityInfo, self), ppTrustee);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISecurityInfo_GetObjectTypes(self: *const T, cObjectTypes: ?*u32, rgObjectTypes: ?*?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ISecurityInfo.VTable, self.vtable).GetObjectTypes(@ptrCast(*const ISecurityInfo, self), cObjectTypes, rgObjectTypes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISecurityInfo_GetPermissions(self: *const T, ObjectType: Guid, pPermissions: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISecurityInfo.VTable, self.vtable).GetPermissions(@ptrCast(*const ISecurityInfo, self), ObjectType, pPermissions);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITableCreation_Value = Guid.initString("0c733abc-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITableCreation = &IID_ITableCreation_Value;
pub const ITableCreation = extern struct {
pub const VTable = extern struct {
base: ITableDefinition.VTable,
GetTableDefinition: fn(
self: *const ITableCreation,
pTableID: ?*DBID,
pcColumnDescs: ?*usize,
prgColumnDescs: ?[*]?*DBCOLUMNDESC,
pcPropertySets: ?*u32,
prgPropertySets: ?[*]?*DBPROPSET,
pcConstraintDescs: ?*u32,
prgConstraintDescs: ?[*]?*DBCONSTRAINTDESC,
ppwszStringBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ITableDefinition.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableCreation_GetTableDefinition(self: *const T, pTableID: ?*DBID, pcColumnDescs: ?*usize, prgColumnDescs: ?[*]?*DBCOLUMNDESC, pcPropertySets: ?*u32, prgPropertySets: ?[*]?*DBPROPSET, pcConstraintDescs: ?*u32, prgConstraintDescs: ?[*]?*DBCONSTRAINTDESC, ppwszStringBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableCreation.VTable, self.vtable).GetTableDefinition(@ptrCast(*const ITableCreation, self), pTableID, pcColumnDescs, prgColumnDescs, pcPropertySets, prgPropertySets, pcConstraintDescs, prgConstraintDescs, ppwszStringBuffer);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITableDefinitionWithConstraints_Value = Guid.initString("0c733aab-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITableDefinitionWithConstraints = &IID_ITableDefinitionWithConstraints_Value;
pub const ITableDefinitionWithConstraints = extern struct {
pub const VTable = extern struct {
base: ITableCreation.VTable,
AddConstraint: fn(
self: *const ITableDefinitionWithConstraints,
pTableID: ?*DBID,
pConstraintDesc: ?*DBCONSTRAINTDESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTableWithConstraints: fn(
self: *const ITableDefinitionWithConstraints,
pUnkOuter: ?*IUnknown,
pTableID: ?*DBID,
cColumnDescs: usize,
rgColumnDescs: ?*DBCOLUMNDESC,
cConstraintDescs: u32,
rgConstraintDescs: ?*DBCONSTRAINTDESC,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: ?*DBPROPSET,
ppTableID: ?*?*DBID,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DropConstraint: fn(
self: *const ITableDefinitionWithConstraints,
pTableID: ?*DBID,
pConstraintID: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ITableCreation.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinitionWithConstraints_AddConstraint(self: *const T, pTableID: ?*DBID, pConstraintDesc: ?*DBCONSTRAINTDESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinitionWithConstraints.VTable, self.vtable).AddConstraint(@ptrCast(*const ITableDefinitionWithConstraints, self), pTableID, pConstraintDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinitionWithConstraints_CreateTableWithConstraints(self: *const T, pUnkOuter: ?*IUnknown, pTableID: ?*DBID, cColumnDescs: usize, rgColumnDescs: ?*DBCOLUMNDESC, cConstraintDescs: u32, rgConstraintDescs: ?*DBCONSTRAINTDESC, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: ?*DBPROPSET, ppTableID: ?*?*DBID, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinitionWithConstraints.VTable, self.vtable).CreateTableWithConstraints(@ptrCast(*const ITableDefinitionWithConstraints, self), pUnkOuter, pTableID, cColumnDescs, rgColumnDescs, cConstraintDescs, rgConstraintDescs, riid, cPropertySets, rgPropertySets, ppTableID, ppRowset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableDefinitionWithConstraints_DropConstraint(self: *const T, pTableID: ?*DBID, pConstraintID: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableDefinitionWithConstraints.VTable, self.vtable).DropConstraint(@ptrCast(*const ITableDefinitionWithConstraints, self), pTableID, pConstraintID);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRow_Value = Guid.initString("0c733ab4-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRow = &IID_IRow_Value;
pub const IRow = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetColumns: fn(
self: *const IRow,
cColumns: usize,
rgColumns: [*]DBCOLUMNACCESS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSourceRowset: fn(
self: *const IRow,
riid: ?*const Guid,
ppRowset: ?*?*IUnknown,
phRow: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Open: fn(
self: *const IRow,
pUnkOuter: ?*IUnknown,
pColumnID: ?*DBID,
rguidColumnType: ?*const Guid,
dwBindFlags: u32,
riid: ?*const Guid,
ppUnk: ?*?*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 IRow_GetColumns(self: *const T, cColumns: usize, rgColumns: [*]DBCOLUMNACCESS) callconv(.Inline) HRESULT {
return @ptrCast(*const IRow.VTable, self.vtable).GetColumns(@ptrCast(*const IRow, self), cColumns, rgColumns);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRow_GetSourceRowset(self: *const T, riid: ?*const Guid, ppRowset: ?*?*IUnknown, phRow: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRow.VTable, self.vtable).GetSourceRowset(@ptrCast(*const IRow, self), riid, ppRowset, phRow);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRow_Open(self: *const T, pUnkOuter: ?*IUnknown, pColumnID: ?*DBID, rguidColumnType: ?*const Guid, dwBindFlags: u32, riid: ?*const Guid, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRow.VTable, self.vtable).Open(@ptrCast(*const IRow, self), pUnkOuter, pColumnID, rguidColumnType, dwBindFlags, riid, ppUnk);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowChange_Value = Guid.initString("0c733ab5-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowChange = &IID_IRowChange_Value;
pub const IRowChange = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetColumns: fn(
self: *const IRowChange,
cColumns: usize,
rgColumns: [*]DBCOLUMNACCESS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowChange_SetColumns(self: *const T, cColumns: usize, rgColumns: [*]DBCOLUMNACCESS) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowChange.VTable, self.vtable).SetColumns(@ptrCast(*const IRowChange, self), cColumns, rgColumns);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowSchemaChange_Value = Guid.initString("0c733aae-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowSchemaChange = &IID_IRowSchemaChange_Value;
pub const IRowSchemaChange = extern struct {
pub const VTable = extern struct {
base: IRowChange.VTable,
DeleteColumns: fn(
self: *const IRowSchemaChange,
cColumns: usize,
rgColumnIDs: ?*const DBID,
rgdwStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddColumns: fn(
self: *const IRowSchemaChange,
cColumns: usize,
rgNewColumnInfo: ?*const DBCOLUMNINFO,
rgColumns: ?*DBCOLUMNACCESS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IRowChange.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowSchemaChange_DeleteColumns(self: *const T, cColumns: usize, rgColumnIDs: ?*const DBID, rgdwStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowSchemaChange.VTable, self.vtable).DeleteColumns(@ptrCast(*const IRowSchemaChange, self), cColumns, rgColumnIDs, rgdwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowSchemaChange_AddColumns(self: *const T, cColumns: usize, rgNewColumnInfo: ?*const DBCOLUMNINFO, rgColumns: ?*DBCOLUMNACCESS) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowSchemaChange.VTable, self.vtable).AddColumns(@ptrCast(*const IRowSchemaChange, self), cColumns, rgNewColumnInfo, rgColumns);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IGetRow_Value = Guid.initString("0c733aaf-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IGetRow = &IID_IGetRow_Value;
pub const IGetRow = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetRowFromHROW: fn(
self: *const IGetRow,
pUnkOuter: ?*IUnknown,
hRow: usize,
riid: ?*const Guid,
ppUnk: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetURLFromHROW: fn(
self: *const IGetRow,
hRow: usize,
ppwszURL: ?*?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 IGetRow_GetRowFromHROW(self: *const T, pUnkOuter: ?*IUnknown, hRow: usize, riid: ?*const Guid, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IGetRow.VTable, self.vtable).GetRowFromHROW(@ptrCast(*const IGetRow, self), pUnkOuter, hRow, riid, ppUnk);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IGetRow_GetURLFromHROW(self: *const T, hRow: usize, ppwszURL: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IGetRow.VTable, self.vtable).GetURLFromHROW(@ptrCast(*const IGetRow, self), hRow, ppwszURL);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IBindResource_Value = Guid.initString("0c733ab1-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IBindResource = &IID_IBindResource_Value;
pub const IBindResource = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Bind: fn(
self: *const IBindResource,
pUnkOuter: ?*IUnknown,
pwszURL: ?[*:0]const u16,
dwBindURLFlags: u32,
rguid: ?*const Guid,
riid: ?*const Guid,
pAuthenticate: ?*IAuthenticate,
pImplSession: ?*DBIMPLICITSESSION,
pdwBindStatus: ?*u32,
ppUnk: ?*?*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 IBindResource_Bind(self: *const T, pUnkOuter: ?*IUnknown, pwszURL: ?[*:0]const u16, dwBindURLFlags: u32, rguid: ?*const Guid, riid: ?*const Guid, pAuthenticate: ?*IAuthenticate, pImplSession: ?*DBIMPLICITSESSION, pdwBindStatus: ?*u32, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IBindResource.VTable, self.vtable).Bind(@ptrCast(*const IBindResource, self), pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate, pImplSession, pdwBindStatus, ppUnk);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBCOPYFLAGSENUM = enum(i32) {
ASYNC = 256,
REPLACE_EXISTING = 512,
ALLOW_EMULATION = 1024,
NON_RECURSIVE = 2048,
ATOMIC = 4096,
};
pub const DBCOPY_ASYNC = DBCOPYFLAGSENUM.ASYNC;
pub const DBCOPY_REPLACE_EXISTING = DBCOPYFLAGSENUM.REPLACE_EXISTING;
pub const DBCOPY_ALLOW_EMULATION = DBCOPYFLAGSENUM.ALLOW_EMULATION;
pub const DBCOPY_NON_RECURSIVE = DBCOPYFLAGSENUM.NON_RECURSIVE;
pub const DBCOPY_ATOMIC = DBCOPYFLAGSENUM.ATOMIC;
pub const DBMOVEFLAGSENUM = enum(i32) {
REPLACE_EXISTING = 1,
ASYNC = 256,
DONT_UPDATE_LINKS = 512,
ALLOW_EMULATION = 1024,
ATOMIC = 4096,
};
pub const DBMOVE_REPLACE_EXISTING = DBMOVEFLAGSENUM.REPLACE_EXISTING;
pub const DBMOVE_ASYNC = DBMOVEFLAGSENUM.ASYNC;
pub const DBMOVE_DONT_UPDATE_LINKS = DBMOVEFLAGSENUM.DONT_UPDATE_LINKS;
pub const DBMOVE_ALLOW_EMULATION = DBMOVEFLAGSENUM.ALLOW_EMULATION;
pub const DBMOVE_ATOMIC = DBMOVEFLAGSENUM.ATOMIC;
pub const DBDELETEFLAGSENUM = enum(i32) {
SYNC = 256,
TOMIC = 4096,
};
pub const DBDELETE_ASYNC = DBDELETEFLAGSENUM.SYNC;
pub const DBDELETE_ATOMIC = DBDELETEFLAGSENUM.TOMIC;
const IID_IScopedOperations_Value = Guid.initString("0c733ab0-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IScopedOperations = &IID_IScopedOperations_Value;
pub const IScopedOperations = extern struct {
pub const VTable = extern struct {
base: IBindResource.VTable,
Copy: fn(
self: *const IScopedOperations,
cRows: usize,
rgpwszSourceURLs: ?[*]?PWSTR,
rgpwszDestURLs: [*]?PWSTR,
dwCopyFlags: u32,
pAuthenticate: ?*IAuthenticate,
rgdwStatus: [*]u32,
rgpwszNewURLs: ?[*]?PWSTR,
ppStringsBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Move: fn(
self: *const IScopedOperations,
cRows: usize,
rgpwszSourceURLs: ?[*]?PWSTR,
rgpwszDestURLs: [*]?PWSTR,
dwMoveFlags: u32,
pAuthenticate: ?*IAuthenticate,
rgdwStatus: [*]u32,
rgpwszNewURLs: ?[*]?PWSTR,
ppStringsBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Delete: fn(
self: *const IScopedOperations,
cRows: usize,
rgpwszURLs: [*]?PWSTR,
dwDeleteFlags: u32,
rgdwStatus: [*]u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenRowset: fn(
self: *const IScopedOperations,
pUnkOuter: ?*IUnknown,
pTableID: ?*DBID,
pIndexID: ?*DBID,
riid: ?*const Guid,
cPropertySets: u32,
rgPropertySets: [*]DBPROPSET,
ppRowset: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IBindResource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IScopedOperations_Copy(self: *const T, cRows: usize, rgpwszSourceURLs: ?[*]?PWSTR, rgpwszDestURLs: [*]?PWSTR, dwCopyFlags: u32, pAuthenticate: ?*IAuthenticate, rgdwStatus: [*]u32, rgpwszNewURLs: ?[*]?PWSTR, ppStringsBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IScopedOperations.VTable, self.vtable).Copy(@ptrCast(*const IScopedOperations, self), cRows, rgpwszSourceURLs, rgpwszDestURLs, dwCopyFlags, pAuthenticate, rgdwStatus, rgpwszNewURLs, ppStringsBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IScopedOperations_Move(self: *const T, cRows: usize, rgpwszSourceURLs: ?[*]?PWSTR, rgpwszDestURLs: [*]?PWSTR, dwMoveFlags: u32, pAuthenticate: ?*IAuthenticate, rgdwStatus: [*]u32, rgpwszNewURLs: ?[*]?PWSTR, ppStringsBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IScopedOperations.VTable, self.vtable).Move(@ptrCast(*const IScopedOperations, self), cRows, rgpwszSourceURLs, rgpwszDestURLs, dwMoveFlags, pAuthenticate, rgdwStatus, rgpwszNewURLs, ppStringsBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IScopedOperations_Delete(self: *const T, cRows: usize, rgpwszURLs: [*]?PWSTR, dwDeleteFlags: u32, rgdwStatus: [*]u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IScopedOperations.VTable, self.vtable).Delete(@ptrCast(*const IScopedOperations, self), cRows, rgpwszURLs, dwDeleteFlags, rgdwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IScopedOperations_OpenRowset(self: *const T, pUnkOuter: ?*IUnknown, pTableID: ?*DBID, pIndexID: ?*DBID, riid: ?*const Guid, cPropertySets: u32, rgPropertySets: [*]DBPROPSET, ppRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IScopedOperations.VTable, self.vtable).OpenRowset(@ptrCast(*const IScopedOperations, self), pUnkOuter, pTableID, pIndexID, riid, cPropertySets, rgPropertySets, ppRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICreateRow_Value = Guid.initString("0c733ab2-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICreateRow = &IID_ICreateRow_Value;
pub const ICreateRow = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateRow: fn(
self: *const ICreateRow,
pUnkOuter: ?*IUnknown,
pwszURL: ?[*:0]const u16,
dwBindURLFlags: u32,
rguid: ?*const Guid,
riid: ?*const Guid,
pAuthenticate: ?*IAuthenticate,
pImplSession: ?*DBIMPLICITSESSION,
pdwBindStatus: ?*u32,
ppwszNewURL: ?*?PWSTR,
ppUnk: ?*?*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 ICreateRow_CreateRow(self: *const T, pUnkOuter: ?*IUnknown, pwszURL: ?[*:0]const u16, dwBindURLFlags: u32, rguid: ?*const Guid, riid: ?*const Guid, pAuthenticate: ?*IAuthenticate, pImplSession: ?*DBIMPLICITSESSION, pdwBindStatus: ?*u32, ppwszNewURL: ?*?PWSTR, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICreateRow.VTable, self.vtable).CreateRow(@ptrCast(*const ICreateRow, self), pUnkOuter, pwszURL, dwBindURLFlags, rguid, riid, pAuthenticate, pImplSession, pdwBindStatus, ppwszNewURL, ppUnk);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBBinderProperties_Value = Guid.initString("0c733ab3-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBBinderProperties = &IID_IDBBinderProperties_Value;
pub const IDBBinderProperties = extern struct {
pub const VTable = extern struct {
base: IDBProperties.VTable,
Reset: fn(
self: *const IDBBinderProperties,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDBProperties.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBBinderProperties_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBBinderProperties.VTable, self.vtable).Reset(@ptrCast(*const IDBBinderProperties, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IColumnsInfo2_Value = Guid.initString("0c733ab8-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IColumnsInfo2 = &IID_IColumnsInfo2_Value;
pub const IColumnsInfo2 = extern struct {
pub const VTable = extern struct {
base: IColumnsInfo.VTable,
GetRestrictedColumnInfo: fn(
self: *const IColumnsInfo2,
cColumnIDMasks: usize,
rgColumnIDMasks: [*]const DBID,
dwFlags: u32,
pcColumns: ?*usize,
prgColumnIDs: ?*?*DBID,
prgColumnInfo: ?*?*DBCOLUMNINFO,
ppStringsBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IColumnsInfo.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IColumnsInfo2_GetRestrictedColumnInfo(self: *const T, cColumnIDMasks: usize, rgColumnIDMasks: [*]const DBID, dwFlags: u32, pcColumns: ?*usize, prgColumnIDs: ?*?*DBID, prgColumnInfo: ?*?*DBCOLUMNINFO, ppStringsBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IColumnsInfo2.VTable, self.vtable).GetRestrictedColumnInfo(@ptrCast(*const IColumnsInfo2, self), cColumnIDMasks, rgColumnIDMasks, dwFlags, pcColumns, prgColumnIDs, prgColumnInfo, ppStringsBuffer);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRegisterProvider_Value = Guid.initString("0c733ab9-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRegisterProvider = &IID_IRegisterProvider_Value;
pub const IRegisterProvider = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetURLMapping: fn(
self: *const IRegisterProvider,
pwszURL: ?[*:0]const u16,
dwReserved: usize,
pclsidProvider: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetURLMapping: fn(
self: *const IRegisterProvider,
pwszURL: ?[*:0]const u16,
dwReserved: usize,
rclsidProvider: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnregisterProvider: fn(
self: *const IRegisterProvider,
pwszURL: ?[*:0]const u16,
dwReserved: usize,
rclsidProvider: ?*const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRegisterProvider_GetURLMapping(self: *const T, pwszURL: ?[*:0]const u16, dwReserved: usize, pclsidProvider: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IRegisterProvider.VTable, self.vtable).GetURLMapping(@ptrCast(*const IRegisterProvider, self), pwszURL, dwReserved, pclsidProvider);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRegisterProvider_SetURLMapping(self: *const T, pwszURL: ?[*:0]const u16, dwReserved: usize, rclsidProvider: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IRegisterProvider.VTable, self.vtable).SetURLMapping(@ptrCast(*const IRegisterProvider, self), pwszURL, dwReserved, rclsidProvider);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRegisterProvider_UnregisterProvider(self: *const T, pwszURL: ?[*:0]const u16, dwReserved: usize, rclsidProvider: ?*const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IRegisterProvider.VTable, self.vtable).UnregisterProvider(@ptrCast(*const IRegisterProvider, self), pwszURL, dwReserved, rclsidProvider);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IGetSession_Value = Guid.initString("0c733aba-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IGetSession = &IID_IGetSession_Value;
pub const IGetSession = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSession: fn(
self: *const IGetSession,
riid: ?*const Guid,
ppSession: ?*?*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 IGetSession_GetSession(self: *const T, riid: ?*const Guid, ppSession: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IGetSession.VTable, self.vtable).GetSession(@ptrCast(*const IGetSession, self), riid, ppSession);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IGetSourceRow_Value = Guid.initString("0c733abb-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IGetSourceRow = &IID_IGetSourceRow_Value;
pub const IGetSourceRow = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSourceRow: fn(
self: *const IGetSourceRow,
riid: ?*const Guid,
ppRow: ?*?*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 IGetSourceRow_GetSourceRow(self: *const T, riid: ?*const Guid, ppRow: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IGetSourceRow.VTable, self.vtable).GetSourceRow(@ptrCast(*const IGetSourceRow, self), riid, ppRow);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetCurrentIndex_Value = Guid.initString("0c733abd-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetCurrentIndex = &IID_IRowsetCurrentIndex_Value;
pub const IRowsetCurrentIndex = extern struct {
pub const VTable = extern struct {
base: IRowsetIndex.VTable,
GetIndex: fn(
self: *const IRowsetCurrentIndex,
ppIndexID: ?*?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetIndex: fn(
self: *const IRowsetCurrentIndex,
pIndexID: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IRowsetIndex.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetCurrentIndex_GetIndex(self: *const T, ppIndexID: ?*?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetCurrentIndex.VTable, self.vtable).GetIndex(@ptrCast(*const IRowsetCurrentIndex, self), ppIndexID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetCurrentIndex_SetIndex(self: *const T, pIndexID: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetCurrentIndex.VTable, self.vtable).SetIndex(@ptrCast(*const IRowsetCurrentIndex, self), pIndexID);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandStream_Value = Guid.initString("0c733abf-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandStream = &IID_ICommandStream_Value;
pub const ICommandStream = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetCommandStream: fn(
self: *const ICommandStream,
piid: ?*Guid,
pguidDialect: ?*Guid,
ppCommandStream: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCommandStream: fn(
self: *const ICommandStream,
riid: ?*const Guid,
rguidDialect: ?*const Guid,
pCommandStream: ?*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 ICommandStream_GetCommandStream(self: *const T, piid: ?*Guid, pguidDialect: ?*Guid, ppCommandStream: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandStream.VTable, self.vtable).GetCommandStream(@ptrCast(*const ICommandStream, self), piid, pguidDialect, ppCommandStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandStream_SetCommandStream(self: *const T, riid: ?*const Guid, rguidDialect: ?*const Guid, pCommandStream: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandStream.VTable, self.vtable).SetCommandStream(@ptrCast(*const ICommandStream, self), riid, rguidDialect, pCommandStream);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetBookmark_Value = Guid.initString("0c733ac2-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetBookmark = &IID_IRowsetBookmark_Value;
pub const IRowsetBookmark = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
PositionOnBookmark: fn(
self: *const IRowsetBookmark,
hChapter: usize,
cbBookmark: usize,
// TODO: what to do with BytesParamIndex 1?
pBookmark: ?*const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetBookmark_PositionOnBookmark(self: *const T, hChapter: usize, cbBookmark: usize, pBookmark: ?*const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetBookmark.VTable, self.vtable).PositionOnBookmark(@ptrCast(*const IRowsetBookmark, self), hChapter, cbBookmark, pBookmark);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_QueryParser_Value = Guid.initString("b72f8fd8-0fab-4dd9-bdbf-245a6ce1485b");
pub const CLSID_QueryParser = &CLSID_QueryParser_Value;
const CLSID_NegationCondition_Value = Guid.initString("8de9c74c-605a-4acd-bee3-2b222aa2d23d");
pub const CLSID_NegationCondition = &CLSID_NegationCondition_Value;
const CLSID_CompoundCondition_Value = Guid.initString("116f8d13-101e-4fa5-84d4-ff8279381935");
pub const CLSID_CompoundCondition = &CLSID_CompoundCondition_Value;
const CLSID_LeafCondition_Value = Guid.initString("52f15c89-5a17-48e1-bbcd-46a3f89c7cc2");
pub const CLSID_LeafCondition = &CLSID_LeafCondition_Value;
const CLSID_ConditionFactory_Value = Guid.initString("e03e85b0-7be3-4000-ba98-6c13de9fa486");
pub const CLSID_ConditionFactory = &CLSID_ConditionFactory_Value;
const CLSID_Interval_Value = Guid.initString("d957171f-4bf9-4de2-bcd5-c70a7ca55836");
pub const CLSID_Interval = &CLSID_Interval_Value;
const CLSID_QueryParserManager_Value = Guid.initString("5088b39a-29b4-4d9d-8245-4ee289222f66");
pub const CLSID_QueryParserManager = &CLSID_QueryParserManager_Value;
pub const STRUCTURED_QUERY_SYNTAX = enum(i32) {
NO_SYNTAX = 0,
ADVANCED_QUERY_SYNTAX = 1,
NATURAL_QUERY_SYNTAX = 2,
};
pub const SQS_NO_SYNTAX = STRUCTURED_QUERY_SYNTAX.NO_SYNTAX;
pub const SQS_ADVANCED_QUERY_SYNTAX = STRUCTURED_QUERY_SYNTAX.ADVANCED_QUERY_SYNTAX;
pub const SQS_NATURAL_QUERY_SYNTAX = STRUCTURED_QUERY_SYNTAX.NATURAL_QUERY_SYNTAX;
pub const STRUCTURED_QUERY_SINGLE_OPTION = enum(i32) {
SCHEMA = 0,
LOCALE_WORD_BREAKING = 1,
WORD_BREAKER = 2,
NATURAL_SYNTAX = 3,
AUTOMATIC_WILDCARD = 4,
TRACE_LEVEL = 5,
LANGUAGE_KEYWORDS = 6,
SYNTAX = 7,
TIME_ZONE = 8,
IMPLICIT_CONNECTOR = 9,
CONNECTOR_CASE = 10,
};
pub const SQSO_SCHEMA = STRUCTURED_QUERY_SINGLE_OPTION.SCHEMA;
pub const SQSO_LOCALE_WORD_BREAKING = STRUCTURED_QUERY_SINGLE_OPTION.LOCALE_WORD_BREAKING;
pub const SQSO_WORD_BREAKER = STRUCTURED_QUERY_SINGLE_OPTION.WORD_BREAKER;
pub const SQSO_NATURAL_SYNTAX = STRUCTURED_QUERY_SINGLE_OPTION.NATURAL_SYNTAX;
pub const SQSO_AUTOMATIC_WILDCARD = STRUCTURED_QUERY_SINGLE_OPTION.AUTOMATIC_WILDCARD;
pub const SQSO_TRACE_LEVEL = STRUCTURED_QUERY_SINGLE_OPTION.TRACE_LEVEL;
pub const SQSO_LANGUAGE_KEYWORDS = STRUCTURED_QUERY_SINGLE_OPTION.LANGUAGE_KEYWORDS;
pub const SQSO_SYNTAX = STRUCTURED_QUERY_SINGLE_OPTION.SYNTAX;
pub const SQSO_TIME_ZONE = STRUCTURED_QUERY_SINGLE_OPTION.TIME_ZONE;
pub const SQSO_IMPLICIT_CONNECTOR = STRUCTURED_QUERY_SINGLE_OPTION.IMPLICIT_CONNECTOR;
pub const SQSO_CONNECTOR_CASE = STRUCTURED_QUERY_SINGLE_OPTION.CONNECTOR_CASE;
pub const STRUCTURED_QUERY_MULTIOPTION = enum(i32) {
VIRTUAL_PROPERTY = 0,
DEFAULT_PROPERTY = 1,
GENERATOR_FOR_TYPE = 2,
MAP_PROPERTY = 3,
};
pub const SQMO_VIRTUAL_PROPERTY = STRUCTURED_QUERY_MULTIOPTION.VIRTUAL_PROPERTY;
pub const SQMO_DEFAULT_PROPERTY = STRUCTURED_QUERY_MULTIOPTION.DEFAULT_PROPERTY;
pub const SQMO_GENERATOR_FOR_TYPE = STRUCTURED_QUERY_MULTIOPTION.GENERATOR_FOR_TYPE;
pub const SQMO_MAP_PROPERTY = STRUCTURED_QUERY_MULTIOPTION.MAP_PROPERTY;
pub const STRUCTURED_QUERY_PARSE_ERROR = enum(i32) {
NONE = 0,
EXTRA_OPENING_PARENTHESIS = 1,
EXTRA_CLOSING_PARENTHESIS = 2,
IGNORED_MODIFIER = 3,
IGNORED_CONNECTOR = 4,
IGNORED_KEYWORD = 5,
UNHANDLED = 6,
};
pub const SQPE_NONE = STRUCTURED_QUERY_PARSE_ERROR.NONE;
pub const SQPE_EXTRA_OPENING_PARENTHESIS = STRUCTURED_QUERY_PARSE_ERROR.EXTRA_OPENING_PARENTHESIS;
pub const SQPE_EXTRA_CLOSING_PARENTHESIS = STRUCTURED_QUERY_PARSE_ERROR.EXTRA_CLOSING_PARENTHESIS;
pub const SQPE_IGNORED_MODIFIER = STRUCTURED_QUERY_PARSE_ERROR.IGNORED_MODIFIER;
pub const SQPE_IGNORED_CONNECTOR = STRUCTURED_QUERY_PARSE_ERROR.IGNORED_CONNECTOR;
pub const SQPE_IGNORED_KEYWORD = STRUCTURED_QUERY_PARSE_ERROR.IGNORED_KEYWORD;
pub const SQPE_UNHANDLED = STRUCTURED_QUERY_PARSE_ERROR.UNHANDLED;
pub const STRUCTURED_QUERY_RESOLVE_OPTION = enum(u32) {
DEFAULT = 0,
DONT_RESOLVE_DATETIME = 1,
ALWAYS_ONE_INTERVAL = 2,
DONT_SIMPLIFY_CONDITION_TREES = 4,
DONT_MAP_RELATIONS = 8,
DONT_RESOLVE_RANGES = 16,
DONT_REMOVE_UNRESTRICTED_KEYWORDS = 32,
DONT_SPLIT_WORDS = 64,
IGNORE_PHRASE_ORDER = 128,
ADD_VALUE_TYPE_FOR_PLAIN_VALUES = 256,
ADD_ROBUST_ITEM_NAME = 512,
_,
pub fn initFlags(o: struct {
DEFAULT: u1 = 0,
DONT_RESOLVE_DATETIME: u1 = 0,
ALWAYS_ONE_INTERVAL: u1 = 0,
DONT_SIMPLIFY_CONDITION_TREES: u1 = 0,
DONT_MAP_RELATIONS: u1 = 0,
DONT_RESOLVE_RANGES: u1 = 0,
DONT_REMOVE_UNRESTRICTED_KEYWORDS: u1 = 0,
DONT_SPLIT_WORDS: u1 = 0,
IGNORE_PHRASE_ORDER: u1 = 0,
ADD_VALUE_TYPE_FOR_PLAIN_VALUES: u1 = 0,
ADD_ROBUST_ITEM_NAME: u1 = 0,
}) STRUCTURED_QUERY_RESOLVE_OPTION {
return @intToEnum(STRUCTURED_QUERY_RESOLVE_OPTION,
(if (o.DEFAULT == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DEFAULT) else 0)
| (if (o.DONT_RESOLVE_DATETIME == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DONT_RESOLVE_DATETIME) else 0)
| (if (o.ALWAYS_ONE_INTERVAL == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.ALWAYS_ONE_INTERVAL) else 0)
| (if (o.DONT_SIMPLIFY_CONDITION_TREES == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DONT_SIMPLIFY_CONDITION_TREES) else 0)
| (if (o.DONT_MAP_RELATIONS == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DONT_MAP_RELATIONS) else 0)
| (if (o.DONT_RESOLVE_RANGES == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DONT_RESOLVE_RANGES) else 0)
| (if (o.DONT_REMOVE_UNRESTRICTED_KEYWORDS == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DONT_REMOVE_UNRESTRICTED_KEYWORDS) else 0)
| (if (o.DONT_SPLIT_WORDS == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.DONT_SPLIT_WORDS) else 0)
| (if (o.IGNORE_PHRASE_ORDER == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.IGNORE_PHRASE_ORDER) else 0)
| (if (o.ADD_VALUE_TYPE_FOR_PLAIN_VALUES == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.ADD_VALUE_TYPE_FOR_PLAIN_VALUES) else 0)
| (if (o.ADD_ROBUST_ITEM_NAME == 1) @enumToInt(STRUCTURED_QUERY_RESOLVE_OPTION.ADD_ROBUST_ITEM_NAME) else 0)
);
}
};
pub const SQRO_DEFAULT = STRUCTURED_QUERY_RESOLVE_OPTION.DEFAULT;
pub const SQRO_DONT_RESOLVE_DATETIME = STRUCTURED_QUERY_RESOLVE_OPTION.DONT_RESOLVE_DATETIME;
pub const SQRO_ALWAYS_ONE_INTERVAL = STRUCTURED_QUERY_RESOLVE_OPTION.ALWAYS_ONE_INTERVAL;
pub const SQRO_DONT_SIMPLIFY_CONDITION_TREES = STRUCTURED_QUERY_RESOLVE_OPTION.DONT_SIMPLIFY_CONDITION_TREES;
pub const SQRO_DONT_MAP_RELATIONS = STRUCTURED_QUERY_RESOLVE_OPTION.DONT_MAP_RELATIONS;
pub const SQRO_DONT_RESOLVE_RANGES = STRUCTURED_QUERY_RESOLVE_OPTION.DONT_RESOLVE_RANGES;
pub const SQRO_DONT_REMOVE_UNRESTRICTED_KEYWORDS = STRUCTURED_QUERY_RESOLVE_OPTION.DONT_REMOVE_UNRESTRICTED_KEYWORDS;
pub const SQRO_DONT_SPLIT_WORDS = STRUCTURED_QUERY_RESOLVE_OPTION.DONT_SPLIT_WORDS;
pub const SQRO_IGNORE_PHRASE_ORDER = STRUCTURED_QUERY_RESOLVE_OPTION.IGNORE_PHRASE_ORDER;
pub const SQRO_ADD_VALUE_TYPE_FOR_PLAIN_VALUES = STRUCTURED_QUERY_RESOLVE_OPTION.ADD_VALUE_TYPE_FOR_PLAIN_VALUES;
pub const SQRO_ADD_ROBUST_ITEM_NAME = STRUCTURED_QUERY_RESOLVE_OPTION.ADD_ROBUST_ITEM_NAME;
pub const CASE_REQUIREMENT = enum(i32) {
ANY = 0,
UPPER_IF_AQS = 1,
};
pub const CASE_REQUIREMENT_ANY = CASE_REQUIREMENT.ANY;
pub const CASE_REQUIREMENT_UPPER_IF_AQS = CASE_REQUIREMENT.UPPER_IF_AQS;
pub const INTERVAL_LIMIT_KIND = enum(i32) {
EXPLICIT_INCLUDED = 0,
EXPLICIT_EXCLUDED = 1,
NEGATIVE_INFINITY = 2,
POSITIVE_INFINITY = 3,
};
pub const ILK_EXPLICIT_INCLUDED = INTERVAL_LIMIT_KIND.EXPLICIT_INCLUDED;
pub const ILK_EXPLICIT_EXCLUDED = INTERVAL_LIMIT_KIND.EXPLICIT_EXCLUDED;
pub const ILK_NEGATIVE_INFINITY = INTERVAL_LIMIT_KIND.NEGATIVE_INFINITY;
pub const ILK_POSITIVE_INFINITY = INTERVAL_LIMIT_KIND.POSITIVE_INFINITY;
pub const QUERY_PARSER_MANAGER_OPTION = enum(i32) {
SCHEMA_BINARY_NAME = 0,
PRELOCALIZED_SCHEMA_BINARY_PATH = 1,
UNLOCALIZED_SCHEMA_BINARY_PATH = 2,
LOCALIZED_SCHEMA_BINARY_PATH = 3,
APPEND_LCID_TO_LOCALIZED_PATH = 4,
LOCALIZER_SUPPORT = 5,
};
pub const QPMO_SCHEMA_BINARY_NAME = QUERY_PARSER_MANAGER_OPTION.SCHEMA_BINARY_NAME;
pub const QPMO_PRELOCALIZED_SCHEMA_BINARY_PATH = QUERY_PARSER_MANAGER_OPTION.PRELOCALIZED_SCHEMA_BINARY_PATH;
pub const QPMO_UNLOCALIZED_SCHEMA_BINARY_PATH = QUERY_PARSER_MANAGER_OPTION.UNLOCALIZED_SCHEMA_BINARY_PATH;
pub const QPMO_LOCALIZED_SCHEMA_BINARY_PATH = QUERY_PARSER_MANAGER_OPTION.LOCALIZED_SCHEMA_BINARY_PATH;
pub const QPMO_APPEND_LCID_TO_LOCALIZED_PATH = QUERY_PARSER_MANAGER_OPTION.APPEND_LCID_TO_LOCALIZED_PATH;
pub const QPMO_LOCALIZER_SUPPORT = QUERY_PARSER_MANAGER_OPTION.LOCALIZER_SUPPORT;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IQueryParser_Value = Guid.initString("2ebdee67-3505-43f8-9946-ea44abc8e5b0");
pub const IID_IQueryParser = &IID_IQueryParser_Value;
pub const IQueryParser = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Parse: fn(
self: *const IQueryParser,
pszInputString: ?[*:0]const u16,
pCustomProperties: ?*IEnumUnknown,
ppSolution: ?*?*IQuerySolution,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOption: fn(
self: *const IQueryParser,
option: STRUCTURED_QUERY_SINGLE_OPTION,
pOptionValue: ?*const PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetOption: fn(
self: *const IQueryParser,
option: STRUCTURED_QUERY_SINGLE_OPTION,
pOptionValue: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMultiOption: fn(
self: *const IQueryParser,
option: STRUCTURED_QUERY_MULTIOPTION,
pszOptionKey: ?[*:0]const u16,
pOptionValue: ?*const PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSchemaProvider: fn(
self: *const IQueryParser,
ppSchemaProvider: ?*?*ISchemaProvider,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RestateToString: fn(
self: *const IQueryParser,
pCondition: ?*ICondition,
fUseEnglish: BOOL,
ppszQueryString: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ParsePropertyValue: fn(
self: *const IQueryParser,
pszPropertyName: ?[*:0]const u16,
pszInputString: ?[*:0]const u16,
ppSolution: ?*?*IQuerySolution,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RestatePropertyValueToString: fn(
self: *const IQueryParser,
pCondition: ?*ICondition,
fUseEnglish: BOOL,
ppszPropertyName: ?*?PWSTR,
ppszQueryString: ?*?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 IQueryParser_Parse(self: *const T, pszInputString: ?[*:0]const u16, pCustomProperties: ?*IEnumUnknown, ppSolution: ?*?*IQuerySolution) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).Parse(@ptrCast(*const IQueryParser, self), pszInputString, pCustomProperties, ppSolution);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_SetOption(self: *const T, option: STRUCTURED_QUERY_SINGLE_OPTION, pOptionValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).SetOption(@ptrCast(*const IQueryParser, self), option, pOptionValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_GetOption(self: *const T, option: STRUCTURED_QUERY_SINGLE_OPTION, pOptionValue: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).GetOption(@ptrCast(*const IQueryParser, self), option, pOptionValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_SetMultiOption(self: *const T, option: STRUCTURED_QUERY_MULTIOPTION, pszOptionKey: ?[*:0]const u16, pOptionValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).SetMultiOption(@ptrCast(*const IQueryParser, self), option, pszOptionKey, pOptionValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_GetSchemaProvider(self: *const T, ppSchemaProvider: ?*?*ISchemaProvider) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).GetSchemaProvider(@ptrCast(*const IQueryParser, self), ppSchemaProvider);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_RestateToString(self: *const T, pCondition: ?*ICondition, fUseEnglish: BOOL, ppszQueryString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).RestateToString(@ptrCast(*const IQueryParser, self), pCondition, fUseEnglish, ppszQueryString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_ParsePropertyValue(self: *const T, pszPropertyName: ?[*:0]const u16, pszInputString: ?[*:0]const u16, ppSolution: ?*?*IQuerySolution) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).ParsePropertyValue(@ptrCast(*const IQueryParser, self), pszPropertyName, pszInputString, ppSolution);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParser_RestatePropertyValueToString(self: *const T, pCondition: ?*ICondition, fUseEnglish: BOOL, ppszPropertyName: ?*?PWSTR, ppszQueryString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParser.VTable, self.vtable).RestatePropertyValueToString(@ptrCast(*const IQueryParser, self), pCondition, fUseEnglish, ppszPropertyName, ppszQueryString);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IConditionFactory_Value = Guid.initString("a5efe073-b16f-474f-9f3e-9f8b497a3e08");
pub const IID_IConditionFactory = &IID_IConditionFactory_Value;
pub const IConditionFactory = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
MakeNot: fn(
self: *const IConditionFactory,
pcSub: ?*ICondition,
fSimplify: BOOL,
ppcResult: ?*?*ICondition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MakeAndOr: fn(
self: *const IConditionFactory,
ct: CONDITION_TYPE,
peuSubs: ?*IEnumUnknown,
fSimplify: BOOL,
ppcResult: ?*?*ICondition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MakeLeaf: fn(
self: *const IConditionFactory,
pszPropertyName: ?[*:0]const u16,
cop: CONDITION_OPERATION,
pszValueType: ?[*:0]const u16,
ppropvar: ?*const PROPVARIANT,
pPropertyNameTerm: ?*IRichChunk,
pOperationTerm: ?*IRichChunk,
pValueTerm: ?*IRichChunk,
fExpand: BOOL,
ppcResult: ?*?*ICondition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Resolve: fn(
self: *const IConditionFactory,
pc: ?*ICondition,
sqro: STRUCTURED_QUERY_RESOLVE_OPTION,
pstReferenceTime: ?*const SYSTEMTIME,
ppcResolved: ?*?*ICondition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory_MakeNot(self: *const T, pcSub: ?*ICondition, fSimplify: BOOL, ppcResult: ?*?*ICondition) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory.VTable, self.vtable).MakeNot(@ptrCast(*const IConditionFactory, self), pcSub, fSimplify, ppcResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory_MakeAndOr(self: *const T, ct: CONDITION_TYPE, peuSubs: ?*IEnumUnknown, fSimplify: BOOL, ppcResult: ?*?*ICondition) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory.VTable, self.vtable).MakeAndOr(@ptrCast(*const IConditionFactory, self), ct, peuSubs, fSimplify, ppcResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory_MakeLeaf(self: *const T, pszPropertyName: ?[*:0]const u16, cop: CONDITION_OPERATION, pszValueType: ?[*:0]const u16, ppropvar: ?*const PROPVARIANT, pPropertyNameTerm: ?*IRichChunk, pOperationTerm: ?*IRichChunk, pValueTerm: ?*IRichChunk, fExpand: BOOL, ppcResult: ?*?*ICondition) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory.VTable, self.vtable).MakeLeaf(@ptrCast(*const IConditionFactory, self), pszPropertyName, cop, pszValueType, ppropvar, pPropertyNameTerm, pOperationTerm, pValueTerm, fExpand, ppcResult);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory_Resolve(self: *const T, pc: ?*ICondition, sqro: STRUCTURED_QUERY_RESOLVE_OPTION, pstReferenceTime: ?*const SYSTEMTIME, ppcResolved: ?*?*ICondition) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory.VTable, self.vtable).Resolve(@ptrCast(*const IConditionFactory, self), pc, sqro, pstReferenceTime, ppcResolved);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IQuerySolution_Value = Guid.initString("d6ebc66b-8921-4193-afdd-a1789fb7ff57");
pub const IID_IQuerySolution = &IID_IQuerySolution_Value;
pub const IQuerySolution = extern struct {
pub const VTable = extern struct {
base: IConditionFactory.VTable,
GetQuery: fn(
self: *const IQuerySolution,
ppQueryNode: ?*?*ICondition,
ppMainType: ?*?*IEntity,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetErrors: fn(
self: *const IQuerySolution,
riid: ?*const Guid,
ppParseErrors: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLexicalData: fn(
self: *const IQuerySolution,
ppszInputString: ?*?PWSTR,
ppTokens: ?*?*ITokenCollection,
plcid: ?*u32,
ppWordBreaker: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IConditionFactory.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQuerySolution_GetQuery(self: *const T, ppQueryNode: ?*?*ICondition, ppMainType: ?*?*IEntity) callconv(.Inline) HRESULT {
return @ptrCast(*const IQuerySolution.VTable, self.vtable).GetQuery(@ptrCast(*const IQuerySolution, self), ppQueryNode, ppMainType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQuerySolution_GetErrors(self: *const T, riid: ?*const Guid, ppParseErrors: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IQuerySolution.VTable, self.vtable).GetErrors(@ptrCast(*const IQuerySolution, self), riid, ppParseErrors);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQuerySolution_GetLexicalData(self: *const T, ppszInputString: ?*?PWSTR, ppTokens: ?*?*ITokenCollection, plcid: ?*u32, ppWordBreaker: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IQuerySolution.VTable, self.vtable).GetLexicalData(@ptrCast(*const IQuerySolution, self), ppszInputString, ppTokens, plcid, ppWordBreaker);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const CONDITION_CREATION_OPTIONS = enum(u32) {
DEFAULT = 0,
// NONE = 0, this enum value conflicts with DEFAULT
SIMPLIFY = 1,
VECTOR_AND = 2,
VECTOR_OR = 4,
VECTOR_LEAF = 8,
USE_CONTENT_LOCALE = 16,
_,
pub fn initFlags(o: struct {
DEFAULT: u1 = 0,
SIMPLIFY: u1 = 0,
VECTOR_AND: u1 = 0,
VECTOR_OR: u1 = 0,
VECTOR_LEAF: u1 = 0,
USE_CONTENT_LOCALE: u1 = 0,
}) CONDITION_CREATION_OPTIONS {
return @intToEnum(CONDITION_CREATION_OPTIONS,
(if (o.DEFAULT == 1) @enumToInt(CONDITION_CREATION_OPTIONS.DEFAULT) else 0)
| (if (o.SIMPLIFY == 1) @enumToInt(CONDITION_CREATION_OPTIONS.SIMPLIFY) else 0)
| (if (o.VECTOR_AND == 1) @enumToInt(CONDITION_CREATION_OPTIONS.VECTOR_AND) else 0)
| (if (o.VECTOR_OR == 1) @enumToInt(CONDITION_CREATION_OPTIONS.VECTOR_OR) else 0)
| (if (o.VECTOR_LEAF == 1) @enumToInt(CONDITION_CREATION_OPTIONS.VECTOR_LEAF) else 0)
| (if (o.USE_CONTENT_LOCALE == 1) @enumToInt(CONDITION_CREATION_OPTIONS.USE_CONTENT_LOCALE) else 0)
);
}
};
pub const CONDITION_CREATION_DEFAULT = CONDITION_CREATION_OPTIONS.DEFAULT;
pub const CONDITION_CREATION_NONE = CONDITION_CREATION_OPTIONS.DEFAULT;
pub const CONDITION_CREATION_SIMPLIFY = CONDITION_CREATION_OPTIONS.SIMPLIFY;
pub const CONDITION_CREATION_VECTOR_AND = CONDITION_CREATION_OPTIONS.VECTOR_AND;
pub const CONDITION_CREATION_VECTOR_OR = CONDITION_CREATION_OPTIONS.VECTOR_OR;
pub const CONDITION_CREATION_VECTOR_LEAF = CONDITION_CREATION_OPTIONS.VECTOR_LEAF;
pub const CONDITION_CREATION_USE_CONTENT_LOCALE = CONDITION_CREATION_OPTIONS.USE_CONTENT_LOCALE;
// TODO: this type is limited to platform 'windows6.1'
const IID_IConditionFactory2_Value = Guid.initString("71d222e1-432f-429e-8c13-b6dafde5077a");
pub const IID_IConditionFactory2 = &IID_IConditionFactory2_Value;
pub const IConditionFactory2 = extern struct {
pub const VTable = extern struct {
base: IConditionFactory.VTable,
CreateTrueFalse: fn(
self: *const IConditionFactory2,
fVal: BOOL,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateNegation: fn(
self: *const IConditionFactory2,
pcSub: ?*ICondition,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateCompoundFromObjectArray: fn(
self: *const IConditionFactory2,
ct: CONDITION_TYPE,
poaSubs: ?*IObjectArray,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateCompoundFromArray: fn(
self: *const IConditionFactory2,
ct: CONDITION_TYPE,
ppcondSubs: [*]?*ICondition,
cSubs: u32,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateStringLeaf: fn(
self: *const IConditionFactory2,
propkey: ?*const PROPERTYKEY,
cop: CONDITION_OPERATION,
pszValue: ?[*:0]const u16,
pszLocaleName: ?[*:0]const u16,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateIntegerLeaf: fn(
self: *const IConditionFactory2,
propkey: ?*const PROPERTYKEY,
cop: CONDITION_OPERATION,
lValue: i32,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateBooleanLeaf: fn(
self: *const IConditionFactory2,
propkey: ?*const PROPERTYKEY,
cop: CONDITION_OPERATION,
fValue: BOOL,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateLeaf: fn(
self: *const IConditionFactory2,
propkey: ?*const PROPERTYKEY,
cop: CONDITION_OPERATION,
propvar: ?*const PROPVARIANT,
pszSemanticType: ?[*:0]const u16,
pszLocaleName: ?[*:0]const u16,
pPropertyNameTerm: ?*IRichChunk,
pOperationTerm: ?*IRichChunk,
pValueTerm: ?*IRichChunk,
cco: CONDITION_CREATION_OPTIONS,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResolveCondition: fn(
self: *const IConditionFactory2,
pc: ?*ICondition,
sqro: STRUCTURED_QUERY_RESOLVE_OPTION,
pstReferenceTime: ?*const SYSTEMTIME,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IConditionFactory.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateTrueFalse(self: *const T, fVal: BOOL, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateTrueFalse(@ptrCast(*const IConditionFactory2, self), fVal, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateNegation(self: *const T, pcSub: ?*ICondition, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateNegation(@ptrCast(*const IConditionFactory2, self), pcSub, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateCompoundFromObjectArray(self: *const T, ct: CONDITION_TYPE, poaSubs: ?*IObjectArray, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateCompoundFromObjectArray(@ptrCast(*const IConditionFactory2, self), ct, poaSubs, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateCompoundFromArray(self: *const T, ct: CONDITION_TYPE, ppcondSubs: [*]?*ICondition, cSubs: u32, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateCompoundFromArray(@ptrCast(*const IConditionFactory2, self), ct, ppcondSubs, cSubs, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateStringLeaf(self: *const T, propkey: ?*const PROPERTYKEY, cop: CONDITION_OPERATION, pszValue: ?[*:0]const u16, pszLocaleName: ?[*:0]const u16, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateStringLeaf(@ptrCast(*const IConditionFactory2, self), propkey, cop, pszValue, pszLocaleName, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateIntegerLeaf(self: *const T, propkey: ?*const PROPERTYKEY, cop: CONDITION_OPERATION, lValue: i32, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateIntegerLeaf(@ptrCast(*const IConditionFactory2, self), propkey, cop, lValue, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateBooleanLeaf(self: *const T, propkey: ?*const PROPERTYKEY, cop: CONDITION_OPERATION, fValue: BOOL, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateBooleanLeaf(@ptrCast(*const IConditionFactory2, self), propkey, cop, fValue, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_CreateLeaf(self: *const T, propkey: ?*const PROPERTYKEY, cop: CONDITION_OPERATION, propvar: ?*const PROPVARIANT, pszSemanticType: ?[*:0]const u16, pszLocaleName: ?[*:0]const u16, pPropertyNameTerm: ?*IRichChunk, pOperationTerm: ?*IRichChunk, pValueTerm: ?*IRichChunk, cco: CONDITION_CREATION_OPTIONS, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).CreateLeaf(@ptrCast(*const IConditionFactory2, self), propkey, cop, propvar, pszSemanticType, pszLocaleName, pPropertyNameTerm, pOperationTerm, pValueTerm, cco, riid, ppv);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionFactory2_ResolveCondition(self: *const T, pc: ?*ICondition, sqro: STRUCTURED_QUERY_RESOLVE_OPTION, pstReferenceTime: ?*const SYSTEMTIME, riid: ?*const Guid, ppv: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionFactory2.VTable, self.vtable).ResolveCondition(@ptrCast(*const IConditionFactory2, self), pc, sqro, pstReferenceTime, riid, ppv);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IConditionGenerator_Value = Guid.initString("92d2cc58-4386-45a3-b98c-7e0ce64a4117");
pub const IID_IConditionGenerator = &IID_IConditionGenerator_Value;
pub const IConditionGenerator = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Initialize: fn(
self: *const IConditionGenerator,
pSchemaProvider: ?*ISchemaProvider,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RecognizeNamedEntities: fn(
self: *const IConditionGenerator,
pszInputString: ?[*:0]const u16,
lcidUserLocale: u32,
pTokenCollection: ?*ITokenCollection,
pNamedEntities: ?*INamedEntityCollector,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GenerateForLeaf: fn(
self: *const IConditionGenerator,
pConditionFactory: ?*IConditionFactory,
pszPropertyName: ?[*:0]const u16,
cop: CONDITION_OPERATION,
pszValueType: ?[*:0]const u16,
pszValue: ?[*:0]const u16,
pszValue2: ?[*:0]const u16,
pPropertyNameTerm: ?*IRichChunk,
pOperationTerm: ?*IRichChunk,
pValueTerm: ?*IRichChunk,
automaticWildcard: BOOL,
pNoStringQuery: ?*BOOL,
ppQueryExpression: ?*?*ICondition,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DefaultPhrase: fn(
self: *const IConditionGenerator,
pszValueType: ?[*:0]const u16,
ppropvar: ?*const PROPVARIANT,
fUseEnglish: BOOL,
ppszPhrase: ?*?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 IConditionGenerator_Initialize(self: *const T, pSchemaProvider: ?*ISchemaProvider) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionGenerator.VTable, self.vtable).Initialize(@ptrCast(*const IConditionGenerator, self), pSchemaProvider);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionGenerator_RecognizeNamedEntities(self: *const T, pszInputString: ?[*:0]const u16, lcidUserLocale: u32, pTokenCollection: ?*ITokenCollection, pNamedEntities: ?*INamedEntityCollector) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionGenerator.VTable, self.vtable).RecognizeNamedEntities(@ptrCast(*const IConditionGenerator, self), pszInputString, lcidUserLocale, pTokenCollection, pNamedEntities);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionGenerator_GenerateForLeaf(self: *const T, pConditionFactory: ?*IConditionFactory, pszPropertyName: ?[*:0]const u16, cop: CONDITION_OPERATION, pszValueType: ?[*:0]const u16, pszValue: ?[*:0]const u16, pszValue2: ?[*:0]const u16, pPropertyNameTerm: ?*IRichChunk, pOperationTerm: ?*IRichChunk, pValueTerm: ?*IRichChunk, automaticWildcard: BOOL, pNoStringQuery: ?*BOOL, ppQueryExpression: ?*?*ICondition) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionGenerator.VTable, self.vtable).GenerateForLeaf(@ptrCast(*const IConditionGenerator, self), pConditionFactory, pszPropertyName, cop, pszValueType, pszValue, pszValue2, pPropertyNameTerm, pOperationTerm, pValueTerm, automaticWildcard, pNoStringQuery, ppQueryExpression);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IConditionGenerator_DefaultPhrase(self: *const T, pszValueType: ?[*:0]const u16, ppropvar: ?*const PROPVARIANT, fUseEnglish: BOOL, ppszPhrase: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IConditionGenerator.VTable, self.vtable).DefaultPhrase(@ptrCast(*const IConditionGenerator, self), pszValueType, ppropvar, fUseEnglish, ppszPhrase);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IInterval_Value = Guid.initString("6bf0a714-3c18-430b-8b5d-83b1c234d3db");
pub const IID_IInterval = &IID_IInterval_Value;
pub const IInterval = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetLimits: fn(
self: *const IInterval,
pilkLower: ?*INTERVAL_LIMIT_KIND,
ppropvarLower: ?*PROPVARIANT,
pilkUpper: ?*INTERVAL_LIMIT_KIND,
ppropvarUpper: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IInterval_GetLimits(self: *const T, pilkLower: ?*INTERVAL_LIMIT_KIND, ppropvarLower: ?*PROPVARIANT, pilkUpper: ?*INTERVAL_LIMIT_KIND, ppropvarUpper: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IInterval.VTable, self.vtable).GetLimits(@ptrCast(*const IInterval, self), pilkLower, ppropvarLower, pilkUpper, ppropvarUpper);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IMetaData_Value = Guid.initString("780102b0-c43b-4876-bc7b-5e9ba5c88794");
pub const IID_IMetaData = &IID_IMetaData_Value;
pub const IMetaData = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetData: fn(
self: *const IMetaData,
ppszKey: ?*?PWSTR,
ppszValue: ?*?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 IMetaData_GetData(self: *const T, ppszKey: ?*?PWSTR, ppszValue: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IMetaData.VTable, self.vtable).GetData(@ptrCast(*const IMetaData, self), ppszKey, ppszValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IEntity_Value = Guid.initString("24264891-e80b-4fd3-b7ce-4ff2fae8931f");
pub const IID_IEntity = &IID_IEntity_Value;
pub const IEntity = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Name: fn(
self: *const IEntity,
ppszName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Base: fn(
self: *const IEntity,
pBaseEntity: ?*?*IEntity,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Relationships: fn(
self: *const IEntity,
riid: ?*const Guid,
pRelationships: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRelationship: fn(
self: *const IEntity,
pszRelationName: ?[*:0]const u16,
pRelationship: ?*?*IRelationship,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MetaData: fn(
self: *const IEntity,
riid: ?*const Guid,
pMetaData: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NamedEntities: fn(
self: *const IEntity,
riid: ?*const Guid,
pNamedEntities: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNamedEntity: fn(
self: *const IEntity,
pszValue: ?[*:0]const u16,
ppNamedEntity: ?*?*INamedEntity,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DefaultPhrase: fn(
self: *const IEntity,
ppszPhrase: ?*?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 IEntity_Name(self: *const T, ppszName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).Name(@ptrCast(*const IEntity, self), ppszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_Base(self: *const T, pBaseEntity: ?*?*IEntity) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).Base(@ptrCast(*const IEntity, self), pBaseEntity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_Relationships(self: *const T, riid: ?*const Guid, pRelationships: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).Relationships(@ptrCast(*const IEntity, self), riid, pRelationships);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_GetRelationship(self: *const T, pszRelationName: ?[*:0]const u16, pRelationship: ?*?*IRelationship) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).GetRelationship(@ptrCast(*const IEntity, self), pszRelationName, pRelationship);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_MetaData(self: *const T, riid: ?*const Guid, pMetaData: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).MetaData(@ptrCast(*const IEntity, self), riid, pMetaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_NamedEntities(self: *const T, riid: ?*const Guid, pNamedEntities: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).NamedEntities(@ptrCast(*const IEntity, self), riid, pNamedEntities);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_GetNamedEntity(self: *const T, pszValue: ?[*:0]const u16, ppNamedEntity: ?*?*INamedEntity) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).GetNamedEntity(@ptrCast(*const IEntity, self), pszValue, ppNamedEntity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEntity_DefaultPhrase(self: *const T, ppszPhrase: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IEntity.VTable, self.vtable).DefaultPhrase(@ptrCast(*const IEntity, self), ppszPhrase);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IRelationship_Value = Guid.initString("2769280b-5108-498c-9c7f-a51239b63147");
pub const IID_IRelationship = &IID_IRelationship_Value;
pub const IRelationship = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Name: fn(
self: *const IRelationship,
ppszName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsReal: fn(
self: *const IRelationship,
pIsReal: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Destination: fn(
self: *const IRelationship,
pDestinationEntity: ?*?*IEntity,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MetaData: fn(
self: *const IRelationship,
riid: ?*const Guid,
pMetaData: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DefaultPhrase: fn(
self: *const IRelationship,
ppszPhrase: ?*?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 IRelationship_Name(self: *const T, ppszName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IRelationship.VTable, self.vtable).Name(@ptrCast(*const IRelationship, self), ppszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRelationship_IsReal(self: *const T, pIsReal: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRelationship.VTable, self.vtable).IsReal(@ptrCast(*const IRelationship, self), pIsReal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRelationship_Destination(self: *const T, pDestinationEntity: ?*?*IEntity) callconv(.Inline) HRESULT {
return @ptrCast(*const IRelationship.VTable, self.vtable).Destination(@ptrCast(*const IRelationship, self), pDestinationEntity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRelationship_MetaData(self: *const T, riid: ?*const Guid, pMetaData: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRelationship.VTable, self.vtable).MetaData(@ptrCast(*const IRelationship, self), riid, pMetaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRelationship_DefaultPhrase(self: *const T, ppszPhrase: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IRelationship.VTable, self.vtable).DefaultPhrase(@ptrCast(*const IRelationship, self), ppszPhrase);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_INamedEntity_Value = Guid.initString("abdbd0b1-7d54-49fb-ab5c-bff4130004cd");
pub const IID_INamedEntity = &IID_INamedEntity_Value;
pub const INamedEntity = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetValue: fn(
self: *const INamedEntity,
ppszValue: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DefaultPhrase: fn(
self: *const INamedEntity,
ppszPhrase: ?*?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 INamedEntity_GetValue(self: *const T, ppszValue: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const INamedEntity.VTable, self.vtable).GetValue(@ptrCast(*const INamedEntity, self), ppszValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn INamedEntity_DefaultPhrase(self: *const T, ppszPhrase: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const INamedEntity.VTable, self.vtable).DefaultPhrase(@ptrCast(*const INamedEntity, self), ppszPhrase);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISchemaProvider_Value = Guid.initString("8cf89bcb-394c-49b2-ae28-a59dd4ed7f68");
pub const IID_ISchemaProvider = &IID_ISchemaProvider_Value;
pub const ISchemaProvider = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Entities: fn(
self: *const ISchemaProvider,
riid: ?*const Guid,
pEntities: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RootEntity: fn(
self: *const ISchemaProvider,
pRootEntity: ?*?*IEntity,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetEntity: fn(
self: *const ISchemaProvider,
pszEntityName: ?[*:0]const u16,
pEntity: ?*?*IEntity,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
MetaData: fn(
self: *const ISchemaProvider,
riid: ?*const Guid,
pMetaData: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Localize: fn(
self: *const ISchemaProvider,
lcid: u32,
pSchemaLocalizerSupport: ?*ISchemaLocalizerSupport,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveBinary: fn(
self: *const ISchemaProvider,
pszSchemaBinaryPath: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LookupAuthoredNamedEntity: fn(
self: *const ISchemaProvider,
pEntity: ?*IEntity,
pszInputString: ?[*:0]const u16,
pTokenCollection: ?*ITokenCollection,
cTokensBegin: u32,
pcTokensLength: ?*u32,
ppszValue: ?*?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 ISchemaProvider_Entities(self: *const T, riid: ?*const Guid, pEntities: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).Entities(@ptrCast(*const ISchemaProvider, self), riid, pEntities);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaProvider_RootEntity(self: *const T, pRootEntity: ?*?*IEntity) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).RootEntity(@ptrCast(*const ISchemaProvider, self), pRootEntity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaProvider_GetEntity(self: *const T, pszEntityName: ?[*:0]const u16, pEntity: ?*?*IEntity) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).GetEntity(@ptrCast(*const ISchemaProvider, self), pszEntityName, pEntity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaProvider_MetaData(self: *const T, riid: ?*const Guid, pMetaData: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).MetaData(@ptrCast(*const ISchemaProvider, self), riid, pMetaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaProvider_Localize(self: *const T, lcid: u32, pSchemaLocalizerSupport: ?*ISchemaLocalizerSupport) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).Localize(@ptrCast(*const ISchemaProvider, self), lcid, pSchemaLocalizerSupport);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaProvider_SaveBinary(self: *const T, pszSchemaBinaryPath: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).SaveBinary(@ptrCast(*const ISchemaProvider, self), pszSchemaBinaryPath);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaProvider_LookupAuthoredNamedEntity(self: *const T, pEntity: ?*IEntity, pszInputString: ?[*:0]const u16, pTokenCollection: ?*ITokenCollection, cTokensBegin: u32, pcTokensLength: ?*u32, ppszValue: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaProvider.VTable, self.vtable).LookupAuthoredNamedEntity(@ptrCast(*const ISchemaProvider, self), pEntity, pszInputString, pTokenCollection, cTokensBegin, pcTokensLength, ppszValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ITokenCollection_Value = Guid.initString("22d8b4f2-f577-4adb-a335-c2ae88416fab");
pub const IID_ITokenCollection = &IID_ITokenCollection_Value;
pub const ITokenCollection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
NumberOfTokens: fn(
self: *const ITokenCollection,
pCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetToken: fn(
self: *const ITokenCollection,
i: u32,
pBegin: ?*u32,
pLength: ?*u32,
ppsz: ?*?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 ITokenCollection_NumberOfTokens(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ITokenCollection.VTable, self.vtable).NumberOfTokens(@ptrCast(*const ITokenCollection, self), pCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITokenCollection_GetToken(self: *const T, i: u32, pBegin: ?*u32, pLength: ?*u32, ppsz: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ITokenCollection.VTable, self.vtable).GetToken(@ptrCast(*const ITokenCollection, self), i, pBegin, pLength, ppsz);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const NAMED_ENTITY_CERTAINTY = enum(i32) {
LOW = 0,
MEDIUM = 1,
HIGH = 2,
};
pub const NEC_LOW = NAMED_ENTITY_CERTAINTY.LOW;
pub const NEC_MEDIUM = NAMED_ENTITY_CERTAINTY.MEDIUM;
pub const NEC_HIGH = NAMED_ENTITY_CERTAINTY.HIGH;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_INamedEntityCollector_Value = Guid.initString("af2440f6-8afc-47d0-9a7f-396a0acfb43d");
pub const IID_INamedEntityCollector = &IID_INamedEntityCollector_Value;
pub const INamedEntityCollector = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Add: fn(
self: *const INamedEntityCollector,
beginSpan: u32,
endSpan: u32,
beginActual: u32,
endActual: u32,
pType: ?*IEntity,
pszValue: ?[*:0]const u16,
certainty: NAMED_ENTITY_CERTAINTY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn INamedEntityCollector_Add(self: *const T, beginSpan: u32, endSpan: u32, beginActual: u32, endActual: u32, pType: ?*IEntity, pszValue: ?[*:0]const u16, certainty: NAMED_ENTITY_CERTAINTY) callconv(.Inline) HRESULT {
return @ptrCast(*const INamedEntityCollector.VTable, self.vtable).Add(@ptrCast(*const INamedEntityCollector, self), beginSpan, endSpan, beginActual, endActual, pType, pszValue, certainty);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISchemaLocalizerSupport_Value = Guid.initString("ca3fdca2-bfbe-4eed-90d7-0caef0a1bda1");
pub const IID_ISchemaLocalizerSupport = &IID_ISchemaLocalizerSupport_Value;
pub const ISchemaLocalizerSupport = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Localize: fn(
self: *const ISchemaLocalizerSupport,
pszGlobalString: ?[*:0]const u16,
ppszLocalString: ?*?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 ISchemaLocalizerSupport_Localize(self: *const T, pszGlobalString: ?[*:0]const u16, ppszLocalString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaLocalizerSupport.VTable, self.vtable).Localize(@ptrCast(*const ISchemaLocalizerSupport, self), pszGlobalString, ppszLocalString);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IQueryParserManager_Value = Guid.initString("a879e3c4-af77-44fb-8f37-ebd1487cf920");
pub const IID_IQueryParserManager = &IID_IQueryParserManager_Value;
pub const IQueryParserManager = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateLoadedParser: fn(
self: *const IQueryParserManager,
pszCatalog: ?[*:0]const u16,
langidForKeywords: u16,
riid: ?*const Guid,
ppQueryParser: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InitializeOptions: fn(
self: *const IQueryParserManager,
fUnderstandNQS: BOOL,
fAutoWildCard: BOOL,
pQueryParser: ?*IQueryParser,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOption: fn(
self: *const IQueryParserManager,
option: QUERY_PARSER_MANAGER_OPTION,
pOptionValue: ?*const PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParserManager_CreateLoadedParser(self: *const T, pszCatalog: ?[*:0]const u16, langidForKeywords: u16, riid: ?*const Guid, ppQueryParser: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParserManager.VTable, self.vtable).CreateLoadedParser(@ptrCast(*const IQueryParserManager, self), pszCatalog, langidForKeywords, riid, ppQueryParser);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParserManager_InitializeOptions(self: *const T, fUnderstandNQS: BOOL, fAutoWildCard: BOOL, pQueryParser: ?*IQueryParser) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParserManager.VTable, self.vtable).InitializeOptions(@ptrCast(*const IQueryParserManager, self), fUnderstandNQS, fAutoWildCard, pQueryParser);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IQueryParserManager_SetOption(self: *const T, option: QUERY_PARSER_MANAGER_OPTION, pOptionValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IQueryParserManager.VTable, self.vtable).SetOption(@ptrCast(*const IQueryParserManager, self), option, pOptionValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const HITRANGE = extern struct {
iPosition: u32,
cLength: u32,
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUrlAccessor_Value = Guid.initString("0b63e318-9ccc-11d0-bcdb-00805fccce04");
pub const IID_IUrlAccessor = &IID_IUrlAccessor_Value;
pub const IUrlAccessor = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddRequestParameter: fn(
self: *const IUrlAccessor,
pSpec: ?*PROPSPEC,
pVar: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDocFormat: fn(
self: *const IUrlAccessor,
wszDocFormat: [*:0]u16,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCLSID: fn(
self: *const IUrlAccessor,
pClsid: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetHost: fn(
self: *const IUrlAccessor,
wszHost: [*:0]u16,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsDirectory: fn(
self: *const IUrlAccessor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSize: fn(
self: *const IUrlAccessor,
pllSize: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLastModified: fn(
self: *const IUrlAccessor,
pftLastModified: ?*FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFileName: fn(
self: *const IUrlAccessor,
wszFileName: [*:0]u16,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSecurityDescriptor: fn(
self: *const IUrlAccessor,
pSD: [*:0]u8,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRedirectedURL: fn(
self: *const IUrlAccessor,
wszRedirectedURL: [*:0]u16,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSecurityProvider: fn(
self: *const IUrlAccessor,
pSPClsid: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindToStream: fn(
self: *const IUrlAccessor,
ppStream: ?*?*IStream,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindToFilter: fn(
self: *const IUrlAccessor,
ppFilter: ?*?*IFilter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_AddRequestParameter(self: *const T, pSpec: ?*PROPSPEC, pVar: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).AddRequestParameter(@ptrCast(*const IUrlAccessor, self), pSpec, pVar);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetDocFormat(self: *const T, wszDocFormat: [*:0]u16, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetDocFormat(@ptrCast(*const IUrlAccessor, self), wszDocFormat, dwSize, pdwLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetCLSID(self: *const T, pClsid: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetCLSID(@ptrCast(*const IUrlAccessor, self), pClsid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetHost(self: *const T, wszHost: [*:0]u16, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetHost(@ptrCast(*const IUrlAccessor, self), wszHost, dwSize, pdwLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_IsDirectory(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).IsDirectory(@ptrCast(*const IUrlAccessor, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetSize(self: *const T, pllSize: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetSize(@ptrCast(*const IUrlAccessor, self), pllSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetLastModified(self: *const T, pftLastModified: ?*FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetLastModified(@ptrCast(*const IUrlAccessor, self), pftLastModified);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetFileName(self: *const T, wszFileName: [*:0]u16, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetFileName(@ptrCast(*const IUrlAccessor, self), wszFileName, dwSize, pdwLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetSecurityDescriptor(self: *const T, pSD: [*:0]u8, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetSecurityDescriptor(@ptrCast(*const IUrlAccessor, self), pSD, dwSize, pdwLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetRedirectedURL(self: *const T, wszRedirectedURL: [*:0]u16, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetRedirectedURL(@ptrCast(*const IUrlAccessor, self), wszRedirectedURL, dwSize, pdwLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_GetSecurityProvider(self: *const T, pSPClsid: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).GetSecurityProvider(@ptrCast(*const IUrlAccessor, self), pSPClsid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_BindToStream(self: *const T, ppStream: ?*?*IStream) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).BindToStream(@ptrCast(*const IUrlAccessor, self), ppStream);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor_BindToFilter(self: *const T, ppFilter: ?*?*IFilter) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor.VTable, self.vtable).BindToFilter(@ptrCast(*const IUrlAccessor, self), ppFilter);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUrlAccessor2_Value = Guid.initString("c7310734-ac80-11d1-8df3-00c04fb6ef4f");
pub const IID_IUrlAccessor2 = &IID_IUrlAccessor2_Value;
pub const IUrlAccessor2 = extern struct {
pub const VTable = extern struct {
base: IUrlAccessor.VTable,
GetDisplayUrl: fn(
self: *const IUrlAccessor2,
wszDocUrl: [*:0]u16,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsDocument: fn(
self: *const IUrlAccessor2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCodePage: fn(
self: *const IUrlAccessor2,
wszCodePage: [*:0]u16,
dwSize: u32,
pdwLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUrlAccessor.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor2_GetDisplayUrl(self: *const T, wszDocUrl: [*:0]u16, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor2.VTable, self.vtable).GetDisplayUrl(@ptrCast(*const IUrlAccessor2, self), wszDocUrl, dwSize, pdwLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor2_IsDocument(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor2.VTable, self.vtable).IsDocument(@ptrCast(*const IUrlAccessor2, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor2_GetCodePage(self: *const T, wszCodePage: [*:0]u16, dwSize: u32, pdwLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor2.VTable, self.vtable).GetCodePage(@ptrCast(*const IUrlAccessor2, self), wszCodePage, dwSize, pdwLength);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IUrlAccessor3_Value = Guid.initString("6fbc7005-0455-4874-b8ff-7439450241a3");
pub const IID_IUrlAccessor3 = &IID_IUrlAccessor3_Value;
pub const IUrlAccessor3 = extern struct {
pub const VTable = extern struct {
base: IUrlAccessor2.VTable,
GetImpersonationSidBlobs: fn(
self: *const IUrlAccessor3,
pcwszURL: ?[*:0]const u16,
pcSidCount: ?*u32,
ppSidBlobs: ?*?*BLOB,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUrlAccessor2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor3_GetImpersonationSidBlobs(self: *const T, pcwszURL: ?[*:0]const u16, pcSidCount: ?*u32, ppSidBlobs: ?*?*BLOB) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor3.VTable, self.vtable).GetImpersonationSidBlobs(@ptrCast(*const IUrlAccessor3, self), pcwszURL, pcSidCount, ppSidBlobs);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.0.6000'
const IID_IUrlAccessor4_Value = Guid.initString("5cc51041-c8d2-41d7-bca3-9e9e286297dc");
pub const IID_IUrlAccessor4 = &IID_IUrlAccessor4_Value;
pub const IUrlAccessor4 = extern struct {
pub const VTable = extern struct {
base: IUrlAccessor3.VTable,
ShouldIndexItemContent: fn(
self: *const IUrlAccessor4,
pfIndexContent: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ShouldIndexProperty: fn(
self: *const IUrlAccessor4,
key: ?*const PROPERTYKEY,
pfIndexProperty: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUrlAccessor3.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor4_ShouldIndexItemContent(self: *const T, pfIndexContent: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor4.VTable, self.vtable).ShouldIndexItemContent(@ptrCast(*const IUrlAccessor4, self), pfIndexContent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUrlAccessor4_ShouldIndexProperty(self: *const T, key: ?*const PROPERTYKEY, pfIndexProperty: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IUrlAccessor4.VTable, self.vtable).ShouldIndexProperty(@ptrCast(*const IUrlAccessor4, self), key, pfIndexProperty);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IOpLockStatus_Value = Guid.initString("c731065d-ac80-11d1-8df3-00c04fb6ef4f");
pub const IID_IOpLockStatus = &IID_IOpLockStatus_Value;
pub const IOpLockStatus = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
IsOplockValid: fn(
self: *const IOpLockStatus,
pfIsOplockValid: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsOplockBroken: fn(
self: *const IOpLockStatus,
pfIsOplockBroken: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetOplockEventHandle: fn(
self: *const IOpLockStatus,
phOplockEv: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IOpLockStatus_IsOplockValid(self: *const T, pfIsOplockValid: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IOpLockStatus.VTable, self.vtable).IsOplockValid(@ptrCast(*const IOpLockStatus, self), pfIsOplockValid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IOpLockStatus_IsOplockBroken(self: *const T, pfIsOplockBroken: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IOpLockStatus.VTable, self.vtable).IsOplockBroken(@ptrCast(*const IOpLockStatus, self), pfIsOplockBroken);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IOpLockStatus_GetOplockEventHandle(self: *const T, phOplockEv: ?*?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const IOpLockStatus.VTable, self.vtable).GetOplockEventHandle(@ptrCast(*const IOpLockStatus, self), phOplockEv);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchProtocolThreadContext_Value = Guid.initString("c73106e1-ac80-11d1-8df3-00c04fb6ef4f");
pub const IID_ISearchProtocolThreadContext = &IID_ISearchProtocolThreadContext_Value;
pub const ISearchProtocolThreadContext = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ThreadInit: fn(
self: *const ISearchProtocolThreadContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ThreadShutdown: fn(
self: *const ISearchProtocolThreadContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ThreadIdle: fn(
self: *const ISearchProtocolThreadContext,
dwTimeElaspedSinceLastCallInMS: 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 ISearchProtocolThreadContext_ThreadInit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocolThreadContext.VTable, self.vtable).ThreadInit(@ptrCast(*const ISearchProtocolThreadContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocolThreadContext_ThreadShutdown(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocolThreadContext.VTable, self.vtable).ThreadShutdown(@ptrCast(*const ISearchProtocolThreadContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocolThreadContext_ThreadIdle(self: *const T, dwTimeElaspedSinceLastCallInMS: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocolThreadContext.VTable, self.vtable).ThreadIdle(@ptrCast(*const ISearchProtocolThreadContext, self), dwTimeElaspedSinceLastCallInMS);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const TIMEOUT_INFO = extern struct {
dwSize: u32,
dwConnectTimeout: u32,
dwDataTimeout: u32,
};
pub const PROXY_ACCESS = enum(i32) {
PRECONFIG = 0,
DIRECT = 1,
PROXY = 2,
};
pub const PROXY_ACCESS_PRECONFIG = PROXY_ACCESS.PRECONFIG;
pub const PROXY_ACCESS_DIRECT = PROXY_ACCESS.DIRECT;
pub const PROXY_ACCESS_PROXY = PROXY_ACCESS.PROXY;
pub const PROXY_INFO = extern struct {
dwSize: u32,
pcwszUserAgent: ?[*:0]const u16,
paUseProxy: PROXY_ACCESS,
fLocalBypass: BOOL,
dwPortNumber: u32,
pcwszProxyName: ?[*:0]const u16,
pcwszBypassList: ?[*:0]const u16,
};
pub const AUTH_TYPE = enum(i32) {
ANONYMOUS = 0,
NTLM = 1,
BASIC = 2,
};
pub const eAUTH_TYPE_ANONYMOUS = AUTH_TYPE.ANONYMOUS;
pub const eAUTH_TYPE_NTLM = AUTH_TYPE.NTLM;
pub const eAUTH_TYPE_BASIC = AUTH_TYPE.BASIC;
pub const AUTHENTICATION_INFO = extern struct {
dwSize: u32,
atAuthenticationType: AUTH_TYPE,
pcwszUser: ?[*:0]const u16,
pcwszPassword: ?[*:0]const u16,
};
pub const INCREMENTAL_ACCESS_INFO = extern struct {
dwSize: u32,
ftLastModifiedTime: FILETIME,
};
pub const ITEM_INFO = extern struct {
dwSize: u32,
pcwszFromEMail: ?[*:0]const u16,
pcwszApplicationName: ?[*:0]const u16,
pcwszCatalogName: ?[*:0]const u16,
pcwszContentClass: ?[*:0]const u16,
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchProtocol_Value = Guid.initString("c73106ba-ac80-11d1-8df3-00c04fb6ef4f");
pub const IID_ISearchProtocol = &IID_ISearchProtocol_Value;
pub const ISearchProtocol = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Init: fn(
self: *const ISearchProtocol,
pTimeoutInfo: ?*TIMEOUT_INFO,
pProtocolHandlerSite: ?*IProtocolHandlerSite,
pProxyInfo: ?*PROXY_INFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAccessor: fn(
self: *const ISearchProtocol,
pcwszURL: ?[*:0]const u16,
pAuthenticationInfo: ?*AUTHENTICATION_INFO,
pIncrementalAccessInfo: ?*INCREMENTAL_ACCESS_INFO,
pItemInfo: ?*ITEM_INFO,
ppAccessor: ?*?*IUrlAccessor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CloseAccessor: fn(
self: *const ISearchProtocol,
pAccessor: ?*IUrlAccessor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ShutDown: fn(
self: *const ISearchProtocol,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocol_Init(self: *const T, pTimeoutInfo: ?*TIMEOUT_INFO, pProtocolHandlerSite: ?*IProtocolHandlerSite, pProxyInfo: ?*PROXY_INFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocol.VTable, self.vtable).Init(@ptrCast(*const ISearchProtocol, self), pTimeoutInfo, pProtocolHandlerSite, pProxyInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocol_CreateAccessor(self: *const T, pcwszURL: ?[*:0]const u16, pAuthenticationInfo: ?*AUTHENTICATION_INFO, pIncrementalAccessInfo: ?*INCREMENTAL_ACCESS_INFO, pItemInfo: ?*ITEM_INFO, ppAccessor: ?*?*IUrlAccessor) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocol.VTable, self.vtable).CreateAccessor(@ptrCast(*const ISearchProtocol, self), pcwszURL, pAuthenticationInfo, pIncrementalAccessInfo, pItemInfo, ppAccessor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocol_CloseAccessor(self: *const T, pAccessor: ?*IUrlAccessor) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocol.VTable, self.vtable).CloseAccessor(@ptrCast(*const ISearchProtocol, self), pAccessor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocol_ShutDown(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocol.VTable, self.vtable).ShutDown(@ptrCast(*const ISearchProtocol, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchProtocol2_Value = Guid.initString("7789f0b2-b5b2-4722-8b65-5dbd150697a9");
pub const IID_ISearchProtocol2 = &IID_ISearchProtocol2_Value;
pub const ISearchProtocol2 = extern struct {
pub const VTable = extern struct {
base: ISearchProtocol.VTable,
CreateAccessorEx: fn(
self: *const ISearchProtocol2,
pcwszURL: ?[*:0]const u16,
pAuthenticationInfo: ?*AUTHENTICATION_INFO,
pIncrementalAccessInfo: ?*INCREMENTAL_ACCESS_INFO,
pItemInfo: ?*ITEM_INFO,
pUserData: ?*const BLOB,
ppAccessor: ?*?*IUrlAccessor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISearchProtocol.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchProtocol2_CreateAccessorEx(self: *const T, pcwszURL: ?[*:0]const u16, pAuthenticationInfo: ?*AUTHENTICATION_INFO, pIncrementalAccessInfo: ?*INCREMENTAL_ACCESS_INFO, pItemInfo: ?*ITEM_INFO, pUserData: ?*const BLOB, ppAccessor: ?*?*IUrlAccessor) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchProtocol2.VTable, self.vtable).CreateAccessorEx(@ptrCast(*const ISearchProtocol2, self), pcwszURL, pAuthenticationInfo, pIncrementalAccessInfo, pItemInfo, pUserData, ppAccessor);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IProtocolHandlerSite_Value = Guid.initString("0b63e385-9ccc-11d0-bcdb-00805fccce04");
pub const IID_IProtocolHandlerSite = &IID_IProtocolHandlerSite_Value;
pub const IProtocolHandlerSite = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetFilter: fn(
self: *const IProtocolHandlerSite,
pclsidObj: ?*Guid,
pcwszContentType: ?[*:0]const u16,
pcwszExtension: ?[*:0]const u16,
ppFilter: ?*?*IFilter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProtocolHandlerSite_GetFilter(self: *const T, pclsidObj: ?*Guid, pcwszContentType: ?[*:0]const u16, pcwszExtension: ?[*:0]const u16, ppFilter: ?*?*IFilter) callconv(.Inline) HRESULT {
return @ptrCast(*const IProtocolHandlerSite.VTable, self.vtable).GetFilter(@ptrCast(*const IProtocolHandlerSite, self), pclsidObj, pcwszContentType, pcwszExtension, ppFilter);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchRoot_Value = Guid.initString("04c18ccf-1f57-4cbd-88cc-3900f5195ce3");
pub const IID_ISearchRoot = &IID_ISearchRoot_Value;
pub const ISearchRoot = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Schedule: fn(
self: *const ISearchRoot,
pszTaskArg: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Schedule: fn(
self: *const ISearchRoot,
ppszTaskArg: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_RootURL: fn(
self: *const ISearchRoot,
pszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_RootURL: fn(
self: *const ISearchRoot,
ppszURL: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_IsHierarchical: fn(
self: *const ISearchRoot,
fIsHierarchical: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IsHierarchical: fn(
self: *const ISearchRoot,
pfIsHierarchical: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_ProvidesNotifications: fn(
self: *const ISearchRoot,
fProvidesNotifications: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ProvidesNotifications: fn(
self: *const ISearchRoot,
pfProvidesNotifications: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_UseNotificationsOnly: fn(
self: *const ISearchRoot,
fUseNotificationsOnly: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UseNotificationsOnly: fn(
self: *const ISearchRoot,
pfUseNotificationsOnly: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_EnumerationDepth: fn(
self: *const ISearchRoot,
dwDepth: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_EnumerationDepth: fn(
self: *const ISearchRoot,
pdwDepth: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_HostDepth: fn(
self: *const ISearchRoot,
dwDepth: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_HostDepth: fn(
self: *const ISearchRoot,
pdwDepth: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_FollowDirectories: fn(
self: *const ISearchRoot,
fFollowDirectories: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FollowDirectories: fn(
self: *const ISearchRoot,
pfFollowDirectories: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_AuthenticationType: fn(
self: *const ISearchRoot,
authType: AUTH_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_AuthenticationType: fn(
self: *const ISearchRoot,
pAuthType: ?*AUTH_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_User: fn(
self: *const ISearchRoot,
pszUser: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_User: fn(
self: *const ISearchRoot,
ppszUser: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_Password: fn(
self: *const ISearchRoot,
pszPassword: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Password: fn(
self: *const ISearchRoot,
ppszPassword: ?*?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 ISearchRoot_put_Schedule(self: *const T, pszTaskArg: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_Schedule(@ptrCast(*const ISearchRoot, self), pszTaskArg);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_Schedule(self: *const T, ppszTaskArg: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_Schedule(@ptrCast(*const ISearchRoot, self), ppszTaskArg);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_RootURL(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_RootURL(@ptrCast(*const ISearchRoot, self), pszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_RootURL(self: *const T, ppszURL: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_RootURL(@ptrCast(*const ISearchRoot, self), ppszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_IsHierarchical(self: *const T, fIsHierarchical: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_IsHierarchical(@ptrCast(*const ISearchRoot, self), fIsHierarchical);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_IsHierarchical(self: *const T, pfIsHierarchical: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_IsHierarchical(@ptrCast(*const ISearchRoot, self), pfIsHierarchical);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_ProvidesNotifications(self: *const T, fProvidesNotifications: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_ProvidesNotifications(@ptrCast(*const ISearchRoot, self), fProvidesNotifications);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_ProvidesNotifications(self: *const T, pfProvidesNotifications: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_ProvidesNotifications(@ptrCast(*const ISearchRoot, self), pfProvidesNotifications);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_UseNotificationsOnly(self: *const T, fUseNotificationsOnly: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_UseNotificationsOnly(@ptrCast(*const ISearchRoot, self), fUseNotificationsOnly);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_UseNotificationsOnly(self: *const T, pfUseNotificationsOnly: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_UseNotificationsOnly(@ptrCast(*const ISearchRoot, self), pfUseNotificationsOnly);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_EnumerationDepth(self: *const T, dwDepth: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_EnumerationDepth(@ptrCast(*const ISearchRoot, self), dwDepth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_EnumerationDepth(self: *const T, pdwDepth: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_EnumerationDepth(@ptrCast(*const ISearchRoot, self), pdwDepth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_HostDepth(self: *const T, dwDepth: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_HostDepth(@ptrCast(*const ISearchRoot, self), dwDepth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_HostDepth(self: *const T, pdwDepth: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_HostDepth(@ptrCast(*const ISearchRoot, self), pdwDepth);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_FollowDirectories(self: *const T, fFollowDirectories: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_FollowDirectories(@ptrCast(*const ISearchRoot, self), fFollowDirectories);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_FollowDirectories(self: *const T, pfFollowDirectories: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_FollowDirectories(@ptrCast(*const ISearchRoot, self), pfFollowDirectories);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_AuthenticationType(self: *const T, authType: AUTH_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_AuthenticationType(@ptrCast(*const ISearchRoot, self), authType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_AuthenticationType(self: *const T, pAuthType: ?*AUTH_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_AuthenticationType(@ptrCast(*const ISearchRoot, self), pAuthType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_User(self: *const T, pszUser: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_User(@ptrCast(*const ISearchRoot, self), pszUser);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_User(self: *const T, ppszUser: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_User(@ptrCast(*const ISearchRoot, self), ppszUser);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_put_Password(self: *const T, pszPassword: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).put_Password(@ptrCast(*const ISearchRoot, self), pszPassword);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchRoot_get_Password(self: *const T, ppszPassword: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchRoot.VTable, self.vtable).get_Password(@ptrCast(*const ISearchRoot, self), ppszPassword);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IEnumSearchRoots_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef52");
pub const IID_IEnumSearchRoots = &IID_IEnumSearchRoots_Value;
pub const IEnumSearchRoots = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSearchRoots,
celt: u32,
rgelt: [*]?*ISearchRoot,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSearchRoots,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSearchRoots,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSearchRoots,
ppenum: ?*?*IEnumSearchRoots,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchRoots_Next(self: *const T, celt: u32, rgelt: [*]?*ISearchRoot, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchRoots.VTable, self.vtable).Next(@ptrCast(*const IEnumSearchRoots, self), celt, rgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchRoots_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchRoots.VTable, self.vtable).Skip(@ptrCast(*const IEnumSearchRoots, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchRoots_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchRoots.VTable, self.vtable).Reset(@ptrCast(*const IEnumSearchRoots, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchRoots_Clone(self: *const T, ppenum: ?*?*IEnumSearchRoots) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchRoots.VTable, self.vtable).Clone(@ptrCast(*const IEnumSearchRoots, self), ppenum);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const FOLLOW_FLAGS = enum(i32) {
INDEXCOMPLEXURLS = 1,
SUPPRESSINDEXING = 2,
};
pub const FF_INDEXCOMPLEXURLS = FOLLOW_FLAGS.INDEXCOMPLEXURLS;
pub const FF_SUPPRESSINDEXING = FOLLOW_FLAGS.SUPPRESSINDEXING;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchScopeRule_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef53");
pub const IID_ISearchScopeRule = &IID_ISearchScopeRule_Value;
pub const ISearchScopeRule = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PatternOrURL: fn(
self: *const ISearchScopeRule,
ppszPatternOrURL: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IsIncluded: fn(
self: *const ISearchScopeRule,
pfIsIncluded: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_IsDefault: fn(
self: *const ISearchScopeRule,
pfIsDefault: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_FollowFlags: fn(
self: *const ISearchScopeRule,
pFollowFlags: ?*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 ISearchScopeRule_get_PatternOrURL(self: *const T, ppszPatternOrURL: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchScopeRule.VTable, self.vtable).get_PatternOrURL(@ptrCast(*const ISearchScopeRule, self), ppszPatternOrURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchScopeRule_get_IsIncluded(self: *const T, pfIsIncluded: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchScopeRule.VTable, self.vtable).get_IsIncluded(@ptrCast(*const ISearchScopeRule, self), pfIsIncluded);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchScopeRule_get_IsDefault(self: *const T, pfIsDefault: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchScopeRule.VTable, self.vtable).get_IsDefault(@ptrCast(*const ISearchScopeRule, self), pfIsDefault);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchScopeRule_get_FollowFlags(self: *const T, pFollowFlags: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchScopeRule.VTable, self.vtable).get_FollowFlags(@ptrCast(*const ISearchScopeRule, self), pFollowFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_IEnumSearchScopeRules_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef54");
pub const IID_IEnumSearchScopeRules = &IID_IEnumSearchScopeRules_Value;
pub const IEnumSearchScopeRules = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSearchScopeRules,
celt: u32,
pprgelt: [*]?*ISearchScopeRule,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSearchScopeRules,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSearchScopeRules,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSearchScopeRules,
ppenum: ?*?*IEnumSearchScopeRules,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchScopeRules_Next(self: *const T, celt: u32, pprgelt: [*]?*ISearchScopeRule, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchScopeRules.VTable, self.vtable).Next(@ptrCast(*const IEnumSearchScopeRules, self), celt, pprgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchScopeRules_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchScopeRules.VTable, self.vtable).Skip(@ptrCast(*const IEnumSearchScopeRules, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchScopeRules_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchScopeRules.VTable, self.vtable).Reset(@ptrCast(*const IEnumSearchScopeRules, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSearchScopeRules_Clone(self: *const T, ppenum: ?*?*IEnumSearchScopeRules) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSearchScopeRules.VTable, self.vtable).Clone(@ptrCast(*const IEnumSearchScopeRules, self), ppenum);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const CLUSION_REASON = enum(i32) {
UNKNOWNSCOPE = 0,
DEFAULT = 1,
USER = 2,
GROUPPOLICY = 3,
};
pub const CLUSIONREASON_UNKNOWNSCOPE = CLUSION_REASON.UNKNOWNSCOPE;
pub const CLUSIONREASON_DEFAULT = CLUSION_REASON.DEFAULT;
pub const CLUSIONREASON_USER = CLUSION_REASON.USER;
pub const CLUSIONREASON_GROUPPOLICY = CLUSION_REASON.GROUPPOLICY;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchCrawlScopeManager_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef55");
pub const IID_ISearchCrawlScopeManager = &IID_ISearchCrawlScopeManager_Value;
pub const ISearchCrawlScopeManager = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddDefaultScopeRule: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
fInclude: BOOL,
fFollowFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddRoot: fn(
self: *const ISearchCrawlScopeManager,
pSearchRoot: ?*ISearchRoot,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveRoot: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumerateRoots: fn(
self: *const ISearchCrawlScopeManager,
ppSearchRoots: ?*?*IEnumSearchRoots,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddHierarchicalScope: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
fInclude: BOOL,
fDefault: BOOL,
fOverrideChildren: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddUserScopeRule: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
fInclude: BOOL,
fOverrideChildren: BOOL,
fFollowFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveScopeRule: fn(
self: *const ISearchCrawlScopeManager,
pszRule: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumerateScopeRules: fn(
self: *const ISearchCrawlScopeManager,
ppSearchScopeRules: ?*?*IEnumSearchScopeRules,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
HasParentScopeRule: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
pfHasParentRule: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
HasChildScopeRule: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
pfHasChildRule: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IncludedInCrawlScope: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
pfIsIncluded: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IncludedInCrawlScopeEx: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
pfIsIncluded: ?*BOOL,
pReason: ?*CLUSION_REASON,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RevertToDefaultScopes: fn(
self: *const ISearchCrawlScopeManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SaveAll: fn(
self: *const ISearchCrawlScopeManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetParentScopeVersionId: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*:0]const u16,
plScopeId: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveDefaultScopeRule: fn(
self: *const ISearchCrawlScopeManager,
pszURL: ?[*: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 ISearchCrawlScopeManager_AddDefaultScopeRule(self: *const T, pszURL: ?[*:0]const u16, fInclude: BOOL, fFollowFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).AddDefaultScopeRule(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, fInclude, fFollowFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_AddRoot(self: *const T, pSearchRoot: ?*ISearchRoot) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).AddRoot(@ptrCast(*const ISearchCrawlScopeManager, self), pSearchRoot);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_RemoveRoot(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).RemoveRoot(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_EnumerateRoots(self: *const T, ppSearchRoots: ?*?*IEnumSearchRoots) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).EnumerateRoots(@ptrCast(*const ISearchCrawlScopeManager, self), ppSearchRoots);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_AddHierarchicalScope(self: *const T, pszURL: ?[*:0]const u16, fInclude: BOOL, fDefault: BOOL, fOverrideChildren: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).AddHierarchicalScope(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, fInclude, fDefault, fOverrideChildren);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_AddUserScopeRule(self: *const T, pszURL: ?[*:0]const u16, fInclude: BOOL, fOverrideChildren: BOOL, fFollowFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).AddUserScopeRule(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, fInclude, fOverrideChildren, fFollowFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_RemoveScopeRule(self: *const T, pszRule: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).RemoveScopeRule(@ptrCast(*const ISearchCrawlScopeManager, self), pszRule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_EnumerateScopeRules(self: *const T, ppSearchScopeRules: ?*?*IEnumSearchScopeRules) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).EnumerateScopeRules(@ptrCast(*const ISearchCrawlScopeManager, self), ppSearchScopeRules);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_HasParentScopeRule(self: *const T, pszURL: ?[*:0]const u16, pfHasParentRule: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).HasParentScopeRule(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, pfHasParentRule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_HasChildScopeRule(self: *const T, pszURL: ?[*:0]const u16, pfHasChildRule: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).HasChildScopeRule(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, pfHasChildRule);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_IncludedInCrawlScope(self: *const T, pszURL: ?[*:0]const u16, pfIsIncluded: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).IncludedInCrawlScope(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, pfIsIncluded);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_IncludedInCrawlScopeEx(self: *const T, pszURL: ?[*:0]const u16, pfIsIncluded: ?*BOOL, pReason: ?*CLUSION_REASON) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).IncludedInCrawlScopeEx(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, pfIsIncluded, pReason);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_RevertToDefaultScopes(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).RevertToDefaultScopes(@ptrCast(*const ISearchCrawlScopeManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_SaveAll(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).SaveAll(@ptrCast(*const ISearchCrawlScopeManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_GetParentScopeVersionId(self: *const T, pszURL: ?[*:0]const u16, plScopeId: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).GetParentScopeVersionId(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL, plScopeId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager_RemoveDefaultScopeRule(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager.VTable, self.vtable).RemoveDefaultScopeRule(@ptrCast(*const ISearchCrawlScopeManager, self), pszURL);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ISearchCrawlScopeManager2_Value = Guid.initString("6292f7ad-4e19-4717-a534-8fc22bcd5ccd");
pub const IID_ISearchCrawlScopeManager2 = &IID_ISearchCrawlScopeManager2_Value;
pub const ISearchCrawlScopeManager2 = extern struct {
pub const VTable = extern struct {
base: ISearchCrawlScopeManager.VTable,
GetVersion: fn(
self: *const ISearchCrawlScopeManager2,
plVersion: ?*?*i32,
phFileMapping: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISearchCrawlScopeManager.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCrawlScopeManager2_GetVersion(self: *const T, plVersion: ?*?*i32, phFileMapping: ?*?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCrawlScopeManager2.VTable, self.vtable).GetVersion(@ptrCast(*const ISearchCrawlScopeManager2, self), plVersion, phFileMapping);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SEARCH_KIND_OF_CHANGE = enum(i32) {
ADD = 0,
DELETE = 1,
MODIFY = 2,
MOVE_RENAME = 3,
SEMANTICS_DIRECTORY = 262144,
SEMANTICS_SHALLOW = 524288,
SEMANTICS_UPDATE_SECURITY = 4194304,
};
pub const SEARCH_CHANGE_ADD = SEARCH_KIND_OF_CHANGE.ADD;
pub const SEARCH_CHANGE_DELETE = SEARCH_KIND_OF_CHANGE.DELETE;
pub const SEARCH_CHANGE_MODIFY = SEARCH_KIND_OF_CHANGE.MODIFY;
pub const SEARCH_CHANGE_MOVE_RENAME = SEARCH_KIND_OF_CHANGE.MOVE_RENAME;
pub const SEARCH_CHANGE_SEMANTICS_DIRECTORY = SEARCH_KIND_OF_CHANGE.SEMANTICS_DIRECTORY;
pub const SEARCH_CHANGE_SEMANTICS_SHALLOW = SEARCH_KIND_OF_CHANGE.SEMANTICS_SHALLOW;
pub const SEARCH_CHANGE_SEMANTICS_UPDATE_SECURITY = SEARCH_KIND_OF_CHANGE.SEMANTICS_UPDATE_SECURITY;
pub const SEARCH_NOTIFICATION_PRIORITY = enum(i32) {
NORMAL_PRIORITY = 0,
HIGH_PRIORITY = 1,
};
pub const SEARCH_NORMAL_PRIORITY = SEARCH_NOTIFICATION_PRIORITY.NORMAL_PRIORITY;
pub const SEARCH_HIGH_PRIORITY = SEARCH_NOTIFICATION_PRIORITY.HIGH_PRIORITY;
pub const SEARCH_ITEM_CHANGE = extern struct {
Change: SEARCH_KIND_OF_CHANGE,
Priority: SEARCH_NOTIFICATION_PRIORITY,
pUserData: ?*BLOB,
lpwszURL: ?PWSTR,
lpwszOldURL: ?PWSTR,
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchItemsChangedSink_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef58");
pub const IID_ISearchItemsChangedSink = &IID_ISearchItemsChangedSink_Value;
pub const ISearchItemsChangedSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
StartedMonitoringScope: fn(
self: *const ISearchItemsChangedSink,
pszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StoppedMonitoringScope: fn(
self: *const ISearchItemsChangedSink,
pszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnItemsChanged: fn(
self: *const ISearchItemsChangedSink,
dwNumberOfChanges: u32,
rgDataChangeEntries: [*]SEARCH_ITEM_CHANGE,
rgdwDocIds: [*]u32,
rghrCompletionCodes: [*]HRESULT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchItemsChangedSink_StartedMonitoringScope(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchItemsChangedSink.VTable, self.vtable).StartedMonitoringScope(@ptrCast(*const ISearchItemsChangedSink, self), pszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchItemsChangedSink_StoppedMonitoringScope(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchItemsChangedSink.VTable, self.vtable).StoppedMonitoringScope(@ptrCast(*const ISearchItemsChangedSink, self), pszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchItemsChangedSink_OnItemsChanged(self: *const T, dwNumberOfChanges: u32, rgDataChangeEntries: [*]SEARCH_ITEM_CHANGE, rgdwDocIds: [*]u32, rghrCompletionCodes: [*]HRESULT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchItemsChangedSink.VTable, self.vtable).OnItemsChanged(@ptrCast(*const ISearchItemsChangedSink, self), dwNumberOfChanges, rgDataChangeEntries, rgdwDocIds, rghrCompletionCodes);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SEARCH_ITEM_PERSISTENT_CHANGE = extern struct {
Change: SEARCH_KIND_OF_CHANGE,
URL: ?PWSTR,
OldURL: ?PWSTR,
Priority: SEARCH_NOTIFICATION_PRIORITY,
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchPersistentItemsChangedSink_Value = Guid.initString("a2ffdf9b-4758-4f84-b729-df81a1a0612f");
pub const IID_ISearchPersistentItemsChangedSink = &IID_ISearchPersistentItemsChangedSink_Value;
pub const ISearchPersistentItemsChangedSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
StartedMonitoringScope: fn(
self: *const ISearchPersistentItemsChangedSink,
pszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StoppedMonitoringScope: fn(
self: *const ISearchPersistentItemsChangedSink,
pszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnItemsChanged: fn(
self: *const ISearchPersistentItemsChangedSink,
dwNumberOfChanges: u32,
DataChangeEntries: [*]SEARCH_ITEM_PERSISTENT_CHANGE,
hrCompletionCodes: [*]HRESULT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchPersistentItemsChangedSink_StartedMonitoringScope(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchPersistentItemsChangedSink.VTable, self.vtable).StartedMonitoringScope(@ptrCast(*const ISearchPersistentItemsChangedSink, self), pszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchPersistentItemsChangedSink_StoppedMonitoringScope(self: *const T, pszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchPersistentItemsChangedSink.VTable, self.vtable).StoppedMonitoringScope(@ptrCast(*const ISearchPersistentItemsChangedSink, self), pszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchPersistentItemsChangedSink_OnItemsChanged(self: *const T, dwNumberOfChanges: u32, DataChangeEntries: [*]SEARCH_ITEM_PERSISTENT_CHANGE, hrCompletionCodes: [*]HRESULT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchPersistentItemsChangedSink.VTable, self.vtable).OnItemsChanged(@ptrCast(*const ISearchPersistentItemsChangedSink, self), dwNumberOfChanges, DataChangeEntries, hrCompletionCodes);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchViewChangedSink_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef65");
pub const IID_ISearchViewChangedSink = &IID_ISearchViewChangedSink_Value;
pub const ISearchViewChangedSink = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnChange: fn(
self: *const ISearchViewChangedSink,
pdwDocID: ?*i32,
pChange: ?*SEARCH_ITEM_CHANGE,
pfInView: ?*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 ISearchViewChangedSink_OnChange(self: *const T, pdwDocID: ?*i32, pChange: ?*SEARCH_ITEM_CHANGE, pfInView: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchViewChangedSink.VTable, self.vtable).OnChange(@ptrCast(*const ISearchViewChangedSink, self), pdwDocID, pChange, pfInView);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SEARCH_INDEXING_PHASE = enum(i32) {
GATHERER = 0,
QUERYABLE = 1,
PERSISTED = 2,
};
pub const SEARCH_INDEXING_PHASE_GATHERER = SEARCH_INDEXING_PHASE.GATHERER;
pub const SEARCH_INDEXING_PHASE_QUERYABLE = SEARCH_INDEXING_PHASE.QUERYABLE;
pub const SEARCH_INDEXING_PHASE_PERSISTED = SEARCH_INDEXING_PHASE.PERSISTED;
pub const SEARCH_ITEM_INDEXING_STATUS = extern struct {
dwDocID: u32,
hrIndexingStatus: HRESULT,
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchNotifyInlineSite_Value = Guid.initString("b5702e61-e75c-4b64-82a1-6cb4f832fccf");
pub const IID_ISearchNotifyInlineSite = &IID_ISearchNotifyInlineSite_Value;
pub const ISearchNotifyInlineSite = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnItemIndexedStatusChange: fn(
self: *const ISearchNotifyInlineSite,
sipStatus: SEARCH_INDEXING_PHASE,
dwNumEntries: u32,
rgItemStatusEntries: [*]SEARCH_ITEM_INDEXING_STATUS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnCatalogStatusChange: fn(
self: *const ISearchNotifyInlineSite,
guidCatalogResetSignature: ?*const Guid,
guidCheckPointSignature: ?*const Guid,
dwLastCheckPointNumber: 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 ISearchNotifyInlineSite_OnItemIndexedStatusChange(self: *const T, sipStatus: SEARCH_INDEXING_PHASE, dwNumEntries: u32, rgItemStatusEntries: [*]SEARCH_ITEM_INDEXING_STATUS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchNotifyInlineSite.VTable, self.vtable).OnItemIndexedStatusChange(@ptrCast(*const ISearchNotifyInlineSite, self), sipStatus, dwNumEntries, rgItemStatusEntries);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchNotifyInlineSite_OnCatalogStatusChange(self: *const T, guidCatalogResetSignature: ?*const Guid, guidCheckPointSignature: ?*const Guid, dwLastCheckPointNumber: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchNotifyInlineSite.VTable, self.vtable).OnCatalogStatusChange(@ptrCast(*const ISearchNotifyInlineSite, self), guidCatalogResetSignature, guidCheckPointSignature, dwLastCheckPointNumber);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const CatalogStatus = enum(i32) {
IDLE = 0,
PAUSED = 1,
RECOVERING = 2,
FULL_CRAWL = 3,
INCREMENTAL_CRAWL = 4,
PROCESSING_NOTIFICATIONS = 5,
SHUTTING_DOWN = 6,
};
pub const CATALOG_STATUS_IDLE = CatalogStatus.IDLE;
pub const CATALOG_STATUS_PAUSED = CatalogStatus.PAUSED;
pub const CATALOG_STATUS_RECOVERING = CatalogStatus.RECOVERING;
pub const CATALOG_STATUS_FULL_CRAWL = CatalogStatus.FULL_CRAWL;
pub const CATALOG_STATUS_INCREMENTAL_CRAWL = CatalogStatus.INCREMENTAL_CRAWL;
pub const CATALOG_STATUS_PROCESSING_NOTIFICATIONS = CatalogStatus.PROCESSING_NOTIFICATIONS;
pub const CATALOG_STATUS_SHUTTING_DOWN = CatalogStatus.SHUTTING_DOWN;
pub const CatalogPausedReason = enum(i32) {
NONE = 0,
HIGH_IO = 1,
HIGH_CPU = 2,
HIGH_NTF_RATE = 3,
LOW_BATTERY = 4,
LOW_MEMORY = 5,
LOW_DISK = 6,
DELAYED_RECOVERY = 7,
USER_ACTIVE = 8,
EXTERNAL = 9,
UPGRADING = 10,
};
pub const CATALOG_PAUSED_REASON_NONE = CatalogPausedReason.NONE;
pub const CATALOG_PAUSED_REASON_HIGH_IO = CatalogPausedReason.HIGH_IO;
pub const CATALOG_PAUSED_REASON_HIGH_CPU = CatalogPausedReason.HIGH_CPU;
pub const CATALOG_PAUSED_REASON_HIGH_NTF_RATE = CatalogPausedReason.HIGH_NTF_RATE;
pub const CATALOG_PAUSED_REASON_LOW_BATTERY = CatalogPausedReason.LOW_BATTERY;
pub const CATALOG_PAUSED_REASON_LOW_MEMORY = CatalogPausedReason.LOW_MEMORY;
pub const CATALOG_PAUSED_REASON_LOW_DISK = CatalogPausedReason.LOW_DISK;
pub const CATALOG_PAUSED_REASON_DELAYED_RECOVERY = CatalogPausedReason.DELAYED_RECOVERY;
pub const CATALOG_PAUSED_REASON_USER_ACTIVE = CatalogPausedReason.USER_ACTIVE;
pub const CATALOG_PAUSED_REASON_EXTERNAL = CatalogPausedReason.EXTERNAL;
pub const CATALOG_PAUSED_REASON_UPGRADING = CatalogPausedReason.UPGRADING;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchCatalogManager_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef50");
pub const IID_ISearchCatalogManager = &IID_ISearchCatalogManager_Value;
pub const ISearchCatalogManager = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Name: fn(
self: *const ISearchCatalogManager,
pszName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetParameter: fn(
self: *const ISearchCatalogManager,
pszName: ?[*:0]const u16,
ppValue: ?*?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetParameter: fn(
self: *const ISearchCatalogManager,
pszName: ?[*:0]const u16,
pValue: ?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCatalogStatus: fn(
self: *const ISearchCatalogManager,
pStatus: ?*CatalogStatus,
pPausedReason: ?*CatalogPausedReason,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const ISearchCatalogManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reindex: fn(
self: *const ISearchCatalogManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReindexMatchingURLs: fn(
self: *const ISearchCatalogManager,
pszPattern: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReindexSearchRoot: fn(
self: *const ISearchCatalogManager,
pszRootURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_ConnectTimeout: fn(
self: *const ISearchCatalogManager,
dwConnectTimeout: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ConnectTimeout: fn(
self: *const ISearchCatalogManager,
pdwConnectTimeout: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_DataTimeout: fn(
self: *const ISearchCatalogManager,
dwDataTimeout: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DataTimeout: fn(
self: *const ISearchCatalogManager,
pdwDataTimeout: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NumberOfItems: fn(
self: *const ISearchCatalogManager,
plCount: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NumberOfItemsToIndex: fn(
self: *const ISearchCatalogManager,
plIncrementalCount: ?*i32,
plNotificationQueue: ?*i32,
plHighPriorityQueue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
URLBeingIndexed: fn(
self: *const ISearchCatalogManager,
pszUrl: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetURLIndexingState: fn(
self: *const ISearchCatalogManager,
pszURL: ?[*:0]const u16,
pdwState: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPersistentItemsChangedSink: fn(
self: *const ISearchCatalogManager,
ppISearchPersistentItemsChangedSink: ?*?*ISearchPersistentItemsChangedSink,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RegisterViewForNotification: fn(
self: *const ISearchCatalogManager,
pszView: ?[*:0]const u16,
pViewChangedSink: ?*ISearchViewChangedSink,
pdwCookie: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetItemsChangedSink: fn(
self: *const ISearchCatalogManager,
pISearchNotifyInlineSite: ?*ISearchNotifyInlineSite,
riid: ?*const Guid,
ppv: ?*?*anyopaque,
pGUIDCatalogResetSignature: ?*Guid,
pGUIDCheckPointSignature: ?*Guid,
pdwLastCheckPointNumber: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnregisterViewForNotification: fn(
self: *const ISearchCatalogManager,
dwCookie: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetExtensionClusion: fn(
self: *const ISearchCatalogManager,
pszExtension: ?[*:0]const u16,
fExclude: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumerateExcludedExtensions: fn(
self: *const ISearchCatalogManager,
ppExtensions: ?*?*IEnumString,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetQueryHelper: fn(
self: *const ISearchCatalogManager,
ppSearchQueryHelper: ?*?*ISearchQueryHelper,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_DiacriticSensitivity: fn(
self: *const ISearchCatalogManager,
fDiacriticSensitive: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_DiacriticSensitivity: fn(
self: *const ISearchCatalogManager,
pfDiacriticSensitive: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCrawlScopeManager: fn(
self: *const ISearchCatalogManager,
ppCrawlScopeManager: ?*?*ISearchCrawlScopeManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_get_Name(self: *const T, pszName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).get_Name(@ptrCast(*const ISearchCatalogManager, self), pszName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetParameter(self: *const T, pszName: ?[*:0]const u16, ppValue: ?*?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetParameter(@ptrCast(*const ISearchCatalogManager, self), pszName, ppValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_SetParameter(self: *const T, pszName: ?[*:0]const u16, pValue: ?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).SetParameter(@ptrCast(*const ISearchCatalogManager, self), pszName, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetCatalogStatus(self: *const T, pStatus: ?*CatalogStatus, pPausedReason: ?*CatalogPausedReason) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetCatalogStatus(@ptrCast(*const ISearchCatalogManager, self), pStatus, pPausedReason);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).Reset(@ptrCast(*const ISearchCatalogManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_Reindex(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).Reindex(@ptrCast(*const ISearchCatalogManager, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_ReindexMatchingURLs(self: *const T, pszPattern: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).ReindexMatchingURLs(@ptrCast(*const ISearchCatalogManager, self), pszPattern);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_ReindexSearchRoot(self: *const T, pszRootURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).ReindexSearchRoot(@ptrCast(*const ISearchCatalogManager, self), pszRootURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_put_ConnectTimeout(self: *const T, dwConnectTimeout: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).put_ConnectTimeout(@ptrCast(*const ISearchCatalogManager, self), dwConnectTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_get_ConnectTimeout(self: *const T, pdwConnectTimeout: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).get_ConnectTimeout(@ptrCast(*const ISearchCatalogManager, self), pdwConnectTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_put_DataTimeout(self: *const T, dwDataTimeout: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).put_DataTimeout(@ptrCast(*const ISearchCatalogManager, self), dwDataTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_get_DataTimeout(self: *const T, pdwDataTimeout: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).get_DataTimeout(@ptrCast(*const ISearchCatalogManager, self), pdwDataTimeout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_NumberOfItems(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).NumberOfItems(@ptrCast(*const ISearchCatalogManager, self), plCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_NumberOfItemsToIndex(self: *const T, plIncrementalCount: ?*i32, plNotificationQueue: ?*i32, plHighPriorityQueue: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).NumberOfItemsToIndex(@ptrCast(*const ISearchCatalogManager, self), plIncrementalCount, plNotificationQueue, plHighPriorityQueue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_URLBeingIndexed(self: *const T, pszUrl: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).URLBeingIndexed(@ptrCast(*const ISearchCatalogManager, self), pszUrl);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetURLIndexingState(self: *const T, pszURL: ?[*:0]const u16, pdwState: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetURLIndexingState(@ptrCast(*const ISearchCatalogManager, self), pszURL, pdwState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetPersistentItemsChangedSink(self: *const T, ppISearchPersistentItemsChangedSink: ?*?*ISearchPersistentItemsChangedSink) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetPersistentItemsChangedSink(@ptrCast(*const ISearchCatalogManager, self), ppISearchPersistentItemsChangedSink);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_RegisterViewForNotification(self: *const T, pszView: ?[*:0]const u16, pViewChangedSink: ?*ISearchViewChangedSink, pdwCookie: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).RegisterViewForNotification(@ptrCast(*const ISearchCatalogManager, self), pszView, pViewChangedSink, pdwCookie);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetItemsChangedSink(self: *const T, pISearchNotifyInlineSite: ?*ISearchNotifyInlineSite, riid: ?*const Guid, ppv: ?*?*anyopaque, pGUIDCatalogResetSignature: ?*Guid, pGUIDCheckPointSignature: ?*Guid, pdwLastCheckPointNumber: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetItemsChangedSink(@ptrCast(*const ISearchCatalogManager, self), pISearchNotifyInlineSite, riid, ppv, pGUIDCatalogResetSignature, pGUIDCheckPointSignature, pdwLastCheckPointNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_UnregisterViewForNotification(self: *const T, dwCookie: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).UnregisterViewForNotification(@ptrCast(*const ISearchCatalogManager, self), dwCookie);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_SetExtensionClusion(self: *const T, pszExtension: ?[*:0]const u16, fExclude: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).SetExtensionClusion(@ptrCast(*const ISearchCatalogManager, self), pszExtension, fExclude);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_EnumerateExcludedExtensions(self: *const T, ppExtensions: ?*?*IEnumString) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).EnumerateExcludedExtensions(@ptrCast(*const ISearchCatalogManager, self), ppExtensions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetQueryHelper(self: *const T, ppSearchQueryHelper: ?*?*ISearchQueryHelper) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetQueryHelper(@ptrCast(*const ISearchCatalogManager, self), ppSearchQueryHelper);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_put_DiacriticSensitivity(self: *const T, fDiacriticSensitive: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).put_DiacriticSensitivity(@ptrCast(*const ISearchCatalogManager, self), fDiacriticSensitive);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_get_DiacriticSensitivity(self: *const T, pfDiacriticSensitive: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).get_DiacriticSensitivity(@ptrCast(*const ISearchCatalogManager, self), pfDiacriticSensitive);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager_GetCrawlScopeManager(self: *const T, ppCrawlScopeManager: ?*?*ISearchCrawlScopeManager) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager.VTable, self.vtable).GetCrawlScopeManager(@ptrCast(*const ISearchCatalogManager, self), ppCrawlScopeManager);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const PRIORITIZE_FLAGS = enum(i32) {
RETRYFAILEDITEMS = 1,
IGNOREFAILURECOUNT = 2,
};
pub const PRIORITIZE_FLAG_RETRYFAILEDITEMS = PRIORITIZE_FLAGS.RETRYFAILEDITEMS;
pub const PRIORITIZE_FLAG_IGNOREFAILURECOUNT = PRIORITIZE_FLAGS.IGNOREFAILURECOUNT;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchCatalogManager2_Value = Guid.initString("7ac3286d-4d1d-4817-84fc-c1c85e3af0d9");
pub const IID_ISearchCatalogManager2 = &IID_ISearchCatalogManager2_Value;
pub const ISearchCatalogManager2 = extern struct {
pub const VTable = extern struct {
base: ISearchCatalogManager.VTable,
PrioritizeMatchingURLs: fn(
self: *const ISearchCatalogManager2,
pszPattern: ?[*:0]const u16,
dwPrioritizeFlags: PRIORITIZE_FLAGS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISearchCatalogManager.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchCatalogManager2_PrioritizeMatchingURLs(self: *const T, pszPattern: ?[*:0]const u16, dwPrioritizeFlags: PRIORITIZE_FLAGS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchCatalogManager2.VTable, self.vtable).PrioritizeMatchingURLs(@ptrCast(*const ISearchCatalogManager2, self), pszPattern, dwPrioritizeFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SEARCH_TERM_EXPANSION = enum(i32) {
NO_EXPANSION = 0,
PREFIX_ALL = 1,
STEM_ALL = 2,
};
pub const SEARCH_TERM_NO_EXPANSION = SEARCH_TERM_EXPANSION.NO_EXPANSION;
pub const SEARCH_TERM_PREFIX_ALL = SEARCH_TERM_EXPANSION.PREFIX_ALL;
pub const SEARCH_TERM_STEM_ALL = SEARCH_TERM_EXPANSION.STEM_ALL;
pub const SEARCH_QUERY_SYNTAX = enum(i32) {
NO_QUERY_SYNTAX = 0,
ADVANCED_QUERY_SYNTAX = 1,
NATURAL_QUERY_SYNTAX = 2,
};
pub const SEARCH_NO_QUERY_SYNTAX = SEARCH_QUERY_SYNTAX.NO_QUERY_SYNTAX;
pub const SEARCH_ADVANCED_QUERY_SYNTAX = SEARCH_QUERY_SYNTAX.ADVANCED_QUERY_SYNTAX;
pub const SEARCH_NATURAL_QUERY_SYNTAX = SEARCH_QUERY_SYNTAX.NATURAL_QUERY_SYNTAX;
pub const SEARCH_COLUMN_PROPERTIES = extern struct {
Value: PROPVARIANT,
lcid: u32,
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchQueryHelper_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef63");
pub const IID_ISearchQueryHelper = &IID_ISearchQueryHelper_Value;
pub const ISearchQueryHelper = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ConnectionString: fn(
self: *const ISearchQueryHelper,
pszConnectionString: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QueryContentLocale: fn(
self: *const ISearchQueryHelper,
lcid: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QueryContentLocale: fn(
self: *const ISearchQueryHelper,
plcid: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QueryKeywordLocale: fn(
self: *const ISearchQueryHelper,
lcid: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QueryKeywordLocale: fn(
self: *const ISearchQueryHelper,
plcid: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QueryTermExpansion: fn(
self: *const ISearchQueryHelper,
expandTerms: SEARCH_TERM_EXPANSION,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QueryTermExpansion: fn(
self: *const ISearchQueryHelper,
pExpandTerms: ?*SEARCH_TERM_EXPANSION,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QuerySyntax: fn(
self: *const ISearchQueryHelper,
querySyntax: SEARCH_QUERY_SYNTAX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QuerySyntax: fn(
self: *const ISearchQueryHelper,
pQuerySyntax: ?*SEARCH_QUERY_SYNTAX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QueryContentProperties: fn(
self: *const ISearchQueryHelper,
pszContentProperties: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QueryContentProperties: fn(
self: *const ISearchQueryHelper,
ppszContentProperties: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QuerySelectColumns: fn(
self: *const ISearchQueryHelper,
pszSelectColumns: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QuerySelectColumns: fn(
self: *const ISearchQueryHelper,
ppszSelectColumns: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QueryWhereRestrictions: fn(
self: *const ISearchQueryHelper,
pszRestrictions: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QueryWhereRestrictions: fn(
self: *const ISearchQueryHelper,
ppszRestrictions: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QuerySorting: fn(
self: *const ISearchQueryHelper,
pszSorting: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QuerySorting: fn(
self: *const ISearchQueryHelper,
ppszSorting: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GenerateSQLFromUserQuery: fn(
self: *const ISearchQueryHelper,
pszQuery: ?[*:0]const u16,
ppszSQL: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WriteProperties: fn(
self: *const ISearchQueryHelper,
itemID: i32,
dwNumberOfColumns: u32,
pColumns: [*]PROPERTYKEY,
pValues: [*]SEARCH_COLUMN_PROPERTIES,
pftGatherModifiedTime: ?*FILETIME,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_QueryMaxResults: fn(
self: *const ISearchQueryHelper,
cMaxResults: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_QueryMaxResults: fn(
self: *const ISearchQueryHelper,
pcMaxResults: ?*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 ISearchQueryHelper_get_ConnectionString(self: *const T, pszConnectionString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_ConnectionString(@ptrCast(*const ISearchQueryHelper, self), pszConnectionString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QueryContentLocale(self: *const T, lcid: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QueryContentLocale(@ptrCast(*const ISearchQueryHelper, self), lcid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QueryContentLocale(self: *const T, plcid: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QueryContentLocale(@ptrCast(*const ISearchQueryHelper, self), plcid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QueryKeywordLocale(self: *const T, lcid: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QueryKeywordLocale(@ptrCast(*const ISearchQueryHelper, self), lcid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QueryKeywordLocale(self: *const T, plcid: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QueryKeywordLocale(@ptrCast(*const ISearchQueryHelper, self), plcid);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QueryTermExpansion(self: *const T, expandTerms: SEARCH_TERM_EXPANSION) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QueryTermExpansion(@ptrCast(*const ISearchQueryHelper, self), expandTerms);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QueryTermExpansion(self: *const T, pExpandTerms: ?*SEARCH_TERM_EXPANSION) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QueryTermExpansion(@ptrCast(*const ISearchQueryHelper, self), pExpandTerms);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QuerySyntax(self: *const T, querySyntax: SEARCH_QUERY_SYNTAX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QuerySyntax(@ptrCast(*const ISearchQueryHelper, self), querySyntax);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QuerySyntax(self: *const T, pQuerySyntax: ?*SEARCH_QUERY_SYNTAX) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QuerySyntax(@ptrCast(*const ISearchQueryHelper, self), pQuerySyntax);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QueryContentProperties(self: *const T, pszContentProperties: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QueryContentProperties(@ptrCast(*const ISearchQueryHelper, self), pszContentProperties);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QueryContentProperties(self: *const T, ppszContentProperties: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QueryContentProperties(@ptrCast(*const ISearchQueryHelper, self), ppszContentProperties);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QuerySelectColumns(self: *const T, pszSelectColumns: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QuerySelectColumns(@ptrCast(*const ISearchQueryHelper, self), pszSelectColumns);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QuerySelectColumns(self: *const T, ppszSelectColumns: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QuerySelectColumns(@ptrCast(*const ISearchQueryHelper, self), ppszSelectColumns);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QueryWhereRestrictions(self: *const T, pszRestrictions: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QueryWhereRestrictions(@ptrCast(*const ISearchQueryHelper, self), pszRestrictions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QueryWhereRestrictions(self: *const T, ppszRestrictions: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QueryWhereRestrictions(@ptrCast(*const ISearchQueryHelper, self), ppszRestrictions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QuerySorting(self: *const T, pszSorting: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QuerySorting(@ptrCast(*const ISearchQueryHelper, self), pszSorting);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QuerySorting(self: *const T, ppszSorting: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QuerySorting(@ptrCast(*const ISearchQueryHelper, self), ppszSorting);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_GenerateSQLFromUserQuery(self: *const T, pszQuery: ?[*:0]const u16, ppszSQL: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).GenerateSQLFromUserQuery(@ptrCast(*const ISearchQueryHelper, self), pszQuery, ppszSQL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_WriteProperties(self: *const T, itemID: i32, dwNumberOfColumns: u32, pColumns: [*]PROPERTYKEY, pValues: [*]SEARCH_COLUMN_PROPERTIES, pftGatherModifiedTime: ?*FILETIME) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).WriteProperties(@ptrCast(*const ISearchQueryHelper, self), itemID, dwNumberOfColumns, pColumns, pValues, pftGatherModifiedTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_put_QueryMaxResults(self: *const T, cMaxResults: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).put_QueryMaxResults(@ptrCast(*const ISearchQueryHelper, self), cMaxResults);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHelper_get_QueryMaxResults(self: *const T, pcMaxResults: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchQueryHelper.VTable, self.vtable).get_QueryMaxResults(@ptrCast(*const ISearchQueryHelper, self), pcMaxResults);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const PRIORITY_LEVEL = enum(i32) {
FOREGROUND = 0,
HIGH = 1,
LOW = 2,
DEFAULT = 3,
};
pub const PRIORITY_LEVEL_FOREGROUND = PRIORITY_LEVEL.FOREGROUND;
pub const PRIORITY_LEVEL_HIGH = PRIORITY_LEVEL.HIGH;
pub const PRIORITY_LEVEL_LOW = PRIORITY_LEVEL.LOW;
pub const PRIORITY_LEVEL_DEFAULT = PRIORITY_LEVEL.DEFAULT;
// TODO: this type is limited to platform 'windows6.1'
const IID_IRowsetPrioritization_Value = Guid.initString("42811652-079d-481b-87a2-09a69ecc5f44");
pub const IID_IRowsetPrioritization = &IID_IRowsetPrioritization_Value;
pub const IRowsetPrioritization = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetScopePriority: fn(
self: *const IRowsetPrioritization,
priority: PRIORITY_LEVEL,
scopeStatisticsEventFrequency: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetScopePriority: fn(
self: *const IRowsetPrioritization,
priority: ?*PRIORITY_LEVEL,
scopeStatisticsEventFrequency: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetScopeStatistics: fn(
self: *const IRowsetPrioritization,
indexedDocumentCount: ?*u32,
oustandingAddCount: ?*u32,
oustandingModifyCount: ?*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 IRowsetPrioritization_SetScopePriority(self: *const T, priority: PRIORITY_LEVEL, scopeStatisticsEventFrequency: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetPrioritization.VTable, self.vtable).SetScopePriority(@ptrCast(*const IRowsetPrioritization, self), priority, scopeStatisticsEventFrequency);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetPrioritization_GetScopePriority(self: *const T, priority: ?*PRIORITY_LEVEL, scopeStatisticsEventFrequency: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetPrioritization.VTable, self.vtable).GetScopePriority(@ptrCast(*const IRowsetPrioritization, self), priority, scopeStatisticsEventFrequency);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetPrioritization_GetScopeStatistics(self: *const T, indexedDocumentCount: ?*u32, oustandingAddCount: ?*u32, oustandingModifyCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetPrioritization.VTable, self.vtable).GetScopeStatistics(@ptrCast(*const IRowsetPrioritization, self), indexedDocumentCount, oustandingAddCount, oustandingModifyCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const ROWSETEVENT_ITEMSTATE = enum(i32) {
NOTINROWSET = 0,
INROWSET = 1,
UNKNOWN = 2,
};
pub const ROWSETEVENT_ITEMSTATE_NOTINROWSET = ROWSETEVENT_ITEMSTATE.NOTINROWSET;
pub const ROWSETEVENT_ITEMSTATE_INROWSET = ROWSETEVENT_ITEMSTATE.INROWSET;
pub const ROWSETEVENT_ITEMSTATE_UNKNOWN = ROWSETEVENT_ITEMSTATE.UNKNOWN;
pub const ROWSETEVENT_TYPE = enum(i32) {
DATAEXPIRED = 0,
FOREGROUNDLOST = 1,
SCOPESTATISTICS = 2,
};
pub const ROWSETEVENT_TYPE_DATAEXPIRED = ROWSETEVENT_TYPE.DATAEXPIRED;
pub const ROWSETEVENT_TYPE_FOREGROUNDLOST = ROWSETEVENT_TYPE.FOREGROUNDLOST;
pub const ROWSETEVENT_TYPE_SCOPESTATISTICS = ROWSETEVENT_TYPE.SCOPESTATISTICS;
// TODO: this type is limited to platform 'windows6.1'
const IID_IRowsetEvents_Value = Guid.initString("1551aea5-5d66-4b11-86f5-d5634cb211b9");
pub const IID_IRowsetEvents = &IID_IRowsetEvents_Value;
pub const IRowsetEvents = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnNewItem: fn(
self: *const IRowsetEvents,
itemID: ?*const PROPVARIANT,
newItemState: ROWSETEVENT_ITEMSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnChangedItem: fn(
self: *const IRowsetEvents,
itemID: ?*const PROPVARIANT,
rowsetItemState: ROWSETEVENT_ITEMSTATE,
changedItemState: ROWSETEVENT_ITEMSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnDeletedItem: fn(
self: *const IRowsetEvents,
itemID: ?*const PROPVARIANT,
deletedItemState: ROWSETEVENT_ITEMSTATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OnRowsetEvent: fn(
self: *const IRowsetEvents,
eventType: ROWSETEVENT_TYPE,
eventData: ?*const PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetEvents_OnNewItem(self: *const T, itemID: ?*const PROPVARIANT, newItemState: ROWSETEVENT_ITEMSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetEvents.VTable, self.vtable).OnNewItem(@ptrCast(*const IRowsetEvents, self), itemID, newItemState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetEvents_OnChangedItem(self: *const T, itemID: ?*const PROPVARIANT, rowsetItemState: ROWSETEVENT_ITEMSTATE, changedItemState: ROWSETEVENT_ITEMSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetEvents.VTable, self.vtable).OnChangedItem(@ptrCast(*const IRowsetEvents, self), itemID, rowsetItemState, changedItemState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetEvents_OnDeletedItem(self: *const T, itemID: ?*const PROPVARIANT, deletedItemState: ROWSETEVENT_ITEMSTATE) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetEvents.VTable, self.vtable).OnDeletedItem(@ptrCast(*const IRowsetEvents, self), itemID, deletedItemState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetEvents_OnRowsetEvent(self: *const T, eventType: ROWSETEVENT_TYPE, eventData: ?*const PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetEvents.VTable, self.vtable).OnRowsetEvent(@ptrCast(*const IRowsetEvents, self), eventType, eventData);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchManager_Value = Guid.initString("ab310581-ac80-11d1-8df3-00c04fb6ef69");
pub const IID_ISearchManager = &IID_ISearchManager_Value;
pub const ISearchManager = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetIndexerVersionStr: fn(
self: *const ISearchManager,
ppszVersionString: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetIndexerVersion: fn(
self: *const ISearchManager,
pdwMajor: ?*u32,
pdwMinor: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetParameter: fn(
self: *const ISearchManager,
pszName: ?[*:0]const u16,
ppValue: ?*?*PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetParameter: fn(
self: *const ISearchManager,
pszName: ?[*:0]const u16,
pValue: ?*const PROPVARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_ProxyName: fn(
self: *const ISearchManager,
ppszProxyName: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_BypassList: fn(
self: *const ISearchManager,
ppszBypassList: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetProxy: fn(
self: *const ISearchManager,
sUseProxy: PROXY_ACCESS,
fLocalByPassProxy: BOOL,
dwPortNumber: u32,
pszProxyName: ?[*:0]const u16,
pszByPassList: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCatalog: fn(
self: *const ISearchManager,
pszCatalog: ?[*:0]const u16,
ppCatalogManager: ?*?*ISearchCatalogManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UserAgent: fn(
self: *const ISearchManager,
ppszUserAgent: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_UserAgent: fn(
self: *const ISearchManager,
pszUserAgent: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_UseProxy: fn(
self: *const ISearchManager,
pUseProxy: ?*PROXY_ACCESS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_LocalBypass: fn(
self: *const ISearchManager,
pfLocalBypass: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_PortNumber: fn(
self: *const ISearchManager,
pdwPortNumber: ?*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 ISearchManager_GetIndexerVersionStr(self: *const T, ppszVersionString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).GetIndexerVersionStr(@ptrCast(*const ISearchManager, self), ppszVersionString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_GetIndexerVersion(self: *const T, pdwMajor: ?*u32, pdwMinor: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).GetIndexerVersion(@ptrCast(*const ISearchManager, self), pdwMajor, pdwMinor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_GetParameter(self: *const T, pszName: ?[*:0]const u16, ppValue: ?*?*PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).GetParameter(@ptrCast(*const ISearchManager, self), pszName, ppValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_SetParameter(self: *const T, pszName: ?[*:0]const u16, pValue: ?*const PROPVARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).SetParameter(@ptrCast(*const ISearchManager, self), pszName, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_get_ProxyName(self: *const T, ppszProxyName: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).get_ProxyName(@ptrCast(*const ISearchManager, self), ppszProxyName);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_get_BypassList(self: *const T, ppszBypassList: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).get_BypassList(@ptrCast(*const ISearchManager, self), ppszBypassList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_SetProxy(self: *const T, sUseProxy: PROXY_ACCESS, fLocalByPassProxy: BOOL, dwPortNumber: u32, pszProxyName: ?[*:0]const u16, pszByPassList: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).SetProxy(@ptrCast(*const ISearchManager, self), sUseProxy, fLocalByPassProxy, dwPortNumber, pszProxyName, pszByPassList);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_GetCatalog(self: *const T, pszCatalog: ?[*:0]const u16, ppCatalogManager: ?*?*ISearchCatalogManager) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).GetCatalog(@ptrCast(*const ISearchManager, self), pszCatalog, ppCatalogManager);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_get_UserAgent(self: *const T, ppszUserAgent: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).get_UserAgent(@ptrCast(*const ISearchManager, self), ppszUserAgent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_put_UserAgent(self: *const T, pszUserAgent: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).put_UserAgent(@ptrCast(*const ISearchManager, self), pszUserAgent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_get_UseProxy(self: *const T, pUseProxy: ?*PROXY_ACCESS) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).get_UseProxy(@ptrCast(*const ISearchManager, self), pUseProxy);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_get_LocalBypass(self: *const T, pfLocalBypass: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).get_LocalBypass(@ptrCast(*const ISearchManager, self), pfLocalBypass);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager_get_PortNumber(self: *const T, pdwPortNumber: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager.VTable, self.vtable).get_PortNumber(@ptrCast(*const ISearchManager, self), pdwPortNumber);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ISearchManager2_Value = Guid.initString("dbab3f73-db19-4a79-bfc0-a61a93886ddf");
pub const IID_ISearchManager2 = &IID_ISearchManager2_Value;
pub const ISearchManager2 = extern struct {
pub const VTable = extern struct {
base: ISearchManager.VTable,
CreateCatalog: fn(
self: *const ISearchManager2,
pszCatalog: ?[*:0]const u16,
ppCatalogManager: ?*?*ISearchCatalogManager,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteCatalog: fn(
self: *const ISearchManager2,
pszCatalog: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISearchManager.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager2_CreateCatalog(self: *const T, pszCatalog: ?[*:0]const u16, ppCatalogManager: ?*?*ISearchCatalogManager) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager2.VTable, self.vtable).CreateCatalog(@ptrCast(*const ISearchManager2, self), pszCatalog, ppCatalogManager);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchManager2_DeleteCatalog(self: *const T, pszCatalog: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchManager2.VTable, self.vtable).DeleteCatalog(@ptrCast(*const ISearchManager2, self), pszCatalog);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_CSearchLanguageSupport_Value = Guid.initString("6a68cc80-4337-4dbc-bd27-fbfb1053820b");
pub const CLSID_CSearchLanguageSupport = &CLSID_CSearchLanguageSupport_Value;
// TODO: this type is limited to platform 'windows5.1.2600'
const IID_ISearchLanguageSupport_Value = Guid.initString("24c3cbaa-ebc1-491a-9ef1-9f6d8deb1b8f");
pub const IID_ISearchLanguageSupport = &IID_ISearchLanguageSupport_Value;
pub const ISearchLanguageSupport = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetDiacriticSensitivity: fn(
self: *const ISearchLanguageSupport,
fDiacriticSensitive: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDiacriticSensitivity: fn(
self: *const ISearchLanguageSupport,
pfDiacriticSensitive: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadWordBreaker: fn(
self: *const ISearchLanguageSupport,
lcid: u32,
riid: ?*const Guid,
ppWordBreaker: ?*?*anyopaque,
pLcidUsed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadStemmer: fn(
self: *const ISearchLanguageSupport,
lcid: u32,
riid: ?*const Guid,
ppStemmer: ?*?*anyopaque,
pLcidUsed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsPrefixNormalized: fn(
self: *const ISearchLanguageSupport,
pwcsQueryToken: [*:0]const u16,
cwcQueryToken: u32,
pwcsDocumentToken: [*:0]const u16,
cwcDocumentToken: u32,
pulPrefixLength: ?*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 ISearchLanguageSupport_SetDiacriticSensitivity(self: *const T, fDiacriticSensitive: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchLanguageSupport.VTable, self.vtable).SetDiacriticSensitivity(@ptrCast(*const ISearchLanguageSupport, self), fDiacriticSensitive);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchLanguageSupport_GetDiacriticSensitivity(self: *const T, pfDiacriticSensitive: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchLanguageSupport.VTable, self.vtable).GetDiacriticSensitivity(@ptrCast(*const ISearchLanguageSupport, self), pfDiacriticSensitive);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchLanguageSupport_LoadWordBreaker(self: *const T, lcid: u32, riid: ?*const Guid, ppWordBreaker: ?*?*anyopaque, pLcidUsed: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchLanguageSupport.VTable, self.vtable).LoadWordBreaker(@ptrCast(*const ISearchLanguageSupport, self), lcid, riid, ppWordBreaker, pLcidUsed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchLanguageSupport_LoadStemmer(self: *const T, lcid: u32, riid: ?*const Guid, ppStemmer: ?*?*anyopaque, pLcidUsed: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchLanguageSupport.VTable, self.vtable).LoadStemmer(@ptrCast(*const ISearchLanguageSupport, self), lcid, riid, ppStemmer, pLcidUsed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchLanguageSupport_IsPrefixNormalized(self: *const T, pwcsQueryToken: [*:0]const u16, cwcQueryToken: u32, pwcsDocumentToken: [*:0]const u16, cwcDocumentToken: u32, pulPrefixLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISearchLanguageSupport.VTable, self.vtable).IsPrefixNormalized(@ptrCast(*const ISearchLanguageSupport, self), pwcsQueryToken, cwcQueryToken, pwcsDocumentToken, cwcDocumentToken, pulPrefixLength);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_SubscriptionMgr_Value = Guid.initString("abbe31d0-6dae-11d0-beca-00c04fd940be");
pub const CLSID_SubscriptionMgr = &CLSID_SubscriptionMgr_Value;
pub const ITEMPROP = extern struct {
variantValue: VARIANT,
pwszName: ?PWSTR,
};
const IID_IEnumItemProperties_Value = Guid.initString("f72c8d96-6dbd-11d1-a1e8-00c04fc2fbe1");
pub const IID_IEnumItemProperties = &IID_IEnumItemProperties_Value;
pub const IEnumItemProperties = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumItemProperties,
celt: u32,
rgelt: [*]ITEMPROP,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumItemProperties,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumItemProperties,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumItemProperties,
ppenum: ?*?*IEnumItemProperties,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCount: fn(
self: *const IEnumItemProperties,
pnCount: ?*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 IEnumItemProperties_Next(self: *const T, celt: u32, rgelt: [*]ITEMPROP, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumItemProperties.VTable, self.vtable).Next(@ptrCast(*const IEnumItemProperties, self), celt, rgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumItemProperties_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumItemProperties.VTable, self.vtable).Skip(@ptrCast(*const IEnumItemProperties, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumItemProperties_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumItemProperties.VTable, self.vtable).Reset(@ptrCast(*const IEnumItemProperties, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumItemProperties_Clone(self: *const T, ppenum: ?*?*IEnumItemProperties) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumItemProperties.VTable, self.vtable).Clone(@ptrCast(*const IEnumItemProperties, self), ppenum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumItemProperties_GetCount(self: *const T, pnCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumItemProperties.VTable, self.vtable).GetCount(@ptrCast(*const IEnumItemProperties, self), pnCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SUBSCRIPTIONITEMINFO = extern struct {
cbSize: u32,
dwFlags: u32,
dwPriority: u32,
ScheduleGroup: Guid,
clsidAgent: Guid,
};
const IID_ISubscriptionItem_Value = Guid.initString("a97559f8-6c4a-11d1-a1e8-00c04fc2fbe1");
pub const IID_ISubscriptionItem = &IID_ISubscriptionItem_Value;
pub const ISubscriptionItem = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetCookie: fn(
self: *const ISubscriptionItem,
pCookie: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSubscriptionItemInfo: fn(
self: *const ISubscriptionItem,
pSubscriptionItemInfo: ?*SUBSCRIPTIONITEMINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSubscriptionItemInfo: fn(
self: *const ISubscriptionItem,
pSubscriptionItemInfo: ?*const SUBSCRIPTIONITEMINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReadProperties: fn(
self: *const ISubscriptionItem,
nCount: u32,
rgwszName: [*]const ?[*:0]const u16,
rgValue: [*]VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WriteProperties: fn(
self: *const ISubscriptionItem,
nCount: u32,
rgwszName: [*]const ?[*:0]const u16,
rgValue: [*]const VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumProperties: fn(
self: *const ISubscriptionItem,
ppEnumItemProperties: ?*?*IEnumItemProperties,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NotifyChanged: fn(
self: *const ISubscriptionItem,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_GetCookie(self: *const T, pCookie: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).GetCookie(@ptrCast(*const ISubscriptionItem, self), pCookie);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_GetSubscriptionItemInfo(self: *const T, pSubscriptionItemInfo: ?*SUBSCRIPTIONITEMINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).GetSubscriptionItemInfo(@ptrCast(*const ISubscriptionItem, self), pSubscriptionItemInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_SetSubscriptionItemInfo(self: *const T, pSubscriptionItemInfo: ?*const SUBSCRIPTIONITEMINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).SetSubscriptionItemInfo(@ptrCast(*const ISubscriptionItem, self), pSubscriptionItemInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_ReadProperties(self: *const T, nCount: u32, rgwszName: [*]const ?[*:0]const u16, rgValue: [*]VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).ReadProperties(@ptrCast(*const ISubscriptionItem, self), nCount, rgwszName, rgValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_WriteProperties(self: *const T, nCount: u32, rgwszName: [*]const ?[*:0]const u16, rgValue: [*]const VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).WriteProperties(@ptrCast(*const ISubscriptionItem, self), nCount, rgwszName, rgValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_EnumProperties(self: *const T, ppEnumItemProperties: ?*?*IEnumItemProperties) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).EnumProperties(@ptrCast(*const ISubscriptionItem, self), ppEnumItemProperties);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionItem_NotifyChanged(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionItem.VTable, self.vtable).NotifyChanged(@ptrCast(*const ISubscriptionItem, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IEnumSubscription_Value = Guid.initString("f72c8d97-6dbd-11d1-a1e8-00c04fc2fbe1");
pub const IID_IEnumSubscription = &IID_IEnumSubscription_Value;
pub const IEnumSubscription = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Next: fn(
self: *const IEnumSubscription,
celt: u32,
rgelt: [*]Guid,
pceltFetched: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Skip: fn(
self: *const IEnumSubscription,
celt: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Reset: fn(
self: *const IEnumSubscription,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Clone: fn(
self: *const IEnumSubscription,
ppenum: ?*?*IEnumSubscription,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCount: fn(
self: *const IEnumSubscription,
pnCount: ?*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 IEnumSubscription_Next(self: *const T, celt: u32, rgelt: [*]Guid, pceltFetched: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSubscription.VTable, self.vtable).Next(@ptrCast(*const IEnumSubscription, self), celt, rgelt, pceltFetched);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSubscription_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSubscription.VTable, self.vtable).Skip(@ptrCast(*const IEnumSubscription, self), celt);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSubscription_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSubscription.VTable, self.vtable).Reset(@ptrCast(*const IEnumSubscription, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSubscription_Clone(self: *const T, ppenum: ?*?*IEnumSubscription) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSubscription.VTable, self.vtable).Clone(@ptrCast(*const IEnumSubscription, self), ppenum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IEnumSubscription_GetCount(self: *const T, pnCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IEnumSubscription.VTable, self.vtable).GetCount(@ptrCast(*const IEnumSubscription, self), pnCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SUBSCRIPTIONTYPE = enum(i32) {
URL = 0,
CHANNEL = 1,
DESKTOPURL = 2,
EXTERNAL = 3,
DESKTOPCHANNEL = 4,
};
pub const SUBSTYPE_URL = SUBSCRIPTIONTYPE.URL;
pub const SUBSTYPE_CHANNEL = SUBSCRIPTIONTYPE.CHANNEL;
pub const SUBSTYPE_DESKTOPURL = SUBSCRIPTIONTYPE.DESKTOPURL;
pub const SUBSTYPE_EXTERNAL = SUBSCRIPTIONTYPE.EXTERNAL;
pub const SUBSTYPE_DESKTOPCHANNEL = SUBSCRIPTIONTYPE.DESKTOPCHANNEL;
pub const SUBSCRIPTIONINFOFLAGS = enum(i32) {
SCHEDULE = 1,
RECURSE = 2,
WEBCRAWL = 4,
MAILNOT = 8,
MAXSIZEKB = 16,
USER = 32,
PASSWORD = 64,
TASKFLAGS = 256,
GLEAM = 512,
CHANGESONLY = 1024,
CHANNELFLAGS = 2048,
FRIENDLYNAME = 8192,
NEEDPASSWORD = 16384,
TYPE = 32768,
};
pub const SUBSINFO_SCHEDULE = SUBSCRIPTIONINFOFLAGS.SCHEDULE;
pub const SUBSINFO_RECURSE = SUBSCRIPTIONINFOFLAGS.RECURSE;
pub const SUBSINFO_WEBCRAWL = SUBSCRIPTIONINFOFLAGS.WEBCRAWL;
pub const SUBSINFO_MAILNOT = SUBSCRIPTIONINFOFLAGS.MAILNOT;
pub const SUBSINFO_MAXSIZEKB = SUBSCRIPTIONINFOFLAGS.MAXSIZEKB;
pub const SUBSINFO_USER = SUBSCRIPTIONINFOFLAGS.USER;
pub const SUBSINFO_PASSWORD = SUBSCRIPTIONINFOFLAGS.PASSWORD;
pub const SUBSINFO_TASKFLAGS = SUBSCRIPTIONINFOFLAGS.TASKFLAGS;
pub const SUBSINFO_GLEAM = SUBSCRIPTIONINFOFLAGS.GLEAM;
pub const SUBSINFO_CHANGESONLY = SUBSCRIPTIONINFOFLAGS.CHANGESONLY;
pub const SUBSINFO_CHANNELFLAGS = SUBSCRIPTIONINFOFLAGS.CHANNELFLAGS;
pub const SUBSINFO_FRIENDLYNAME = SUBSCRIPTIONINFOFLAGS.FRIENDLYNAME;
pub const SUBSINFO_NEEDPASSWORD = SUBSCRIPTIONINFOFLAGS.NEEDPASSWORD;
pub const SUBSINFO_TYPE = SUBSCRIPTIONINFOFLAGS.TYPE;
pub const CREATESUBSCRIPTIONFLAGS = enum(i32) {
ADDTOFAVORITES = 1,
FROMFAVORITES = 2,
NOUI = 4,
NOSAVE = 8,
SOFTWAREUPDATE = 16,
};
pub const CREATESUBS_ADDTOFAVORITES = CREATESUBSCRIPTIONFLAGS.ADDTOFAVORITES;
pub const CREATESUBS_FROMFAVORITES = CREATESUBSCRIPTIONFLAGS.FROMFAVORITES;
pub const CREATESUBS_NOUI = CREATESUBSCRIPTIONFLAGS.NOUI;
pub const CREATESUBS_NOSAVE = CREATESUBSCRIPTIONFLAGS.NOSAVE;
pub const CREATESUBS_SOFTWAREUPDATE = CREATESUBSCRIPTIONFLAGS.SOFTWAREUPDATE;
pub const SUBSCRIPTIONSCHEDULE = enum(i32) {
AUTO = 0,
DAILY = 1,
WEEKLY = 2,
CUSTOM = 3,
MANUAL = 4,
};
pub const SUBSSCHED_AUTO = SUBSCRIPTIONSCHEDULE.AUTO;
pub const SUBSSCHED_DAILY = SUBSCRIPTIONSCHEDULE.DAILY;
pub const SUBSSCHED_WEEKLY = SUBSCRIPTIONSCHEDULE.WEEKLY;
pub const SUBSSCHED_CUSTOM = SUBSCRIPTIONSCHEDULE.CUSTOM;
pub const SUBSSCHED_MANUAL = SUBSCRIPTIONSCHEDULE.MANUAL;
pub const SUBSCRIPTIONINFO = extern struct {
cbSize: u32,
fUpdateFlags: u32,
schedule: SUBSCRIPTIONSCHEDULE,
customGroupCookie: Guid,
pTrigger: ?*anyopaque,
dwRecurseLevels: u32,
fWebcrawlerFlags: u32,
bMailNotification: BOOL,
bGleam: BOOL,
bChangesOnly: BOOL,
bNeedPassword: BOOL,
fChannelFlags: u32,
bstrUserName: ?BSTR,
bstrPassword: ?BSTR,
bstrFriendlyName: ?BSTR,
dwMaxSizeKB: u32,
subType: SUBSCRIPTIONTYPE,
fTaskFlags: u32,
dwReserved: u32,
};
const IID_ISubscriptionMgr_Value = Guid.initString("085fb2c0-0df8-11d1-8f4b-00a0c905413f");
pub const IID_ISubscriptionMgr = &IID_ISubscriptionMgr_Value;
pub const ISubscriptionMgr = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
DeleteSubscription: fn(
self: *const ISubscriptionMgr,
pwszURL: ?[*:0]const u16,
hwnd: ?HWND,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UpdateSubscription: fn(
self: *const ISubscriptionMgr,
pwszURL: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UpdateAll: fn(
self: *const ISubscriptionMgr,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
IsSubscribed: fn(
self: *const ISubscriptionMgr,
pwszURL: ?[*:0]const u16,
pfSubscribed: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSubscriptionInfo: fn(
self: *const ISubscriptionMgr,
pwszURL: ?[*:0]const u16,
pInfo: ?*SUBSCRIPTIONINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDefaultInfo: fn(
self: *const ISubscriptionMgr,
subType: SUBSCRIPTIONTYPE,
pInfo: ?*SUBSCRIPTIONINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ShowSubscriptionProperties: fn(
self: *const ISubscriptionMgr,
pwszURL: ?[*:0]const u16,
hwnd: ?HWND,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSubscription: fn(
self: *const ISubscriptionMgr,
hwnd: ?HWND,
pwszURL: ?[*:0]const u16,
pwszFriendlyName: ?[*:0]const u16,
dwFlags: u32,
subsType: SUBSCRIPTIONTYPE,
pInfo: ?*SUBSCRIPTIONINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_DeleteSubscription(self: *const T, pwszURL: ?[*:0]const u16, hwnd: ?HWND) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).DeleteSubscription(@ptrCast(*const ISubscriptionMgr, self), pwszURL, hwnd);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_UpdateSubscription(self: *const T, pwszURL: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).UpdateSubscription(@ptrCast(*const ISubscriptionMgr, self), pwszURL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_UpdateAll(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).UpdateAll(@ptrCast(*const ISubscriptionMgr, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_IsSubscribed(self: *const T, pwszURL: ?[*:0]const u16, pfSubscribed: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).IsSubscribed(@ptrCast(*const ISubscriptionMgr, self), pwszURL, pfSubscribed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_GetSubscriptionInfo(self: *const T, pwszURL: ?[*:0]const u16, pInfo: ?*SUBSCRIPTIONINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).GetSubscriptionInfo(@ptrCast(*const ISubscriptionMgr, self), pwszURL, pInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_GetDefaultInfo(self: *const T, subType: SUBSCRIPTIONTYPE, pInfo: ?*SUBSCRIPTIONINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).GetDefaultInfo(@ptrCast(*const ISubscriptionMgr, self), subType, pInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_ShowSubscriptionProperties(self: *const T, pwszURL: ?[*:0]const u16, hwnd: ?HWND) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).ShowSubscriptionProperties(@ptrCast(*const ISubscriptionMgr, self), pwszURL, hwnd);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr_CreateSubscription(self: *const T, hwnd: ?HWND, pwszURL: ?[*:0]const u16, pwszFriendlyName: ?[*:0]const u16, dwFlags: u32, subsType: SUBSCRIPTIONTYPE, pInfo: ?*SUBSCRIPTIONINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr.VTable, self.vtable).CreateSubscription(@ptrCast(*const ISubscriptionMgr, self), hwnd, pwszURL, pwszFriendlyName, dwFlags, subsType, pInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISubscriptionMgr2_Value = Guid.initString("614bc270-aedf-11d1-a1f9-00c04fc2fbe1");
pub const IID_ISubscriptionMgr2 = &IID_ISubscriptionMgr2_Value;
pub const ISubscriptionMgr2 = extern struct {
pub const VTable = extern struct {
base: ISubscriptionMgr.VTable,
GetItemFromURL: fn(
self: *const ISubscriptionMgr2,
pwszURL: ?[*:0]const u16,
ppSubscriptionItem: ?*?*ISubscriptionItem,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetItemFromCookie: fn(
self: *const ISubscriptionMgr2,
pSubscriptionCookie: ?*const Guid,
ppSubscriptionItem: ?*?*ISubscriptionItem,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSubscriptionRunState: fn(
self: *const ISubscriptionMgr2,
dwNumCookies: u32,
pCookies: [*]const Guid,
pdwRunState: [*]u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnumSubscriptions: fn(
self: *const ISubscriptionMgr2,
dwFlags: u32,
ppEnumSubscriptions: ?*?*IEnumSubscription,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UpdateItems: fn(
self: *const ISubscriptionMgr2,
dwFlags: u32,
dwNumCookies: u32,
pCookies: [*]const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AbortItems: fn(
self: *const ISubscriptionMgr2,
dwNumCookies: u32,
pCookies: [*]const Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AbortAll: fn(
self: *const ISubscriptionMgr2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ISubscriptionMgr.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_GetItemFromURL(self: *const T, pwszURL: ?[*:0]const u16, ppSubscriptionItem: ?*?*ISubscriptionItem) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).GetItemFromURL(@ptrCast(*const ISubscriptionMgr2, self), pwszURL, ppSubscriptionItem);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_GetItemFromCookie(self: *const T, pSubscriptionCookie: ?*const Guid, ppSubscriptionItem: ?*?*ISubscriptionItem) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).GetItemFromCookie(@ptrCast(*const ISubscriptionMgr2, self), pSubscriptionCookie, ppSubscriptionItem);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_GetSubscriptionRunState(self: *const T, dwNumCookies: u32, pCookies: [*]const Guid, pdwRunState: [*]u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).GetSubscriptionRunState(@ptrCast(*const ISubscriptionMgr2, self), dwNumCookies, pCookies, pdwRunState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_EnumSubscriptions(self: *const T, dwFlags: u32, ppEnumSubscriptions: ?*?*IEnumSubscription) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).EnumSubscriptions(@ptrCast(*const ISubscriptionMgr2, self), dwFlags, ppEnumSubscriptions);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_UpdateItems(self: *const T, dwFlags: u32, dwNumCookies: u32, pCookies: [*]const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).UpdateItems(@ptrCast(*const ISubscriptionMgr2, self), dwFlags, dwNumCookies, pCookies);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_AbortItems(self: *const T, dwNumCookies: u32, pCookies: [*]const Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).AbortItems(@ptrCast(*const ISubscriptionMgr2, self), dwNumCookies, pCookies);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISubscriptionMgr2_AbortAll(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ISubscriptionMgr2.VTable, self.vtable).AbortAll(@ptrCast(*const ISubscriptionMgr2, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DELIVERY_AGENT_FLAGS = enum(i32) {
NO_BROADCAST = 4,
NO_RESTRICTIONS = 8,
SILENT_DIAL = 16,
};
pub const DELIVERY_AGENT_FLAG_NO_BROADCAST = DELIVERY_AGENT_FLAGS.NO_BROADCAST;
pub const DELIVERY_AGENT_FLAG_NO_RESTRICTIONS = DELIVERY_AGENT_FLAGS.NO_RESTRICTIONS;
pub const DELIVERY_AGENT_FLAG_SILENT_DIAL = DELIVERY_AGENT_FLAGS.SILENT_DIAL;
pub const WEBCRAWL_RECURSEFLAGS = enum(i32) {
DONT_MAKE_STICKY = 1,
GET_IMAGES = 2,
GET_VIDEOS = 4,
GET_BGSOUNDS = 8,
GET_CONTROLS = 16,
LINKS_ELSEWHERE = 32,
IGNORE_ROBOTSTXT = 128,
ONLY_LINKS_TO_HTML = 256,
};
pub const WEBCRAWL_DONT_MAKE_STICKY = WEBCRAWL_RECURSEFLAGS.DONT_MAKE_STICKY;
pub const WEBCRAWL_GET_IMAGES = WEBCRAWL_RECURSEFLAGS.GET_IMAGES;
pub const WEBCRAWL_GET_VIDEOS = WEBCRAWL_RECURSEFLAGS.GET_VIDEOS;
pub const WEBCRAWL_GET_BGSOUNDS = WEBCRAWL_RECURSEFLAGS.GET_BGSOUNDS;
pub const WEBCRAWL_GET_CONTROLS = WEBCRAWL_RECURSEFLAGS.GET_CONTROLS;
pub const WEBCRAWL_LINKS_ELSEWHERE = WEBCRAWL_RECURSEFLAGS.LINKS_ELSEWHERE;
pub const WEBCRAWL_IGNORE_ROBOTSTXT = WEBCRAWL_RECURSEFLAGS.IGNORE_ROBOTSTXT;
pub const WEBCRAWL_ONLY_LINKS_TO_HTML = WEBCRAWL_RECURSEFLAGS.ONLY_LINKS_TO_HTML;
pub const CHANNEL_AGENT_FLAGS = enum(i32) {
DYNAMIC_SCHEDULE = 1,
PRECACHE_SOME = 2,
PRECACHE_ALL = 4,
PRECACHE_SCRNSAVER = 8,
};
pub const CHANNEL_AGENT_DYNAMIC_SCHEDULE = CHANNEL_AGENT_FLAGS.DYNAMIC_SCHEDULE;
pub const CHANNEL_AGENT_PRECACHE_SOME = CHANNEL_AGENT_FLAGS.PRECACHE_SOME;
pub const CHANNEL_AGENT_PRECACHE_ALL = CHANNEL_AGENT_FLAGS.PRECACHE_ALL;
pub const CHANNEL_AGENT_PRECACHE_SCRNSAVER = CHANNEL_AGENT_FLAGS.PRECACHE_SCRNSAVER;
pub const DBDATACONVERTENUM = enum(i32) {
DEFAULT = 0,
SETDATABEHAVIOR = 1,
LENGTHFROMNTS = 2,
DSTISFIXEDLENGTH = 4,
DECIMALSCALE = 8,
};
pub const DBDATACONVERT_DEFAULT = DBDATACONVERTENUM.DEFAULT;
pub const DBDATACONVERT_SETDATABEHAVIOR = DBDATACONVERTENUM.SETDATABEHAVIOR;
pub const DBDATACONVERT_LENGTHFROMNTS = DBDATACONVERTENUM.LENGTHFROMNTS;
pub const DBDATACONVERT_DSTISFIXEDLENGTH = DBDATACONVERTENUM.DSTISFIXEDLENGTH;
pub const DBDATACONVERT_DECIMALSCALE = DBDATACONVERTENUM.DECIMALSCALE;
const IID_IDataConvert_Value = Guid.initString("0c733a8d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDataConvert = &IID_IDataConvert_Value;
pub const IDataConvert = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
DataConvert: fn(
self: *const IDataConvert,
wSrcType: u16,
wDstType: u16,
cbSrcLength: usize,
pcbDstLength: ?*usize,
// TODO: what to do with BytesParamIndex 2?
pSrc: ?*anyopaque,
pDst: ?*anyopaque,
cbDstMaxLength: usize,
dbsSrcStatus: u32,
pdbsStatus: ?*u32,
bPrecision: u8,
bScale: u8,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CanConvert: fn(
self: *const IDataConvert,
wSrcType: u16,
wDstType: u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetConversionSize: fn(
self: *const IDataConvert,
wSrcType: u16,
wDstType: u16,
pcbSrcLength: ?*usize,
pcbDstLength: ?*usize,
// TODO: what to do with BytesParamIndex 2?
pSrc: ?*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 IDataConvert_DataConvert(self: *const T, wSrcType: u16, wDstType: u16, cbSrcLength: usize, pcbDstLength: ?*usize, pSrc: ?*anyopaque, pDst: ?*anyopaque, cbDstMaxLength: usize, dbsSrcStatus: u32, pdbsStatus: ?*u32, bPrecision: u8, bScale: u8, dwFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataConvert.VTable, self.vtable).DataConvert(@ptrCast(*const IDataConvert, self), wSrcType, wDstType, cbSrcLength, pcbDstLength, pSrc, pDst, cbDstMaxLength, dbsSrcStatus, pdbsStatus, bPrecision, bScale, dwFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataConvert_CanConvert(self: *const T, wSrcType: u16, wDstType: u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataConvert.VTable, self.vtable).CanConvert(@ptrCast(*const IDataConvert, self), wSrcType, wDstType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataConvert_GetConversionSize(self: *const T, wSrcType: u16, wDstType: u16, pcbSrcLength: ?*usize, pcbDstLength: ?*usize, pSrc: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataConvert.VTable, self.vtable).GetConversionSize(@ptrCast(*const IDataConvert, self), wSrcType, wDstType, pcbSrcLength, pcbDstLength, pSrc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DCINFOTYPEENUM = enum(i32) {
N = 1,
};
pub const DCINFOTYPE_VERSION = DCINFOTYPEENUM.N;
pub const DCINFO = extern struct {
eInfoType: u32,
vData: VARIANT,
};
const IID_IDCInfo_Value = Guid.initString("0c733a9c-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDCInfo = &IID_IDCInfo_Value;
pub const IDCInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetInfo: fn(
self: *const IDCInfo,
cInfo: u32,
rgeInfoType: [*]u32,
prgInfo: [*]?*DCINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetInfo: fn(
self: *const IDCInfo,
cInfo: u32,
rgInfo: [*]DCINFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCInfo_GetInfo(self: *const T, cInfo: u32, rgeInfoType: [*]u32, prgInfo: [*]?*DCINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCInfo.VTable, self.vtable).GetInfo(@ptrCast(*const IDCInfo, self), cInfo, rgeInfoType, prgInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCInfo_SetInfo(self: *const T, cInfo: u32, rgInfo: [*]DCINFO) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCInfo.VTable, self.vtable).SetInfo(@ptrCast(*const IDCInfo, self), cInfo, rgInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_MSDAORA_Value = Guid.initString("e8cc4cbe-fdff-11d0-b865-00a0c9081c1d");
pub const CLSID_MSDAORA = &CLSID_MSDAORA_Value;
const CLSID_MSDAORA_ERROR_Value = Guid.initString("e8cc4cbf-fdff-11d0-b865-00a0c9081c1d");
pub const CLSID_MSDAORA_ERROR = &CLSID_MSDAORA_ERROR_Value;
const CLSID_MSDAORA8_Value = Guid.initString("7f06a373-dd6a-43db-b4e0-1fc121e5e62b");
pub const CLSID_MSDAORA8 = &CLSID_MSDAORA8_Value;
const CLSID_MSDAORA8_ERROR_Value = Guid.initString("7f06a374-dd6a-43db-b4e0-1fc121e5e62b");
pub const CLSID_MSDAORA8_ERROR = &CLSID_MSDAORA8_ERROR_Value;
const IID_DataSourceListener_Value = Guid.initString("7c0ffab2-cd84-11d0-949a-00a0c91110ed");
pub const IID_DataSourceListener = &IID_DataSourceListener_Value;
pub const DataSourceListener = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
dataMemberChanged: fn(
self: *const DataSourceListener,
bstrDM: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
dataMemberAdded: fn(
self: *const DataSourceListener,
bstrDM: ?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
dataMemberRemoved: fn(
self: *const DataSourceListener,
bstrDM: ?*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 DataSourceListener_dataMemberChanged(self: *const T, bstrDM: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSourceListener.VTable, self.vtable).dataMemberChanged(@ptrCast(*const DataSourceListener, self), bstrDM);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSourceListener_dataMemberAdded(self: *const T, bstrDM: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSourceListener.VTable, self.vtable).dataMemberAdded(@ptrCast(*const DataSourceListener, self), bstrDM);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSourceListener_dataMemberRemoved(self: *const T, bstrDM: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSourceListener.VTable, self.vtable).dataMemberRemoved(@ptrCast(*const DataSourceListener, self), bstrDM);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_DataSource_Value = Guid.initString("7c0ffab3-cd84-11d0-949a-00a0c91110ed");
pub const IID_DataSource = &IID_DataSource_Value;
pub const DataSource = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
getDataMember: fn(
self: *const DataSource,
bstrDM: ?*u16,
riid: ?*const Guid,
ppunk: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getDataMemberName: fn(
self: *const DataSource,
lIndex: i32,
pbstrDM: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getDataMemberCount: fn(
self: *const DataSource,
plCount: ?*i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
addDataSourceListener: fn(
self: *const DataSource,
pDSL: ?*DataSourceListener,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
removeDataSourceListener: fn(
self: *const DataSource,
pDSL: ?*DataSourceListener,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSource_getDataMember(self: *const T, bstrDM: ?*u16, riid: ?*const Guid, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSource.VTable, self.vtable).getDataMember(@ptrCast(*const DataSource, self), bstrDM, riid, ppunk);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSource_getDataMemberName(self: *const T, lIndex: i32, pbstrDM: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSource.VTable, self.vtable).getDataMemberName(@ptrCast(*const DataSource, self), lIndex, pbstrDM);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSource_getDataMemberCount(self: *const T, plCount: ?*i32) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSource.VTable, self.vtable).getDataMemberCount(@ptrCast(*const DataSource, self), plCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSource_addDataSourceListener(self: *const T, pDSL: ?*DataSourceListener) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSource.VTable, self.vtable).addDataSourceListener(@ptrCast(*const DataSource, self), pDSL);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn DataSource_removeDataSourceListener(self: *const T, pDSL: ?*DataSourceListener) callconv(.Inline) HRESULT {
return @ptrCast(*const DataSource.VTable, self.vtable).removeDataSourceListener(@ptrCast(*const DataSource, self), pDSL);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const OSPFORMAT = enum(i32) {
RAW = 0,
// DEFAULT = 0, this enum value conflicts with RAW
FORMATTED = 1,
HTML = 2,
};
pub const OSPFORMAT_RAW = OSPFORMAT.RAW;
pub const OSPFORMAT_DEFAULT = OSPFORMAT.RAW;
pub const OSPFORMAT_FORMATTED = OSPFORMAT.FORMATTED;
pub const OSPFORMAT_HTML = OSPFORMAT.HTML;
pub const OSPRW = enum(i32) {
DEFAULT = 1,
READONLY = 0,
// READWRITE = 1, this enum value conflicts with DEFAULT
MIXED = 2,
};
pub const OSPRW_DEFAULT = OSPRW.DEFAULT;
pub const OSPRW_READONLY = OSPRW.READONLY;
pub const OSPRW_READWRITE = OSPRW.DEFAULT;
pub const OSPRW_MIXED = OSPRW.MIXED;
pub const OSPFIND = enum(i32) {
DEFAULT = 0,
UP = 1,
CASESENSITIVE = 2,
UPCASESENSITIVE = 3,
};
pub const OSPFIND_DEFAULT = OSPFIND.DEFAULT;
pub const OSPFIND_UP = OSPFIND.UP;
pub const OSPFIND_CASESENSITIVE = OSPFIND.CASESENSITIVE;
pub const OSPFIND_UPCASESENSITIVE = OSPFIND.UPCASESENSITIVE;
pub const OSPCOMP = enum(i32) {
EQ = 1,
// DEFAULT = 1, this enum value conflicts with EQ
LT = 2,
LE = 3,
GE = 4,
GT = 5,
NE = 6,
};
pub const OSPCOMP_EQ = OSPCOMP.EQ;
pub const OSPCOMP_DEFAULT = OSPCOMP.EQ;
pub const OSPCOMP_LT = OSPCOMP.LT;
pub const OSPCOMP_LE = OSPCOMP.LE;
pub const OSPCOMP_GE = OSPCOMP.GE;
pub const OSPCOMP_GT = OSPCOMP.GT;
pub const OSPCOMP_NE = OSPCOMP.NE;
pub const OSPXFER = enum(i32) {
COMPLETE = 0,
ABORT = 1,
ERROR = 2,
};
pub const OSPXFER_COMPLETE = OSPXFER.COMPLETE;
pub const OSPXFER_ABORT = OSPXFER.ABORT;
pub const OSPXFER_ERROR = OSPXFER.ERROR;
const IID_OLEDBSimpleProviderListener_Value = Guid.initString("e0e270c1-c0be-11d0-8fe4-00a0c90a6341");
pub const IID_OLEDBSimpleProviderListener = &IID_OLEDBSimpleProviderListener_Value;
pub const OLEDBSimpleProviderListener = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
aboutToChangeCell: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
iColumn: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
cellChanged: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
iColumn: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
aboutToDeleteRows: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
cRows: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
deletedRows: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
cRows: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
aboutToInsertRows: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
cRows: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
insertedRows: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
cRows: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
rowsAvailable: fn(
self: *const OLEDBSimpleProviderListener,
iRow: isize,
cRows: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
transferComplete: fn(
self: *const OLEDBSimpleProviderListener,
xfer: OSPXFER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_aboutToChangeCell(self: *const T, iRow: isize, iColumn: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).aboutToChangeCell(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, iColumn);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_cellChanged(self: *const T, iRow: isize, iColumn: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).cellChanged(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, iColumn);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_aboutToDeleteRows(self: *const T, iRow: isize, cRows: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).aboutToDeleteRows(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, cRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_deletedRows(self: *const T, iRow: isize, cRows: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).deletedRows(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, cRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_aboutToInsertRows(self: *const T, iRow: isize, cRows: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).aboutToInsertRows(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, cRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_insertedRows(self: *const T, iRow: isize, cRows: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).insertedRows(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, cRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_rowsAvailable(self: *const T, iRow: isize, cRows: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).rowsAvailable(@ptrCast(*const OLEDBSimpleProviderListener, self), iRow, cRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProviderListener_transferComplete(self: *const T, xfer: OSPXFER) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProviderListener.VTable, self.vtable).transferComplete(@ptrCast(*const OLEDBSimpleProviderListener, self), xfer);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_OLEDBSimpleProvider_Value = Guid.initString("e0e270c0-c0be-11d0-8fe4-00a0c90a6341");
pub const IID_OLEDBSimpleProvider = &IID_OLEDBSimpleProvider_Value;
pub const OLEDBSimpleProvider = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
getRowCount: fn(
self: *const OLEDBSimpleProvider,
pcRows: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getColumnCount: fn(
self: *const OLEDBSimpleProvider,
pcColumns: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getRWStatus: fn(
self: *const OLEDBSimpleProvider,
iRow: isize,
iColumn: isize,
prwStatus: ?*OSPRW,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getVariant: fn(
self: *const OLEDBSimpleProvider,
iRow: isize,
iColumn: isize,
format: OSPFORMAT,
pVar: ?*VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
setVariant: fn(
self: *const OLEDBSimpleProvider,
iRow: isize,
iColumn: isize,
format: OSPFORMAT,
Var: VARIANT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getLocale: fn(
self: *const OLEDBSimpleProvider,
pbstrLocale: ?*?BSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
deleteRows: fn(
self: *const OLEDBSimpleProvider,
iRow: isize,
cRows: isize,
pcRowsDeleted: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
insertRows: fn(
self: *const OLEDBSimpleProvider,
iRow: isize,
cRows: isize,
pcRowsInserted: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
find: fn(
self: *const OLEDBSimpleProvider,
iRowStart: isize,
iColumn: isize,
val: VARIANT,
findFlags: OSPFIND,
compType: OSPCOMP,
piRowFound: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
addOLEDBSimpleProviderListener: fn(
self: *const OLEDBSimpleProvider,
pospIListener: ?*OLEDBSimpleProviderListener,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
removeOLEDBSimpleProviderListener: fn(
self: *const OLEDBSimpleProvider,
pospIListener: ?*OLEDBSimpleProviderListener,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
isAsync: fn(
self: *const OLEDBSimpleProvider,
pbAsynch: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
getEstimatedRows: fn(
self: *const OLEDBSimpleProvider,
piRows: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
stopTransfer: fn(
self: *const OLEDBSimpleProvider,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_getRowCount(self: *const T, pcRows: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).getRowCount(@ptrCast(*const OLEDBSimpleProvider, self), pcRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_getColumnCount(self: *const T, pcColumns: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).getColumnCount(@ptrCast(*const OLEDBSimpleProvider, self), pcColumns);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_getRWStatus(self: *const T, iRow: isize, iColumn: isize, prwStatus: ?*OSPRW) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).getRWStatus(@ptrCast(*const OLEDBSimpleProvider, self), iRow, iColumn, prwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_getVariant(self: *const T, iRow: isize, iColumn: isize, format: OSPFORMAT, pVar: ?*VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).getVariant(@ptrCast(*const OLEDBSimpleProvider, self), iRow, iColumn, format, pVar);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_setVariant(self: *const T, iRow: isize, iColumn: isize, format: OSPFORMAT, Var: VARIANT) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).setVariant(@ptrCast(*const OLEDBSimpleProvider, self), iRow, iColumn, format, Var);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_getLocale(self: *const T, pbstrLocale: ?*?BSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).getLocale(@ptrCast(*const OLEDBSimpleProvider, self), pbstrLocale);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_deleteRows(self: *const T, iRow: isize, cRows: isize, pcRowsDeleted: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).deleteRows(@ptrCast(*const OLEDBSimpleProvider, self), iRow, cRows, pcRowsDeleted);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_insertRows(self: *const T, iRow: isize, cRows: isize, pcRowsInserted: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).insertRows(@ptrCast(*const OLEDBSimpleProvider, self), iRow, cRows, pcRowsInserted);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_find(self: *const T, iRowStart: isize, iColumn: isize, val: VARIANT, findFlags: OSPFIND, compType: OSPCOMP, piRowFound: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).find(@ptrCast(*const OLEDBSimpleProvider, self), iRowStart, iColumn, val, findFlags, compType, piRowFound);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_addOLEDBSimpleProviderListener(self: *const T, pospIListener: ?*OLEDBSimpleProviderListener) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).addOLEDBSimpleProviderListener(@ptrCast(*const OLEDBSimpleProvider, self), pospIListener);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_removeOLEDBSimpleProviderListener(self: *const T, pospIListener: ?*OLEDBSimpleProviderListener) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).removeOLEDBSimpleProviderListener(@ptrCast(*const OLEDBSimpleProvider, self), pospIListener);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_isAsync(self: *const T, pbAsynch: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).isAsync(@ptrCast(*const OLEDBSimpleProvider, self), pbAsynch);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_getEstimatedRows(self: *const T, piRows: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).getEstimatedRows(@ptrCast(*const OLEDBSimpleProvider, self), piRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn OLEDBSimpleProvider_stopTransfer(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const OLEDBSimpleProvider.VTable, self.vtable).stopTransfer(@ptrCast(*const OLEDBSimpleProvider, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_DataSourceObject_Value = Guid.initString("0ae9a4e4-18d4-11d1-b3b3-00aa00c1a924");
pub const IID_DataSourceObject = &IID_DataSourceObject_Value;
pub const DataSourceObject = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDispatch.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
const CLSID_DataLinks_Value = Guid.initString("2206cdb2-19c1-11d1-89e0-00c04fd7a829");
pub const CLSID_DataLinks = &CLSID_DataLinks_Value;
const CLSID_MSDAINITIALIZE_Value = Guid.initString("2206cdb0-19c1-11d1-89e0-00c04fd7a829");
pub const CLSID_MSDAINITIALIZE = &CLSID_MSDAINITIALIZE_Value;
const CLSID_PDPO_Value = Guid.initString("ccb4ec60-b9dc-11d1-ac80-00a0c9034873");
pub const CLSID_PDPO = &CLSID_PDPO_Value;
const CLSID_RootBinder_Value = Guid.initString("ff151822-b0bf-11d1-a80d-000000000000");
pub const CLSID_RootBinder = &CLSID_RootBinder_Value;
pub const EBindInfoOptions = enum(i32) {
R = 1,
};
pub const BIO_BINDER = EBindInfoOptions.R;
const IID_IService_Value = Guid.initString("06210e88-01f5-11d1-b512-0080c781c384");
pub const IID_IService = &IID_IService_Value;
pub const IService = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
InvokeService: fn(
self: *const IService,
pUnkInner: ?*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 IService_InvokeService(self: *const T, pUnkInner: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IService.VTable, self.vtable).InvokeService(@ptrCast(*const IService, self), pUnkInner);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBPROMPTOPTIONSENUM = enum(i32) {
NONE = 0,
WIZARDSHEET = 1,
PROPERTYSHEET = 2,
BROWSEONLY = 8,
DISABLE_PROVIDER_SELECTION = 16,
DISABLESAVEPASSWORD = 32,
};
pub const DBPROMPTOPTIONS_NONE = DBPROMPTOPTIONSENUM.NONE;
pub const DBPROMPTOPTIONS_WIZARDSHEET = DBPROMPTOPTIONSENUM.WIZARDSHEET;
pub const DBPROMPTOPTIONS_PROPERTYSHEET = DBPROMPTOPTIONSENUM.PROPERTYSHEET;
pub const DBPROMPTOPTIONS_BROWSEONLY = DBPROMPTOPTIONSENUM.BROWSEONLY;
pub const DBPROMPTOPTIONS_DISABLE_PROVIDER_SELECTION = DBPROMPTOPTIONSENUM.DISABLE_PROVIDER_SELECTION;
pub const DBPROMPTOPTIONS_DISABLESAVEPASSWORD = DBPROMPTOPTIONSENUM.DISABLESAVEPASSWORD;
const IID_IDBPromptInitialize_Value = Guid.initString("2206ccb0-19c1-11d1-89e0-00c04fd7a829");
pub const IID_IDBPromptInitialize = &IID_IDBPromptInitialize_Value;
pub const IDBPromptInitialize = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
PromptDataSource: fn(
self: *const IDBPromptInitialize,
pUnkOuter: ?*IUnknown,
hWndParent: ?HWND,
dwPromptOptions: u32,
cSourceTypeFilter: u32,
rgSourceTypeFilter: ?[*]u32,
pwszszzProviderFilter: ?[*:0]const u16,
riid: ?*const Guid,
ppDataSource: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PromptFileName: fn(
self: *const IDBPromptInitialize,
hWndParent: ?HWND,
dwPromptOptions: u32,
pwszInitialDirectory: ?[*:0]const u16,
pwszInitialFile: ?[*:0]const u16,
ppwszSelectedFile: ?*?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 IDBPromptInitialize_PromptDataSource(self: *const T, pUnkOuter: ?*IUnknown, hWndParent: ?HWND, dwPromptOptions: u32, cSourceTypeFilter: u32, rgSourceTypeFilter: ?[*]u32, pwszszzProviderFilter: ?[*:0]const u16, riid: ?*const Guid, ppDataSource: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBPromptInitialize.VTable, self.vtable).PromptDataSource(@ptrCast(*const IDBPromptInitialize, self), pUnkOuter, hWndParent, dwPromptOptions, cSourceTypeFilter, rgSourceTypeFilter, pwszszzProviderFilter, riid, ppDataSource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBPromptInitialize_PromptFileName(self: *const T, hWndParent: ?HWND, dwPromptOptions: u32, pwszInitialDirectory: ?[*:0]const u16, pwszInitialFile: ?[*:0]const u16, ppwszSelectedFile: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBPromptInitialize.VTable, self.vtable).PromptFileName(@ptrCast(*const IDBPromptInitialize, self), hWndParent, dwPromptOptions, pwszInitialDirectory, pwszInitialFile, ppwszSelectedFile);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDataInitialize_Value = Guid.initString("2206ccb1-19c1-11d1-89e0-00c04fd7a829");
pub const IID_IDataInitialize = &IID_IDataInitialize_Value;
pub const IDataInitialize = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDataSource: fn(
self: *const IDataInitialize,
pUnkOuter: ?*IUnknown,
dwClsCtx: u32,
pwszInitializationString: ?[*:0]const u16,
riid: ?*const Guid,
ppDataSource: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInitializationString: fn(
self: *const IDataInitialize,
pDataSource: ?*IUnknown,
fIncludePassword: u8,
ppwszInitString: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDBInstance: fn(
self: *const IDataInitialize,
clsidProvider: ?*const Guid,
pUnkOuter: ?*IUnknown,
dwClsCtx: u32,
pwszReserved: ?PWSTR,
riid: ?*const Guid,
ppDataSource: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDBInstanceEx: fn(
self: *const IDataInitialize,
clsidProvider: ?*const Guid,
pUnkOuter: ?*IUnknown,
dwClsCtx: u32,
pwszReserved: ?PWSTR,
pServerInfo: ?*COSERVERINFO,
cmq: u32,
rgmqResults: [*]MULTI_QI,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
LoadStringFromStorage: fn(
self: *const IDataInitialize,
pwszFileName: ?[*:0]const u16,
ppwszInitializationString: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WriteStringToStorage: fn(
self: *const IDataInitialize,
pwszFileName: ?[*:0]const u16,
pwszInitializationString: ?[*:0]const u16,
dwCreationDisposition: 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 IDataInitialize_GetDataSource(self: *const T, pUnkOuter: ?*IUnknown, dwClsCtx: u32, pwszInitializationString: ?[*:0]const u16, riid: ?*const Guid, ppDataSource: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataInitialize.VTable, self.vtable).GetDataSource(@ptrCast(*const IDataInitialize, self), pUnkOuter, dwClsCtx, pwszInitializationString, riid, ppDataSource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataInitialize_GetInitializationString(self: *const T, pDataSource: ?*IUnknown, fIncludePassword: u8, ppwszInitString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataInitialize.VTable, self.vtable).GetInitializationString(@ptrCast(*const IDataInitialize, self), pDataSource, fIncludePassword, ppwszInitString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataInitialize_CreateDBInstance(self: *const T, clsidProvider: ?*const Guid, pUnkOuter: ?*IUnknown, dwClsCtx: u32, pwszReserved: ?PWSTR, riid: ?*const Guid, ppDataSource: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataInitialize.VTable, self.vtable).CreateDBInstance(@ptrCast(*const IDataInitialize, self), clsidProvider, pUnkOuter, dwClsCtx, pwszReserved, riid, ppDataSource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataInitialize_CreateDBInstanceEx(self: *const T, clsidProvider: ?*const Guid, pUnkOuter: ?*IUnknown, dwClsCtx: u32, pwszReserved: ?PWSTR, pServerInfo: ?*COSERVERINFO, cmq: u32, rgmqResults: [*]MULTI_QI) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataInitialize.VTable, self.vtable).CreateDBInstanceEx(@ptrCast(*const IDataInitialize, self), clsidProvider, pUnkOuter, dwClsCtx, pwszReserved, pServerInfo, cmq, rgmqResults);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataInitialize_LoadStringFromStorage(self: *const T, pwszFileName: ?[*:0]const u16, ppwszInitializationString: ?*?PWSTR) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataInitialize.VTable, self.vtable).LoadStringFromStorage(@ptrCast(*const IDataInitialize, self), pwszFileName, ppwszInitializationString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataInitialize_WriteStringToStorage(self: *const T, pwszFileName: ?[*:0]const u16, pwszInitializationString: ?[*:0]const u16, dwCreationDisposition: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataInitialize.VTable, self.vtable).WriteStringToStorage(@ptrCast(*const IDataInitialize, self), pwszFileName, pwszInitializationString, dwCreationDisposition);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDataSourceLocator_Value = Guid.initString("2206ccb2-19c1-11d1-89e0-00c04fd7a829");
pub const IID_IDataSourceLocator = &IID_IDataSourceLocator_Value;
pub const IDataSourceLocator = extern struct {
pub const VTable = extern struct {
base: IDispatch.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_hWnd: fn(
self: *const IDataSourceLocator,
phwndParent: ?*i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
// TODO: this function has a "SpecialName", should Zig do anything with this?
put_hWnd: fn(
self: *const IDataSourceLocator,
hwndParent: i64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PromptNew: fn(
self: *const IDataSourceLocator,
ppADOConnection: ?*?*IDispatch,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PromptEdit: fn(
self: *const IDataSourceLocator,
ppADOConnection: ?*?*IDispatch,
pbSuccess: ?*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 IDataSourceLocator_get_hWnd(self: *const T, phwndParent: ?*i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataSourceLocator.VTable, self.vtable).get_hWnd(@ptrCast(*const IDataSourceLocator, self), phwndParent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataSourceLocator_put_hWnd(self: *const T, hwndParent: i64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataSourceLocator.VTable, self.vtable).put_hWnd(@ptrCast(*const IDataSourceLocator, self), hwndParent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataSourceLocator_PromptNew(self: *const T, ppADOConnection: ?*?*IDispatch) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataSourceLocator.VTable, self.vtable).PromptNew(@ptrCast(*const IDataSourceLocator, self), ppADOConnection);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDataSourceLocator_PromptEdit(self: *const T, ppADOConnection: ?*?*IDispatch, pbSuccess: ?*i16) callconv(.Inline) HRESULT {
return @ptrCast(*const IDataSourceLocator.VTable, self.vtable).PromptEdit(@ptrCast(*const IDataSourceLocator, self), ppADOConnection, pbSuccess);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const KAGREQDIAGFLAGSENUM = enum(i32) {
HEADER = 1,
RECORD = 2,
};
pub const KAGREQDIAGFLAGS_HEADER = KAGREQDIAGFLAGSENUM.HEADER;
pub const KAGREQDIAGFLAGS_RECORD = KAGREQDIAGFLAGSENUM.RECORD;
const IID_IRowsetChangeExtInfo_Value = Guid.initString("0c733a8f-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetChangeExtInfo = &IID_IRowsetChangeExtInfo_Value;
pub const IRowsetChangeExtInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetOriginalRow: fn(
self: *const IRowsetChangeExtInfo,
hReserved: usize,
hRow: usize,
phRowOriginal: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPendingColumns: fn(
self: *const IRowsetChangeExtInfo,
hReserved: usize,
hRow: usize,
cColumnOrdinals: u32,
rgiOrdinals: ?*const u32,
rgColumnStatus: ?*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 IRowsetChangeExtInfo_GetOriginalRow(self: *const T, hReserved: usize, hRow: usize, phRowOriginal: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetChangeExtInfo.VTable, self.vtable).GetOriginalRow(@ptrCast(*const IRowsetChangeExtInfo, self), hReserved, hRow, phRowOriginal);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetChangeExtInfo_GetPendingColumns(self: *const T, hReserved: usize, hRow: usize, cColumnOrdinals: u32, rgiOrdinals: ?*const u32, rgColumnStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetChangeExtInfo.VTable, self.vtable).GetPendingColumns(@ptrCast(*const IRowsetChangeExtInfo, self), hReserved, hRow, cColumnOrdinals, rgiOrdinals, rgColumnStatus);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const KAGREQDIAG = extern struct {
ulDiagFlags: u32,
vt: u16,
sDiagField: i16,
};
pub const KAGGETDIAG = extern struct {
ulSize: u32,
vDiagInfo: VARIANT,
sDiagField: i16,
};
const IID_ISQLRequestDiagFields_Value = Guid.initString("228972f0-b5ff-11d0-8a80-00c04fd611cd");
pub const IID_ISQLRequestDiagFields = &IID_ISQLRequestDiagFields_Value;
pub const ISQLRequestDiagFields = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
RequestDiagFields: fn(
self: *const ISQLRequestDiagFields,
cDiagFields: u32,
rgDiagFields: [*]KAGREQDIAG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISQLRequestDiagFields_RequestDiagFields(self: *const T, cDiagFields: u32, rgDiagFields: [*]KAGREQDIAG) callconv(.Inline) HRESULT {
return @ptrCast(*const ISQLRequestDiagFields.VTable, self.vtable).RequestDiagFields(@ptrCast(*const ISQLRequestDiagFields, self), cDiagFields, rgDiagFields);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISQLGetDiagField_Value = Guid.initString("228972f1-b5ff-11d0-8a80-00c04fd611cd");
pub const IID_ISQLGetDiagField = &IID_ISQLGetDiagField_Value;
pub const ISQLGetDiagField = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDiagField: fn(
self: *const ISQLGetDiagField,
pDiagInfo: ?*KAGGETDIAG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISQLGetDiagField_GetDiagField(self: *const T, pDiagInfo: ?*KAGGETDIAG) callconv(.Inline) HRESULT {
return @ptrCast(*const ISQLGetDiagField.VTable, self.vtable).GetDiagField(@ptrCast(*const ISQLGetDiagField, self), pDiagInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const MSDSDBINITPROPENUM = enum(i32) {
R = 2,
};
pub const DBPROP_MSDS_DBINIT_DATAPROVIDER = MSDSDBINITPROPENUM.R;
pub const MSDSSESSIONPROPENUM = enum(i32) {
S = 2,
};
pub const DBPROP_MSDS_SESS_UNIQUENAMES = MSDSSESSIONPROPENUM.S;
pub const DATE_STRUCT = extern struct {
year: i16,
month: u16,
day: u16,
};
pub const TIME_STRUCT = extern struct {
hour: u16,
minute: u16,
second: u16,
};
pub const TIMESTAMP_STRUCT = extern struct {
year: i16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16,
fraction: u32,
};
pub const SQLINTERVAL = enum(i32) {
YEAR = 1,
MONTH = 2,
DAY = 3,
HOUR = 4,
MINUTE = 5,
SECOND = 6,
YEAR_TO_MONTH = 7,
DAY_TO_HOUR = 8,
DAY_TO_MINUTE = 9,
DAY_TO_SECOND = 10,
HOUR_TO_MINUTE = 11,
HOUR_TO_SECOND = 12,
MINUTE_TO_SECOND = 13,
};
pub const SQL_IS_YEAR = SQLINTERVAL.YEAR;
pub const SQL_IS_MONTH = SQLINTERVAL.MONTH;
pub const SQL_IS_DAY = SQLINTERVAL.DAY;
pub const SQL_IS_HOUR = SQLINTERVAL.HOUR;
pub const SQL_IS_MINUTE = SQLINTERVAL.MINUTE;
pub const SQL_IS_SECOND = SQLINTERVAL.SECOND;
pub const SQL_IS_YEAR_TO_MONTH = SQLINTERVAL.YEAR_TO_MONTH;
pub const SQL_IS_DAY_TO_HOUR = SQLINTERVAL.DAY_TO_HOUR;
pub const SQL_IS_DAY_TO_MINUTE = SQLINTERVAL.DAY_TO_MINUTE;
pub const SQL_IS_DAY_TO_SECOND = SQLINTERVAL.DAY_TO_SECOND;
pub const SQL_IS_HOUR_TO_MINUTE = SQLINTERVAL.HOUR_TO_MINUTE;
pub const SQL_IS_HOUR_TO_SECOND = SQLINTERVAL.HOUR_TO_SECOND;
pub const SQL_IS_MINUTE_TO_SECOND = SQLINTERVAL.MINUTE_TO_SECOND;
pub const tagSQL_YEAR_MONTH = extern struct {
year: u32,
month: u32,
};
pub const tagSQL_DAY_SECOND = extern struct {
day: u32,
hour: u32,
minute: u32,
second: u32,
fraction: u32,
};
pub const SQL_INTERVAL_STRUCT = extern struct {
interval_type: SQLINTERVAL,
interval_sign: i16,
intval: extern union {
year_month: tagSQL_YEAR_MONTH,
day_second: tagSQL_DAY_SECOND,
},
};
pub const SQL_NUMERIC_STRUCT = extern struct {
precision: u8,
scale: i8,
sign: u8,
val: [16]u8,
};
pub const dbvarychar = extern struct {
len: i16,
str: [8001]i8,
};
pub const dbvarybin = extern struct {
len: i16,
array: [8001]u8,
};
pub const dbmoney = extern struct {
mnyhigh: i32,
mnylow: u32,
};
pub const dbdatetime = extern struct {
dtdays: i32,
dttime: u32,
};
pub const dbdatetime4 = extern struct {
numdays: u16,
nummins: u16,
};
pub const sqlperf = extern struct {
TimerResolution: u32,
SQLidu: u32,
SQLiduRows: u32,
SQLSelects: u32,
SQLSelectRows: u32,
Transactions: u32,
SQLPrepares: u32,
ExecDirects: u32,
SQLExecutes: u32,
CursorOpens: u32,
CursorSize: u32,
CursorUsed: u32,
PercentCursorUsed: f64,
AvgFetchTime: f64,
AvgCursorSize: f64,
AvgCursorUsed: f64,
SQLFetchTime: u32,
SQLFetchCount: u32,
CurrentStmtCount: u32,
MaxOpenStmt: u32,
SumOpenStmt: u32,
CurrentConnectionCount: u32,
MaxConnectionsOpened: u32,
SumConnectionsOpened: u32,
SumConnectiontime: u32,
AvgTimeOpened: f64,
ServerRndTrips: u32,
BuffersSent: u32,
BuffersRec: u32,
BytesSent: u32,
BytesRec: u32,
msExecutionTime: u32,
msNetWorkServerTime: u32,
};
pub const DBPROPENUM25_DEPRECATED = enum(i32) {
CommandCost = 141,
CommandTree = 142,
CommandValidate = 143,
DBSchemaCommand = 144,
ProvideMoniker = 125,
Query = 146,
ReadData = 147,
RowsetAsynch = 148,
RowsetCopyRows = 149,
RowsetKeys = 151,
RowsetNewRowAfter = 152,
RowsetNextRowset = 153,
RowsetWatchAll = 155,
RowsetWatchNotify = 156,
RowsetWatchRegion = 157,
RowsetWithParameters = 158,
};
pub const DBPROP_ICommandCost = DBPROPENUM25_DEPRECATED.CommandCost;
pub const DBPROP_ICommandTree = DBPROPENUM25_DEPRECATED.CommandTree;
pub const DBPROP_ICommandValidate = DBPROPENUM25_DEPRECATED.CommandValidate;
pub const DBPROP_IDBSchemaCommand = DBPROPENUM25_DEPRECATED.DBSchemaCommand;
pub const DBPROP_IProvideMoniker = DBPROPENUM25_DEPRECATED.ProvideMoniker;
pub const DBPROP_IQuery = DBPROPENUM25_DEPRECATED.Query;
pub const DBPROP_IReadData = DBPROPENUM25_DEPRECATED.ReadData;
pub const DBPROP_IRowsetAsynch = DBPROPENUM25_DEPRECATED.RowsetAsynch;
pub const DBPROP_IRowsetCopyRows = DBPROPENUM25_DEPRECATED.RowsetCopyRows;
pub const DBPROP_IRowsetKeys = DBPROPENUM25_DEPRECATED.RowsetKeys;
pub const DBPROP_IRowsetNewRowAfter = DBPROPENUM25_DEPRECATED.RowsetNewRowAfter;
pub const DBPROP_IRowsetNextRowset = DBPROPENUM25_DEPRECATED.RowsetNextRowset;
pub const DBPROP_IRowsetWatchAll = DBPROPENUM25_DEPRECATED.RowsetWatchAll;
pub const DBPROP_IRowsetWatchNotify = DBPROPENUM25_DEPRECATED.RowsetWatchNotify;
pub const DBPROP_IRowsetWatchRegion = DBPROPENUM25_DEPRECATED.RowsetWatchRegion;
pub const DBPROP_IRowsetWithParameters = DBPROPENUM25_DEPRECATED.RowsetWithParameters;
pub const DBREASONENUM25 = enum(i32) {
ROWSADDED = 19,
POPULATIONCOMPLETE = 20,
POPULATIONSTOPPED = 21,
};
pub const DBREASON_ROWSET_ROWSADDED = DBREASONENUM25.ROWSADDED;
pub const DBREASON_ROWSET_POPULATIONCOMPLETE = DBREASONENUM25.POPULATIONCOMPLETE;
pub const DBREASON_ROWSET_POPULATIONSTOPPED = DBREASONENUM25.POPULATIONSTOPPED;
const IID_IRowsetNextRowset_Value = Guid.initString("0c733a72-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetNextRowset = &IID_IRowsetNextRowset_Value;
pub const IRowsetNextRowset = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetNextRowset: fn(
self: *const IRowsetNextRowset,
pUnkOuter: ?*IUnknown,
riid: ?*const Guid,
ppNextRowset: ?*?*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 IRowsetNextRowset_GetNextRowset(self: *const T, pUnkOuter: ?*IUnknown, riid: ?*const Guid, ppNextRowset: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetNextRowset.VTable, self.vtable).GetNextRowset(@ptrCast(*const IRowsetNextRowset, self), pUnkOuter, riid, ppNextRowset);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetNewRowAfter_Value = Guid.initString("0c733a71-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetNewRowAfter = &IID_IRowsetNewRowAfter_Value;
pub const IRowsetNewRowAfter = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetNewDataAfter: fn(
self: *const IRowsetNewRowAfter,
hChapter: usize,
cbbmPrevious: u32,
pbmPrevious: ?*const u8,
hAccessor: usize,
pData: ?*u8,
phRow: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetNewRowAfter_SetNewDataAfter(self: *const T, hChapter: usize, cbbmPrevious: u32, pbmPrevious: ?*const u8, hAccessor: usize, pData: ?*u8, phRow: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetNewRowAfter.VTable, self.vtable).SetNewDataAfter(@ptrCast(*const IRowsetNewRowAfter, self), hChapter, cbbmPrevious, pbmPrevious, hAccessor, pData, phRow);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetWithParameters_Value = Guid.initString("0c733a6e-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetWithParameters = &IID_IRowsetWithParameters_Value;
pub const IRowsetWithParameters = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetParameterInfo: fn(
self: *const IRowsetWithParameters,
pcParams: ?*usize,
prgParamInfo: ?*?*DBPARAMINFO,
ppNamesBuffer: ?*?*u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Requery: fn(
self: *const IRowsetWithParameters,
pParams: ?*DBPARAMS,
pulErrorParam: ?*u32,
phReserved: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWithParameters_GetParameterInfo(self: *const T, pcParams: ?*usize, prgParamInfo: ?*?*DBPARAMINFO, ppNamesBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWithParameters.VTable, self.vtable).GetParameterInfo(@ptrCast(*const IRowsetWithParameters, self), pcParams, prgParamInfo, ppNamesBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWithParameters_Requery(self: *const T, pParams: ?*DBPARAMS, pulErrorParam: ?*u32, phReserved: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWithParameters.VTable, self.vtable).Requery(@ptrCast(*const IRowsetWithParameters, self), pParams, pulErrorParam, phReserved);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetAsynch_Value = Guid.initString("0c733a0f-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetAsynch = &IID_IRowsetAsynch_Value;
pub const IRowsetAsynch = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
RatioFinished: fn(
self: *const IRowsetAsynch,
pulDenominator: ?*usize,
pulNumerator: ?*usize,
pcRows: ?*usize,
pfNewRows: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Stop: fn(
self: *const IRowsetAsynch,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetAsynch_RatioFinished(self: *const T, pulDenominator: ?*usize, pulNumerator: ?*usize, pcRows: ?*usize, pfNewRows: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetAsynch.VTable, self.vtable).RatioFinished(@ptrCast(*const IRowsetAsynch, self), pulDenominator, pulNumerator, pcRows, pfNewRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetAsynch_Stop(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetAsynch.VTable, self.vtable).Stop(@ptrCast(*const IRowsetAsynch, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetKeys_Value = Guid.initString("0c733a12-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetKeys = &IID_IRowsetKeys_Value;
pub const IRowsetKeys = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ListKeys: fn(
self: *const IRowsetKeys,
pcColumns: ?*usize,
prgColumns: ?*?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetKeys_ListKeys(self: *const T, pcColumns: ?*usize, prgColumns: ?*?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetKeys.VTable, self.vtable).ListKeys(@ptrCast(*const IRowsetKeys, self), pcColumns, prgColumns);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetWatchAll_Value = Guid.initString("0c733a73-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetWatchAll = &IID_IRowsetWatchAll_Value;
pub const IRowsetWatchAll = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Acknowledge: fn(
self: *const IRowsetWatchAll,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Start: fn(
self: *const IRowsetWatchAll,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StopWatching: fn(
self: *const IRowsetWatchAll,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchAll_Acknowledge(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchAll.VTable, self.vtable).Acknowledge(@ptrCast(*const IRowsetWatchAll, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchAll_Start(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchAll.VTable, self.vtable).Start(@ptrCast(*const IRowsetWatchAll, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchAll_StopWatching(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchAll.VTable, self.vtable).StopWatching(@ptrCast(*const IRowsetWatchAll, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBWATCHNOTIFYENUM = enum(i32) {
ROWSCHANGED = 1,
QUERYDONE = 2,
QUERYREEXECUTED = 3,
};
pub const DBWATCHNOTIFY_ROWSCHANGED = DBWATCHNOTIFYENUM.ROWSCHANGED;
pub const DBWATCHNOTIFY_QUERYDONE = DBWATCHNOTIFYENUM.QUERYDONE;
pub const DBWATCHNOTIFY_QUERYREEXECUTED = DBWATCHNOTIFYENUM.QUERYREEXECUTED;
const IID_IRowsetWatchNotify_Value = Guid.initString("0c733a44-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetWatchNotify = &IID_IRowsetWatchNotify_Value;
pub const IRowsetWatchNotify = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
OnChange: fn(
self: *const IRowsetWatchNotify,
pRowset: ?*IRowset,
eChangeReason: 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 IRowsetWatchNotify_OnChange(self: *const T, pRowset: ?*IRowset, eChangeReason: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchNotify.VTable, self.vtable).OnChange(@ptrCast(*const IRowsetWatchNotify, self), pRowset, eChangeReason);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBWATCHMODEENUM = enum(i32) {
ALL = 1,
EXTEND = 2,
MOVE = 4,
COUNT = 8,
};
pub const DBWATCHMODE_ALL = DBWATCHMODEENUM.ALL;
pub const DBWATCHMODE_EXTEND = DBWATCHMODEENUM.EXTEND;
pub const DBWATCHMODE_MOVE = DBWATCHMODEENUM.MOVE;
pub const DBWATCHMODE_COUNT = DBWATCHMODEENUM.COUNT;
pub const DBROWCHANGEKINDENUM = enum(i32) {
INSERT = 0,
DELETE = 1,
UPDATE = 2,
COUNT = 3,
};
pub const DBROWCHANGEKIND_INSERT = DBROWCHANGEKINDENUM.INSERT;
pub const DBROWCHANGEKIND_DELETE = DBROWCHANGEKINDENUM.DELETE;
pub const DBROWCHANGEKIND_UPDATE = DBROWCHANGEKINDENUM.UPDATE;
pub const DBROWCHANGEKIND_COUNT = DBROWCHANGEKINDENUM.COUNT;
const IID_IRowsetWatchRegion_Value = Guid.initString("0c733a45-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetWatchRegion = &IID_IRowsetWatchRegion_Value;
pub const IRowsetWatchRegion = extern struct {
pub const VTable = extern struct {
base: IRowsetWatchAll.VTable,
CreateWatchRegion: fn(
self: *const IRowsetWatchRegion,
dwWatchMode: u32,
phRegion: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ChangeWatchMode: fn(
self: *const IRowsetWatchRegion,
hRegion: usize,
dwWatchMode: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DeleteWatchRegion: fn(
self: *const IRowsetWatchRegion,
hRegion: usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWatchRegionInfo: fn(
self: *const IRowsetWatchRegion,
hRegion: usize,
pdwWatchMode: ?*u32,
phChapter: ?*usize,
pcbBookmark: ?*usize,
ppBookmark: ?*?*u8,
pcRows: ?*isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Refresh: fn(
self: *const IRowsetWatchRegion,
pcChangesObtained: ?*usize,
prgChanges: ?*?*tagDBROWWATCHRANGE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ShrinkWatchRegion: fn(
self: *const IRowsetWatchRegion,
hRegion: usize,
hChapter: usize,
cbBookmark: usize,
pBookmark: ?*u8,
cRows: isize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IRowsetWatchAll.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchRegion_CreateWatchRegion(self: *const T, dwWatchMode: u32, phRegion: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchRegion.VTable, self.vtable).CreateWatchRegion(@ptrCast(*const IRowsetWatchRegion, self), dwWatchMode, phRegion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchRegion_ChangeWatchMode(self: *const T, hRegion: usize, dwWatchMode: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchRegion.VTable, self.vtable).ChangeWatchMode(@ptrCast(*const IRowsetWatchRegion, self), hRegion, dwWatchMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchRegion_DeleteWatchRegion(self: *const T, hRegion: usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchRegion.VTable, self.vtable).DeleteWatchRegion(@ptrCast(*const IRowsetWatchRegion, self), hRegion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchRegion_GetWatchRegionInfo(self: *const T, hRegion: usize, pdwWatchMode: ?*u32, phChapter: ?*usize, pcbBookmark: ?*usize, ppBookmark: ?*?*u8, pcRows: ?*isize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchRegion.VTable, self.vtable).GetWatchRegionInfo(@ptrCast(*const IRowsetWatchRegion, self), hRegion, pdwWatchMode, phChapter, pcbBookmark, ppBookmark, pcRows);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchRegion_Refresh(self: *const T, pcChangesObtained: ?*usize, prgChanges: ?*?*tagDBROWWATCHRANGE) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchRegion.VTable, self.vtable).Refresh(@ptrCast(*const IRowsetWatchRegion, self), pcChangesObtained, prgChanges);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetWatchRegion_ShrinkWatchRegion(self: *const T, hRegion: usize, hChapter: usize, cbBookmark: usize, pBookmark: ?*u8, cRows: isize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetWatchRegion.VTable, self.vtable).ShrinkWatchRegion(@ptrCast(*const IRowsetWatchRegion, self), hRegion, hChapter, cbBookmark, pBookmark, cRows);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetCopyRows_Value = Guid.initString("0c733a6b-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IRowsetCopyRows = &IID_IRowsetCopyRows_Value;
pub const IRowsetCopyRows = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CloseSource: fn(
self: *const IRowsetCopyRows,
hSourceID: u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CopyByHROWS: fn(
self: *const IRowsetCopyRows,
hSourceID: u16,
hReserved: usize,
cRows: isize,
rghRows: ?*const usize,
bFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CopyRows: fn(
self: *const IRowsetCopyRows,
hSourceID: u16,
hReserved: usize,
cRows: isize,
bFlags: u32,
pcRowsCopied: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DefineSource: fn(
self: *const IRowsetCopyRows,
pRowsetSource: ?*IRowset,
cColIds: usize,
rgSourceColumns: ?*const isize,
rgTargetColumns: ?*const isize,
phSourceID: ?*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 IRowsetCopyRows_CloseSource(self: *const T, hSourceID: u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetCopyRows.VTable, self.vtable).CloseSource(@ptrCast(*const IRowsetCopyRows, self), hSourceID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetCopyRows_CopyByHROWS(self: *const T, hSourceID: u16, hReserved: usize, cRows: isize, rghRows: ?*const usize, bFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetCopyRows.VTable, self.vtable).CopyByHROWS(@ptrCast(*const IRowsetCopyRows, self), hSourceID, hReserved, cRows, rghRows, bFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetCopyRows_CopyRows(self: *const T, hSourceID: u16, hReserved: usize, cRows: isize, bFlags: u32, pcRowsCopied: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetCopyRows.VTable, self.vtable).CopyRows(@ptrCast(*const IRowsetCopyRows, self), hSourceID, hReserved, cRows, bFlags, pcRowsCopied);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetCopyRows_DefineSource(self: *const T, pRowsetSource: ?*IRowset, cColIds: usize, rgSourceColumns: ?*const isize, rgTargetColumns: ?*const isize, phSourceID: ?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetCopyRows.VTable, self.vtable).DefineSource(@ptrCast(*const IRowsetCopyRows, self), pRowsetSource, cColIds, rgSourceColumns, rgTargetColumns, phSourceID);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IReadData_Value = Guid.initString("0c733a6a-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IReadData = &IID_IReadData_Value;
pub const IReadData = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ReadData: fn(
self: *const IReadData,
hChapter: usize,
cbBookmark: usize,
pBookmark: ?*const u8,
lRowsOffset: isize,
hAccessor: usize,
cRows: isize,
pcRowsObtained: ?*usize,
ppFixedData: ?*?*u8,
pcbVariableTotal: ?*usize,
ppVariableData: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseChapter: fn(
self: *const IReadData,
hChapter: usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IReadData_ReadData(self: *const T, hChapter: usize, cbBookmark: usize, pBookmark: ?*const u8, lRowsOffset: isize, hAccessor: usize, cRows: isize, pcRowsObtained: ?*usize, ppFixedData: ?*?*u8, pcbVariableTotal: ?*usize, ppVariableData: ?*?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IReadData.VTable, self.vtable).ReadData(@ptrCast(*const IReadData, self), hChapter, cbBookmark, pBookmark, lRowsOffset, hAccessor, cRows, pcRowsObtained, ppFixedData, pcbVariableTotal, ppVariableData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IReadData_ReleaseChapter(self: *const T, hChapter: usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IReadData.VTable, self.vtable).ReleaseChapter(@ptrCast(*const IReadData, self), hChapter);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DBRESOURCEKINDENUM = enum(i32) {
INVALID = 0,
TOTAL = 1,
CPU = 2,
MEMORY = 3,
DISK = 4,
NETWORK = 5,
RESPONSE = 6,
ROWS = 7,
OTHER = 8,
};
pub const DBRESOURCE_INVALID = DBRESOURCEKINDENUM.INVALID;
pub const DBRESOURCE_TOTAL = DBRESOURCEKINDENUM.TOTAL;
pub const DBRESOURCE_CPU = DBRESOURCEKINDENUM.CPU;
pub const DBRESOURCE_MEMORY = DBRESOURCEKINDENUM.MEMORY;
pub const DBRESOURCE_DISK = DBRESOURCEKINDENUM.DISK;
pub const DBRESOURCE_NETWORK = DBRESOURCEKINDENUM.NETWORK;
pub const DBRESOURCE_RESPONSE = DBRESOURCEKINDENUM.RESPONSE;
pub const DBRESOURCE_ROWS = DBRESOURCEKINDENUM.ROWS;
pub const DBRESOURCE_OTHER = DBRESOURCEKINDENUM.OTHER;
pub const DBCOSTUNITENUM = enum(i32) {
INVALID = 0,
WEIGHT = 1,
PERCENT = 2,
MAXIMUM = 4,
MINIMUM = 8,
MICRO_SECOND = 16,
MILLI_SECOND = 32,
SECOND = 64,
MINUTE = 128,
HOUR = 256,
BYTE = 512,
KILO_BYTE = 1024,
MEGA_BYTE = 2048,
GIGA_BYTE = 4096,
NUM_MSGS = 8192,
NUM_LOCKS = 16384,
NUM_ROWS = 32768,
OTHER = 65536,
};
pub const DBUNIT_INVALID = DBCOSTUNITENUM.INVALID;
pub const DBUNIT_WEIGHT = DBCOSTUNITENUM.WEIGHT;
pub const DBUNIT_PERCENT = DBCOSTUNITENUM.PERCENT;
pub const DBUNIT_MAXIMUM = DBCOSTUNITENUM.MAXIMUM;
pub const DBUNIT_MINIMUM = DBCOSTUNITENUM.MINIMUM;
pub const DBUNIT_MICRO_SECOND = DBCOSTUNITENUM.MICRO_SECOND;
pub const DBUNIT_MILLI_SECOND = DBCOSTUNITENUM.MILLI_SECOND;
pub const DBUNIT_SECOND = DBCOSTUNITENUM.SECOND;
pub const DBUNIT_MINUTE = DBCOSTUNITENUM.MINUTE;
pub const DBUNIT_HOUR = DBCOSTUNITENUM.HOUR;
pub const DBUNIT_BYTE = DBCOSTUNITENUM.BYTE;
pub const DBUNIT_KILO_BYTE = DBCOSTUNITENUM.KILO_BYTE;
pub const DBUNIT_MEGA_BYTE = DBCOSTUNITENUM.MEGA_BYTE;
pub const DBUNIT_GIGA_BYTE = DBCOSTUNITENUM.GIGA_BYTE;
pub const DBUNIT_NUM_MSGS = DBCOSTUNITENUM.NUM_MSGS;
pub const DBUNIT_NUM_LOCKS = DBCOSTUNITENUM.NUM_LOCKS;
pub const DBUNIT_NUM_ROWS = DBCOSTUNITENUM.NUM_ROWS;
pub const DBUNIT_OTHER = DBCOSTUNITENUM.OTHER;
pub const DBEXECLIMITSENUM = enum(i32) {
ABORT = 1,
STOP = 2,
SUSPEND = 3,
};
pub const DBEXECLIMITS_ABORT = DBEXECLIMITSENUM.ABORT;
pub const DBEXECLIMITS_STOP = DBEXECLIMITSENUM.STOP;
pub const DBEXECLIMITS_SUSPEND = DBEXECLIMITSENUM.SUSPEND;
const IID_ICommandCost_Value = Guid.initString("0c733a4e-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandCost = &IID_ICommandCost_Value;
pub const ICommandCost = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetAccumulatedCost: fn(
self: *const ICommandCost,
pwszRowsetName: ?[*:0]const u16,
pcCostLimits: ?*u32,
prgCostLimits: ?*?*DBCOST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCostEstimate: fn(
self: *const ICommandCost,
pwszRowsetName: ?[*:0]const u16,
pcCostEstimates: ?*u32,
prgCostEstimates: ?*DBCOST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCostGoals: fn(
self: *const ICommandCost,
pwszRowsetName: ?[*:0]const u16,
pcCostGoals: ?*u32,
prgCostGoals: ?*DBCOST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCostLimits: fn(
self: *const ICommandCost,
pwszRowsetName: ?[*:0]const u16,
pcCostLimits: ?*u32,
prgCostLimits: ?*DBCOST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCostGoals: fn(
self: *const ICommandCost,
pwszRowsetName: ?[*:0]const u16,
cCostGoals: u32,
rgCostGoals: ?*const DBCOST,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCostLimits: fn(
self: *const ICommandCost,
pwszRowsetName: ?[*:0]const u16,
cCostLimits: u32,
prgCostLimits: ?*DBCOST,
dwExecutionFlags: 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 ICommandCost_GetAccumulatedCost(self: *const T, pwszRowsetName: ?[*:0]const u16, pcCostLimits: ?*u32, prgCostLimits: ?*?*DBCOST) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandCost.VTable, self.vtable).GetAccumulatedCost(@ptrCast(*const ICommandCost, self), pwszRowsetName, pcCostLimits, prgCostLimits);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandCost_GetCostEstimate(self: *const T, pwszRowsetName: ?[*:0]const u16, pcCostEstimates: ?*u32, prgCostEstimates: ?*DBCOST) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandCost.VTable, self.vtable).GetCostEstimate(@ptrCast(*const ICommandCost, self), pwszRowsetName, pcCostEstimates, prgCostEstimates);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandCost_GetCostGoals(self: *const T, pwszRowsetName: ?[*:0]const u16, pcCostGoals: ?*u32, prgCostGoals: ?*DBCOST) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandCost.VTable, self.vtable).GetCostGoals(@ptrCast(*const ICommandCost, self), pwszRowsetName, pcCostGoals, prgCostGoals);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandCost_GetCostLimits(self: *const T, pwszRowsetName: ?[*:0]const u16, pcCostLimits: ?*u32, prgCostLimits: ?*DBCOST) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandCost.VTable, self.vtable).GetCostLimits(@ptrCast(*const ICommandCost, self), pwszRowsetName, pcCostLimits, prgCostLimits);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandCost_SetCostGoals(self: *const T, pwszRowsetName: ?[*:0]const u16, cCostGoals: u32, rgCostGoals: ?*const DBCOST) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandCost.VTable, self.vtable).SetCostGoals(@ptrCast(*const ICommandCost, self), pwszRowsetName, cCostGoals, rgCostGoals);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandCost_SetCostLimits(self: *const T, pwszRowsetName: ?[*:0]const u16, cCostLimits: u32, prgCostLimits: ?*DBCOST, dwExecutionFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandCost.VTable, self.vtable).SetCostLimits(@ptrCast(*const ICommandCost, self), pwszRowsetName, cCostLimits, prgCostLimits, dwExecutionFlags);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICommandValidate_Value = Guid.initString("0c733a18-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ICommandValidate = &IID_ICommandValidate_Value;
pub const ICommandValidate = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ValidateCompletely: fn(
self: *const ICommandValidate,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ValidateSyntax: fn(
self: *const ICommandValidate,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandValidate_ValidateCompletely(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandValidate.VTable, self.vtable).ValidateCompletely(@ptrCast(*const ICommandValidate, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICommandValidate_ValidateSyntax(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICommandValidate.VTable, self.vtable).ValidateSyntax(@ptrCast(*const ICommandValidate, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ITableRename_Value = Guid.initString("0c733a77-2a1c-11ce-ade5-00aa0044773d");
pub const IID_ITableRename = &IID_ITableRename_Value;
pub const ITableRename = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
RenameColumn: fn(
self: *const ITableRename,
pTableId: ?*DBID,
pOldColumnId: ?*DBID,
pNewColumnId: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RenameTable: fn(
self: *const ITableRename,
pOldTableId: ?*DBID,
pOldIndexId: ?*DBID,
pNewTableId: ?*DBID,
pNewIndexId: ?*DBID,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableRename_RenameColumn(self: *const T, pTableId: ?*DBID, pOldColumnId: ?*DBID, pNewColumnId: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableRename.VTable, self.vtable).RenameColumn(@ptrCast(*const ITableRename, self), pTableId, pOldColumnId, pNewColumnId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ITableRename_RenameTable(self: *const T, pOldTableId: ?*DBID, pOldIndexId: ?*DBID, pNewTableId: ?*DBID, pNewIndexId: ?*DBID) callconv(.Inline) HRESULT {
return @ptrCast(*const ITableRename.VTable, self.vtable).RenameTable(@ptrCast(*const ITableRename, self), pOldTableId, pOldIndexId, pNewTableId, pNewIndexId);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDBSchemaCommand_Value = Guid.initString("0c733a50-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IDBSchemaCommand = &IID_IDBSchemaCommand_Value;
pub const IDBSchemaCommand = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetCommand: fn(
self: *const IDBSchemaCommand,
pUnkOuter: ?*IUnknown,
rguidSchema: ?*const Guid,
ppCommand: ?*?*ICommand,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSchemas: fn(
self: *const IDBSchemaCommand,
pcSchemas: ?*u32,
prgSchemas: ?*?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBSchemaCommand_GetCommand(self: *const T, pUnkOuter: ?*IUnknown, rguidSchema: ?*const Guid, ppCommand: ?*?*ICommand) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBSchemaCommand.VTable, self.vtable).GetCommand(@ptrCast(*const IDBSchemaCommand, self), pUnkOuter, rguidSchema, ppCommand);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDBSchemaCommand_GetSchemas(self: *const T, pcSchemas: ?*u32, prgSchemas: ?*?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const IDBSchemaCommand.VTable, self.vtable).GetSchemas(@ptrCast(*const IDBSchemaCommand, self), pcSchemas, prgSchemas);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IProvideMoniker_Value = Guid.initString("0c733a4d-2a1c-11ce-ade5-00aa0044773d");
pub const IID_IProvideMoniker = &IID_IProvideMoniker_Value;
pub const IProvideMoniker = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetMoniker: fn(
self: *const IProvideMoniker,
ppIMoniker: ?*?*IMoniker,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IProvideMoniker_GetMoniker(self: *const T, ppIMoniker: ?*?*IMoniker) callconv(.Inline) HRESULT {
return @ptrCast(*const IProvideMoniker.VTable, self.vtable).GetMoniker(@ptrCast(*const IProvideMoniker, self), ppIMoniker);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const NOTRESTRICTION = extern struct {
pRes: ?*RESTRICTION,
};
pub const NODERESTRICTION = extern struct {
cRes: u32,
paRes: ?*?*RESTRICTION,
reserved: u32,
};
pub const VECTORRESTRICTION = extern struct {
Node: NODERESTRICTION,
RankMethod: u32,
};
pub const CONTENTRESTRICTION = extern struct {
prop: FULLPROPSPEC,
pwcsPhrase: ?PWSTR,
lcid: u32,
ulGenerateMethod: u32,
};
pub const NATLANGUAGERESTRICTION = extern struct {
prop: FULLPROPSPEC,
pwcsPhrase: ?PWSTR,
lcid: u32,
};
pub const PROPERTYRESTRICTION = extern struct {
rel: u32,
prop: FULLPROPSPEC,
prval: PROPVARIANT,
};
pub const RESTRICTION = extern struct {
pub const _URes = extern union {
ar: NODERESTRICTION,
orRestriction: NODERESTRICTION,
pxr: NODERESTRICTION,
vr: VECTORRESTRICTION,
nr: NOTRESTRICTION,
cr: CONTENTRESTRICTION,
nlr: NATLANGUAGERESTRICTION,
pr: PROPERTYRESTRICTION,
};
rt: u32,
weight: u32,
res: _URes,
};
pub const COLUMNSET = extern struct {
cCol: u32,
aCol: ?*FULLPROPSPEC,
};
pub const SORTKEY = extern struct {
propColumn: FULLPROPSPEC,
dwOrder: u32,
locale: u32,
};
pub const SORTSET = extern struct {
cCol: u32,
aCol: ?*SORTKEY,
};
pub const BUCKETCATEGORIZE = extern struct {
cBuckets: u32,
Distribution: u32,
};
pub const RANGECATEGORIZE = extern struct {
cRange: u32,
aRangeBegin: ?*PROPVARIANT,
};
pub const CATEGORIZATION = extern struct {
ulCatType: u32,
Anonymous: extern union {
cClusters: u32,
bucket: BUCKETCATEGORIZE,
range: RANGECATEGORIZE,
},
csColumns: COLUMNSET,
};
pub const CATEGORIZATIONSET = extern struct {
cCat: u32,
aCat: ?*CATEGORIZATION,
};
const IID_ISearchQueryHits_Value = Guid.initString("ed8ce7e0-106c-11ce-84e2-00aa004b9986");
pub const IID_ISearchQueryHits = &IID_ISearchQueryHits_Value;
pub const ISearchQueryHits = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Init: fn(
self: *const ISearchQueryHits,
pflt: ?*IFilter,
ulFlags: u32,
) callconv(@import("std").os.windows.WINAPI) i32,
NextHitMoniker: fn(
self: *const ISearchQueryHits,
pcMnk: ?*u32,
papMnk: ?*?*?*IMoniker,
) callconv(@import("std").os.windows.WINAPI) i32,
NextHitOffset: fn(
self: *const ISearchQueryHits,
pcRegion: ?*u32,
paRegion: ?*?*FILTERREGION,
) 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 ISearchQueryHits_Init(self: *const T, pflt: ?*IFilter, ulFlags: u32) callconv(.Inline) i32 {
return @ptrCast(*const ISearchQueryHits.VTable, self.vtable).Init(@ptrCast(*const ISearchQueryHits, self), pflt, ulFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHits_NextHitMoniker(self: *const T, pcMnk: ?*u32, papMnk: ?*?*?*IMoniker) callconv(.Inline) i32 {
return @ptrCast(*const ISearchQueryHits.VTable, self.vtable).NextHitMoniker(@ptrCast(*const ISearchQueryHits, self), pcMnk, papMnk);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISearchQueryHits_NextHitOffset(self: *const T, pcRegion: ?*u32, paRegion: ?*?*FILTERREGION) callconv(.Inline) i32 {
return @ptrCast(*const ISearchQueryHits.VTable, self.vtable).NextHitOffset(@ptrCast(*const ISearchQueryHits, self), pcRegion, paRegion);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetQueryStatus_Value = Guid.initString("a7ac77ed-f8d7-11ce-a798-0020f8008024");
pub const IID_IRowsetQueryStatus = &IID_IRowsetQueryStatus_Value;
pub const IRowsetQueryStatus = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetStatus: fn(
self: *const IRowsetQueryStatus,
pdwStatus: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStatusEx: fn(
self: *const IRowsetQueryStatus,
pdwStatus: ?*u32,
pcFilteredDocuments: ?*u32,
pcDocumentsToFilter: ?*u32,
pdwRatioFinishedDenominator: ?*usize,
pdwRatioFinishedNumerator: ?*usize,
cbBmk: usize,
pBmk: ?*const u8,
piRowBmk: ?*usize,
pcRowsTotal: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetQueryStatus_GetStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetQueryStatus.VTable, self.vtable).GetStatus(@ptrCast(*const IRowsetQueryStatus, self), pdwStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetQueryStatus_GetStatusEx(self: *const T, pdwStatus: ?*u32, pcFilteredDocuments: ?*u32, pcDocumentsToFilter: ?*u32, pdwRatioFinishedDenominator: ?*usize, pdwRatioFinishedNumerator: ?*usize, cbBmk: usize, pBmk: ?*const u8, piRowBmk: ?*usize, pcRowsTotal: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetQueryStatus.VTable, self.vtable).GetStatusEx(@ptrCast(*const IRowsetQueryStatus, self), pdwStatus, pcFilteredDocuments, pcDocumentsToFilter, pdwRatioFinishedDenominator, pdwRatioFinishedNumerator, cbBmk, pBmk, piRowBmk, pcRowsTotal);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const ODBC_VS_ARGS = extern struct {
pguidEvent: ?*const Guid,
dwFlags: u32,
Anonymous1: extern union {
wszArg: ?PWSTR,
szArg: ?PSTR,
},
Anonymous2: extern union {
wszCorrelation: ?PWSTR,
szCorrelation: ?PSTR,
},
RetCode: i16,
};
pub const SQLVARENUM = enum(i32) {
EMPTY = 0,
NULL = 1,
UI1 = 17,
I2 = 2,
I4 = 3,
I8 = 20,
R4 = 4,
R8 = 5,
MONEY = 6,
SMALLMONEY = 200,
WSTRING = 201,
WVARSTRING = 202,
STRING = 203,
VARSTRING = 204,
BIT = 11,
GUID = 72,
NUMERIC = 131,
DECIMAL = 205,
DATETIME = 135,
SMALLDATETIME = 206,
BINARY = 207,
VARBINARY = 208,
UNKNOWN = 209,
};
pub const VT_SS_EMPTY = SQLVARENUM.EMPTY;
pub const VT_SS_NULL = SQLVARENUM.NULL;
pub const VT_SS_UI1 = SQLVARENUM.UI1;
pub const VT_SS_I2 = SQLVARENUM.I2;
pub const VT_SS_I4 = SQLVARENUM.I4;
pub const VT_SS_I8 = SQLVARENUM.I8;
pub const VT_SS_R4 = SQLVARENUM.R4;
pub const VT_SS_R8 = SQLVARENUM.R8;
pub const VT_SS_MONEY = SQLVARENUM.MONEY;
pub const VT_SS_SMALLMONEY = SQLVARENUM.SMALLMONEY;
pub const VT_SS_WSTRING = SQLVARENUM.WSTRING;
pub const VT_SS_WVARSTRING = SQLVARENUM.WVARSTRING;
pub const VT_SS_STRING = SQLVARENUM.STRING;
pub const VT_SS_VARSTRING = SQLVARENUM.VARSTRING;
pub const VT_SS_BIT = SQLVARENUM.BIT;
pub const VT_SS_GUID = SQLVARENUM.GUID;
pub const VT_SS_NUMERIC = SQLVARENUM.NUMERIC;
pub const VT_SS_DECIMAL = SQLVARENUM.DECIMAL;
pub const VT_SS_DATETIME = SQLVARENUM.DATETIME;
pub const VT_SS_SMALLDATETIME = SQLVARENUM.SMALLDATETIME;
pub const VT_SS_BINARY = SQLVARENUM.BINARY;
pub const VT_SS_VARBINARY = SQLVARENUM.VARBINARY;
pub const VT_SS_UNKNOWN = SQLVARENUM.UNKNOWN;
pub const SSVARIANT = extern struct {
vt: u16,
dwReserved1: u32,
dwReserved2: u32,
Anonymous: extern union {
pub const _UnknownType = extern struct {
dwActualLength: u32,
rgMetadata: [16]u8,
pUnknownData: ?*u8,
};
pub const _CharVal = extern struct {
sActualLength: i16,
sMaxLength: i16,
pchCharVal: ?PSTR,
rgbReserved: [5]u8,
dwReserved: u32,
pwchReserved: ?PWSTR,
};
pub const _BinaryVal = extern struct {
sActualLength: i16,
sMaxLength: i16,
prgbBinaryVal: ?*u8,
dwReserved: u32,
};
pub const _BLOBType = extern struct {
dbobj: DBOBJECT,
pUnk: ?*IUnknown,
};
pub const _NCharVal = extern struct {
sActualLength: i16,
sMaxLength: i16,
pwchNCharVal: ?PWSTR,
rgbReserved: [5]u8,
dwReserved: u32,
pwchReserved: ?PWSTR,
};
bTinyIntVal: u8,
sShortIntVal: i16,
lIntVal: i32,
llBigIntVal: i64,
fltRealVal: f32,
dblFloatVal: f64,
cyMoneyVal: CY,
NCharVal: _NCharVal,
CharVal: _CharVal,
fBitVal: i16,
rgbGuidVal: [16]u8,
numNumericVal: DB_NUMERIC,
BinaryVal: _BinaryVal,
tsDateTimeVal: DBTIMESTAMP,
UnknownType: _UnknownType,
BLOBType: _BLOBType,
},
};
const IID_IUMSInitialize_Value = Guid.initString("5cf4ca14-ef21-11d0-97e7-00c04fc2ad98");
pub const IID_IUMSInitialize = &IID_IUMSInitialize_Value;
pub const IUMSInitialize = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Initialize: fn(
self: *const IUMSInitialize,
pUMS: ?*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 IUMSInitialize_Initialize(self: *const T, pUMS: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IUMSInitialize.VTable, self.vtable).Initialize(@ptrCast(*const IUMSInitialize, self), pUMS);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const IUMS = extern struct {
pub const VTable = extern struct {
SqlUmsSuspend: fn(
self: *const IUMS,
ticks: u32,
) callconv(@import("std").os.windows.WINAPI) void,
SqlUmsYield: fn(
self: *const IUMS,
ticks: u32,
) callconv(@import("std").os.windows.WINAPI) void,
SqlUmsSwitchPremptive: fn(
self: *const IUMS,
) callconv(@import("std").os.windows.WINAPI) void,
SqlUmsSwitchNonPremptive: fn(
self: *const IUMS,
) callconv(@import("std").os.windows.WINAPI) void,
SqlUmsFIsPremptive: fn(
self: *const IUMS,
) callconv(@import("std").os.windows.WINAPI) BOOL,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUMS_SqlUmsSuspend(self: *const T, ticks: u32) callconv(.Inline) void {
return @ptrCast(*const IUMS.VTable, self.vtable).SqlUmsSuspend(@ptrCast(*const IUMS, self), ticks);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUMS_SqlUmsYield(self: *const T, ticks: u32) callconv(.Inline) void {
return @ptrCast(*const IUMS.VTable, self.vtable).SqlUmsYield(@ptrCast(*const IUMS, self), ticks);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUMS_SqlUmsSwitchPremptive(self: *const T) callconv(.Inline) void {
return @ptrCast(*const IUMS.VTable, self.vtable).SqlUmsSwitchPremptive(@ptrCast(*const IUMS, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUMS_SqlUmsSwitchNonPremptive(self: *const T) callconv(.Inline) void {
return @ptrCast(*const IUMS.VTable, self.vtable).SqlUmsSwitchNonPremptive(@ptrCast(*const IUMS, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IUMS_SqlUmsFIsPremptive(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const IUMS.VTable, self.vtable).SqlUmsFIsPremptive(@ptrCast(*const IUMS, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const tagSSErrorInfo = extern struct {
pwszMessage: ?PWSTR,
pwszServer: ?PWSTR,
pwszProcedure: ?PWSTR,
lNative: i32,
bState: u8,
bClass: u8,
wLineNumber: u16,
};
const IID_ISQLServerErrorInfo_Value = Guid.initString("5cf4ca12-ef21-11d0-97e7-00c04fc2ad98");
pub const IID_ISQLServerErrorInfo = &IID_ISQLServerErrorInfo_Value;
pub const ISQLServerErrorInfo = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetErrorInfo: fn(
self: *const ISQLServerErrorInfo,
ppErrorInfo: ?*?*tagSSErrorInfo,
ppStringsBuffer: ?*?*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 ISQLServerErrorInfo_GetErrorInfo(self: *const T, ppErrorInfo: ?*?*tagSSErrorInfo, ppStringsBuffer: ?*?*u16) callconv(.Inline) HRESULT {
return @ptrCast(*const ISQLServerErrorInfo.VTable, self.vtable).GetErrorInfo(@ptrCast(*const ISQLServerErrorInfo, self), ppErrorInfo, ppStringsBuffer);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IRowsetFastLoad_Value = Guid.initString("5cf4ca13-ef21-11d0-97e7-00c04fc2ad98");
pub const IID_IRowsetFastLoad = &IID_IRowsetFastLoad_Value;
pub const IRowsetFastLoad = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
InsertRow: fn(
self: *const IRowsetFastLoad,
hAccessor: usize,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Commit: fn(
self: *const IRowsetFastLoad,
fDone: 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 IRowsetFastLoad_InsertRow(self: *const T, hAccessor: usize, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetFastLoad.VTable, self.vtable).InsertRow(@ptrCast(*const IRowsetFastLoad, self), hAccessor, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IRowsetFastLoad_Commit(self: *const T, fDone: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IRowsetFastLoad.VTable, self.vtable).Commit(@ptrCast(*const IRowsetFastLoad, self), fDone);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const LOCKMODEENUM = enum(i32) {
INVALID = 0,
EXCLUSIVE = 1,
SHARED = 2,
};
pub const LOCKMODE_INVALID = LOCKMODEENUM.INVALID;
pub const LOCKMODE_EXCLUSIVE = LOCKMODEENUM.EXCLUSIVE;
pub const LOCKMODE_SHARED = LOCKMODEENUM.SHARED;
const IID_ISchemaLock_Value = Guid.initString("4c2389fb-2511-11d4-b258-00c04f7971ce");
pub const IID_ISchemaLock = &IID_ISchemaLock_Value;
pub const ISchemaLock = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetSchemaLock: fn(
self: *const ISchemaLock,
pTableID: ?*DBID,
lmMode: u32,
phLockHandle: ?*?HANDLE,
pTableVersion: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseSchemaLock: fn(
self: *const ISchemaLock,
hLockHandle: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaLock_GetSchemaLock(self: *const T, pTableID: ?*DBID, lmMode: u32, phLockHandle: ?*?HANDLE, pTableVersion: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaLock.VTable, self.vtable).GetSchemaLock(@ptrCast(*const ISchemaLock, self), pTableID, lmMode, phLockHandle, pTableVersion);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ISchemaLock_ReleaseSchemaLock(self: *const T, hLockHandle: ?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const ISchemaLock.VTable, self.vtable).ReleaseSchemaLock(@ptrCast(*const ISchemaLock, self), hLockHandle);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const SQL_ASYNC_NOTIFICATION_CALLBACK = fn(
pContext: ?*anyopaque,
fLast: BOOL,
) callconv(@import("std").os.windows.WINAPI) i16;
pub const DBVECTOR = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
size: usize,
ptr: ?*anyopaque,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
size: usize,
ptr: ?*anyopaque,
},
};
pub const DBTIMESTAMP = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
year: i16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16,
fraction: u32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
year: i16,
month: u16,
day: u16,
hour: u16,
minute: u16,
second: u16,
fraction: u32,
},
};
pub const SEC_OBJECT_ELEMENT = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
guidObjectType: Guid,
ObjectID: DBID,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
guidObjectType: Guid,
ObjectID: DBID,
},
};
pub const SEC_OBJECT = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cObjects: u32,
prgObjects: ?*SEC_OBJECT_ELEMENT,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cObjects: u32,
prgObjects: ?*SEC_OBJECT_ELEMENT,
},
};
pub const DBIMPLICITSESSION = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pUnkOuter: ?*IUnknown,
piid: ?*Guid,
pSession: ?*IUnknown,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pUnkOuter: ?*IUnknown,
piid: ?*Guid,
pSession: ?*IUnknown,
},
};
pub const DBOBJECT = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
dwFlags: u32,
iid: Guid,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwFlags: u32,
iid: Guid,
},
};
pub const DBBINDEXT = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pExtension: ?*u8,
ulExtension: usize,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pExtension: ?*u8,
ulExtension: usize,
},
};
pub const DBBINDING = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
iOrdinal: usize,
obValue: usize,
obLength: usize,
obStatus: usize,
pTypeInfo: ?*ITypeInfo,
pObject: ?*DBOBJECT,
pBindExt: ?*DBBINDEXT,
dwPart: u32,
dwMemOwner: u32,
eParamIO: u32,
cbMaxLen: usize,
dwFlags: u32,
wType: u16,
bPrecision: u8,
bScale: u8,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
iOrdinal: usize,
obValue: usize,
obLength: usize,
obStatus: usize,
pTypeInfo: ?*ITypeInfo,
pObject: ?*DBOBJECT,
pBindExt: ?*DBBINDEXT,
dwPart: u32,
dwMemOwner: u32,
eParamIO: u32,
cbMaxLen: usize,
dwFlags: u32,
wType: u16,
bPrecision: u8,
bScale: u8,
},
};
pub const DBFAILUREINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
hRow: usize,
iColumn: usize,
failure: HRESULT,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
hRow: usize,
iColumn: usize,
failure: HRESULT,
},
};
pub const DBCOLUMNINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pwszName: ?PWSTR,
pTypeInfo: ?*ITypeInfo,
iOrdinal: usize,
dwFlags: u32,
ulColumnSize: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
columnid: DBID,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pwszName: ?PWSTR,
pTypeInfo: ?*ITypeInfo,
iOrdinal: usize,
dwFlags: u32,
ulColumnSize: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
columnid: DBID,
},
};
pub const DBPARAMS = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pData: ?*anyopaque,
cParamSets: usize,
hAccessor: usize,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pData: ?*anyopaque,
cParamSets: usize,
hAccessor: usize,
},
};
pub const DBPARAMINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
dwFlags: u32,
iOrdinal: usize,
pwszName: ?PWSTR,
pTypeInfo: ?*ITypeInfo,
ulParamSize: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwFlags: u32,
iOrdinal: usize,
pwszName: ?PWSTR,
pTypeInfo: ?*ITypeInfo,
ulParamSize: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
},
};
pub const DBPROPIDSET = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
rgPropertyIDs: ?*u32,
cPropertyIDs: u32,
guidPropertySet: Guid,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
rgPropertyIDs: ?*u32,
cPropertyIDs: u32,
guidPropertySet: Guid,
},
};
pub const DBPROPINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pwszDescription: ?PWSTR,
dwPropertyID: u32,
dwFlags: u32,
vtType: u16,
vValues: VARIANT,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pwszDescription: ?PWSTR,
dwPropertyID: u32,
dwFlags: u32,
vtType: u16,
vValues: VARIANT,
},
};
pub const DBPROPINFOSET = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
rgPropertyInfos: ?*DBPROPINFO,
cPropertyInfos: u32,
guidPropertySet: Guid,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
rgPropertyInfos: ?*DBPROPINFO,
cPropertyInfos: u32,
guidPropertySet: Guid,
},
};
pub const DBPROP = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
dwPropertyID: u32,
dwOptions: u32,
dwStatus: u32,
colid: DBID,
vValue: VARIANT,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwPropertyID: u32,
dwOptions: u32,
dwStatus: u32,
colid: DBID,
vValue: VARIANT,
},
};
pub const DBPROPSET = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
rgProperties: ?*DBPROP,
cProperties: u32,
guidPropertySet: Guid,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
rgProperties: ?*DBPROP,
cProperties: u32,
guidPropertySet: Guid,
},
};
pub const DBINDEXCOLUMNDESC = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pColumnID: ?*DBID,
eIndexColOrder: u32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pColumnID: ?*DBID,
eIndexColOrder: u32,
},
};
pub const DBCOLUMNDESC = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pwszTypeName: ?PWSTR,
pTypeInfo: ?*ITypeInfo,
rgPropertySets: ?*DBPROPSET,
pclsid: ?*Guid,
cPropertySets: u32,
ulColumnSize: usize,
dbcid: DBID,
wType: u16,
bPrecision: u8,
bScale: u8,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pwszTypeName: ?PWSTR,
pTypeInfo: ?*ITypeInfo,
rgPropertySets: ?*DBPROPSET,
pclsid: ?*Guid,
cPropertySets: u32,
ulColumnSize: usize,
dbcid: DBID,
wType: u16,
bPrecision: u8,
bScale: u8,
},
};
pub const DBCOLUMNACCESS = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pData: ?*anyopaque,
columnid: DBID,
cbDataLen: usize,
dwStatus: u32,
cbMaxLen: usize,
dwReserved: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pData: ?*anyopaque,
columnid: DBID,
cbDataLen: usize,
dwStatus: u32,
cbMaxLen: usize,
dwReserved: usize,
wType: u16,
bPrecision: u8,
bScale: u8,
},
};
pub const DBCONSTRAINTDESC = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pConstraintID: ?*DBID,
ConstraintType: u32,
cColumns: usize,
rgColumnList: ?*DBID,
pReferencedTableID: ?*DBID,
cForeignKeyColumns: usize,
rgForeignKeyColumnList: ?*DBID,
pwszConstraintText: ?PWSTR,
UpdateRule: u32,
DeleteRule: u32,
MatchType: u32,
Deferrability: u32,
cReserved: usize,
rgReserved: ?*DBPROPSET,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pConstraintID: ?*DBID,
ConstraintType: u32,
cColumns: usize,
rgColumnList: ?*DBID,
pReferencedTableID: ?*DBID,
cForeignKeyColumns: usize,
rgForeignKeyColumnList: ?*DBID,
pwszConstraintText: ?PWSTR,
UpdateRule: u32,
DeleteRule: u32,
MatchType: u32,
Deferrability: u32,
cReserved: usize,
rgReserved: ?*DBPROPSET,
},
};
pub const MDAXISINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
cbSize: usize,
iAxis: usize,
cDimensions: usize,
cCoordinates: usize,
rgcColumns: ?*usize,
rgpwszDimensionNames: ?*?PWSTR,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
cbSize: usize,
iAxis: usize,
cDimensions: usize,
cCoordinates: usize,
rgcColumns: ?*usize,
rgpwszDimensionNames: ?*?PWSTR,
},
};
pub const RMTPACK = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pISeqStream: ?*ISequentialStream,
cbData: u32,
cBSTR: u32,
rgBSTR: ?*?BSTR,
cVARIANT: u32,
rgVARIANT: ?*VARIANT,
cIDISPATCH: u32,
rgIDISPATCH: ?*?*IDispatch,
cIUNKNOWN: u32,
rgIUNKNOWN: ?*?*IUnknown,
cPROPVARIANT: u32,
rgPROPVARIANT: ?*PROPVARIANT,
cArray: u32,
rgArray: ?*VARIANT,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pISeqStream: ?*ISequentialStream,
cbData: u32,
cBSTR: u32,
rgBSTR: ?*?BSTR,
cVARIANT: u32,
rgVARIANT: ?*VARIANT,
cIDISPATCH: u32,
rgIDISPATCH: ?*?*IDispatch,
cIUNKNOWN: u32,
rgIUNKNOWN: ?*?*IUnknown,
cPROPVARIANT: u32,
rgPROPVARIANT: ?*PROPVARIANT,
cArray: u32,
rgArray: ?*VARIANT,
},
};
pub const DBPARAMBINDINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pwszDataSourceType: ?PWSTR,
pwszName: ?PWSTR,
ulParamSize: usize,
dwFlags: u32,
bPrecision: u8,
bScale: u8,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pwszDataSourceType: ?PWSTR,
pwszName: ?PWSTR,
ulParamSize: usize,
dwFlags: u32,
bPrecision: u8,
bScale: u8,
},
};
pub const DBLITERALINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
pwszLiteralValue: ?PWSTR,
pwszInvalidChars: ?PWSTR,
pwszInvalidStartingChars: ?PWSTR,
lt: u32,
fSupported: BOOL,
cchMaxLen: u32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
pwszLiteralValue: ?PWSTR,
pwszInvalidChars: ?PWSTR,
pwszInvalidStartingChars: ?PWSTR,
lt: u32,
fSupported: BOOL,
cchMaxLen: u32,
},
};
pub const ERRORINFO = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
hrError: HRESULT,
dwMinor: u32,
clsid: Guid,
iid: Guid,
dispid: i32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
hrError: HRESULT,
dwMinor: u32,
clsid: Guid,
iid: Guid,
dispid: i32,
},
};
pub const tagDBROWWATCHRANGE = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
hRegion: usize,
eChangeKind: u32,
hRow: usize,
iRow: usize,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
hRegion: usize,
eChangeKind: u32,
hRow: usize,
iRow: usize,
},
};
pub const DBCOST = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
eKind: u32,
dwUnits: u32,
lValue: i32,
},
.X86 => extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
eKind: u32,
dwUnits: u32,
lValue: i32,
},
};
//--------------------------------------------------------------------------------
// Section: Functions (211)
//--------------------------------------------------------------------------------
pub extern "ODBC32" fn SQLAllocConnect(
EnvironmentHandle: ?*anyopaque,
ConnectionHandle: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLAllocEnv(
EnvironmentHandle: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLAllocHandle(
HandleType: i16,
InputHandle: ?*anyopaque,
OutputHandle: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLAllocStmt(
ConnectionHandle: ?*anyopaque,
StatementHandle: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLBindCol(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
TargetType: i16,
TargetValue: ?*anyopaque,
BufferLength: i64,
StrLen_or_Ind: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLBindParam(
StatementHandle: ?*anyopaque,
ParameterNumber: u16,
ValueType: i16,
ParameterType: i16,
LengthPrecision: u64,
ParameterScale: i16,
ParameterValue: ?*anyopaque,
StrLen_or_Ind: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLCancel(
StatementHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLCancelHandle(
HandleType: i16,
InputHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLCloseCursor(
StatementHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLColAttribute(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
FieldIdentifier: u16,
// TODO: what to do with BytesParamIndex 4?
CharacterAttribute: ?*anyopaque,
BufferLength: i16,
StringLength: ?*i16,
NumericAttribute: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLColumns(
StatementHandle: ?*anyopaque,
CatalogName: ?[*:0]u8,
NameLength1: i16,
SchemaName: ?[*:0]u8,
NameLength2: i16,
TableName: ?[*:0]u8,
NameLength3: i16,
ColumnName: ?[*:0]u8,
NameLength4: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLCompleteAsync(
HandleType: i16,
Handle: ?*anyopaque,
AsyncRetCodePtr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLConnect(
ConnectionHandle: ?*anyopaque,
ServerName: [*:0]u8,
NameLength1: i16,
UserName: [*:0]u8,
NameLength2: i16,
Authentication: [*:0]u8,
NameLength3: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLCopyDesc(
SourceDescHandle: ?*anyopaque,
TargetDescHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDataSources(
EnvironmentHandle: ?*anyopaque,
Direction: u16,
ServerName: ?[*:0]u8,
BufferLength1: i16,
NameLength1Ptr: ?*i16,
Description: ?[*:0]u8,
BufferLength2: i16,
NameLength2Ptr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLDescribeCol(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
ColumnName: ?[*:0]u8,
BufferLength: i16,
NameLength: ?*i16,
DataType: ?*i16,
ColumnSize: ?*u64,
DecimalDigits: ?*i16,
Nullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLDisconnect(
ConnectionHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLEndTran(
HandleType: i16,
Handle: ?*anyopaque,
CompletionType: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLError(
EnvironmentHandle: ?*anyopaque,
ConnectionHandle: ?*anyopaque,
StatementHandle: ?*anyopaque,
Sqlstate: *[6]u8,
NativeError: ?*i32,
MessageText: ?[*:0]u8,
BufferLength: i16,
TextLength: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLExecDirect(
StatementHandle: ?*anyopaque,
StatementText: ?[*:0]u8,
TextLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLExecute(
StatementHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLFetch(
StatementHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLFetchScroll(
StatementHandle: ?*anyopaque,
FetchOrientation: i16,
FetchOffset: i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLFreeConnect(
ConnectionHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLFreeEnv(
EnvironmentHandle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLFreeHandle(
HandleType: i16,
Handle: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLFreeStmt(
StatementHandle: ?*anyopaque,
Option: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetConnectAttr(
ConnectionHandle: ?*anyopaque,
Attribute: i32,
Value: ?*anyopaque,
BufferLength: i32,
StringLengthPtr: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetConnectOption(
ConnectionHandle: ?*anyopaque,
Option: u16,
Value: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetCursorName(
StatementHandle: ?*anyopaque,
CursorName: ?[*:0]u8,
BufferLength: i16,
NameLengthPtr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLGetData(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
TargetType: i16,
TargetValue: ?*anyopaque,
BufferLength: i64,
StrLen_or_IndPtr: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLGetDescField(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
FieldIdentifier: i16,
Value: ?*anyopaque,
BufferLength: i32,
StringLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLGetDescRec(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
Name: ?[*:0]u8,
BufferLength: i16,
StringLengthPtr: ?*i16,
TypePtr: ?*i16,
SubTypePtr: ?*i16,
LengthPtr: ?*i64,
PrecisionPtr: ?*i16,
ScalePtr: ?*i16,
NullablePtr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLGetDiagField(
HandleType: i16,
Handle: ?*anyopaque,
RecNumber: i16,
DiagIdentifier: i16,
DiagInfo: ?*anyopaque,
BufferLength: i16,
StringLength: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetDiagRec(
HandleType: i16,
Handle: ?*anyopaque,
RecNumber: i16,
Sqlstate: ?*[6]u8,
NativeError: ?*i32,
MessageText: ?[*:0]u8,
BufferLength: i16,
TextLength: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetEnvAttr(
EnvironmentHandle: ?*anyopaque,
Attribute: i32,
Value: ?*anyopaque,
BufferLength: i32,
StringLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetFunctions(
ConnectionHandle: ?*anyopaque,
FunctionId: u16,
Supported: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetInfo(
ConnectionHandle: ?*anyopaque,
InfoType: u16,
// TODO: what to do with BytesParamIndex 3?
InfoValue: ?*anyopaque,
BufferLength: i16,
StringLengthPtr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetStmtAttr(
StatementHandle: ?*anyopaque,
Attribute: i32,
Value: ?*anyopaque,
BufferLength: i32,
StringLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetStmtOption(
StatementHandle: ?*anyopaque,
Option: u16,
Value: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetTypeInfo(
StatementHandle: ?*anyopaque,
DataType: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLNumResultCols(
StatementHandle: ?*anyopaque,
ColumnCount: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLParamData(
StatementHandle: ?*anyopaque,
Value: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLPrepare(
StatementHandle: ?*anyopaque,
StatementText: [*:0]u8,
TextLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLPutData(
StatementHandle: ?*anyopaque,
Data: ?*anyopaque,
StrLen_or_Ind: i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLRowCount(
StatementHandle: ?*anyopaque,
RowCount: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSetConnectAttr(
ConnectionHandle: ?*anyopaque,
Attribute: i32,
// TODO: what to do with BytesParamIndex 3?
Value: ?*anyopaque,
StringLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetConnectOption(
ConnectionHandle: ?*anyopaque,
Option: u16,
Value: u64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSetCursorName(
StatementHandle: ?*anyopaque,
CursorName: [*:0]u8,
NameLength: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetDescField(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
FieldIdentifier: i16,
Value: ?*anyopaque,
BufferLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetDescRec(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
Type: i16,
SubType: i16,
Length: i64,
Precision: i16,
Scale: i16,
// TODO: what to do with BytesParamIndex 4?
Data: ?*anyopaque,
StringLength: ?*i64,
Indicator: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSetEnvAttr(
EnvironmentHandle: ?*anyopaque,
Attribute: i32,
// TODO: what to do with BytesParamIndex 3?
Value: ?*anyopaque,
StringLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetParam(
StatementHandle: ?*anyopaque,
ParameterNumber: u16,
ValueType: i16,
ParameterType: i16,
LengthPrecision: u64,
ParameterScale: i16,
ParameterValue: ?*anyopaque,
StrLen_or_Ind: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSetStmtAttr(
StatementHandle: ?*anyopaque,
Attribute: i32,
Value: ?*anyopaque,
StringLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetStmtOption(
StatementHandle: ?*anyopaque,
Option: u16,
Value: u64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSpecialColumns(
StatementHandle: ?*anyopaque,
IdentifierType: u16,
CatalogName: ?[*:0]u8,
NameLength1: i16,
SchemaName: ?[*:0]u8,
NameLength2: i16,
TableName: ?[*:0]u8,
NameLength3: i16,
Scope: u16,
Nullable: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLStatistics(
StatementHandle: ?*anyopaque,
CatalogName: ?[*:0]u8,
NameLength1: i16,
SchemaName: ?[*:0]u8,
NameLength2: i16,
TableName: ?[*:0]u8,
NameLength3: i16,
Unique: u16,
Reserved: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLTables(
StatementHandle: ?*anyopaque,
CatalogName: ?[*:0]u8,
NameLength1: i16,
SchemaName: ?[*:0]u8,
NameLength2: i16,
TableName: ?[*:0]u8,
NameLength3: i16,
TableType: ?[*:0]u8,
NameLength4: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLTransact(
EnvironmentHandle: ?*anyopaque,
ConnectionHandle: ?*anyopaque,
CompletionType: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_batch(
param0: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "odbcbcp" fn bcp_bind(
param0: ?*anyopaque,
param1: ?*u8,
param2: i32,
param3: i32,
param4: ?*u8,
param5: i32,
param6: i32,
param7: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_colfmt(
param0: ?*anyopaque,
param1: i32,
param2: u8,
param3: i32,
param4: i32,
param5: ?*u8,
param6: i32,
param7: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_collen(
param0: ?*anyopaque,
param1: i32,
param2: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_colptr(
param0: ?*anyopaque,
param1: ?*u8,
param2: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_columns(
param0: ?*anyopaque,
param1: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_control(
param0: ?*anyopaque,
param1: i32,
param2: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_done(
param0: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i32;
pub extern "odbcbcp" fn bcp_exec(
param0: ?*anyopaque,
param1: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_getcolfmt(
param0: ?*anyopaque,
param1: i32,
param2: i32,
param3: ?*anyopaque,
param4: i32,
param5: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_initA(
param0: ?*anyopaque,
param1: ?[*:0]const u8,
param2: ?[*:0]const u8,
param3: ?[*:0]const u8,
param4: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_initW(
param0: ?*anyopaque,
param1: ?[*:0]const u16,
param2: ?[*:0]const u16,
param3: ?[*:0]const u16,
param4: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_moretext(
param0: ?*anyopaque,
param1: i32,
param2: ?*u8,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_readfmtA(
param0: ?*anyopaque,
param1: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_readfmtW(
param0: ?*anyopaque,
param1: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_sendrow(
param0: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_setcolfmt(
param0: ?*anyopaque,
param1: i32,
param2: i32,
param3: ?*anyopaque,
param4: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_writefmtA(
param0: ?*anyopaque,
param1: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn bcp_writefmtW(
param0: ?*anyopaque,
param1: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn dbprtypeA(
param0: i32,
) callconv(@import("std").os.windows.WINAPI) ?PSTR;
pub extern "odbcbcp" fn dbprtypeW(
param0: i32,
) callconv(@import("std").os.windows.WINAPI) ?PWSTR;
pub extern "odbcbcp" fn SQLLinkedServers(
param0: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn SQLLinkedCatalogsA(
param0: ?*anyopaque,
param1: ?[*:0]const u8,
param2: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn SQLLinkedCatalogsW(
param0: ?*anyopaque,
param1: ?[*:0]const u16,
param2: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn SQLInitEnumServers(
pwchServerName: ?PWSTR,
pwchInstanceName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) ?HANDLE;
pub extern "odbcbcp" fn SQLGetNextEnumeration(
hEnumHandle: ?HANDLE,
prgEnumData: ?*u8,
piEnumLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "odbcbcp" fn SQLCloseEnumServers(
hEnumHandle: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDriverConnect(
hdbc: ?*anyopaque,
hwnd: isize,
szConnStrIn: [*:0]u8,
cchConnStrIn: i16,
szConnStrOut: ?[*:0]u8,
cchConnStrOutMax: i16,
pcchConnStrOut: ?*i16,
fDriverCompletion: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLBrowseConnect(
hdbc: ?*anyopaque,
szConnStrIn: [*:0]u8,
cchConnStrIn: i16,
szConnStrOut: ?[*:0]u8,
cchConnStrOutMax: i16,
pcchConnStrOut: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLBulkOperations(
StatementHandle: ?*anyopaque,
Operation: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLColAttributes(
hstmt: ?*anyopaque,
icol: u16,
fDescType: u16,
rgbDesc: ?*anyopaque,
cbDescMax: i16,
pcbDesc: ?*i16,
pfDesc: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLColumnPrivileges(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cchCatalogName: i16,
szSchemaName: ?[*:0]u8,
cchSchemaName: i16,
szTableName: ?[*:0]u8,
cchTableName: i16,
szColumnName: ?[*:0]u8,
cchColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLDescribeParam(
hstmt: ?*anyopaque,
ipar: u16,
pfSqlType: ?*i16,
pcbParamDef: ?*u64,
pibScale: ?*i16,
pfNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLExtendedFetch(
hstmt: ?*anyopaque,
fFetchType: u16,
irow: i64,
pcrow: ?*u64,
rgfRowStatus: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLForeignKeys(
hstmt: ?*anyopaque,
szPkCatalogName: ?[*:0]u8,
cchPkCatalogName: i16,
szPkSchemaName: ?[*:0]u8,
cchPkSchemaName: i16,
szPkTableName: ?[*:0]u8,
cchPkTableName: i16,
szFkCatalogName: ?[*:0]u8,
cchFkCatalogName: i16,
szFkSchemaName: ?[*:0]u8,
cchFkSchemaName: i16,
szFkTableName: ?[*:0]u8,
cchFkTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLMoreResults(
hstmt: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLNativeSql(
hdbc: ?*anyopaque,
szSqlStrIn: [*:0]u8,
cchSqlStrIn: i32,
szSqlStr: ?[*:0]u8,
cchSqlStrMax: i32,
pcbSqlStr: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLNumParams(
hstmt: ?*anyopaque,
pcpar: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLParamOptions(
hstmt: ?*anyopaque,
crow: u64,
pirow: ?*u64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLPrimaryKeys(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cchCatalogName: i16,
szSchemaName: ?[*:0]u8,
cchSchemaName: i16,
szTableName: ?[*:0]u8,
cchTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLProcedureColumns(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cchCatalogName: i16,
szSchemaName: ?[*:0]u8,
cchSchemaName: i16,
szProcName: ?[*:0]u8,
cchProcName: i16,
szColumnName: ?[*:0]u8,
cchColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLProcedures(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cchCatalogName: i16,
szSchemaName: ?[*:0]u8,
cchSchemaName: i16,
szProcName: ?[*:0]u8,
cchProcName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetPos(
hstmt: ?*anyopaque,
irow: u64,
fOption: u16,
fLock: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLTablePrivileges(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cchCatalogName: i16,
szSchemaName: ?[*:0]u8,
cchSchemaName: i16,
szTableName: ?[*:0]u8,
cchTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDrivers(
henv: ?*anyopaque,
fDirection: u16,
szDriverDesc: ?[*:0]u8,
cchDriverDescMax: i16,
pcchDriverDesc: ?*i16,
szDriverAttributes: ?[*:0]u8,
cchDrvrAttrMax: i16,
pcchDrvrAttr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLBindParameter(
hstmt: ?*anyopaque,
ipar: u16,
fParamType: i16,
fCType: i16,
fSqlType: i16,
cbColDef: u64,
ibScale: i16,
rgbValue: ?*anyopaque,
cbValueMax: i64,
pcbValue: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLAllocHandleStd(
fHandleType: i16,
hInput: ?*anyopaque,
phOutput: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetScrollOptions(
hstmt: ?*anyopaque,
fConcurrency: u16,
crowKeyset: i64,
crowRowset: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn ODBCSetTryWaitValue(
dwValue: u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub extern "ODBC32" fn ODBCGetTryWaitValue(
) callconv(@import("std").os.windows.WINAPI) u32;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLColAttributeW(
hstmt: ?*anyopaque,
iCol: u16,
iField: u16,
// TODO: what to do with BytesParamIndex 4?
pCharAttr: ?*anyopaque,
cbDescMax: i16,
pcbCharAttr: ?*i16,
pNumAttr: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLColAttributesW(
hstmt: ?*anyopaque,
icol: u16,
fDescType: u16,
// TODO: what to do with BytesParamIndex 4?
rgbDesc: ?*anyopaque,
cbDescMax: i16,
pcbDesc: ?*i16,
pfDesc: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLConnectW(
hdbc: ?*anyopaque,
szDSN: [*:0]u16,
cchDSN: i16,
szUID: [*:0]u16,
cchUID: i16,
szAuthStr: [*:0]u16,
cchAuthStr: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLDescribeColW(
hstmt: ?*anyopaque,
icol: u16,
szColName: ?[*:0]u16,
cchColNameMax: i16,
pcchColName: ?*i16,
pfSqlType: ?*i16,
pcbColDef: ?*u64,
pibScale: ?*i16,
pfNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLErrorW(
henv: ?*anyopaque,
hdbc: ?*anyopaque,
hstmt: ?*anyopaque,
wszSqlState: *[6]u16,
pfNativeError: ?*i32,
wszErrorMsg: ?[*:0]u16,
cchErrorMsgMax: i16,
pcchErrorMsg: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLExecDirectW(
hstmt: ?*anyopaque,
szSqlStr: ?[*:0]u16,
TextLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetConnectAttrW(
hdbc: ?*anyopaque,
fAttribute: i32,
rgbValue: ?*anyopaque,
cbValueMax: i32,
pcbValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetCursorNameW(
hstmt: ?*anyopaque,
szCursor: ?[*:0]u16,
cchCursorMax: i16,
pcchCursor: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetDescFieldW(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
FieldIdentifier: i16,
Value: ?*anyopaque,
BufferLength: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetDescFieldW(
hdesc: ?*anyopaque,
iRecord: i16,
iField: i16,
rgbValue: ?*anyopaque,
cbBufferLength: i32,
StringLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLGetDescRecW(
hdesc: ?*anyopaque,
iRecord: i16,
szName: ?[*:0]u16,
cchNameMax: i16,
pcchName: ?*i16,
pfType: ?*i16,
pfSubType: ?*i16,
pLength: ?*i64,
pPrecision: ?*i16,
pScale: ?*i16,
pNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLGetDiagFieldW(
fHandleType: i16,
handle: ?*anyopaque,
iRecord: i16,
fDiagField: i16,
rgbDiagInfo: ?*anyopaque,
cbBufferLength: i16,
pcbStringLength: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetDiagRecW(
fHandleType: i16,
handle: ?*anyopaque,
iRecord: i16,
szSqlState: ?*[6]u16,
pfNativeError: ?*i32,
szErrorMsg: ?[*:0]u16,
cchErrorMsgMax: i16,
pcchErrorMsg: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLPrepareW(
hstmt: ?*anyopaque,
szSqlStr: [*:0]u16,
cchSqlStr: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetConnectAttrW(
hdbc: ?*anyopaque,
fAttribute: i32,
// TODO: what to do with BytesParamIndex 3?
rgbValue: ?*anyopaque,
cbValue: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetCursorNameW(
hstmt: ?*anyopaque,
szCursor: [*:0]u16,
cchCursor: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLColumnsW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
szColumnName: ?[*:0]u16,
cchColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetConnectOptionW(
hdbc: ?*anyopaque,
fOption: u16,
pvParam: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetInfoW(
hdbc: ?*anyopaque,
fInfoType: u16,
// TODO: what to do with BytesParamIndex 3?
rgbInfoValue: ?*anyopaque,
cbInfoValueMax: i16,
pcbInfoValue: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetTypeInfoW(
StatementHandle: ?*anyopaque,
DataType: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetConnectOptionW(
hdbc: ?*anyopaque,
fOption: u16,
vParam: u64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSpecialColumnsW(
hstmt: ?*anyopaque,
fColType: u16,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
fScope: u16,
fNullable: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLStatisticsW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
fUnique: u16,
fAccuracy: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLTablesW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
szTableType: ?[*:0]u16,
cchTableType: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDataSourcesW(
henv: ?*anyopaque,
fDirection: u16,
szDSN: ?[*:0]u16,
cchDSNMax: i16,
pcchDSN: ?*i16,
wszDescription: ?[*:0]u16,
cchDescriptionMax: i16,
pcchDescription: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDriverConnectW(
hdbc: ?*anyopaque,
hwnd: isize,
szConnStrIn: [*:0]u16,
cchConnStrIn: i16,
szConnStrOut: ?[*:0]u16,
cchConnStrOutMax: i16,
pcchConnStrOut: ?*i16,
fDriverCompletion: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLBrowseConnectW(
hdbc: ?*anyopaque,
szConnStrIn: [*:0]u16,
cchConnStrIn: i16,
szConnStrOut: ?[*:0]u16,
cchConnStrOutMax: i16,
pcchConnStrOut: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLColumnPrivilegesW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
szColumnName: ?[*:0]u16,
cchColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetStmtAttrW(
hstmt: ?*anyopaque,
fAttribute: i32,
rgbValue: ?*anyopaque,
cbValueMax: i32,
pcbValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetStmtAttrW(
hstmt: ?*anyopaque,
fAttribute: i32,
rgbValue: ?*anyopaque,
cbValueMax: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLForeignKeysW(
hstmt: ?*anyopaque,
szPkCatalogName: ?[*:0]u16,
cchPkCatalogName: i16,
szPkSchemaName: ?[*:0]u16,
cchPkSchemaName: i16,
szPkTableName: ?[*:0]u16,
cchPkTableName: i16,
szFkCatalogName: ?[*:0]u16,
cchFkCatalogName: i16,
szFkSchemaName: ?[*:0]u16,
cchFkSchemaName: i16,
szFkTableName: ?[*:0]u16,
cchFkTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLNativeSqlW(
hdbc: ?*anyopaque,
szSqlStrIn: [*:0]u16,
cchSqlStrIn: i32,
szSqlStr: ?[*:0]u16,
cchSqlStrMax: i32,
pcchSqlStr: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLPrimaryKeysW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLProcedureColumnsW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szProcName: ?[*:0]u16,
cchProcName: i16,
szColumnName: ?[*:0]u16,
cchColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLProceduresW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szProcName: ?[*:0]u16,
cchProcName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLTablePrivilegesW(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u16,
cchCatalogName: i16,
szSchemaName: ?[*:0]u16,
cchSchemaName: i16,
szTableName: ?[*:0]u16,
cchTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDriversW(
henv: ?*anyopaque,
fDirection: u16,
szDriverDesc: ?[*:0]u16,
cchDriverDescMax: i16,
pcchDriverDesc: ?*i16,
szDriverAttributes: ?[*:0]u16,
cchDrvrAttrMax: i16,
pcchDrvrAttr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLColAttributeA(
hstmt: ?*anyopaque,
iCol: i16,
iField: i16,
// TODO: what to do with BytesParamIndex 4?
pCharAttr: ?*anyopaque,
cbCharAttrMax: i16,
pcbCharAttr: ?*i16,
pNumAttr: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLColAttributesA(
hstmt: ?*anyopaque,
icol: u16,
fDescType: u16,
// TODO: what to do with BytesParamIndex 4?
rgbDesc: ?*anyopaque,
cbDescMax: i16,
pcbDesc: ?*i16,
pfDesc: ?*i64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLConnectA(
hdbc: ?*anyopaque,
szDSN: [*:0]u8,
cbDSN: i16,
szUID: [*:0]u8,
cbUID: i16,
szAuthStr: [*:0]u8,
cbAuthStr: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLDescribeColA(
hstmt: ?*anyopaque,
icol: u16,
szColName: ?[*:0]u8,
cbColNameMax: i16,
pcbColName: ?*i16,
pfSqlType: ?*i16,
pcbColDef: ?*u64,
pibScale: ?*i16,
pfNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLErrorA(
henv: ?*anyopaque,
hdbc: ?*anyopaque,
hstmt: ?*anyopaque,
szSqlState: ?*u8,
pfNativeError: ?*i32,
szErrorMsg: ?[*:0]u8,
cbErrorMsgMax: i16,
pcbErrorMsg: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLExecDirectA(
hstmt: ?*anyopaque,
szSqlStr: ?[*:0]u8,
cbSqlStr: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetConnectAttrA(
hdbc: ?*anyopaque,
fAttribute: i32,
rgbValue: ?*anyopaque,
cbValueMax: i32,
pcbValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetCursorNameA(
hstmt: ?*anyopaque,
szCursor: ?[*:0]u8,
cbCursorMax: i16,
pcbCursor: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetDescFieldA(
hdesc: ?*anyopaque,
iRecord: i16,
iField: i16,
rgbValue: ?*anyopaque,
cbBufferLength: i32,
StringLength: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLGetDescRecA(
hdesc: ?*anyopaque,
iRecord: i16,
szName: ?[*:0]u8,
cbNameMax: i16,
pcbName: ?*i16,
pfType: ?*i16,
pfSubType: ?*i16,
pLength: ?*i64,
pPrecision: ?*i16,
pScale: ?*i16,
pNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLGetDiagFieldA(
fHandleType: i16,
handle: ?*anyopaque,
iRecord: i16,
fDiagField: i16,
rgbDiagInfo: ?*anyopaque,
cbDiagInfoMax: i16,
pcbDiagInfo: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetDiagRecA(
fHandleType: i16,
handle: ?*anyopaque,
iRecord: i16,
szSqlState: ?*[6]u8,
pfNativeError: ?*i32,
szErrorMsg: ?[*:0]u8,
cbErrorMsgMax: i16,
pcbErrorMsg: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetStmtAttrA(
hstmt: ?*anyopaque,
fAttribute: i32,
rgbValue: ?*anyopaque,
cbValueMax: i32,
pcbValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetTypeInfoA(
StatementHandle: ?*anyopaque,
DataType: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLPrepareA(
hstmt: ?*anyopaque,
szSqlStr: [*:0]u8,
cbSqlStr: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetConnectAttrA(
hdbc: ?*anyopaque,
fAttribute: i32,
// TODO: what to do with BytesParamIndex 3?
rgbValue: ?*anyopaque,
cbValue: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLSetCursorNameA(
hstmt: ?*anyopaque,
szCursor: [*:0]u8,
cbCursor: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLColumnsA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
szColumnName: ?[*:0]u8,
cbColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetConnectOptionA(
hdbc: ?*anyopaque,
fOption: u16,
pvParam: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLGetInfoA(
hdbc: ?*anyopaque,
fInfoType: u16,
// TODO: what to do with BytesParamIndex 3?
rgbInfoValue: ?*anyopaque,
cbInfoValueMax: i16,
pcbInfoValue: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X64, .Arm64 => struct {
pub extern "ODBC32" fn SQLSetConnectOptionA(
hdbc: ?*anyopaque,
fOption: u16,
vParam: u64,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub extern "ODBC32" fn SQLSpecialColumnsA(
hstmt: ?*anyopaque,
fColType: u16,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
fScope: u16,
fNullable: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLStatisticsA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
fUnique: u16,
fAccuracy: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLTablesA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
szTableType: ?[*:0]u8,
cbTableType: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDataSourcesA(
henv: ?*anyopaque,
fDirection: u16,
szDSN: ?[*:0]u8,
cbDSNMax: i16,
pcbDSN: ?*i16,
szDescription: ?[*:0]u8,
cbDescriptionMax: i16,
pcbDescription: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDriverConnectA(
hdbc: ?*anyopaque,
hwnd: isize,
szConnStrIn: [*:0]u8,
cbConnStrIn: i16,
szConnStrOut: ?[*:0]u8,
cbConnStrOutMax: i16,
pcbConnStrOut: ?*i16,
fDriverCompletion: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLBrowseConnectA(
hdbc: ?*anyopaque,
szConnStrIn: [*:0]u8,
cbConnStrIn: i16,
szConnStrOut: ?[*:0]u8,
cbConnStrOutMax: i16,
pcbConnStrOut: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLColumnPrivilegesA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
szColumnName: ?[*:0]u8,
cbColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLForeignKeysA(
hstmt: ?*anyopaque,
szPkCatalogName: ?[*:0]u8,
cbPkCatalogName: i16,
szPkSchemaName: ?[*:0]u8,
cbPkSchemaName: i16,
szPkTableName: ?[*:0]u8,
cbPkTableName: i16,
szFkCatalogName: ?[*:0]u8,
cbFkCatalogName: i16,
szFkSchemaName: ?[*:0]u8,
cbFkSchemaName: i16,
szFkTableName: ?[*:0]u8,
cbFkTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLNativeSqlA(
hdbc: ?*anyopaque,
szSqlStrIn: [*:0]u8,
cbSqlStrIn: i32,
szSqlStr: ?[*:0]u8,
cbSqlStrMax: i32,
pcbSqlStr: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLPrimaryKeysA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLProcedureColumnsA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szProcName: ?[*:0]u8,
cbProcName: i16,
szColumnName: ?[*:0]u8,
cbColumnName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLProceduresA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szProcName: ?[*:0]u8,
cbProcName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLTablePrivilegesA(
hstmt: ?*anyopaque,
szCatalogName: ?[*:0]u8,
cbCatalogName: i16,
szSchemaName: ?[*:0]u8,
cbSchemaName: i16,
szTableName: ?[*:0]u8,
cbTableName: i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub extern "ODBC32" fn SQLDriversA(
henv: ?*anyopaque,
fDirection: u16,
szDriverDesc: ?[*:0]u8,
cbDriverDescMax: i16,
pcbDriverDesc: ?*i16,
szDriverAttributes: ?[*:0]u8,
cbDrvrAttrMax: i16,
pcbDrvrAttr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLBindCol(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
TargetType: i16,
TargetValue: ?*anyopaque,
BufferLength: i32,
StrLen_or_Ind: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLBindParam(
StatementHandle: ?*anyopaque,
ParameterNumber: u16,
ValueType: i16,
ParameterType: i16,
LengthPrecision: u32,
ParameterScale: i16,
ParameterValue: ?*anyopaque,
StrLen_or_Ind: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLColAttribute(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
FieldIdentifier: u16,
// TODO: what to do with BytesParamIndex 4?
CharacterAttribute: ?*anyopaque,
BufferLength: i16,
StringLength: ?*i16,
NumericAttribute: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLDescribeCol(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
ColumnName: ?[*:0]u8,
BufferLength: i16,
NameLength: ?*i16,
DataType: ?*i16,
ColumnSize: ?*u32,
DecimalDigits: ?*i16,
Nullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLFetchScroll(
StatementHandle: ?*anyopaque,
FetchOrientation: i16,
FetchOffset: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLGetData(
StatementHandle: ?*anyopaque,
ColumnNumber: u16,
TargetType: i16,
TargetValue: ?*anyopaque,
BufferLength: i32,
StrLen_or_IndPtr: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLGetDescRec(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
Name: ?[*:0]u8,
BufferLength: i16,
StringLengthPtr: ?*i16,
TypePtr: ?*i16,
SubTypePtr: ?*i16,
LengthPtr: ?*i32,
PrecisionPtr: ?*i16,
ScalePtr: ?*i16,
NullablePtr: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLPutData(
StatementHandle: ?*anyopaque,
Data: ?*anyopaque,
StrLen_or_Ind: i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLRowCount(
StatementHandle: ?*anyopaque,
RowCount: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetConnectOption(
ConnectionHandle: ?*anyopaque,
Option: u16,
Value: u32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetDescRec(
DescriptorHandle: ?*anyopaque,
RecNumber: i16,
Type: i16,
SubType: i16,
Length: i32,
Precision: i16,
Scale: i16,
// TODO: what to do with BytesParamIndex 4?
Data: ?*anyopaque,
StringLength: ?*i32,
Indicator: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetParam(
StatementHandle: ?*anyopaque,
ParameterNumber: u16,
ValueType: i16,
ParameterType: i16,
LengthPrecision: u32,
ParameterScale: i16,
ParameterValue: ?*anyopaque,
StrLen_or_Ind: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetStmtOption(
StatementHandle: ?*anyopaque,
Option: u16,
Value: u32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLColAttributes(
hstmt: ?*anyopaque,
icol: u16,
fDescType: u16,
rgbDesc: ?*anyopaque,
cbDescMax: i16,
pcbDesc: ?*i16,
pfDesc: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLDescribeParam(
hstmt: ?*anyopaque,
ipar: u16,
pfSqlType: ?*i16,
pcbParamDef: ?*u32,
pibScale: ?*i16,
pfNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLExtendedFetch(
hstmt: ?*anyopaque,
fFetchType: u16,
irow: i32,
pcrow: ?*u32,
rgfRowStatus: ?*u16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLParamOptions(
hstmt: ?*anyopaque,
crow: u32,
pirow: ?*u32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetPos(
hstmt: ?*anyopaque,
irow: u16,
fOption: u16,
fLock: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLBindParameter(
hstmt: ?*anyopaque,
ipar: u16,
fParamType: i16,
fCType: i16,
fSqlType: i16,
cbColDef: u32,
ibScale: i16,
rgbValue: ?*anyopaque,
cbValueMax: i32,
pcbValue: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetScrollOptions(
hstmt: ?*anyopaque,
fConcurrency: u16,
crowKeyset: i32,
crowRowset: u16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLColAttributeW(
hstmt: ?*anyopaque,
iCol: u16,
iField: u16,
// TODO: what to do with BytesParamIndex 4?
pCharAttr: ?*anyopaque,
cbDescMax: i16,
pcbCharAttr: ?*i16,
pNumAttr: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLColAttributesW(
hstmt: ?*anyopaque,
icol: u16,
fDescType: u16,
// TODO: what to do with BytesParamIndex 4?
rgbDesc: ?*anyopaque,
cbDescMax: i16,
pcbDesc: ?*i16,
pfDesc: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLDescribeColW(
hstmt: ?*anyopaque,
icol: u16,
szColName: ?[*:0]u16,
cchColNameMax: i16,
pcchColName: ?*i16,
pfSqlType: ?*i16,
pcbColDef: ?*u32,
pibScale: ?*i16,
pfNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLGetDescRecW(
hdesc: ?*anyopaque,
iRecord: i16,
szName: ?[*:0]u16,
cchNameMax: i16,
pcchName: ?*i16,
pfType: ?*i16,
pfSubType: ?*i16,
pLength: ?*i32,
pPrecision: ?*i16,
pScale: ?*i16,
pNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetConnectOptionW(
hdbc: ?*anyopaque,
fOption: u16,
vParam: u32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLColAttributeA(
hstmt: ?*anyopaque,
iCol: i16,
iField: i16,
// TODO: what to do with BytesParamIndex 4?
pCharAttr: ?*anyopaque,
cbCharAttrMax: i16,
pcbCharAttr: ?*i16,
pNumAttr: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLColAttributesA(
hstmt: ?*anyopaque,
icol: u16,
fDescType: u16,
// TODO: what to do with BytesParamIndex 4?
rgbDesc: ?*anyopaque,
cbDescMax: i16,
pcbDesc: ?*i16,
pfDesc: ?*i32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLDescribeColA(
hstmt: ?*anyopaque,
icol: u16,
szColName: ?[*:0]u8,
cbColNameMax: i16,
pcbColName: ?*i16,
pfSqlType: ?*i16,
pcbColDef: ?*u32,
pibScale: ?*i16,
pfNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLGetDescRecA(
hdesc: ?*anyopaque,
iRecord: i16,
szName: ?[*:0]u8,
cbNameMax: i16,
pcbName: ?*i16,
pfType: ?*i16,
pfSubType: ?*i16,
pLength: ?*i32,
pPrecision: ?*i16,
pScale: ?*i16,
pNullable: ?*i16,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
pub usingnamespace switch (@import("../zig.zig").arch) {
.X86 => struct {
pub extern "ODBC32" fn SQLSetConnectOptionA(
hdbc: ?*anyopaque,
fOption: u16,
vParam: u32,
) callconv(@import("std").os.windows.WINAPI) i16;
}, else => struct { } };
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (5)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
pub const bcp_init = thismodule.bcp_initA;
pub const bcp_readfmt = thismodule.bcp_readfmtA;
pub const bcp_writefmt = thismodule.bcp_writefmtA;
pub const dbprtype = thismodule.dbprtypeA;
pub const SQLLinkedCatalogs = thismodule.SQLLinkedCatalogsA;
},
.wide => struct {
pub const bcp_init = thismodule.bcp_initW;
pub const bcp_readfmt = thismodule.bcp_readfmtW;
pub const bcp_writefmt = thismodule.bcp_writefmtW;
pub const dbprtype = thismodule.dbprtypeW;
pub const SQLLinkedCatalogs = thismodule.SQLLinkedCatalogsW;
},
.unspecified => if (@import("builtin").is_test) struct {
pub const bcp_init = *opaque{};
pub const bcp_readfmt = *opaque{};
pub const bcp_writefmt = *opaque{};
pub const dbprtype = *opaque{};
pub const SQLLinkedCatalogs = *opaque{};
} else struct {
pub const bcp_init = @compileError("'bcp_init' requires that UNICODE be set to true or false in the root module");
pub const bcp_readfmt = @compileError("'bcp_readfmt' requires that UNICODE be set to true or false in the root module");
pub const bcp_writefmt = @compileError("'bcp_writefmt' requires that UNICODE be set to true or false in the root module");
pub const dbprtype = @compileError("'dbprtype' requires that UNICODE be set to true or false in the root module");
pub const SQLLinkedCatalogs = @compileError("'SQLLinkedCatalogs' requires that UNICODE be set to true or false in the root module");
},
};
//--------------------------------------------------------------------------------
// Section: Imports (44)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BLOB = @import("../system/com.zig").BLOB;
const BOOL = @import("../foundation.zig").BOOL;
const BSTR = @import("../foundation.zig").BSTR;
const CONDITION_OPERATION = @import("../system/search/common.zig").CONDITION_OPERATION;
const CONDITION_TYPE = @import("../system/search/common.zig").CONDITION_TYPE;
const COSERVERINFO = @import("../system/com.zig").COSERVERINFO;
const CY = @import("../system/com.zig").CY;
const DBID = @import("../storage/index_server.zig").DBID;
const DISPPARAMS = @import("../system/com.zig").DISPPARAMS;
const EXPLICIT_ACCESS_W = @import("../security/authorization.zig").EXPLICIT_ACCESS_W;
const FILETIME = @import("../foundation.zig").FILETIME;
const FILTERREGION = @import("../storage/index_server.zig").FILTERREGION;
const FULLPROPSPEC = @import("../storage/index_server.zig").FULLPROPSPEC;
const HANDLE = @import("../foundation.zig").HANDLE;
const HRESULT = @import("../foundation.zig").HRESULT;
const HWND = @import("../foundation.zig").HWND;
const IAuthenticate = @import("../system/com.zig").IAuthenticate;
const IDispatch = @import("../system/com.zig").IDispatch;
const IEnumString = @import("../system/com.zig").IEnumString;
const IEnumUnknown = @import("../system/com.zig").IEnumUnknown;
const IErrorInfo = @import("../system/com.zig").IErrorInfo;
const IFilter = @import("../storage/index_server.zig").IFilter;
const IMoniker = @import("../system/com.zig").IMoniker;
const IObjectArray = @import("../ui/shell/common.zig").IObjectArray;
const IPersistStream = @import("../system/com.zig").IPersistStream;
const IPhraseSink = @import("../storage/index_server.zig").IPhraseSink;
const ISequentialStream = @import("../system/com.zig").ISequentialStream;
const IStorage = @import("../system/com/structured_storage.zig").IStorage;
const IStream = @import("../system/com.zig").IStream;
const ITransaction = @import("../system/distributed_transaction_coordinator.zig").ITransaction;
const ITransactionOptions = @import("../system/distributed_transaction_coordinator.zig").ITransactionOptions;
const ITypeInfo = @import("../system/com.zig").ITypeInfo;
const IUnknown = @import("../system/com.zig").IUnknown;
const MULTI_QI = @import("../system/com.zig").MULTI_QI;
const PROPERTYKEY = @import("../ui/shell/properties_system.zig").PROPERTYKEY;
const PROPSPEC = @import("../system/com/structured_storage.zig").PROPSPEC;
const PROPVARIANT = @import("../system/com/structured_storage.zig").PROPVARIANT;
const PSTR = @import("../foundation.zig").PSTR;
const PWSTR = @import("../foundation.zig").PWSTR;
const SYSTEMTIME = @import("../foundation.zig").SYSTEMTIME;
const TRUSTEE_W = @import("../security/authorization.zig").TRUSTEE_W;
const VARIANT = @import("../system/com.zig").VARIANT;
const WORDREP_BREAK_TYPE = @import("../storage/index_server.zig").WORDREP_BREAK_TYPE;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "PFNFILLTEXTBUFFER")) { _ = PFNFILLTEXTBUFFER; }
if (@hasDecl(@This(), "SQL_ASYNC_NOTIFICATION_CALLBACK")) { _ = SQL_ASYNC_NOTIFICATION_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;
}
}
}
//--------------------------------------------------------------------------------
// Section: SubModules (1)
//--------------------------------------------------------------------------------
pub const common = @import("search/common.zig"); | win32/system/search.zig |
pub const RASNAP_ProbationTime = @as(u32, 1);
pub const RASTUNNELENDPOINT_UNKNOWN = @as(u32, 0);
pub const RASTUNNELENDPOINT_IPv4 = @as(u32, 1);
pub const RASTUNNELENDPOINT_IPv6 = @as(u32, 2);
pub const RAS_MaxDeviceType = @as(u32, 16);
pub const RAS_MaxPhoneNumber = @as(u32, 128);
pub const RAS_MaxIpAddress = @as(u32, 15);
pub const RAS_MaxIpxAddress = @as(u32, 21);
pub const RAS_MaxEntryName = @as(u32, 256);
pub const RAS_MaxDeviceName = @as(u32, 128);
pub const RAS_MaxCallbackNumber = @as(u32, 128);
pub const RAS_MaxAreaCode = @as(u32, 10);
pub const RAS_MaxPadType = @as(u32, 32);
pub const RAS_MaxX25Address = @as(u32, 200);
pub const RAS_MaxFacilities = @as(u32, 200);
pub const RAS_MaxUserData = @as(u32, 200);
pub const RAS_MaxReplyMessage = @as(u32, 1024);
pub const RAS_MaxDnsSuffix = @as(u32, 256);
pub const RASCF_AllUsers = @as(u32, 1);
pub const RASCF_GlobalCreds = @as(u32, 2);
pub const RASCF_OwnerKnown = @as(u32, 4);
pub const RASCF_OwnerMatch = @as(u32, 8);
pub const RAS_MaxIDSize = @as(u32, 256);
pub const RASCS_PAUSED = @as(u32, 4096);
pub const RASCS_DONE = @as(u32, 8192);
pub const RASCSS_DONE = @as(u32, 8192);
pub const RDEOPT_UsePrefixSuffix = @as(u32, 1);
pub const RDEOPT_PausedStates = @as(u32, 2);
pub const RDEOPT_IgnoreModemSpeaker = @as(u32, 4);
pub const RDEOPT_SetModemSpeaker = @as(u32, 8);
pub const RDEOPT_IgnoreSoftwareCompression = @as(u32, 16);
pub const RDEOPT_SetSoftwareCompression = @as(u32, 32);
pub const RDEOPT_DisableConnectedUI = @as(u32, 64);
pub const RDEOPT_DisableReconnectUI = @as(u32, 128);
pub const RDEOPT_DisableReconnect = @as(u32, 256);
pub const RDEOPT_NoUser = @as(u32, 512);
pub const RDEOPT_PauseOnScript = @as(u32, 1024);
pub const RDEOPT_Router = @as(u32, 2048);
pub const RDEOPT_CustomDial = @as(u32, 4096);
pub const RDEOPT_UseCustomScripting = @as(u32, 8192);
pub const RDEOPT_InvokeAutoTriggerCredentialUI = @as(u32, 16384);
pub const RDEOPT_EapInfoCryptInCapable = @as(u32, 32768);
pub const REN_User = @as(u32, 0);
pub const REN_AllUsers = @as(u32, 1);
pub const RASIPO_VJ = @as(u32, 1);
pub const RASLCPO_PFC = @as(u32, 1);
pub const RASLCPO_ACFC = @as(u32, 2);
pub const RASLCPO_SSHF = @as(u32, 4);
pub const RASLCPO_DES_56 = @as(u32, 8);
pub const RASLCPO_3_DES = @as(u32, 16);
pub const RASLCPO_AES_128 = @as(u32, 32);
pub const RASLCPO_AES_256 = @as(u32, 64);
pub const RASLCPO_AES_192 = @as(u32, 128);
pub const RASLCPO_GCM_AES_128 = @as(u32, 256);
pub const RASLCPO_GCM_AES_192 = @as(u32, 512);
pub const RASLCPO_GCM_AES_256 = @as(u32, 1024);
pub const RASCCPCA_MPPC = @as(u32, 6);
pub const RASCCPCA_STAC = @as(u32, 5);
pub const RASCCPO_Compression = @as(u32, 1);
pub const RASCCPO_HistoryLess = @as(u32, 2);
pub const RASCCPO_Encryption56bit = @as(u32, 16);
pub const RASCCPO_Encryption40bit = @as(u32, 32);
pub const RASCCPO_Encryption128bit = @as(u32, 64);
pub const RASIKEv2_AUTH_MACHINECERTIFICATES = @as(u32, 1);
pub const RASIKEv2_AUTH_EAP = @as(u32, 2);
pub const RASIKEv2_AUTH_PSK = @as(u32, 3);
pub const WM_RASDIALEVENT = @as(u32, 52429);
pub const ET_None = @as(u32, 0);
pub const ET_Require = @as(u32, 1);
pub const ET_RequireMax = @as(u32, 2);
pub const ET_Optional = @as(u32, 3);
pub const VS_Default = @as(u32, 0);
pub const VS_PptpOnly = @as(u32, 1);
pub const VS_PptpFirst = @as(u32, 2);
pub const VS_L2tpOnly = @as(u32, 3);
pub const VS_L2tpFirst = @as(u32, 4);
pub const VS_SstpOnly = @as(u32, 5);
pub const VS_SstpFirst = @as(u32, 6);
pub const VS_Ikev2Only = @as(u32, 7);
pub const VS_Ikev2First = @as(u32, 8);
pub const VS_GREOnly = @as(u32, 9);
pub const VS_PptpSstp = @as(u32, 12);
pub const VS_L2tpSstp = @as(u32, 13);
pub const VS_Ikev2Sstp = @as(u32, 14);
pub const VS_ProtocolList = @as(u32, 15);
pub const RASEO_UseCountryAndAreaCodes = @as(u32, 1);
pub const RASEO_SpecificIpAddr = @as(u32, 2);
pub const RASEO_SpecificNameServers = @as(u32, 4);
pub const RASEO_IpHeaderCompression = @as(u32, 8);
pub const RASEO_RemoteDefaultGateway = @as(u32, 16);
pub const RASEO_DisableLcpExtensions = @as(u32, 32);
pub const RASEO_TerminalBeforeDial = @as(u32, 64);
pub const RASEO_TerminalAfterDial = @as(u32, 128);
pub const RASEO_ModemLights = @as(u32, 256);
pub const RASEO_SwCompression = @as(u32, 512);
pub const RASEO_RequireEncryptedPw = @as(u32, 1024);
pub const RASEO_RequireMsEncryptedPw = @as(u32, 2048);
pub const RASEO_RequireDataEncryption = @as(u32, 4096);
pub const RASEO_NetworkLogon = @as(u32, 8192);
pub const RASEO_UseLogonCredentials = @as(u32, 16384);
pub const RASEO_PromoteAlternates = @as(u32, 32768);
pub const RASEO_SecureLocalFiles = @as(u32, 65536);
pub const RASEO_RequireEAP = @as(u32, 131072);
pub const RASEO_RequirePAP = @as(u32, 262144);
pub const RASEO_RequireSPAP = @as(u32, 524288);
pub const RASEO_Custom = @as(u32, 1048576);
pub const RASEO_PreviewPhoneNumber = @as(u32, 2097152);
pub const RASEO_SharedPhoneNumbers = @as(u32, 8388608);
pub const RASEO_PreviewUserPw = @as(u32, 16777216);
pub const RASEO_PreviewDomain = @as(u32, 33554432);
pub const RASEO_ShowDialingProgress = @as(u32, 67108864);
pub const RASEO_RequireCHAP = @as(u32, 134217728);
pub const RASEO_RequireMsCHAP = @as(u32, 268435456);
pub const RASEO_RequireMsCHAP2 = @as(u32, 536870912);
pub const RASEO_RequireW95MSCHAP = @as(u32, 1073741824);
pub const RASEO_CustomScript = @as(u32, 2147483648);
pub const RASEO2_SecureFileAndPrint = @as(u32, 1);
pub const RASEO2_SecureClientForMSNet = @as(u32, 2);
pub const RASEO2_DontNegotiateMultilink = @as(u32, 4);
pub const RASEO2_DontUseRasCredentials = @as(u32, 8);
pub const RASEO2_UsePreSharedKey = @as(u32, 16);
pub const RASEO2_Internet = @as(u32, 32);
pub const RASEO2_DisableNbtOverIP = @as(u32, 64);
pub const RASEO2_UseGlobalDeviceSettings = @as(u32, 128);
pub const RASEO2_ReconnectIfDropped = @as(u32, 256);
pub const RASEO2_SharePhoneNumbers = @as(u32, 512);
pub const RASEO2_SecureRoutingCompartment = @as(u32, 1024);
pub const RASEO2_UseTypicalSettings = @as(u32, 2048);
pub const RASEO2_IPv6SpecificNameServers = @as(u32, 4096);
pub const RASEO2_IPv6RemoteDefaultGateway = @as(u32, 8192);
pub const RASEO2_RegisterIpWithDNS = @as(u32, 16384);
pub const RASEO2_UseDNSSuffixForRegistration = @as(u32, 32768);
pub const RASEO2_IPv4ExplicitMetric = @as(u32, 65536);
pub const RASEO2_IPv6ExplicitMetric = @as(u32, 131072);
pub const RASEO2_DisableIKENameEkuCheck = @as(u32, 262144);
pub const RASEO2_DisableClassBasedStaticRoute = @as(u32, 524288);
pub const RASEO2_SpecificIPv6Addr = @as(u32, 1048576);
pub const RASEO2_DisableMobility = @as(u32, 2097152);
pub const RASEO2_RequireMachineCertificates = @as(u32, 4194304);
pub const RASEO2_UsePreSharedKeyForIkev2Initiator = @as(u32, 8388608);
pub const RASEO2_UsePreSharedKeyForIkev2Responder = @as(u32, 16777216);
pub const RASEO2_CacheCredentials = @as(u32, 33554432);
pub const RASEO2_AutoTriggerCapable = @as(u32, 67108864);
pub const RASEO2_IsThirdPartyProfile = @as(u32, 134217728);
pub const RASEO2_AuthTypeIsOtp = @as(u32, 268435456);
pub const RASEO2_IsAlwaysOn = @as(u32, 536870912);
pub const RASEO2_IsPrivateNetwork = @as(u32, 1073741824);
pub const RASEO2_PlumbIKEv2TSAsRoutes = @as(u32, 2147483648);
pub const RASNP_NetBEUI = @as(u32, 1);
pub const RASNP_Ipx = @as(u32, 2);
pub const RASNP_Ip = @as(u32, 4);
pub const RASNP_Ipv6 = @as(u32, 8);
pub const RASFP_Ppp = @as(u32, 1);
pub const RASFP_Slip = @as(u32, 2);
pub const RASFP_Ras = @as(u32, 4);
pub const RASET_Phone = @as(u32, 1);
pub const RASET_Vpn = @as(u32, 2);
pub const RASET_Direct = @as(u32, 3);
pub const RASET_Internet = @as(u32, 4);
pub const RASET_Broadband = @as(u32, 5);
pub const RASCN_Connection = @as(u32, 1);
pub const RASCN_Disconnection = @as(u32, 2);
pub const RASCN_BandwidthAdded = @as(u32, 4);
pub const RASCN_BandwidthRemoved = @as(u32, 8);
pub const RASCN_Dormant = @as(u32, 16);
pub const RASCN_ReConnection = @as(u32, 32);
pub const RASCN_EPDGPacketArrival = @as(u32, 64);
pub const RASIDS_Disabled = @as(u32, 4294967295);
pub const RASIDS_UseGlobalValue = @as(u32, 0);
pub const RASADFLG_PositionDlg = @as(u32, 1);
pub const RASCM_UserName = @as(u32, 1);
pub const RASCM_Password = @as(u32, 2);
pub const RASCM_Domain = @as(u32, 4);
pub const RASCM_DefaultCreds = @as(u32, 8);
pub const RASCM_PreSharedKey = @as(u32, 16);
pub const RASCM_ServerPreSharedKey = @as(u32, 32);
pub const RASCM_DDMPreSharedKey = @as(u32, 64);
pub const RASADP_DisableConnectionQuery = @as(u32, 0);
pub const RASADP_LoginSessionDisable = @as(u32, 1);
pub const RASADP_SavedAddressesLimit = @as(u32, 2);
pub const RASADP_FailedConnectionTimeout = @as(u32, 3);
pub const RASADP_ConnectionQueryTimeout = @as(u32, 4);
pub const RASEAPF_NonInteractive = @as(u32, 2);
pub const RASEAPF_Logon = @as(u32, 4);
pub const RASEAPF_Preview = @as(u32, 8);
pub const RCD_SingleUser = @as(u32, 0);
pub const RCD_AllUsers = @as(u32, 1);
pub const RCD_Eap = @as(u32, 2);
pub const RCD_Logon = @as(u32, 4);
pub const RASPBDEVENT_AddEntry = @as(u32, 1);
pub const RASPBDEVENT_EditEntry = @as(u32, 2);
pub const RASPBDEVENT_RemoveEntry = @as(u32, 3);
pub const RASPBDEVENT_DialEntry = @as(u32, 4);
pub const RASPBDEVENT_EditGlobals = @as(u32, 5);
pub const RASPBDEVENT_NoUser = @as(u32, 6);
pub const RASPBDEVENT_NoUserEdit = @as(u32, 7);
pub const RASNOUSER_SmartCard = @as(u32, 1);
pub const RASPBDFLAG_PositionDlg = @as(u32, 1);
pub const RASPBDFLAG_ForceCloseOnDial = @as(u32, 2);
pub const RASPBDFLAG_NoUser = @as(u32, 16);
pub const RASPBDFLAG_UpdateDefaults = @as(u32, 2147483648);
pub const RASEDFLAG_PositionDlg = @as(u32, 1);
pub const RASEDFLAG_NewEntry = @as(u32, 2);
pub const RASEDFLAG_CloneEntry = @as(u32, 4);
pub const RASEDFLAG_NoRename = @as(u32, 8);
pub const RASEDFLAG_ShellOwned = @as(u32, 1073741824);
pub const RASEDFLAG_NewPhoneEntry = @as(u32, 16);
pub const RASEDFLAG_NewTunnelEntry = @as(u32, 32);
pub const RASEDFLAG_NewDirectEntry = @as(u32, 64);
pub const RASEDFLAG_NewBroadbandEntry = @as(u32, 128);
pub const RASEDFLAG_InternetEntry = @as(u32, 256);
pub const RASEDFLAG_NAT = @as(u32, 512);
pub const RASEDFLAG_IncomingConnection = @as(u32, 1024);
pub const RASDDFLAG_PositionDlg = @as(u32, 1);
pub const RASDDFLAG_NoPrompt = @as(u32, 2);
pub const RASDDFLAG_AoacRedial = @as(u32, 4);
pub const RASDDFLAG_LinkFailure = @as(u32, 2147483648);
pub const PID_IPX = @as(u32, 43);
pub const PID_IP = @as(u32, 33);
pub const PID_IPV6 = @as(u32, 87);
pub const PID_NBF = @as(u32, 63);
pub const PID_ATALK = @as(u32, 41);
pub const MPR_INTERFACE_OUT_OF_RESOURCES = @as(u32, 1);
pub const MPR_INTERFACE_ADMIN_DISABLED = @as(u32, 2);
pub const MPR_INTERFACE_CONNECTION_FAILURE = @as(u32, 4);
pub const MPR_INTERFACE_SERVICE_PAUSED = @as(u32, 8);
pub const MPR_INTERFACE_DIALOUT_HOURS_RESTRICTION = @as(u32, 16);
pub const MPR_INTERFACE_NO_MEDIA_SENSE = @as(u32, 32);
pub const MPR_INTERFACE_NO_DEVICE = @as(u32, 64);
pub const MPR_MaxDeviceType = @as(u32, 16);
pub const MPR_MaxPhoneNumber = @as(u32, 128);
pub const MPR_MaxIpAddress = @as(u32, 15);
pub const MPR_MaxIpxAddress = @as(u32, 21);
pub const MPR_MaxEntryName = @as(u32, 256);
pub const MPR_MaxDeviceName = @as(u32, 128);
pub const MPR_MaxCallbackNumber = @as(u32, 128);
pub const MPR_MaxAreaCode = @as(u32, 10);
pub const MPR_MaxPadType = @as(u32, 32);
pub const MPR_MaxX25Address = @as(u32, 200);
pub const MPR_MaxFacilities = @as(u32, 200);
pub const MPR_MaxUserData = @as(u32, 200);
pub const MPRIO_SpecificIpAddr = @as(u32, 2);
pub const MPRIO_SpecificNameServers = @as(u32, 4);
pub const MPRIO_IpHeaderCompression = @as(u32, 8);
pub const MPRIO_RemoteDefaultGateway = @as(u32, 16);
pub const MPRIO_DisableLcpExtensions = @as(u32, 32);
pub const MPRIO_SwCompression = @as(u32, 512);
pub const MPRIO_RequireEncryptedPw = @as(u32, 1024);
pub const MPRIO_RequireMsEncryptedPw = @as(u32, 2048);
pub const MPRIO_RequireDataEncryption = @as(u32, 4096);
pub const MPRIO_NetworkLogon = @as(u32, 8192);
pub const MPRIO_PromoteAlternates = @as(u32, 32768);
pub const MPRIO_SecureLocalFiles = @as(u32, 65536);
pub const MPRIO_RequireEAP = @as(u32, 131072);
pub const MPRIO_RequirePAP = @as(u32, 262144);
pub const MPRIO_RequireSPAP = @as(u32, 524288);
pub const MPRIO_SharedPhoneNumbers = @as(u32, 8388608);
pub const MPRIO_RequireCHAP = @as(u32, 134217728);
pub const MPRIO_RequireMsCHAP = @as(u32, 268435456);
pub const MPRIO_RequireMsCHAP2 = @as(u32, 536870912);
pub const MPRIO_IpSecPreSharedKey = @as(u32, 2147483648);
pub const MPRIO_RequireMachineCertificates = @as(u32, 16777216);
pub const MPRIO_UsePreSharedKeyForIkev2Initiator = @as(u32, 33554432);
pub const MPRIO_UsePreSharedKeyForIkev2Responder = @as(u32, 67108864);
pub const MPRNP_Ipx = @as(u32, 2);
pub const MPRNP_Ip = @as(u32, 4);
pub const MPRNP_Ipv6 = @as(u32, 8);
pub const MPRET_Phone = @as(u32, 1);
pub const MPRET_Vpn = @as(u32, 2);
pub const MPRET_Direct = @as(u32, 3);
pub const MPRIDS_Disabled = @as(u32, 4294967295);
pub const MPRIDS_UseGlobalValue = @as(u32, 0);
pub const MPR_VS_Ikev2Only = @as(u32, 7);
pub const MPR_VS_Ikev2First = @as(u32, 8);
pub const MPR_ENABLE_RAS_ON_DEVICE = @as(u32, 1);
pub const MPR_ENABLE_ROUTING_ON_DEVICE = @as(u32, 2);
pub const IPADDRESSLEN = @as(u32, 15);
pub const IPXADDRESSLEN = @as(u32, 22);
pub const ATADDRESSLEN = @as(u32, 32);
pub const MAXIPADRESSLEN = @as(u32, 64);
pub const PPP_IPCP_VJ = @as(u32, 1);
pub const PPP_CCP_COMPRESSION = @as(u32, 1);
pub const PPP_CCP_ENCRYPTION40BITOLD = @as(u32, 16);
pub const PPP_CCP_ENCRYPTION40BIT = @as(u32, 32);
pub const PPP_CCP_ENCRYPTION128BIT = @as(u32, 64);
pub const PPP_CCP_ENCRYPTION56BIT = @as(u32, 128);
pub const PPP_CCP_HISTORYLESS = @as(u32, 16777216);
pub const PPP_LCP_MULTILINK_FRAMING = @as(u32, 1);
pub const PPP_LCP_PFC = @as(u32, 2);
pub const PPP_LCP_ACFC = @as(u32, 4);
pub const PPP_LCP_SSHF = @as(u32, 8);
pub const PPP_LCP_DES_56 = @as(u32, 16);
pub const PPP_LCP_3_DES = @as(u32, 32);
pub const PPP_LCP_AES_128 = @as(u32, 64);
pub const PPP_LCP_AES_256 = @as(u32, 128);
pub const PPP_LCP_AES_192 = @as(u32, 256);
pub const PPP_LCP_GCM_AES_128 = @as(u32, 512);
pub const PPP_LCP_GCM_AES_192 = @as(u32, 1024);
pub const PPP_LCP_GCM_AES_256 = @as(u32, 2048);
pub const RAS_FLAGS_RAS_CONNECTION = @as(u32, 4);
pub const RASPRIV_NoCallback = @as(u32, 1);
pub const RASPRIV_AdminSetCallback = @as(u32, 2);
pub const RASPRIV_CallerSetCallback = @as(u32, 4);
pub const RASPRIV_DialinPrivilege = @as(u32, 8);
pub const RASPRIV2_DialinPolicy = @as(u32, 1);
pub const MPRAPI_IKEV2_AUTH_USING_CERT = @as(u32, 1);
pub const MPRAPI_IKEV2_AUTH_USING_EAP = @as(u32, 2);
pub const MPRAPI_PPP_PROJECTION_INFO_TYPE = @as(u32, 1);
pub const MPRAPI_IKEV2_PROJECTION_INFO_TYPE = @as(u32, 2);
pub const MPRAPI_RAS_CONNECTION_OBJECT_REVISION_1 = @as(u32, 1);
pub const MPRAPI_MPR_IF_CUSTOM_CONFIG_OBJECT_REVISION_1 = @as(u32, 1);
pub const MPRAPI_IF_CUSTOM_CONFIG_FOR_IKEV2 = @as(u32, 1);
pub const MPRAPI_MPR_IF_CUSTOM_CONFIG_OBJECT_REVISION_3 = @as(u32, 3);
pub const MPRAPI_MPR_IF_CUSTOM_CONFIG_OBJECT_REVISION_2 = @as(u32, 2);
pub const MPRAPI_IKEV2_SET_TUNNEL_CONFIG_PARAMS = @as(u32, 1);
pub const MPRAPI_L2TP_SET_TUNNEL_CONFIG_PARAMS = @as(u32, 1);
pub const MAX_SSTP_HASH_SIZE = @as(u32, 32);
pub const MPRAPI_MPR_SERVER_OBJECT_REVISION_1 = @as(u32, 1);
pub const MPRAPI_MPR_SERVER_OBJECT_REVISION_2 = @as(u32, 2);
pub const MPRAPI_MPR_SERVER_OBJECT_REVISION_3 = @as(u32, 3);
pub const MPRAPI_MPR_SERVER_OBJECT_REVISION_4 = @as(u32, 4);
pub const MPRAPI_MPR_SERVER_OBJECT_REVISION_5 = @as(u32, 5);
pub const MPRAPI_MPR_SERVER_SET_CONFIG_OBJECT_REVISION_1 = @as(u32, 1);
pub const MPRAPI_MPR_SERVER_SET_CONFIG_OBJECT_REVISION_2 = @as(u32, 2);
pub const MPRAPI_MPR_SERVER_SET_CONFIG_OBJECT_REVISION_3 = @as(u32, 3);
pub const MPRAPI_MPR_SERVER_SET_CONFIG_OBJECT_REVISION_4 = @as(u32, 4);
pub const MPRAPI_MPR_SERVER_SET_CONFIG_OBJECT_REVISION_5 = @as(u32, 5);
pub const MPRAPI_SET_CONFIG_PROTOCOL_FOR_PPTP = @as(u32, 1);
pub const MPRAPI_SET_CONFIG_PROTOCOL_FOR_L2TP = @as(u32, 2);
pub const MPRAPI_SET_CONFIG_PROTOCOL_FOR_SSTP = @as(u32, 4);
pub const MPRAPI_SET_CONFIG_PROTOCOL_FOR_IKEV2 = @as(u32, 8);
pub const MPRAPI_SET_CONFIG_PROTOCOL_FOR_GRE = @as(u32, 16);
pub const ALLOW_NO_AUTH = @as(u32, 1);
pub const DO_NOT_ALLOW_NO_AUTH = @as(u32, 0);
pub const MPRAPI_RAS_UPDATE_CONNECTION_OBJECT_REVISION_1 = @as(u32, 1);
pub const MPRAPI_ADMIN_DLL_VERSION_1 = @as(u32, 1);
pub const MPRAPI_ADMIN_DLL_VERSION_2 = @as(u32, 2);
pub const MGM_JOIN_STATE_FLAG = @as(u32, 1);
pub const MGM_FORWARD_STATE_FLAG = @as(u32, 2);
pub const MGM_MFE_STATS_0 = @as(u32, 1);
pub const MGM_MFE_STATS_1 = @as(u32, 2);
pub const RTM_MAX_ADDRESS_SIZE = @as(u32, 16);
pub const RTM_MAX_VIEWS = @as(u32, 32);
pub const RTM_VIEW_ID_UCAST = @as(u32, 0);
pub const RTM_VIEW_ID_MCAST = @as(u32, 1);
pub const RTM_VIEW_MASK_SIZE = @as(u32, 32);
pub const RTM_VIEW_MASK_NONE = @as(u32, 0);
pub const RTM_VIEW_MASK_ANY = @as(u32, 0);
pub const RTM_VIEW_MASK_UCAST = @as(u32, 1);
pub const RTM_VIEW_MASK_MCAST = @as(u32, 2);
pub const RTM_VIEW_MASK_ALL = @as(u32, 4294967295);
pub const IPV6_ADDRESS_LEN_IN_BYTES = @as(u32, 16);
pub const RTM_DEST_FLAG_NATURAL_NET = @as(u32, 1);
pub const RTM_DEST_FLAG_FWD_ENGIN_ADD = @as(u32, 2);
pub const RTM_DEST_FLAG_DONT_FORWARD = @as(u32, 4);
pub const RTM_ROUTE_STATE_CREATED = @as(u32, 0);
pub const RTM_ROUTE_STATE_DELETING = @as(u32, 1);
pub const RTM_ROUTE_STATE_DELETED = @as(u32, 2);
pub const RTM_ROUTE_FLAGS_MARTIAN = @as(u32, 1);
pub const RTM_ROUTE_FLAGS_BLACKHOLE = @as(u32, 2);
pub const RTM_ROUTE_FLAGS_DISCARD = @as(u32, 4);
pub const RTM_ROUTE_FLAGS_INACTIVE = @as(u32, 8);
pub const RTM_ROUTE_FLAGS_LOCAL = @as(u32, 16);
pub const RTM_ROUTE_FLAGS_REMOTE = @as(u32, 32);
pub const RTM_ROUTE_FLAGS_MYSELF = @as(u32, 64);
pub const RTM_ROUTE_FLAGS_LOOPBACK = @as(u32, 128);
pub const RTM_ROUTE_FLAGS_MCAST = @as(u32, 256);
pub const RTM_ROUTE_FLAGS_LOCAL_MCAST = @as(u32, 512);
pub const RTM_ROUTE_FLAGS_LIMITED_BC = @as(u32, 1024);
pub const RTM_ROUTE_FLAGS_ZEROS_NETBC = @as(u32, 4096);
pub const RTM_ROUTE_FLAGS_ZEROS_SUBNETBC = @as(u32, 8192);
pub const RTM_ROUTE_FLAGS_ONES_NETBC = @as(u32, 16384);
pub const RTM_ROUTE_FLAGS_ONES_SUBNETBC = @as(u32, 32768);
pub const RTM_NEXTHOP_STATE_CREATED = @as(u32, 0);
pub const RTM_NEXTHOP_STATE_DELETED = @as(u32, 1);
pub const RTM_NEXTHOP_FLAGS_REMOTE = @as(u32, 1);
pub const RTM_NEXTHOP_FLAGS_DOWN = @as(u32, 2);
pub const METHOD_TYPE_ALL_METHODS = @as(u32, 4294967295);
pub const METHOD_RIP2_NEIGHBOUR_ADDR = @as(u32, 1);
pub const METHOD_RIP2_OUTBOUND_INTF = @as(u32, 2);
pub const METHOD_RIP2_ROUTE_TAG = @as(u32, 4);
pub const METHOD_RIP2_ROUTE_TIMESTAMP = @as(u32, 8);
pub const METHOD_BGP4_AS_PATH = @as(u32, 1);
pub const METHOD_BGP4_PEER_ID = @as(u32, 2);
pub const METHOD_BGP4_PA_ORIGIN = @as(u32, 4);
pub const METHOD_BGP4_NEXTHOP_ATTR = @as(u32, 8);
pub const RTM_RESUME_METHODS = @as(u32, 0);
pub const RTM_BLOCK_METHODS = @as(u32, 1);
pub const RTM_ROUTE_CHANGE_FIRST = @as(u32, 1);
pub const RTM_ROUTE_CHANGE_NEW = @as(u32, 2);
pub const RTM_ROUTE_CHANGE_BEST = @as(u32, 65536);
pub const RTM_NEXTHOP_CHANGE_NEW = @as(u32, 1);
pub const RTM_MATCH_NONE = @as(u32, 0);
pub const RTM_MATCH_OWNER = @as(u32, 1);
pub const RTM_MATCH_NEIGHBOUR = @as(u32, 2);
pub const RTM_MATCH_PREF = @as(u32, 4);
pub const RTM_MATCH_NEXTHOP = @as(u32, 8);
pub const RTM_MATCH_INTERFACE = @as(u32, 16);
pub const RTM_MATCH_FULL = @as(u32, 65535);
pub const RTM_ENUM_START = @as(u32, 0);
pub const RTM_ENUM_NEXT = @as(u32, 1);
pub const RTM_ENUM_RANGE = @as(u32, 2);
pub const RTM_ENUM_ALL_DESTS = @as(u32, 0);
pub const RTM_ENUM_OWN_DESTS = @as(u32, 16777216);
pub const RTM_ENUM_ALL_ROUTES = @as(u32, 0);
pub const RTM_ENUM_OWN_ROUTES = @as(u32, 65536);
pub const RTM_NUM_CHANGE_TYPES = @as(u32, 3);
pub const RTM_CHANGE_TYPE_ALL = @as(u32, 1);
pub const RTM_CHANGE_TYPE_BEST = @as(u32, 2);
pub const RTM_CHANGE_TYPE_FORWARDING = @as(u32, 4);
pub const RTM_NOTIFY_ONLY_MARKED_DESTS = @as(u32, 65536);
pub const RASBASE = @as(u32, 600);
pub const PENDING = @as(u32, 600);
pub const ERROR_INVALID_PORT_HANDLE = @as(u32, 601);
pub const ERROR_PORT_ALREADY_OPEN = @as(u32, 602);
pub const ERROR_BUFFER_TOO_SMALL = @as(u32, 603);
pub const ERROR_WRONG_INFO_SPECIFIED = @as(u32, 604);
pub const ERROR_CANNOT_SET_PORT_INFO = @as(u32, 605);
pub const ERROR_PORT_NOT_CONNECTED = @as(u32, 606);
pub const ERROR_EVENT_INVALID = @as(u32, 607);
pub const ERROR_DEVICE_DOES_NOT_EXIST = @as(u32, 608);
pub const ERROR_DEVICETYPE_DOES_NOT_EXIST = @as(u32, 609);
pub const ERROR_BUFFER_INVALID = @as(u32, 610);
pub const ERROR_ROUTE_NOT_AVAILABLE = @as(u32, 611);
pub const ERROR_ROUTE_NOT_ALLOCATED = @as(u32, 612);
pub const ERROR_INVALID_COMPRESSION_SPECIFIED = @as(u32, 613);
pub const ERROR_OUT_OF_BUFFERS = @as(u32, 614);
pub const ERROR_PORT_NOT_FOUND = @as(u32, 615);
pub const ERROR_ASYNC_REQUEST_PENDING = @as(u32, 616);
pub const ERROR_ALREADY_DISCONNECTING = @as(u32, 617);
pub const ERROR_PORT_NOT_OPEN = @as(u32, 618);
pub const ERROR_PORT_DISCONNECTED = @as(u32, 619);
pub const ERROR_NO_ENDPOINTS = @as(u32, 620);
pub const ERROR_CANNOT_OPEN_PHONEBOOK = @as(u32, 621);
pub const ERROR_CANNOT_LOAD_PHONEBOOK = @as(u32, 622);
pub const ERROR_CANNOT_FIND_PHONEBOOK_ENTRY = @as(u32, 623);
pub const ERROR_CANNOT_WRITE_PHONEBOOK = @as(u32, 624);
pub const ERROR_CORRUPT_PHONEBOOK = @as(u32, 625);
pub const ERROR_CANNOT_LOAD_STRING = @as(u32, 626);
pub const ERROR_KEY_NOT_FOUND = @as(u32, 627);
pub const ERROR_DISCONNECTION = @as(u32, 628);
pub const ERROR_REMOTE_DISCONNECTION = @as(u32, 629);
pub const ERROR_HARDWARE_FAILURE = @as(u32, 630);
pub const ERROR_USER_DISCONNECTION = @as(u32, 631);
pub const ERROR_INVALID_SIZE = @as(u32, 632);
pub const ERROR_PORT_NOT_AVAILABLE = @as(u32, 633);
pub const ERROR_CANNOT_PROJECT_CLIENT = @as(u32, 634);
pub const ERROR_UNKNOWN = @as(u32, 635);
pub const ERROR_WRONG_DEVICE_ATTACHED = @as(u32, 636);
pub const ERROR_BAD_STRING = @as(u32, 637);
pub const ERROR_REQUEST_TIMEOUT = @as(u32, 638);
pub const ERROR_CANNOT_GET_LANA = @as(u32, 639);
pub const ERROR_NETBIOS_ERROR = @as(u32, 640);
pub const ERROR_SERVER_OUT_OF_RESOURCES = @as(u32, 641);
pub const ERROR_NAME_EXISTS_ON_NET = @as(u32, 642);
pub const ERROR_SERVER_GENERAL_NET_FAILURE = @as(u32, 643);
pub const WARNING_MSG_ALIAS_NOT_ADDED = @as(u32, 644);
pub const ERROR_AUTH_INTERNAL = @as(u32, 645);
pub const ERROR_RESTRICTED_LOGON_HOURS = @as(u32, 646);
pub const ERROR_ACCT_DISABLED = @as(u32, 647);
pub const ERROR_PASSWD_EXPIRED = @as(u32, 648);
pub const ERROR_NO_DIALIN_PERMISSION = @as(u32, 649);
pub const ERROR_SERVER_NOT_RESPONDING = @as(u32, 650);
pub const ERROR_FROM_DEVICE = @as(u32, 651);
pub const ERROR_UNRECOGNIZED_RESPONSE = @as(u32, 652);
pub const ERROR_MACRO_NOT_FOUND = @as(u32, 653);
pub const ERROR_MACRO_NOT_DEFINED = @as(u32, 654);
pub const ERROR_MESSAGE_MACRO_NOT_FOUND = @as(u32, 655);
pub const ERROR_DEFAULTOFF_MACRO_NOT_FOUND = @as(u32, 656);
pub const ERROR_FILE_COULD_NOT_BE_OPENED = @as(u32, 657);
pub const ERROR_DEVICENAME_TOO_LONG = @as(u32, 658);
pub const ERROR_DEVICENAME_NOT_FOUND = @as(u32, 659);
pub const ERROR_NO_RESPONSES = @as(u32, 660);
pub const ERROR_NO_COMMAND_FOUND = @as(u32, 661);
pub const ERROR_WRONG_KEY_SPECIFIED = @as(u32, 662);
pub const ERROR_UNKNOWN_DEVICE_TYPE = @as(u32, 663);
pub const ERROR_ALLOCATING_MEMORY = @as(u32, 664);
pub const ERROR_PORT_NOT_CONFIGURED = @as(u32, 665);
pub const ERROR_DEVICE_NOT_READY = @as(u32, 666);
pub const ERROR_READING_INI_FILE = @as(u32, 667);
pub const ERROR_NO_CONNECTION = @as(u32, 668);
pub const ERROR_BAD_USAGE_IN_INI_FILE = @as(u32, 669);
pub const ERROR_READING_SECTIONNAME = @as(u32, 670);
pub const ERROR_READING_DEVICETYPE = @as(u32, 671);
pub const ERROR_READING_DEVICENAME = @as(u32, 672);
pub const ERROR_READING_USAGE = @as(u32, 673);
pub const ERROR_READING_MAXCONNECTBPS = @as(u32, 674);
pub const ERROR_READING_MAXCARRIERBPS = @as(u32, 675);
pub const ERROR_LINE_BUSY = @as(u32, 676);
pub const ERROR_VOICE_ANSWER = @as(u32, 677);
pub const ERROR_NO_ANSWER = @as(u32, 678);
pub const ERROR_NO_CARRIER = @as(u32, 679);
pub const ERROR_NO_DIALTONE = @as(u32, 680);
pub const ERROR_IN_COMMAND = @as(u32, 681);
pub const ERROR_WRITING_SECTIONNAME = @as(u32, 682);
pub const ERROR_WRITING_DEVICETYPE = @as(u32, 683);
pub const ERROR_WRITING_DEVICENAME = @as(u32, 684);
pub const ERROR_WRITING_MAXCONNECTBPS = @as(u32, 685);
pub const ERROR_WRITING_MAXCARRIERBPS = @as(u32, 686);
pub const ERROR_WRITING_USAGE = @as(u32, 687);
pub const ERROR_WRITING_DEFAULTOFF = @as(u32, 688);
pub const ERROR_READING_DEFAULTOFF = @as(u32, 689);
pub const ERROR_EMPTY_INI_FILE = @as(u32, 690);
pub const ERROR_AUTHENTICATION_FAILURE = @as(u32, 691);
pub const ERROR_PORT_OR_DEVICE = @as(u32, 692);
pub const ERROR_NOT_BINARY_MACRO = @as(u32, 693);
pub const ERROR_DCB_NOT_FOUND = @as(u32, 694);
pub const ERROR_STATE_MACHINES_NOT_STARTED = @as(u32, 695);
pub const ERROR_STATE_MACHINES_ALREADY_STARTED = @as(u32, 696);
pub const ERROR_PARTIAL_RESPONSE_LOOPING = @as(u32, 697);
pub const ERROR_UNKNOWN_RESPONSE_KEY = @as(u32, 698);
pub const ERROR_RECV_BUF_FULL = @as(u32, 699);
pub const ERROR_CMD_TOO_LONG = @as(u32, 700);
pub const ERROR_UNSUPPORTED_BPS = @as(u32, 701);
pub const ERROR_UNEXPECTED_RESPONSE = @as(u32, 702);
pub const ERROR_INTERACTIVE_MODE = @as(u32, 703);
pub const ERROR_BAD_CALLBACK_NUMBER = @as(u32, 704);
pub const ERROR_INVALID_AUTH_STATE = @as(u32, 705);
pub const ERROR_WRITING_INITBPS = @as(u32, 706);
pub const ERROR_X25_DIAGNOSTIC = @as(u32, 707);
pub const ERROR_ACCT_EXPIRED = @as(u32, 708);
pub const ERROR_CHANGING_PASSWORD = @as(u32, 709);
pub const ERROR_OVERRUN = @as(u32, 710);
pub const ERROR_RASMAN_CANNOT_INITIALIZE = @as(u32, 711);
pub const ERROR_BIPLEX_PORT_NOT_AVAILABLE = @as(u32, 712);
pub const ERROR_NO_ACTIVE_ISDN_LINES = @as(u32, 713);
pub const ERROR_NO_ISDN_CHANNELS_AVAILABLE = @as(u32, 714);
pub const ERROR_TOO_MANY_LINE_ERRORS = @as(u32, 715);
pub const ERROR_IP_CONFIGURATION = @as(u32, 716);
pub const ERROR_NO_IP_ADDRESSES = @as(u32, 717);
pub const ERROR_PPP_TIMEOUT = @as(u32, 718);
pub const ERROR_PPP_REMOTE_TERMINATED = @as(u32, 719);
pub const ERROR_PPP_NO_PROTOCOLS_CONFIGURED = @as(u32, 720);
pub const ERROR_PPP_NO_RESPONSE = @as(u32, 721);
pub const ERROR_PPP_INVALID_PACKET = @as(u32, 722);
pub const ERROR_PHONE_NUMBER_TOO_LONG = @as(u32, 723);
pub const ERROR_IPXCP_NO_DIALOUT_CONFIGURED = @as(u32, 724);
pub const ERROR_IPXCP_NO_DIALIN_CONFIGURED = @as(u32, 725);
pub const ERROR_IPXCP_DIALOUT_ALREADY_ACTIVE = @as(u32, 726);
pub const ERROR_ACCESSING_TCPCFGDLL = @as(u32, 727);
pub const ERROR_NO_IP_RAS_ADAPTER = @as(u32, 728);
pub const ERROR_SLIP_REQUIRES_IP = @as(u32, 729);
pub const ERROR_PROJECTION_NOT_COMPLETE = @as(u32, 730);
pub const ERROR_PROTOCOL_NOT_CONFIGURED = @as(u32, 731);
pub const ERROR_PPP_NOT_CONVERGING = @as(u32, 732);
pub const ERROR_PPP_CP_REJECTED = @as(u32, 733);
pub const ERROR_PPP_LCP_TERMINATED = @as(u32, 734);
pub const ERROR_PPP_REQUIRED_ADDRESS_REJECTED = @as(u32, 735);
pub const ERROR_PPP_NCP_TERMINATED = @as(u32, 736);
pub const ERROR_PPP_LOOPBACK_DETECTED = @as(u32, 737);
pub const ERROR_PPP_NO_ADDRESS_ASSIGNED = @as(u32, 738);
pub const ERROR_CANNOT_USE_LOGON_CREDENTIALS = @as(u32, 739);
pub const ERROR_TAPI_CONFIGURATION = @as(u32, 740);
pub const ERROR_NO_LOCAL_ENCRYPTION = @as(u32, 741);
pub const ERROR_NO_REMOTE_ENCRYPTION = @as(u32, 742);
pub const ERROR_REMOTE_REQUIRES_ENCRYPTION = @as(u32, 743);
pub const ERROR_IPXCP_NET_NUMBER_CONFLICT = @as(u32, 744);
pub const ERROR_INVALID_SMM = @as(u32, 745);
pub const ERROR_SMM_UNINITIALIZED = @as(u32, 746);
pub const ERROR_NO_MAC_FOR_PORT = @as(u32, 747);
pub const ERROR_SMM_TIMEOUT = @as(u32, 748);
pub const ERROR_BAD_PHONE_NUMBER = @as(u32, 749);
pub const ERROR_WRONG_MODULE = @as(u32, 750);
pub const ERROR_INVALID_CALLBACK_NUMBER = @as(u32, 751);
pub const ERROR_SCRIPT_SYNTAX = @as(u32, 752);
pub const ERROR_HANGUP_FAILED = @as(u32, 753);
pub const ERROR_BUNDLE_NOT_FOUND = @as(u32, 754);
pub const ERROR_CANNOT_DO_CUSTOMDIAL = @as(u32, 755);
pub const ERROR_DIAL_ALREADY_IN_PROGRESS = @as(u32, 756);
pub const ERROR_RASAUTO_CANNOT_INITIALIZE = @as(u32, 757);
pub const ERROR_CONNECTION_ALREADY_SHARED = @as(u32, 758);
pub const ERROR_SHARING_CHANGE_FAILED = @as(u32, 759);
pub const ERROR_SHARING_ROUTER_INSTALL = @as(u32, 760);
pub const ERROR_SHARE_CONNECTION_FAILED = @as(u32, 761);
pub const ERROR_SHARING_PRIVATE_INSTALL = @as(u32, 762);
pub const ERROR_CANNOT_SHARE_CONNECTION = @as(u32, 763);
pub const ERROR_NO_SMART_CARD_READER = @as(u32, 764);
pub const ERROR_SHARING_ADDRESS_EXISTS = @as(u32, 765);
pub const ERROR_NO_CERTIFICATE = @as(u32, 766);
pub const ERROR_SHARING_MULTIPLE_ADDRESSES = @as(u32, 767);
pub const ERROR_FAILED_TO_ENCRYPT = @as(u32, 768);
pub const ERROR_BAD_ADDRESS_SPECIFIED = @as(u32, 769);
pub const ERROR_CONNECTION_REJECT = @as(u32, 770);
pub const ERROR_CONGESTION = @as(u32, 771);
pub const ERROR_INCOMPATIBLE = @as(u32, 772);
pub const ERROR_NUMBERCHANGED = @as(u32, 773);
pub const ERROR_TEMPFAILURE = @as(u32, 774);
pub const ERROR_BLOCKED = @as(u32, 775);
pub const ERROR_DONOTDISTURB = @as(u32, 776);
pub const ERROR_OUTOFORDER = @as(u32, 777);
pub const ERROR_UNABLE_TO_AUTHENTICATE_SERVER = @as(u32, 778);
pub const ERROR_SMART_CARD_REQUIRED = @as(u32, 779);
pub const ERROR_INVALID_FUNCTION_FOR_ENTRY = @as(u32, 780);
pub const ERROR_CERT_FOR_ENCRYPTION_NOT_FOUND = @as(u32, 781);
pub const ERROR_SHARING_RRAS_CONFLICT = @as(u32, 782);
pub const ERROR_SHARING_NO_PRIVATE_LAN = @as(u32, 783);
pub const ERROR_NO_DIFF_USER_AT_LOGON = @as(u32, 784);
pub const ERROR_NO_REG_CERT_AT_LOGON = @as(u32, 785);
pub const ERROR_OAKLEY_NO_CERT = @as(u32, 786);
pub const ERROR_OAKLEY_AUTH_FAIL = @as(u32, 787);
pub const ERROR_OAKLEY_ATTRIB_FAIL = @as(u32, 788);
pub const ERROR_OAKLEY_GENERAL_PROCESSING = @as(u32, 789);
pub const ERROR_OAKLEY_NO_PEER_CERT = @as(u32, 790);
pub const ERROR_OAKLEY_NO_POLICY = @as(u32, 791);
pub const ERROR_OAKLEY_TIMED_OUT = @as(u32, 792);
pub const ERROR_OAKLEY_ERROR = @as(u32, 793);
pub const ERROR_UNKNOWN_FRAMED_PROTOCOL = @as(u32, 794);
pub const ERROR_WRONG_TUNNEL_TYPE = @as(u32, 795);
pub const ERROR_UNKNOWN_SERVICE_TYPE = @as(u32, 796);
pub const ERROR_CONNECTING_DEVICE_NOT_FOUND = @as(u32, 797);
pub const ERROR_NO_EAPTLS_CERTIFICATE = @as(u32, 798);
pub const ERROR_SHARING_HOST_ADDRESS_CONFLICT = @as(u32, 799);
pub const ERROR_AUTOMATIC_VPN_FAILED = @as(u32, 800);
pub const ERROR_VALIDATING_SERVER_CERT = @as(u32, 801);
pub const ERROR_READING_SCARD = @as(u32, 802);
pub const ERROR_INVALID_PEAP_COOKIE_CONFIG = @as(u32, 803);
pub const ERROR_INVALID_PEAP_COOKIE_USER = @as(u32, 804);
pub const ERROR_INVALID_MSCHAPV2_CONFIG = @as(u32, 805);
pub const ERROR_VPN_GRE_BLOCKED = @as(u32, 806);
pub const ERROR_VPN_DISCONNECT = @as(u32, 807);
pub const ERROR_VPN_REFUSED = @as(u32, 808);
pub const ERROR_VPN_TIMEOUT = @as(u32, 809);
pub const ERROR_VPN_BAD_CERT = @as(u32, 810);
pub const ERROR_VPN_BAD_PSK = @as(u32, 811);
pub const ERROR_SERVER_POLICY = @as(u32, 812);
pub const ERROR_BROADBAND_ACTIVE = @as(u32, 813);
pub const ERROR_BROADBAND_NO_NIC = @as(u32, 814);
pub const ERROR_BROADBAND_TIMEOUT = @as(u32, 815);
pub const ERROR_FEATURE_DEPRECATED = @as(u32, 816);
pub const ERROR_CANNOT_DELETE = @as(u32, 817);
pub const ERROR_RASQEC_RESOURCE_CREATION_FAILED = @as(u32, 818);
pub const ERROR_RASQEC_NAPAGENT_NOT_ENABLED = @as(u32, 819);
pub const ERROR_RASQEC_NAPAGENT_NOT_CONNECTED = @as(u32, 820);
pub const ERROR_RASQEC_CONN_DOESNOTEXIST = @as(u32, 821);
pub const ERROR_RASQEC_TIMEOUT = @as(u32, 822);
pub const ERROR_PEAP_CRYPTOBINDING_INVALID = @as(u32, 823);
pub const ERROR_PEAP_CRYPTOBINDING_NOTRECEIVED = @as(u32, 824);
pub const ERROR_INVALID_VPNSTRATEGY = @as(u32, 825);
pub const ERROR_EAPTLS_CACHE_CREDENTIALS_INVALID = @as(u32, 826);
pub const ERROR_IPSEC_SERVICE_STOPPED = @as(u32, 827);
pub const ERROR_IDLE_TIMEOUT = @as(u32, 828);
pub const ERROR_LINK_FAILURE = @as(u32, 829);
pub const ERROR_USER_LOGOFF = @as(u32, 830);
pub const ERROR_FAST_USER_SWITCH = @as(u32, 831);
pub const ERROR_HIBERNATION = @as(u32, 832);
pub const ERROR_SYSTEM_SUSPENDED = @as(u32, 833);
pub const ERROR_RASMAN_SERVICE_STOPPED = @as(u32, 834);
pub const ERROR_INVALID_SERVER_CERT = @as(u32, 835);
pub const ERROR_NOT_NAP_CAPABLE = @as(u32, 836);
pub const ERROR_INVALID_TUNNELID = @as(u32, 837);
pub const ERROR_UPDATECONNECTION_REQUEST_IN_PROCESS = @as(u32, 838);
pub const ERROR_PROTOCOL_ENGINE_DISABLED = @as(u32, 839);
pub const ERROR_INTERNAL_ADDRESS_FAILURE = @as(u32, 840);
pub const ERROR_FAILED_CP_REQUIRED = @as(u32, 841);
pub const ERROR_TS_UNACCEPTABLE = @as(u32, 842);
pub const ERROR_MOBIKE_DISABLED = @as(u32, 843);
pub const ERROR_CANNOT_INITIATE_MOBIKE_UPDATE = @as(u32, 844);
pub const ERROR_PEAP_SERVER_REJECTED_CLIENT_TLV = @as(u32, 845);
pub const ERROR_INVALID_PREFERENCES = @as(u32, 846);
pub const ERROR_EAPTLS_SCARD_CACHE_CREDENTIALS_INVALID = @as(u32, 847);
pub const ERROR_SSTP_COOKIE_SET_FAILURE = @as(u32, 848);
pub const ERROR_INVALID_PEAP_COOKIE_ATTRIBUTES = @as(u32, 849);
pub const ERROR_EAP_METHOD_NOT_INSTALLED = @as(u32, 850);
pub const ERROR_EAP_METHOD_DOES_NOT_SUPPORT_SSO = @as(u32, 851);
pub const ERROR_EAP_METHOD_OPERATION_NOT_SUPPORTED = @as(u32, 852);
pub const ERROR_EAP_USER_CERT_INVALID = @as(u32, 853);
pub const ERROR_EAP_USER_CERT_EXPIRED = @as(u32, 854);
pub const ERROR_EAP_USER_CERT_REVOKED = @as(u32, 855);
pub const ERROR_EAP_USER_CERT_OTHER_ERROR = @as(u32, 856);
pub const ERROR_EAP_SERVER_CERT_INVALID = @as(u32, 857);
pub const ERROR_EAP_SERVER_CERT_EXPIRED = @as(u32, 858);
pub const ERROR_EAP_SERVER_CERT_REVOKED = @as(u32, 859);
pub const ERROR_EAP_SERVER_CERT_OTHER_ERROR = @as(u32, 860);
pub const ERROR_EAP_USER_ROOT_CERT_NOT_FOUND = @as(u32, 861);
pub const ERROR_EAP_USER_ROOT_CERT_INVALID = @as(u32, 862);
pub const ERROR_EAP_USER_ROOT_CERT_EXPIRED = @as(u32, 863);
pub const ERROR_EAP_SERVER_ROOT_CERT_NOT_FOUND = @as(u32, 864);
pub const ERROR_EAP_SERVER_ROOT_CERT_INVALID = @as(u32, 865);
pub const ERROR_EAP_SERVER_ROOT_CERT_NAME_REQUIRED = @as(u32, 866);
pub const ERROR_PEAP_IDENTITY_MISMATCH = @as(u32, 867);
pub const ERROR_DNSNAME_NOT_RESOLVABLE = @as(u32, 868);
pub const ERROR_EAPTLS_PASSWD_INVALID = @as(u32, 869);
pub const ERROR_IKEV2_PSK_INTERFACE_ALREADY_EXISTS = @as(u32, 870);
pub const ERROR_INVALID_DESTINATION_IP = @as(u32, 871);
pub const ERROR_INVALID_INTERFACE_CONFIG = @as(u32, 872);
pub const ERROR_VPN_PLUGIN_GENERIC = @as(u32, 873);
pub const ERROR_SSO_CERT_MISSING = @as(u32, 874);
pub const ERROR_DEVICE_COMPLIANCE = @as(u32, 875);
pub const ERROR_PLUGIN_NOT_INSTALLED = @as(u32, 876);
pub const ERROR_ACTION_REQUIRED = @as(u32, 877);
pub const RASBASEEND = @as(u32, 877);
//--------------------------------------------------------------------------------
// Section: Types (224)
//--------------------------------------------------------------------------------
pub const MPR_INTERFACE_DIAL_MODE = enum(u32) {
First = 0,
All = 1,
AsNeeded = 2,
};
pub const MPRDM_DialFirst = MPR_INTERFACE_DIAL_MODE.First;
pub const MPRDM_DialAll = MPR_INTERFACE_DIAL_MODE.All;
pub const MPRDM_DialAsNeeded = MPR_INTERFACE_DIAL_MODE.AsNeeded;
pub const RASENTRY_DIAL_MODE = enum(u32) {
ll = 1,
sNeeded = 2,
};
pub const RASEDM_DialAll = RASENTRY_DIAL_MODE.ll;
pub const RASEDM_DialAsNeeded = RASENTRY_DIAL_MODE.sNeeded;
pub const RAS_FLAGS = enum(u32) {
PPP_CONNECTION = 1,
MESSENGER_PRESENT = 2,
QUARANTINE_PRESENT = 8,
ARAP_CONNECTION = 16,
// IKEV2_CONNECTION = 16, this enum value conflicts with ARAP_CONNECTION
DORMANT = 32,
};
pub const RAS_FLAGS_PPP_CONNECTION = RAS_FLAGS.PPP_CONNECTION;
pub const RAS_FLAGS_MESSENGER_PRESENT = RAS_FLAGS.MESSENGER_PRESENT;
pub const RAS_FLAGS_QUARANTINE_PRESENT = RAS_FLAGS.QUARANTINE_PRESENT;
pub const RAS_FLAGS_ARAP_CONNECTION = RAS_FLAGS.ARAP_CONNECTION;
pub const RAS_FLAGS_IKEV2_CONNECTION = RAS_FLAGS.ARAP_CONNECTION;
pub const RAS_FLAGS_DORMANT = RAS_FLAGS.DORMANT;
pub const MPR_ET = enum(u32) {
None = 0,
Require = 1,
RequireMax = 2,
Optional = 3,
};
pub const MPR_ET_None = MPR_ET.None;
pub const MPR_ET_Require = MPR_ET.Require;
pub const MPR_ET_RequireMax = MPR_ET.RequireMax;
pub const MPR_ET_Optional = MPR_ET.Optional;
pub const RASPPP_PROJECTION_INFO_SERVER_AUTH_DATA = enum(u32) {
D5 = 5,
S = 128,
SV2 = 129,
};
pub const RASLCPAD_CHAP_MD5 = RASPPP_PROJECTION_INFO_SERVER_AUTH_DATA.D5;
pub const RASLCPAD_CHAP_MS = RASPPP_PROJECTION_INFO_SERVER_AUTH_DATA.S;
pub const RASLCPAD_CHAP_MSV2 = RASPPP_PROJECTION_INFO_SERVER_AUTH_DATA.SV2;
pub const PPP_LCP = enum(u32) {
PAP = 49187,
CHAP = 49699,
EAP = 49703,
SPAP = 49191,
};
pub const PPP_LCP_PAP = PPP_LCP.PAP;
pub const PPP_LCP_CHAP = PPP_LCP.CHAP;
pub const PPP_LCP_EAP = PPP_LCP.EAP;
pub const PPP_LCP_SPAP = PPP_LCP.SPAP;
pub const RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL = enum(u32) {
PAP = 49187,
SPAP = 49191,
CHAP = 49699,
EAP = 49703,
};
pub const RASLCPAP_PAP = RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL.PAP;
pub const RASLCPAP_SPAP = RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL.SPAP;
pub const RASLCPAP_CHAP = RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL.CHAP;
pub const RASLCPAP_EAP = RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL.EAP;
pub const PPP_LCP_INFO_AUTH_DATA = enum(u32) {
D5 = 5,
S = 128,
SV2 = 129,
};
pub const PPP_LCP_CHAP_MD5 = PPP_LCP_INFO_AUTH_DATA.D5;
pub const PPP_LCP_CHAP_MS = PPP_LCP_INFO_AUTH_DATA.S;
pub const PPP_LCP_CHAP_MSV2 = PPP_LCP_INFO_AUTH_DATA.SV2;
pub const RASIKEV_PROJECTION_INFO_FLAGS = enum(u32) {
MOBIKESUPPORTED = 1,
BEHIND_NAT = 2,
SERVERBEHIND_NAT = 4,
_,
pub fn initFlags(o: struct {
MOBIKESUPPORTED: u1 = 0,
BEHIND_NAT: u1 = 0,
SERVERBEHIND_NAT: u1 = 0,
}) RASIKEV_PROJECTION_INFO_FLAGS {
return @intToEnum(RASIKEV_PROJECTION_INFO_FLAGS,
(if (o.MOBIKESUPPORTED == 1) @enumToInt(RASIKEV_PROJECTION_INFO_FLAGS.MOBIKESUPPORTED) else 0)
| (if (o.BEHIND_NAT == 1) @enumToInt(RASIKEV_PROJECTION_INFO_FLAGS.BEHIND_NAT) else 0)
| (if (o.SERVERBEHIND_NAT == 1) @enumToInt(RASIKEV_PROJECTION_INFO_FLAGS.SERVERBEHIND_NAT) else 0)
);
}
};
pub const RASIKEv2_FLAGS_MOBIKESUPPORTED = RASIKEV_PROJECTION_INFO_FLAGS.MOBIKESUPPORTED;
pub const RASIKEv2_FLAGS_BEHIND_NAT = RASIKEV_PROJECTION_INFO_FLAGS.BEHIND_NAT;
pub const RASIKEv2_FLAGS_SERVERBEHIND_NAT = RASIKEV_PROJECTION_INFO_FLAGS.SERVERBEHIND_NAT;
pub const MPR_VS = enum(u32) {
Default = 0,
PptpOnly = 1,
PptpFirst = 2,
L2tpOnly = 3,
L2tpFirst = 4,
};
pub const MPR_VS_Default = MPR_VS.Default;
pub const MPR_VS_PptpOnly = MPR_VS.PptpOnly;
pub const MPR_VS_PptpFirst = MPR_VS.PptpFirst;
pub const MPR_VS_L2tpOnly = MPR_VS.L2tpOnly;
pub const MPR_VS_L2tpFirst = MPR_VS.L2tpFirst;
pub const SECURITY_MESSAGE_MSG_ID = enum(u32) {
SUCCESS = 1,
FAILURE = 2,
ERROR = 3,
};
pub const SECURITYMSG_SUCCESS = SECURITY_MESSAGE_MSG_ID.SUCCESS;
pub const SECURITYMSG_FAILURE = SECURITY_MESSAGE_MSG_ID.FAILURE;
pub const SECURITYMSG_ERROR = SECURITY_MESSAGE_MSG_ID.ERROR;
pub const HRASCONN = *opaque{};
pub const RASAPIVERSION = enum(i32) {
@"500" = 1,
@"501" = 2,
@"600" = 3,
@"601" = 4,
};
pub const RASAPIVERSION_500 = RASAPIVERSION.@"500";
pub const RASAPIVERSION_501 = RASAPIVERSION.@"501";
pub const RASAPIVERSION_600 = RASAPIVERSION.@"600";
pub const RASAPIVERSION_601 = RASAPIVERSION.@"601";
pub const RASIPADDR = extern struct {
a: u8,
b: u8,
c: u8,
d: u8,
};
pub const RASTUNNELENDPOINT = extern struct {
dwType: u32,
Anonymous: extern union {
ipv4: IN_ADDR,
ipv6: IN6_ADDR,
},
};
pub const RASCONNW = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hrasconn: ?HRASCONN,
szEntryName: [257]u16,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szPhonebook: [260]u16,
dwSubEntry: u32,
guidEntry: Guid,
dwFlags: u32,
luid: LUID,
guidCorrelationId: Guid,
};
pub const RASCONNA = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hrasconn: ?HRASCONN,
szEntryName: [257]CHAR,
szDeviceType: [17]CHAR,
szDeviceName: [129]CHAR,
szPhonebook: [260]CHAR,
dwSubEntry: u32,
guidEntry: Guid,
dwFlags: u32,
luid: LUID,
guidCorrelationId: Guid,
};
pub const RASCONNSTATE = enum(i32) {
OpenPort = 0,
PortOpened = 1,
ConnectDevice = 2,
DeviceConnected = 3,
AllDevicesConnected = 4,
Authenticate = 5,
AuthNotify = 6,
AuthRetry = 7,
AuthCallback = 8,
AuthChangePassword = 9,
AuthProject = 10,
AuthLinkSpeed = 11,
AuthAck = 12,
ReAuthenticate = 13,
Authenticated = 14,
PrepareForCallback = 15,
WaitForModemReset = 16,
WaitForCallback = 17,
Projected = 18,
StartAuthentication = 19,
CallbackComplete = 20,
LogonNetwork = 21,
SubEntryConnected = 22,
SubEntryDisconnected = 23,
ApplySettings = 24,
Interactive = 4096,
RetryAuthentication = 4097,
CallbackSetByCaller = 4098,
PasswordExpired = <PASSWORD>,
InvokeEapUI = 4100,
Connected = 8192,
Disconnected = 8193,
};
pub const RASCS_OpenPort = RASCONNSTATE.OpenPort;
pub const RASCS_PortOpened = RASCONNSTATE.PortOpened;
pub const RASCS_ConnectDevice = RASCONNSTATE.ConnectDevice;
pub const RASCS_DeviceConnected = RASCONNSTATE.DeviceConnected;
pub const RASCS_AllDevicesConnected = RASCONNSTATE.AllDevicesConnected;
pub const RASCS_Authenticate = RASCONNSTATE.Authenticate;
pub const RASCS_AuthNotify = RASCONNSTATE.AuthNotify;
pub const RASCS_AuthRetry = RASCONNSTATE.AuthRetry;
pub const RASCS_AuthCallback = RASCONNSTATE.AuthCallback;
pub const RASCS_AuthChangePassword = RASCONNSTATE.AuthChangePassword;
pub const RASCS_AuthProject = RASCONNSTATE.AuthProject;
pub const RASCS_AuthLinkSpeed = RASCONNSTATE.AuthLinkSpeed;
pub const RASCS_AuthAck = RASCONNSTATE.AuthAck;
pub const RASCS_ReAuthenticate = RASCONNSTATE.ReAuthenticate;
pub const RASCS_Authenticated = RASCONNSTATE.Authenticated;
pub const RASCS_PrepareForCallback = RASCONNSTATE.PrepareForCallback;
pub const RASCS_WaitForModemReset = RASCONNSTATE.WaitForModemReset;
pub const RASCS_WaitForCallback = RASCONNSTATE.WaitForCallback;
pub const RASCS_Projected = RASCONNSTATE.Projected;
pub const RASCS_StartAuthentication = RASCONNSTATE.StartAuthentication;
pub const RASCS_CallbackComplete = RASCONNSTATE.CallbackComplete;
pub const RASCS_LogonNetwork = RASCONNSTATE.LogonNetwork;
pub const RASCS_SubEntryConnected = RASCONNSTATE.SubEntryConnected;
pub const RASCS_SubEntryDisconnected = RASCONNSTATE.SubEntryDisconnected;
pub const RASCS_ApplySettings = RASCONNSTATE.ApplySettings;
pub const RASCS_Interactive = RASCONNSTATE.Interactive;
pub const RASCS_RetryAuthentication = RASCONNSTATE.RetryAuthentication;
pub const RASCS_CallbackSetByCaller = RASCONNSTATE.CallbackSetByCaller;
pub const RASCS_PasswordExpired = RASCONNSTATE.PasswordExpired;
pub const RASCS_InvokeEapUI = RASCONNSTATE.InvokeEapUI;
pub const RASCS_Connected = RASCONNSTATE.Connected;
pub const RASCS_Disconnected = RASCONNSTATE.Disconnected;
pub const RASCONNSUBSTATE = enum(i32) {
None = 0,
Dormant = 1,
Reconnecting = 2,
Reconnected = 8192,
};
pub const RASCSS_None = RASCONNSUBSTATE.None;
pub const RASCSS_Dormant = RASCONNSUBSTATE.Dormant;
pub const RASCSS_Reconnecting = RASCONNSUBSTATE.Reconnecting;
pub const RASCSS_Reconnected = RASCONNSUBSTATE.Reconnected;
pub const RASCONNSTATUSW = extern struct {
dwSize: u32,
rasconnstate: RASCONNSTATE,
dwError: u32,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szPhoneNumber: [129]u16,
localEndPoint: RASTUNNELENDPOINT,
remoteEndPoint: RASTUNNELENDPOINT,
rasconnsubstate: RASCONNSUBSTATE,
};
pub const RASCONNSTATUSA = extern struct {
dwSize: u32,
rasconnstate: RASCONNSTATE,
dwError: u32,
szDeviceType: [17]CHAR,
szDeviceName: [129]CHAR,
szPhoneNumber: [129]CHAR,
localEndPoint: RASTUNNELENDPOINT,
remoteEndPoint: RASTUNNELENDPOINT,
rasconnsubstate: RASCONNSUBSTATE,
};
pub const RASDIALPARAMSW = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
szEntryName: [257]u16,
szPhoneNumber: [129]u16,
szCallbackNumber: [129]u16,
szUserName: [257]u16,
szPassword: [257]u16,
szDomain: [16]u16,
dwSubEntry: u32,
dwCallbackId: usize,
dwIfIndex: u32,
szEncPassword: ?PWSTR,
};
pub const RASDIALPARAMSA = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
szEntryName: [257]CHAR,
szPhoneNumber: [129]CHAR,
szCallbackNumber: [129]CHAR,
szUserName: [257]CHAR,
szPassword: [257]CHAR,
szDomain: [16]CHAR,
dwSubEntry: u32,
dwCallbackId: usize,
dwIfIndex: u32,
szEncPassword: ?PSTR,
};
pub const RASEAPINFO = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSizeofEapInfo: u32,
pbEapInfo: ?*u8,
};
pub const RASDEVSPECIFICINFO = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
pbDevSpecificInfo: ?*u8,
};
pub const RASDIALEXTENSIONS = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
dwfOptions: u32,
hwndParent: ?HWND,
reserved: usize,
reserved1: usize,
RasEapInfo: RASEAPINFO,
fSkipPppAuth: BOOL,
RasDevSpecificInfo: RASDEVSPECIFICINFO,
};
pub const RASENTRYNAMEW = extern struct {
dwSize: u32,
szEntryName: [257]u16,
dwFlags: u32,
szPhonebookPath: [261]u16,
};
pub const RASENTRYNAMEA = extern struct {
dwSize: u32,
szEntryName: [257]CHAR,
dwFlags: u32,
szPhonebookPath: [261]CHAR,
};
pub const RASPROJECTION = enum(i32) {
Amb = 65536,
PppNbf = 32831,
PppIpx = 32811,
PppIp = 32801,
PppCcp = 33021,
PppLcp = 49185,
PppIpv6 = 32855,
};
pub const RASP_Amb = RASPROJECTION.Amb;
pub const RASP_PppNbf = RASPROJECTION.PppNbf;
pub const RASP_PppIpx = RASPROJECTION.PppIpx;
pub const RASP_PppIp = RASPROJECTION.PppIp;
pub const RASP_PppCcp = RASPROJECTION.PppCcp;
pub const RASP_PppLcp = RASPROJECTION.PppLcp;
pub const RASP_PppIpv6 = RASPROJECTION.PppIpv6;
pub const RASAMBW = extern struct {
dwSize: u32,
dwError: u32,
szNetBiosError: [17]u16,
bLana: u8,
};
pub const RASAMBA = extern struct {
dwSize: u32,
dwError: u32,
szNetBiosError: [17]CHAR,
bLana: u8,
};
pub const RASPPPNBFW = extern struct {
dwSize: u32,
dwError: u32,
dwNetBiosError: u32,
szNetBiosError: [17]u16,
szWorkstationName: [17]u16,
bLana: u8,
};
pub const RASPPPNBFA = extern struct {
dwSize: u32,
dwError: u32,
dwNetBiosError: u32,
szNetBiosError: [17]CHAR,
szWorkstationName: [17]CHAR,
bLana: u8,
};
pub const RASIPXW = extern struct {
dwSize: u32,
dwError: u32,
szIpxAddress: [22]u16,
};
pub const RASPPPIPXA = extern struct {
dwSize: u32,
dwError: u32,
szIpxAddress: [22]CHAR,
};
pub const RASPPPIPW = extern struct {
dwSize: u32,
dwError: u32,
szIpAddress: [16]u16,
szServerIpAddress: [16]u16,
dwOptions: u32,
dwServerOptions: u32,
};
pub const RASPPPIPA = extern struct {
dwSize: u32,
dwError: u32,
szIpAddress: [16]CHAR,
szServerIpAddress: [16]CHAR,
dwOptions: u32,
dwServerOptions: u32,
};
pub const RASPPPIPV6 = extern struct {
dwSize: u32,
dwError: u32,
bLocalInterfaceIdentifier: [8]u8,
bPeerInterfaceIdentifier: [8]u8,
bLocalCompressionProtocol: [2]u8,
bPeerCompressionProtocol: [2]u8,
};
pub const RASPPPLCPW = extern struct {
dwSize: u32,
fBundled: BOOL,
dwError: u32,
dwAuthenticationProtocol: u32,
dwAuthenticationData: u32,
dwEapTypeId: u32,
dwServerAuthenticationProtocol: u32,
dwServerAuthenticationData: u32,
dwServerEapTypeId: u32,
fMultilink: BOOL,
dwTerminateReason: u32,
dwServerTerminateReason: u32,
szReplyMessage: [1024]u16,
dwOptions: u32,
dwServerOptions: u32,
};
pub const RASPPPLCPA = extern struct {
dwSize: u32,
fBundled: BOOL,
dwError: u32,
dwAuthenticationProtocol: u32,
dwAuthenticationData: u32,
dwEapTypeId: u32,
dwServerAuthenticationProtocol: u32,
dwServerAuthenticationData: u32,
dwServerEapTypeId: u32,
fMultilink: BOOL,
dwTerminateReason: u32,
dwServerTerminateReason: u32,
szReplyMessage: [1024]CHAR,
dwOptions: u32,
dwServerOptions: u32,
};
pub const RASPPPCCP = extern struct {
dwSize: u32,
dwError: u32,
dwCompressionAlgorithm: u32,
dwOptions: u32,
dwServerCompressionAlgorithm: u32,
dwServerOptions: u32,
};
pub const RASPPP_PROJECTION_INFO = extern struct {
dwIPv4NegotiationError: u32,
ipv4Address: IN_ADDR,
ipv4ServerAddress: IN_ADDR,
dwIPv4Options: u32,
dwIPv4ServerOptions: u32,
dwIPv6NegotiationError: u32,
bInterfaceIdentifier: [8]u8,
bServerInterfaceIdentifier: [8]u8,
fBundled: BOOL,
fMultilink: BOOL,
dwAuthenticationProtocol: RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL,
dwAuthenticationData: RASPPP_PROJECTION_INFO_SERVER_AUTH_DATA,
dwServerAuthenticationProtocol: RASPPP_PROJECTION_INFO_SERVER_AUTH_PROTOCOL,
dwServerAuthenticationData: RASPPP_PROJECTION_INFO_SERVER_AUTH_DATA,
dwEapTypeId: u32,
dwServerEapTypeId: u32,
dwLcpOptions: u32,
dwLcpServerOptions: u32,
dwCcpError: u32,
dwCcpCompressionAlgorithm: u32,
dwCcpServerCompressionAlgorithm: u32,
dwCcpOptions: u32,
dwCcpServerOptions: u32,
};
pub const RASIKEV2_PROJECTION_INFO = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwIPv4NegotiationError: u32,
ipv4Address: IN_ADDR,
ipv4ServerAddress: IN_ADDR,
dwIPv6NegotiationError: u32,
ipv6Address: IN6_ADDR,
ipv6ServerAddress: IN6_ADDR,
dwPrefixLength: u32,
dwAuthenticationProtocol: u32,
dwEapTypeId: u32,
dwFlags: RASIKEV_PROJECTION_INFO_FLAGS,
dwEncryptionMethod: u32,
numIPv4ServerAddresses: u32,
ipv4ServerAddresses: ?*IN_ADDR,
numIPv6ServerAddresses: u32,
ipv6ServerAddresses: ?*IN6_ADDR,
};
pub const RASPROJECTION_INFO_TYPE = enum(i32) {
PPP = 1,
IKEv2 = 2,
};
pub const PROJECTION_INFO_TYPE_PPP = RASPROJECTION_INFO_TYPE.PPP;
pub const PROJECTION_INFO_TYPE_IKEv2 = RASPROJECTION_INFO_TYPE.IKEv2;
pub const IKEV2_ID_PAYLOAD_TYPE = enum(i32) {
INVALID = 0,
IPV4_ADDR = 1,
FQDN = 2,
RFC822_ADDR = 3,
RESERVED1 = 4,
ID_IPV6_ADDR = 5,
RESERVED2 = 6,
RESERVED3 = 7,
RESERVED4 = 8,
DER_ASN1_DN = 9,
DER_ASN1_GN = 10,
KEY_ID = 11,
MAX = 12,
};
pub const IKEV2_ID_PAYLOAD_TYPE_INVALID = IKEV2_ID_PAYLOAD_TYPE.INVALID;
pub const IKEV2_ID_PAYLOAD_TYPE_IPV4_ADDR = IKEV2_ID_PAYLOAD_TYPE.IPV4_ADDR;
pub const IKEV2_ID_PAYLOAD_TYPE_FQDN = IKEV2_ID_PAYLOAD_TYPE.FQDN;
pub const IKEV2_ID_PAYLOAD_TYPE_RFC822_ADDR = IKEV2_ID_PAYLOAD_TYPE.RFC822_ADDR;
pub const IKEV2_ID_PAYLOAD_TYPE_RESERVED1 = IKEV2_ID_PAYLOAD_TYPE.RESERVED1;
pub const IKEV2_ID_PAYLOAD_TYPE_ID_IPV6_ADDR = IKEV2_ID_PAYLOAD_TYPE.ID_IPV6_ADDR;
pub const IKEV2_ID_PAYLOAD_TYPE_RESERVED2 = IKEV2_ID_PAYLOAD_TYPE.RESERVED2;
pub const IKEV2_ID_PAYLOAD_TYPE_RESERVED3 = IKEV2_ID_PAYLOAD_TYPE.RESERVED3;
pub const IKEV2_ID_PAYLOAD_TYPE_RESERVED4 = IKEV2_ID_PAYLOAD_TYPE.RESERVED4;
pub const IKEV2_ID_PAYLOAD_TYPE_DER_ASN1_DN = IKEV2_ID_PAYLOAD_TYPE.DER_ASN1_DN;
pub const IKEV2_ID_PAYLOAD_TYPE_DER_ASN1_GN = IKEV2_ID_PAYLOAD_TYPE.DER_ASN1_GN;
pub const IKEV2_ID_PAYLOAD_TYPE_KEY_ID = IKEV2_ID_PAYLOAD_TYPE.KEY_ID;
pub const IKEV2_ID_PAYLOAD_TYPE_MAX = IKEV2_ID_PAYLOAD_TYPE.MAX;
pub const RAS_PROJECTION_INFO = extern struct {
version: RASAPIVERSION,
type: RASPROJECTION_INFO_TYPE,
Anonymous: extern union {
ppp: RASPPP_PROJECTION_INFO,
ikev2: RASIKEV2_PROJECTION_INFO,
},
};
pub const RASDIALFUNC = fn(
param0: u32,
param1: RASCONNSTATE,
param2: u32,
) callconv(@import("std").os.windows.WINAPI) void;
pub const RASDIALFUNC1 = fn(
param0: ?HRASCONN,
param1: u32,
param2: RASCONNSTATE,
param3: u32,
param4: u32,
) callconv(@import("std").os.windows.WINAPI) void;
pub const RASDIALFUNC2 = fn(
param0: usize,
param1: u32,
param2: ?HRASCONN,
param3: u32,
param4: RASCONNSTATE,
param5: u32,
param6: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RASDEVINFOW = extern struct {
dwSize: u32,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
};
pub const RASDEVINFOA = extern struct {
dwSize: u32,
szDeviceType: [17]CHAR,
szDeviceName: [129]CHAR,
};
pub const RASCTRYINFO = extern struct {
dwSize: u32,
dwCountryID: u32,
dwNextCountryID: u32,
dwCountryCode: u32,
dwCountryNameOffset: u32,
};
pub const RASENTRYA = extern struct {
dwSize: u32,
dwfOptions: u32,
dwCountryID: u32,
dwCountryCode: u32,
szAreaCode: [11]CHAR,
szLocalPhoneNumber: [129]CHAR,
dwAlternateOffset: u32,
ipaddr: RASIPADDR,
ipaddrDns: RASIPADDR,
ipaddrDnsAlt: RASIPADDR,
ipaddrWins: RASIPADDR,
ipaddrWinsAlt: RASIPADDR,
dwFrameSize: u32,
dwfNetProtocols: u32,
dwFramingProtocol: u32,
szScript: [260]CHAR,
szAutodialDll: [260]CHAR,
szAutodialFunc: [260]CHAR,
szDeviceType: [17]CHAR,
szDeviceName: [129]CHAR,
szX25PadType: [33]CHAR,
szX25Address: [201]CHAR,
szX25Facilities: [201]CHAR,
szX25UserData: [201]CHAR,
dwChannels: u32,
dwReserved1: u32,
dwReserved2: u32,
dwSubEntries: u32,
dwDialMode: RASENTRY_DIAL_MODE,
dwDialExtraPercent: u32,
dwDialExtraSampleSeconds: u32,
dwHangUpExtraPercent: u32,
dwHangUpExtraSampleSeconds: u32,
dwIdleDisconnectSeconds: u32,
dwType: u32,
dwEncryptionType: u32,
dwCustomAuthKey: u32,
guidId: Guid,
szCustomDialDll: [260]CHAR,
dwVpnStrategy: u32,
dwfOptions2: u32,
dwfOptions3: u32,
szDnsSuffix: [256]CHAR,
dwTcpWindowSize: u32,
szPrerequisitePbk: [260]CHAR,
szPrerequisiteEntry: [257]CHAR,
dwRedialCount: u32,
dwRedialPause: u32,
ipv6addrDns: IN6_ADDR,
ipv6addrDnsAlt: IN6_ADDR,
dwIPv4InterfaceMetric: u32,
dwIPv6InterfaceMetric: u32,
ipv6addr: IN6_ADDR,
dwIPv6PrefixLength: u32,
dwNetworkOutageTime: u32,
szIDi: [257]CHAR,
szIDr: [257]CHAR,
fIsImsConfig: BOOL,
IdiType: IKEV2_ID_PAYLOAD_TYPE,
IdrType: IKEV2_ID_PAYLOAD_TYPE,
fDisableIKEv2Fragmentation: BOOL,
};
pub const RASENTRYW = extern struct {
dwSize: u32,
dwfOptions: u32,
dwCountryID: u32,
dwCountryCode: u32,
szAreaCode: [11]u16,
szLocalPhoneNumber: [129]u16,
dwAlternateOffset: u32,
ipaddr: RASIPADDR,
ipaddrDns: RASIPADDR,
ipaddrDnsAlt: RASIPADDR,
ipaddrWins: RASIPADDR,
ipaddrWinsAlt: RASIPADDR,
dwFrameSize: u32,
dwfNetProtocols: u32,
dwFramingProtocol: u32,
szScript: [260]u16,
szAutodialDll: [260]u16,
szAutodialFunc: [260]u16,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szX25PadType: [33]u16,
szX25Address: [201]u16,
szX25Facilities: [201]u16,
szX25UserData: [201]u16,
dwChannels: u32,
dwReserved1: u32,
dwReserved2: u32,
dwSubEntries: u32,
dwDialMode: RASENTRY_DIAL_MODE,
dwDialExtraPercent: u32,
dwDialExtraSampleSeconds: u32,
dwHangUpExtraPercent: u32,
dwHangUpExtraSampleSeconds: u32,
dwIdleDisconnectSeconds: u32,
dwType: u32,
dwEncryptionType: u32,
dwCustomAuthKey: u32,
guidId: Guid,
szCustomDialDll: [260]u16,
dwVpnStrategy: u32,
dwfOptions2: u32,
dwfOptions3: u32,
szDnsSuffix: [256]u16,
dwTcpWindowSize: u32,
szPrerequisitePbk: [260]u16,
szPrerequisiteEntry: [257]u16,
dwRedialCount: u32,
dwRedialPause: u32,
ipv6addrDns: IN6_ADDR,
ipv6addrDnsAlt: IN6_ADDR,
dwIPv4InterfaceMetric: u32,
dwIPv6InterfaceMetric: u32,
ipv6addr: IN6_ADDR,
dwIPv6PrefixLength: u32,
dwNetworkOutageTime: u32,
szIDi: [257]u16,
szIDr: [257]u16,
fIsImsConfig: BOOL,
IdiType: IKEV2_ID_PAYLOAD_TYPE,
IdrType: IKEV2_ID_PAYLOAD_TYPE,
fDisableIKEv2Fragmentation: BOOL,
};
pub const ORASADFUNC = fn(
param0: ?HWND,
param1: ?PSTR,
param2: u32,
param3: ?*u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const RASADPARAMS = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hwndOwner: ?HWND,
dwFlags: u32,
xDlg: i32,
yDlg: i32,
};
pub const RASADFUNCA = fn(
param0: ?PSTR,
param1: ?PSTR,
param2: ?*RASADPARAMS,
param3: ?*u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const RASADFUNCW = fn(
param0: ?PWSTR,
param1: ?PWSTR,
param2: ?*RASADPARAMS,
param3: ?*u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const RASSUBENTRYA = extern struct {
dwSize: u32,
dwfFlags: u32,
szDeviceType: [17]CHAR,
szDeviceName: [129]CHAR,
szLocalPhoneNumber: [129]CHAR,
dwAlternateOffset: u32,
};
pub const RASSUBENTRYW = extern struct {
dwSize: u32,
dwfFlags: u32,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szLocalPhoneNumber: [129]u16,
dwAlternateOffset: u32,
};
pub const RASCREDENTIALSA = extern struct {
dwSize: u32,
dwMask: u32,
szUserName: [257]CHAR,
szPassword: [257]CHAR,
szDomain: [16]CHAR,
};
pub const RASCREDENTIALSW = extern struct {
dwSize: u32,
dwMask: u32,
szUserName: [257]u16,
szPassword: [257]u16,
szDomain: [16]u16,
};
pub const RASAUTODIALENTRYA = extern struct {
dwSize: u32,
dwFlags: u32,
dwDialingLocation: u32,
szEntry: [257]CHAR,
};
pub const RASAUTODIALENTRYW = extern struct {
dwSize: u32,
dwFlags: u32,
dwDialingLocation: u32,
szEntry: [257]u16,
};
pub const RASEAPUSERIDENTITYA = extern struct {
szUserName: [257]CHAR,
dwSizeofEapInfo: u32,
pbEapInfo: [1]u8,
};
pub const RASEAPUSERIDENTITYW = extern struct {
szUserName: [257]u16,
dwSizeofEapInfo: u32,
pbEapInfo: [1]u8,
};
pub const PFNRASGETBUFFER = fn(
ppBuffer: ?*?*u8,
pdwSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PFNRASFREEBUFFER = fn(
pBufer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PFNRASSENDBUFFER = fn(
hPort: ?HANDLE,
pBuffer: ?*u8,
dwSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PFNRASRECEIVEBUFFER = fn(
hPort: ?HANDLE,
pBuffer: ?*u8,
pdwSize: ?*u32,
dwTimeOut: u32,
hEvent: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PFNRASRETRIEVEBUFFER = fn(
hPort: ?HANDLE,
pBuffer: ?*u8,
pdwSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RasCustomScriptExecuteFn = fn(
hPort: ?HANDLE,
lpszPhonebook: ?[*:0]const u16,
lpszEntryName: ?[*:0]const u16,
pfnRasGetBuffer: ?PFNRASGETBUFFER,
pfnRasFreeBuffer: ?PFNRASFREEBUFFER,
pfnRasSendBuffer: ?PFNRASSENDBUFFER,
pfnRasReceiveBuffer: ?PFNRASRECEIVEBUFFER,
pfnRasRetrieveBuffer: ?PFNRASRETRIEVEBUFFER,
hWnd: ?HWND,
pRasDialParams: ?*RASDIALPARAMSA,
pvReserved: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RASCOMMSETTINGS = extern struct {
dwSize: u32,
bParity: u8,
bStop: u8,
bByteSize: u8,
bAlign: u8,
};
pub const PFNRASSETCOMMSETTINGS = fn(
hPort: ?HANDLE,
pRasCommSettings: ?*RASCOMMSETTINGS,
pvReserved: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RASCUSTOMSCRIPTEXTENSIONS = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
pfnRasSetCommSettings: ?PFNRASSETCOMMSETTINGS,
};
pub const RAS_STATS = extern struct {
dwSize: u32,
dwBytesXmited: u32,
dwBytesRcved: u32,
dwFramesXmited: u32,
dwFramesRcved: u32,
dwCrcErr: u32,
dwTimeoutErr: u32,
dwAlignmentErr: u32,
dwHardwareOverrunErr: u32,
dwFramingErr: u32,
dwBufferOverrunErr: u32,
dwCompressionRatioIn: u32,
dwCompressionRatioOut: u32,
dwBps: u32,
dwConnectDuration: u32,
};
pub const RasCustomHangUpFn = fn(
hRasConn: ?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RasCustomDialFn = fn(
hInstDll: ?HINSTANCE,
lpRasDialExtensions: ?*RASDIALEXTENSIONS,
lpszPhonebook: ?[*:0]const u16,
lpRasDialParams: ?*RASDIALPARAMSA,
dwNotifierType: u32,
lpvNotifier: ?*anyopaque,
lphRasConn: ?*?HRASCONN,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RasCustomDeleteEntryNotifyFn = fn(
lpszPhonebook: ?[*:0]const u16,
lpszEntry: ?[*:0]const u16,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RASUPDATECONN = extern struct {
version: RASAPIVERSION,
dwSize: u32,
dwFlags: u32,
dwIfIndex: u32,
localEndPoint: RASTUNNELENDPOINT,
remoteEndPoint: RASTUNNELENDPOINT,
};
pub const RASPBDLGFUNCW = fn(
param0: usize,
param1: u32,
param2: ?PWSTR,
param3: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void;
pub const RASPBDLGFUNCA = fn(
param0: usize,
param1: u32,
param2: ?PSTR,
param3: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void;
pub const RASNOUSERW = extern struct {
dwSize: u32,
dwFlags: u32,
dwTimeoutMs: u32,
szUserName: [257]u16,
szPassword: [257]u16,
szDomain: [16]u16,
};
pub const RASNOUSERA = extern struct {
dwSize: u32,
dwFlags: u32,
dwTimeoutMs: u32,
szUserName: [257]CHAR,
szPassword: [257]CHAR,
szDomain: [16]CHAR,
};
pub const RASPBDLGW = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hwndOwner: ?HWND,
dwFlags: u32,
xDlg: i32,
yDlg: i32,
dwCallbackId: usize,
pCallback: ?RASPBDLGFUNCW,
dwError: u32,
reserved: usize,
reserved2: usize,
};
pub const RASPBDLGA = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hwndOwner: ?HWND,
dwFlags: u32,
xDlg: i32,
yDlg: i32,
dwCallbackId: usize,
pCallback: ?RASPBDLGFUNCA,
dwError: u32,
reserved: usize,
reserved2: usize,
};
pub const RASENTRYDLGW = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hwndOwner: ?HWND,
dwFlags: u32,
xDlg: i32,
yDlg: i32,
szEntry: [257]u16,
dwError: u32,
reserved: usize,
reserved2: usize,
};
pub const RASENTRYDLGA = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hwndOwner: ?HWND,
dwFlags: u32,
xDlg: i32,
yDlg: i32,
szEntry: [257]CHAR,
dwError: u32,
reserved: usize,
reserved2: usize,
};
pub const RASDIALDLG = extern struct {
// WARNING: unable to add field alignment because it's causing a compiler bug
dwSize: u32,
hwndOwner: ?HWND,
dwFlags: u32,
xDlg: i32,
yDlg: i32,
dwSubEntry: u32,
dwError: u32,
reserved: usize,
reserved2: usize,
};
pub const RasCustomDialDlgFn = fn(
hInstDll: ?HINSTANCE,
dwFlags: u32,
lpszPhonebook: ?PWSTR,
lpszEntry: ?PWSTR,
lpszPhoneNumber: ?PWSTR,
lpInfo: ?*RASDIALDLG,
pvInfo: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const RasCustomEntryDlgFn = fn(
hInstDll: ?HINSTANCE,
lpszPhonebook: ?PWSTR,
lpszEntry: ?PWSTR,
lpInfo: ?*RASENTRYDLGA,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const ROUTER_INTERFACE_TYPE = enum(i32) {
CLIENT = 0,
HOME_ROUTER = 1,
FULL_ROUTER = 2,
DEDICATED = 3,
INTERNAL = 4,
LOOPBACK = 5,
TUNNEL1 = 6,
DIALOUT = 7,
MAX = 8,
};
pub const ROUTER_IF_TYPE_CLIENT = ROUTER_INTERFACE_TYPE.CLIENT;
pub const ROUTER_IF_TYPE_HOME_ROUTER = ROUTER_INTERFACE_TYPE.HOME_ROUTER;
pub const ROUTER_IF_TYPE_FULL_ROUTER = ROUTER_INTERFACE_TYPE.FULL_ROUTER;
pub const ROUTER_IF_TYPE_DEDICATED = ROUTER_INTERFACE_TYPE.DEDICATED;
pub const ROUTER_IF_TYPE_INTERNAL = ROUTER_INTERFACE_TYPE.INTERNAL;
pub const ROUTER_IF_TYPE_LOOPBACK = ROUTER_INTERFACE_TYPE.LOOPBACK;
pub const ROUTER_IF_TYPE_TUNNEL1 = ROUTER_INTERFACE_TYPE.TUNNEL1;
pub const ROUTER_IF_TYPE_DIALOUT = ROUTER_INTERFACE_TYPE.DIALOUT;
pub const ROUTER_IF_TYPE_MAX = ROUTER_INTERFACE_TYPE.MAX;
pub const ROUTER_CONNECTION_STATE = enum(i32) {
UNREACHABLE = 0,
DISCONNECTED = 1,
CONNECTING = 2,
CONNECTED = 3,
};
pub const ROUTER_IF_STATE_UNREACHABLE = ROUTER_CONNECTION_STATE.UNREACHABLE;
pub const ROUTER_IF_STATE_DISCONNECTED = ROUTER_CONNECTION_STATE.DISCONNECTED;
pub const ROUTER_IF_STATE_CONNECTING = ROUTER_CONNECTION_STATE.CONNECTING;
pub const ROUTER_IF_STATE_CONNECTED = ROUTER_CONNECTION_STATE.CONNECTED;
pub const MPR_INTERFACE_0 = extern struct {
wszInterfaceName: [257]u16,
hInterface: ?HANDLE,
fEnabled: BOOL,
dwIfType: ROUTER_INTERFACE_TYPE,
dwConnectionState: ROUTER_CONNECTION_STATE,
fUnReachabilityReasons: u32,
dwLastError: u32,
};
pub const MPR_IPINIP_INTERFACE_0 = extern struct {
wszFriendlyName: [257]u16,
Guid: Guid,
};
pub const MPR_INTERFACE_1 = extern struct {
wszInterfaceName: [257]u16,
hInterface: ?HANDLE,
fEnabled: BOOL,
dwIfType: ROUTER_INTERFACE_TYPE,
dwConnectionState: ROUTER_CONNECTION_STATE,
fUnReachabilityReasons: u32,
dwLastError: u32,
lpwsDialoutHoursRestriction: ?PWSTR,
};
pub const MPR_INTERFACE_2 = extern struct {
wszInterfaceName: [257]u16,
hInterface: ?HANDLE,
fEnabled: BOOL,
dwIfType: ROUTER_INTERFACE_TYPE,
dwConnectionState: ROUTER_CONNECTION_STATE,
fUnReachabilityReasons: u32,
dwLastError: u32,
dwfOptions: u32,
szLocalPhoneNumber: [129]u16,
szAlternates: ?[*]u16,
ipaddr: u32,
ipaddrDns: u32,
ipaddrDnsAlt: u32,
ipaddrWins: u32,
ipaddrWinsAlt: u32,
dwfNetProtocols: u32,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szX25PadType: [33]u16,
szX25Address: [201]u16,
szX25Facilities: [201]u16,
szX25UserData: [201]u16,
dwChannels: u32,
dwSubEntries: u32,
dwDialMode: MPR_INTERFACE_DIAL_MODE,
dwDialExtraPercent: u32,
dwDialExtraSampleSeconds: u32,
dwHangUpExtraPercent: u32,
dwHangUpExtraSampleSeconds: u32,
dwIdleDisconnectSeconds: u32,
dwType: u32,
dwEncryptionType: MPR_ET,
dwCustomAuthKey: u32,
dwCustomAuthDataSize: u32,
lpbCustomAuthData: ?*u8,
guidId: Guid,
dwVpnStrategy: MPR_VS,
};
pub const MPR_INTERFACE_3 = extern struct {
wszInterfaceName: [257]u16,
hInterface: ?HANDLE,
fEnabled: BOOL,
dwIfType: ROUTER_INTERFACE_TYPE,
dwConnectionState: ROUTER_CONNECTION_STATE,
fUnReachabilityReasons: u32,
dwLastError: u32,
dwfOptions: u32,
szLocalPhoneNumber: [129]u16,
szAlternates: ?[*]u16,
ipaddr: u32,
ipaddrDns: u32,
ipaddrDnsAlt: u32,
ipaddrWins: u32,
ipaddrWinsAlt: u32,
dwfNetProtocols: u32,
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szX25PadType: [33]u16,
szX25Address: [201]u16,
szX25Facilities: [201]u16,
szX25UserData: [201]u16,
dwChannels: u32,
dwSubEntries: u32,
dwDialMode: MPR_INTERFACE_DIAL_MODE,
dwDialExtraPercent: u32,
dwDialExtraSampleSeconds: u32,
dwHangUpExtraPercent: u32,
dwHangUpExtraSampleSeconds: u32,
dwIdleDisconnectSeconds: u32,
dwType: u32,
dwEncryptionType: MPR_ET,
dwCustomAuthKey: u32,
dwCustomAuthDataSize: u32,
lpbCustomAuthData: ?*u8,
guidId: Guid,
dwVpnStrategy: MPR_VS,
AddressCount: u32,
ipv6addrDns: IN6_ADDR,
ipv6addrDnsAlt: IN6_ADDR,
ipv6addr: ?*IN6_ADDR,
};
pub const MPR_DEVICE_0 = extern struct {
szDeviceType: [17]u16,
szDeviceName: [129]u16,
};
pub const MPR_DEVICE_1 = extern struct {
szDeviceType: [17]u16,
szDeviceName: [129]u16,
szLocalPhoneNumber: [129]u16,
szAlternates: ?[*]u16,
};
pub const MPR_CREDENTIALSEX_0 = extern struct {
dwSize: u32,
lpbCredentialsInfo: ?*u8,
};
pub const MPR_CREDENTIALSEX_1 = extern struct {
dwSize: u32,
lpbCredentialsInfo: ?*u8,
};
pub const MPR_TRANSPORT_0 = extern struct {
dwTransportId: u32,
hTransport: ?HANDLE,
wszTransportName: [41]u16,
};
pub const MPR_IFTRANSPORT_0 = extern struct {
dwTransportId: u32,
hIfTransport: ?HANDLE,
wszIfTransportName: [41]u16,
};
pub const MPR_SERVER_0 = extern struct {
fLanOnlyMode: BOOL,
dwUpTime: u32,
dwTotalPorts: u32,
dwPortsInUse: u32,
};
pub const MPR_SERVER_1 = extern struct {
dwNumPptpPorts: u32,
dwPptpPortFlags: u32,
dwNumL2tpPorts: u32,
dwL2tpPortFlags: u32,
};
pub const MPR_SERVER_2 = extern struct {
dwNumPptpPorts: u32,
dwPptpPortFlags: u32,
dwNumL2tpPorts: u32,
dwL2tpPortFlags: u32,
dwNumSstpPorts: u32,
dwSstpPortFlags: u32,
};
pub const RAS_PORT_CONDITION = enum(i32) {
NON_OPERATIONAL = 0,
DISCONNECTED = 1,
CALLING_BACK = 2,
LISTENING = 3,
AUTHENTICATING = 4,
AUTHENTICATED = 5,
INITIALIZING = 6,
};
pub const RAS_PORT_NON_OPERATIONAL = RAS_PORT_CONDITION.NON_OPERATIONAL;
pub const RAS_PORT_DISCONNECTED = RAS_PORT_CONDITION.DISCONNECTED;
pub const RAS_PORT_CALLING_BACK = RAS_PORT_CONDITION.CALLING_BACK;
pub const RAS_PORT_LISTENING = RAS_PORT_CONDITION.LISTENING;
pub const RAS_PORT_AUTHENTICATING = RAS_PORT_CONDITION.AUTHENTICATING;
pub const RAS_PORT_AUTHENTICATED = RAS_PORT_CONDITION.AUTHENTICATED;
pub const RAS_PORT_INITIALIZING = RAS_PORT_CONDITION.INITIALIZING;
pub const RAS_HARDWARE_CONDITION = enum(i32) {
OPERATIONAL = 0,
FAILURE = 1,
};
pub const RAS_HARDWARE_OPERATIONAL = RAS_HARDWARE_CONDITION.OPERATIONAL;
pub const RAS_HARDWARE_FAILURE = RAS_HARDWARE_CONDITION.FAILURE;
pub const RAS_PORT_0 = extern struct {
hPort: ?HANDLE,
hConnection: ?HANDLE,
dwPortCondition: RAS_PORT_CONDITION,
dwTotalNumberOfCalls: u32,
dwConnectDuration: u32,
wszPortName: [17]u16,
wszMediaName: [17]u16,
wszDeviceName: [129]u16,
wszDeviceType: [17]u16,
};
pub const RAS_PORT_1 = extern struct {
hPort: ?HANDLE,
hConnection: ?HANDLE,
dwHardwareCondition: RAS_HARDWARE_CONDITION,
dwLineSpeed: u32,
dwBytesXmited: u32,
dwBytesRcved: u32,
dwFramesXmited: u32,
dwFramesRcved: u32,
dwCrcErr: u32,
dwTimeoutErr: u32,
dwAlignmentErr: u32,
dwHardwareOverrunErr: u32,
dwFramingErr: u32,
dwBufferOverrunErr: u32,
dwCompressionRatioIn: u32,
dwCompressionRatioOut: u32,
};
pub const RAS_PORT_2 = extern struct {
hPort: ?HANDLE,
hConnection: ?HANDLE,
dwConn_State: u32,
wszPortName: [17]u16,
wszMediaName: [17]u16,
wszDeviceName: [129]u16,
wszDeviceType: [17]u16,
dwHardwareCondition: RAS_HARDWARE_CONDITION,
dwLineSpeed: u32,
dwCrcErr: u32,
dwSerialOverRunErrs: u32,
dwTimeoutErr: u32,
dwAlignmentErr: u32,
dwHardwareOverrunErr: u32,
dwFramingErr: u32,
dwBufferOverrunErr: u32,
dwCompressionRatioIn: u32,
dwCompressionRatioOut: u32,
dwTotalErrors: u32,
ullBytesXmited: u64,
ullBytesRcved: u64,
ullFramesXmited: u64,
ullFramesRcved: u64,
ullBytesTxUncompressed: u64,
ullBytesTxCompressed: u64,
ullBytesRcvUncompressed: u64,
ullBytesRcvCompressed: u64,
};
pub const PPP_NBFCP_INFO = extern struct {
dwError: u32,
wszWksta: [17]u16,
};
pub const PPP_IPCP_INFO = extern struct {
dwError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
};
pub const PPP_IPCP_INFO2 = extern struct {
dwError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
dwOptions: u32,
dwRemoteOptions: u32,
};
pub const PPP_IPXCP_INFO = extern struct {
dwError: u32,
wszAddress: [23]u16,
};
pub const PPP_ATCP_INFO = extern struct {
dwError: u32,
wszAddress: [33]u16,
};
pub const PPP_IPV6_CP_INFO = extern struct {
dwVersion: u32,
dwSize: u32,
dwError: u32,
bInterfaceIdentifier: [8]u8,
bRemoteInterfaceIdentifier: [8]u8,
dwOptions: u32,
dwRemoteOptions: u32,
bPrefix: [8]u8,
dwPrefixLength: u32,
};
pub const PPP_INFO = extern struct {
nbf: PPP_NBFCP_INFO,
ip: PPP_IPCP_INFO,
ipx: PPP_IPXCP_INFO,
at: PPP_ATCP_INFO,
};
pub const PPP_CCP_INFO = extern struct {
dwError: u32,
dwCompressionAlgorithm: u32,
dwOptions: u32,
dwRemoteCompressionAlgorithm: u32,
dwRemoteOptions: u32,
};
pub const PPP_LCP_INFO = extern struct {
dwError: u32,
dwAuthenticationProtocol: PPP_LCP,
dwAuthenticationData: PPP_LCP_INFO_AUTH_DATA,
dwRemoteAuthenticationProtocol: u32,
dwRemoteAuthenticationData: u32,
dwTerminateReason: u32,
dwRemoteTerminateReason: u32,
dwOptions: u32,
dwRemoteOptions: u32,
dwEapTypeId: u32,
dwRemoteEapTypeId: u32,
};
pub const PPP_INFO_2 = extern struct {
nbf: PPP_NBFCP_INFO,
ip: PPP_IPCP_INFO2,
ipx: PPP_IPXCP_INFO,
at: PPP_ATCP_INFO,
ccp: PPP_CCP_INFO,
lcp: PPP_LCP_INFO,
};
pub const PPP_INFO_3 = extern struct {
nbf: PPP_NBFCP_INFO,
ip: PPP_IPCP_INFO2,
ipv6: PPP_IPV6_CP_INFO,
ccp: PPP_CCP_INFO,
lcp: PPP_LCP_INFO,
};
pub const RAS_CONNECTION_0 = extern struct {
hConnection: ?HANDLE,
hInterface: ?HANDLE,
dwConnectDuration: u32,
dwInterfaceType: ROUTER_INTERFACE_TYPE,
dwConnectionFlags: RAS_FLAGS,
wszInterfaceName: [257]u16,
wszUserName: [257]u16,
wszLogonDomain: [16]u16,
wszRemoteComputer: [17]u16,
};
pub const RAS_CONNECTION_1 = extern struct {
hConnection: ?HANDLE,
hInterface: ?HANDLE,
PppInfo: PPP_INFO,
dwBytesXmited: u32,
dwBytesRcved: u32,
dwFramesXmited: u32,
dwFramesRcved: u32,
dwCrcErr: u32,
dwTimeoutErr: u32,
dwAlignmentErr: u32,
dwHardwareOverrunErr: u32,
dwFramingErr: u32,
dwBufferOverrunErr: u32,
dwCompressionRatioIn: u32,
dwCompressionRatioOut: u32,
};
pub const RAS_CONNECTION_2 = extern struct {
hConnection: ?HANDLE,
wszUserName: [257]u16,
dwInterfaceType: ROUTER_INTERFACE_TYPE,
guid: Guid,
PppInfo2: PPP_INFO_2,
};
pub const RAS_QUARANTINE_STATE = enum(i32) {
NORMAL = 0,
QUARANTINE = 1,
PROBATION = 2,
NOT_CAPABLE = 3,
};
pub const RAS_QUAR_STATE_NORMAL = RAS_QUARANTINE_STATE.NORMAL;
pub const RAS_QUAR_STATE_QUARANTINE = RAS_QUARANTINE_STATE.QUARANTINE;
pub const RAS_QUAR_STATE_PROBATION = RAS_QUARANTINE_STATE.PROBATION;
pub const RAS_QUAR_STATE_NOT_CAPABLE = RAS_QUARANTINE_STATE.NOT_CAPABLE;
pub const RAS_CONNECTION_3 = extern struct {
dwVersion: u32,
dwSize: u32,
hConnection: ?HANDLE,
wszUserName: [257]u16,
dwInterfaceType: ROUTER_INTERFACE_TYPE,
guid: Guid,
PppInfo3: PPP_INFO_3,
rasQuarState: RAS_QUARANTINE_STATE,
timer: FILETIME,
};
pub const RAS_USER_0 = extern struct {
bfPrivilege: u8,
wszPhoneNumber: [129]u16,
};
pub const RAS_USER_1 = extern struct {
bfPrivilege: u8,
wszPhoneNumber: [129]u16,
bfPrivilege2: u8,
};
pub const MPR_FILTER_0 = extern struct {
fEnable: BOOL,
};
pub const MPRAPI_OBJECT_HEADER = extern struct {
revision: u8,
type: u8,
size: u16,
};
pub const MPRAPI_OBJECT_TYPE = enum(i32) {
RAS_CONNECTION_OBJECT = 1,
MPR_SERVER_OBJECT = 2,
MPR_SERVER_SET_CONFIG_OBJECT = 3,
AUTH_VALIDATION_OBJECT = 4,
UPDATE_CONNECTION_OBJECT = 5,
IF_CUSTOM_CONFIG_OBJECT = 6,
};
pub const MPRAPI_OBJECT_TYPE_RAS_CONNECTION_OBJECT = MPRAPI_OBJECT_TYPE.RAS_CONNECTION_OBJECT;
pub const MPRAPI_OBJECT_TYPE_MPR_SERVER_OBJECT = MPRAPI_OBJECT_TYPE.MPR_SERVER_OBJECT;
pub const MPRAPI_OBJECT_TYPE_MPR_SERVER_SET_CONFIG_OBJECT = MPRAPI_OBJECT_TYPE.MPR_SERVER_SET_CONFIG_OBJECT;
pub const MPRAPI_OBJECT_TYPE_AUTH_VALIDATION_OBJECT = MPRAPI_OBJECT_TYPE.AUTH_VALIDATION_OBJECT;
pub const MPRAPI_OBJECT_TYPE_UPDATE_CONNECTION_OBJECT = MPRAPI_OBJECT_TYPE.UPDATE_CONNECTION_OBJECT;
pub const MPRAPI_OBJECT_TYPE_IF_CUSTOM_CONFIG_OBJECT = MPRAPI_OBJECT_TYPE.IF_CUSTOM_CONFIG_OBJECT;
pub const PPP_PROJECTION_INFO = extern struct {
dwIPv4NegotiationError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
dwIPv4Options: u32,
dwIPv4RemoteOptions: u32,
IPv4SubInterfaceIndex: u64,
dwIPv6NegotiationError: u32,
bInterfaceIdentifier: [8]u8,
bRemoteInterfaceIdentifier: [8]u8,
bPrefix: [8]u8,
dwPrefixLength: u32,
IPv6SubInterfaceIndex: u64,
dwLcpError: u32,
dwAuthenticationProtocol: PPP_LCP,
dwAuthenticationData: PPP_LCP_INFO_AUTH_DATA,
dwRemoteAuthenticationProtocol: PPP_LCP,
dwRemoteAuthenticationData: PPP_LCP_INFO_AUTH_DATA,
dwLcpTerminateReason: u32,
dwLcpRemoteTerminateReason: u32,
dwLcpOptions: u32,
dwLcpRemoteOptions: u32,
dwEapTypeId: u32,
dwRemoteEapTypeId: u32,
dwCcpError: u32,
dwCompressionAlgorithm: u32,
dwCcpOptions: u32,
dwRemoteCompressionAlgorithm: u32,
dwCcpRemoteOptions: u32,
};
pub const PPP_PROJECTION_INFO2 = extern struct {
dwIPv4NegotiationError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
dwIPv4Options: u32,
dwIPv4RemoteOptions: u32,
IPv4SubInterfaceIndex: u64,
dwIPv6NegotiationError: u32,
bInterfaceIdentifier: [8]u8,
bRemoteInterfaceIdentifier: [8]u8,
bPrefix: [8]u8,
dwPrefixLength: u32,
IPv6SubInterfaceIndex: u64,
dwLcpError: u32,
dwAuthenticationProtocol: PPP_LCP,
dwAuthenticationData: PPP_LCP_INFO_AUTH_DATA,
dwRemoteAuthenticationProtocol: PPP_LCP,
dwRemoteAuthenticationData: PPP_LCP_INFO_AUTH_DATA,
dwLcpTerminateReason: u32,
dwLcpRemoteTerminateReason: u32,
dwLcpOptions: u32,
dwLcpRemoteOptions: u32,
dwEapTypeId: u32,
dwEmbeddedEAPTypeId: u32,
dwRemoteEapTypeId: u32,
dwCcpError: u32,
dwCompressionAlgorithm: u32,
dwCcpOptions: u32,
dwRemoteCompressionAlgorithm: u32,
dwCcpRemoteOptions: u32,
};
pub const IKEV2_PROJECTION_INFO = extern struct {
dwIPv4NegotiationError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
IPv4SubInterfaceIndex: u64,
dwIPv6NegotiationError: u32,
bInterfaceIdentifier: [8]u8,
bRemoteInterfaceIdentifier: [8]u8,
bPrefix: [8]u8,
dwPrefixLength: u32,
IPv6SubInterfaceIndex: u64,
dwOptions: u32,
dwAuthenticationProtocol: u32,
dwEapTypeId: u32,
dwCompressionAlgorithm: u32,
dwEncryptionMethod: u32,
};
pub const IKEV2_PROJECTION_INFO2 = extern struct {
dwIPv4NegotiationError: u32,
wszAddress: [16]u16,
wszRemoteAddress: [16]u16,
IPv4SubInterfaceIndex: u64,
dwIPv6NegotiationError: u32,
bInterfaceIdentifier: [8]u8,
bRemoteInterfaceIdentifier: [8]u8,
bPrefix: [8]u8,
dwPrefixLength: u32,
IPv6SubInterfaceIndex: u64,
dwOptions: u32,
dwAuthenticationProtocol: u32,
dwEapTypeId: u32,
dwEmbeddedEAPTypeId: u32,
dwCompressionAlgorithm: u32,
dwEncryptionMethod: u32,
};
pub const PROJECTION_INFO = extern struct {
projectionInfoType: u8,
Anonymous: extern union {
PppProjectionInfo: PPP_PROJECTION_INFO,
Ikev2ProjectionInfo: IKEV2_PROJECTION_INFO,
},
};
pub const PROJECTION_INFO2 = extern struct {
projectionInfoType: u8,
Anonymous: extern union {
PppProjectionInfo: PPP_PROJECTION_INFO2,
Ikev2ProjectionInfo: IKEV2_PROJECTION_INFO2,
},
};
pub const RAS_CONNECTION_EX = extern struct {
Header: MPRAPI_OBJECT_HEADER,
dwConnectDuration: u32,
dwInterfaceType: ROUTER_INTERFACE_TYPE,
dwConnectionFlags: RAS_FLAGS,
wszInterfaceName: [257]u16,
wszUserName: [257]u16,
wszLogonDomain: [16]u16,
wszRemoteComputer: [17]u16,
guid: Guid,
rasQuarState: RAS_QUARANTINE_STATE,
probationTime: FILETIME,
dwBytesXmited: u32,
dwBytesRcved: u32,
dwFramesXmited: u32,
dwFramesRcved: u32,
dwCrcErr: u32,
dwTimeoutErr: u32,
dwAlignmentErr: u32,
dwHardwareOverrunErr: u32,
dwFramingErr: u32,
dwBufferOverrunErr: u32,
dwCompressionRatioIn: u32,
dwCompressionRatioOut: u32,
dwNumSwitchOvers: u32,
wszRemoteEndpointAddress: [65]u16,
wszLocalEndpointAddress: [65]u16,
ProjectionInfo: PROJECTION_INFO,
hConnection: ?HANDLE,
hInterface: ?HANDLE,
};
pub const RAS_CONNECTION_4 = extern struct {
dwConnectDuration: u32,
dwInterfaceType: ROUTER_INTERFACE_TYPE,
dwConnectionFlags: RAS_FLAGS,
wszInterfaceName: [257]u16,
wszUserName: [257]u16,
wszLogonDomain: [16]u16,
wszRemoteComputer: [17]u16,
guid: Guid,
rasQuarState: RAS_QUARANTINE_STATE,
probationTime: FILETIME,
connectionStartTime: FILETIME,
ullBytesXmited: u64,
ullBytesRcved: u64,
dwFramesXmited: u32,
dwFramesRcved: u32,
dwCrcErr: u32,
dwTimeoutErr: u32,
dwAlignmentErr: u32,
dwHardwareOverrunErr: u32,
dwFramingErr: u32,
dwBufferOverrunErr: u32,
dwCompressionRatioIn: u32,
dwCompressionRatioOut: u32,
dwNumSwitchOvers: u32,
wszRemoteEndpointAddress: [65]u16,
wszLocalEndpointAddress: [65]u16,
ProjectionInfo: PROJECTION_INFO2,
hConnection: ?HANDLE,
hInterface: ?HANDLE,
dwDeviceType: u32,
};
pub const ROUTER_CUSTOM_IKEv2_POLICY0 = extern struct {
dwIntegrityMethod: u32,
dwEncryptionMethod: u32,
dwCipherTransformConstant: u32,
dwAuthTransformConstant: u32,
dwPfsGroup: u32,
dwDhGroup: u32,
};
pub const ROUTER_IKEv2_IF_CUSTOM_CONFIG0 = extern struct {
dwSaLifeTime: u32,
dwSaDataSize: u32,
certificateName: CRYPTOAPI_BLOB,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
};
pub const MPR_IF_CUSTOMINFOEX0 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
dwFlags: u32,
customIkev2Config: ROUTER_IKEv2_IF_CUSTOM_CONFIG0,
};
pub const MPR_CERT_EKU = extern struct {
dwSize: u32,
IsEKUOID: BOOL,
pwszEKU: ?PWSTR,
};
pub const VPN_TS_IP_ADDRESS = extern struct {
Type: u16,
Anonymous: extern union {
v4: IN_ADDR,
v6: IN6_ADDR,
},
};
pub const MPR_VPN_TS_TYPE = enum(i32) {
@"4_ADDR_RANGE" = 7,
@"6_ADDR_RANGE" = 8,
};
pub const MPR_VPN_TS_IPv4_ADDR_RANGE = MPR_VPN_TS_TYPE.@"4_ADDR_RANGE";
pub const MPR_VPN_TS_IPv6_ADDR_RANGE = MPR_VPN_TS_TYPE.@"6_ADDR_RANGE";
pub const _MPR_VPN_SELECTOR = extern struct {
type: MPR_VPN_TS_TYPE,
protocolId: u8,
portStart: u16,
portEnd: u16,
tsPayloadId: u16,
addrStart: VPN_TS_IP_ADDRESS,
addrEnd: VPN_TS_IP_ADDRESS,
};
pub const MPR_VPN_TRAFFIC_SELECTORS = extern struct {
numTsi: u32,
numTsr: u32,
tsI: ?*_MPR_VPN_SELECTOR,
tsR: ?*_MPR_VPN_SELECTOR,
};
pub const ROUTER_IKEv2_IF_CUSTOM_CONFIG2 = extern struct {
dwSaLifeTime: u32,
dwSaDataSize: u32,
certificateName: CRYPTOAPI_BLOB,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
certificateHash: CRYPTOAPI_BLOB,
dwMmSaLifeTime: u32,
vpnTrafficSelectors: MPR_VPN_TRAFFIC_SELECTORS,
};
pub const MPR_IF_CUSTOMINFOEX2 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
dwFlags: u32,
customIkev2Config: ROUTER_IKEv2_IF_CUSTOM_CONFIG2,
};
pub const IKEV2_TUNNEL_CONFIG_PARAMS4 = extern struct {
dwIdleTimeout: u32,
dwNetworkBlackoutTime: u32,
dwSaLifeTime: u32,
dwSaDataSizeForRenegotiation: u32,
dwConfigOptions: u32,
dwTotalCertificates: u32,
certificateNames: ?*CRYPTOAPI_BLOB,
machineCertificateName: CRYPTOAPI_BLOB,
dwEncryptionType: u32,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
dwTotalEkus: u32,
certificateEKUs: ?*MPR_CERT_EKU,
machineCertificateHash: CRYPTOAPI_BLOB,
dwMmSaLifeTime: u32,
};
pub const ROUTER_IKEv2_IF_CUSTOM_CONFIG1 = extern struct {
dwSaLifeTime: u32,
dwSaDataSize: u32,
certificateName: CRYPTOAPI_BLOB,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
certificateHash: CRYPTOAPI_BLOB,
};
pub const MPR_IF_CUSTOMINFOEX1 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
dwFlags: u32,
customIkev2Config: ROUTER_IKEv2_IF_CUSTOM_CONFIG1,
};
pub const IKEV2_TUNNEL_CONFIG_PARAMS3 = extern struct {
dwIdleTimeout: u32,
dwNetworkBlackoutTime: u32,
dwSaLifeTime: u32,
dwSaDataSizeForRenegotiation: u32,
dwConfigOptions: u32,
dwTotalCertificates: u32,
certificateNames: ?*CRYPTOAPI_BLOB,
machineCertificateName: CRYPTOAPI_BLOB,
dwEncryptionType: u32,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
dwTotalEkus: u32,
certificateEKUs: ?*MPR_CERT_EKU,
machineCertificateHash: CRYPTOAPI_BLOB,
};
pub const IKEV2_TUNNEL_CONFIG_PARAMS2 = extern struct {
dwIdleTimeout: u32,
dwNetworkBlackoutTime: u32,
dwSaLifeTime: u32,
dwSaDataSizeForRenegotiation: u32,
dwConfigOptions: u32,
dwTotalCertificates: u32,
certificateNames: ?*CRYPTOAPI_BLOB,
machineCertificateName: CRYPTOAPI_BLOB,
dwEncryptionType: u32,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
};
pub const L2TP_TUNNEL_CONFIG_PARAMS2 = extern struct {
dwIdleTimeout: u32,
dwEncryptionType: u32,
dwSaLifeTime: u32,
dwSaDataSizeForRenegotiation: u32,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
dwMmSaLifeTime: u32,
};
pub const L2TP_TUNNEL_CONFIG_PARAMS1 = extern struct {
dwIdleTimeout: u32,
dwEncryptionType: u32,
dwSaLifeTime: u32,
dwSaDataSizeForRenegotiation: u32,
customPolicy: ?*ROUTER_CUSTOM_IKEv2_POLICY0,
};
pub const IKEV2_CONFIG_PARAMS = extern struct {
dwNumPorts: u32,
dwPortFlags: u32,
dwTunnelConfigParamFlags: u32,
TunnelConfigParams: IKEV2_TUNNEL_CONFIG_PARAMS4,
};
pub const PPTP_CONFIG_PARAMS = extern struct {
dwNumPorts: u32,
dwPortFlags: u32,
};
pub const L2TP_CONFIG_PARAMS1 = extern struct {
dwNumPorts: u32,
dwPortFlags: u32,
dwTunnelConfigParamFlags: u32,
TunnelConfigParams: L2TP_TUNNEL_CONFIG_PARAMS2,
};
pub const GRE_CONFIG_PARAMS0 = extern struct {
dwNumPorts: u32,
dwPortFlags: u32,
};
pub const L2TP_CONFIG_PARAMS0 = extern struct {
dwNumPorts: u32,
dwPortFlags: u32,
};
pub const SSTP_CERT_INFO = extern struct {
isDefault: BOOL,
certBlob: CRYPTOAPI_BLOB,
};
pub const SSTP_CONFIG_PARAMS = extern struct {
dwNumPorts: u32,
dwPortFlags: u32,
isUseHttps: BOOL,
certAlgorithm: u32,
sstpCertDetails: SSTP_CERT_INFO,
};
pub const MPRAPI_TUNNEL_CONFIG_PARAMS0 = extern struct {
IkeConfigParams: IKEV2_CONFIG_PARAMS,
PptpConfigParams: PPTP_CONFIG_PARAMS,
L2tpConfigParams: L2TP_CONFIG_PARAMS1,
SstpConfigParams: SSTP_CONFIG_PARAMS,
};
pub const MPRAPI_TUNNEL_CONFIG_PARAMS1 = extern struct {
IkeConfigParams: IKEV2_CONFIG_PARAMS,
PptpConfigParams: PPTP_CONFIG_PARAMS,
L2tpConfigParams: L2TP_CONFIG_PARAMS1,
SstpConfigParams: SSTP_CONFIG_PARAMS,
GREConfigParams: GRE_CONFIG_PARAMS0,
};
pub const MPR_SERVER_EX0 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
fLanOnlyMode: u32,
dwUpTime: u32,
dwTotalPorts: u32,
dwPortsInUse: u32,
Reserved: u32,
ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS0,
};
pub const MPR_SERVER_EX1 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
fLanOnlyMode: u32,
dwUpTime: u32,
dwTotalPorts: u32,
dwPortsInUse: u32,
Reserved: u32,
ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS1,
};
pub const MPR_SERVER_SET_CONFIG_EX0 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
setConfigForProtocols: u32,
ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS0,
};
pub const MPR_SERVER_SET_CONFIG_EX1 = extern struct {
Header: MPRAPI_OBJECT_HEADER,
setConfigForProtocols: u32,
ConfigParams: MPRAPI_TUNNEL_CONFIG_PARAMS1,
};
pub const AUTH_VALIDATION_EX = extern struct {
Header: MPRAPI_OBJECT_HEADER,
hRasConnection: ?HANDLE,
wszUserName: [257]u16,
wszLogonDomain: [16]u16,
AuthInfoSize: u32,
AuthInfo: [1]u8,
};
pub const RAS_UPDATE_CONNECTION = extern struct {
Header: MPRAPI_OBJECT_HEADER,
dwIfIndex: u32,
wszLocalEndpointAddress: [65]u16,
wszRemoteEndpointAddress: [65]u16,
};
pub const PMPRADMINGETIPADDRESSFORUSER = fn(
param0: ?PWSTR,
param1: ?PWSTR,
param2: ?*u32,
param3: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMPRADMINRELEASEIPADRESS = fn(
param0: ?PWSTR,
param1: ?PWSTR,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINGETIPV6ADDRESSFORUSER = fn(
param0: ?PWSTR,
param1: ?PWSTR,
param2: ?*IN6_ADDR,
param3: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMPRADMINRELEASEIPV6ADDRESSFORUSER = fn(
param0: ?PWSTR,
param1: ?PWSTR,
param2: ?*IN6_ADDR,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINACCEPTNEWCONNECTION = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINACCEPTNEWCONNECTION2 = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
param2: ?*RAS_CONNECTION_2,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINACCEPTNEWCONNECTION3 = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
param2: ?*RAS_CONNECTION_2,
param3: ?*RAS_CONNECTION_3,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINACCEPTNEWLINK = fn(
param0: ?*RAS_PORT_0,
param1: ?*RAS_PORT_1,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINCONNECTIONHANGUPNOTIFICATION = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINCONNECTIONHANGUPNOTIFICATION2 = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
param2: ?*RAS_CONNECTION_2,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINCONNECTIONHANGUPNOTIFICATION3 = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
param2: ?*RAS_CONNECTION_2,
param3: RAS_CONNECTION_3,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINLINKHANGUPNOTIFICATION = fn(
param0: ?*RAS_PORT_0,
param1: ?*RAS_PORT_1,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINTERMINATEDLL = fn(
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMPRADMINACCEPTREAUTHENTICATION = fn(
param0: ?*RAS_CONNECTION_0,
param1: ?*RAS_CONNECTION_1,
param2: ?*RAS_CONNECTION_2,
param3: ?*RAS_CONNECTION_3,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINACCEPTNEWCONNECTIONEX = fn(
param0: ?*RAS_CONNECTION_EX,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINACCEPTREAUTHENTICATIONEX = fn(
param0: ?*RAS_CONNECTION_EX,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINACCEPTTUNNELENDPOINTCHANGEEX = fn(
param0: ?*RAS_CONNECTION_EX,
) callconv(@import("std").os.windows.WINAPI) BOOL;
pub const PMPRADMINCONNECTIONHANGUPNOTIFICATIONEX = fn(
param0: ?*RAS_CONNECTION_EX,
) callconv(@import("std").os.windows.WINAPI) void;
pub const PMPRADMINRASVALIDATEPREAUTHENTICATEDCONNECTIONEX = fn(
param0: ?*AUTH_VALIDATION_EX,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const MPRAPI_ADMIN_DLL_CALLBACKS = extern struct {
revision: u8,
lpfnMprAdminGetIpAddressForUser: ?PMPRADMINGETIPADDRESSFORUSER,
lpfnMprAdminReleaseIpAddress: ?PMPRADMINRELEASEIPADRESS,
lpfnMprAdminGetIpv6AddressForUser: ?PMPRADMINGETIPV6ADDRESSFORUSER,
lpfnMprAdminReleaseIpV6AddressForUser: ?PMPRADMINRELEASEIPV6ADDRESSFORUSER,
lpfnRasAdminAcceptNewLink: ?PMPRADMINACCEPTNEWLINK,
lpfnRasAdminLinkHangupNotification: ?PMPRADMINLINKHANGUPNOTIFICATION,
lpfnRasAdminTerminateDll: ?PMPRADMINTERMINATEDLL,
lpfnRasAdminAcceptNewConnectionEx: ?PMPRADMINACCEPTNEWCONNECTIONEX,
lpfnRasAdminAcceptEndpointChangeEx: ?PMPRADMINACCEPTTUNNELENDPOINTCHANGEEX,
lpfnRasAdminAcceptReauthenticationEx: ?PMPRADMINACCEPTREAUTHENTICATIONEX,
lpfnRasAdminConnectionHangupNotificationEx: ?PMPRADMINCONNECTIONHANGUPNOTIFICATIONEX,
lpfnRASValidatePreAuthenticatedConnectionEx: ?PMPRADMINRASVALIDATEPREAUTHENTICATEDCONNECTIONEX,
};
pub const SECURITY_MESSAGE = extern struct {
dwMsgId: SECURITY_MESSAGE_MSG_ID,
hPort: isize,
dwError: u32,
UserName: [257]CHAR,
Domain: [16]CHAR,
};
pub const RAS_SECURITY_INFO = extern struct {
LastError: u32,
BytesReceived: u32,
DeviceName: [129]CHAR,
};
pub const RASSECURITYPROC = fn(
) callconv(@import("std").os.windows.WINAPI) u32;
pub const MGM_IF_ENTRY = extern struct {
dwIfIndex: u32,
dwIfNextHopAddr: u32,
bIGMP: BOOL,
bIsEnabled: BOOL,
};
pub const PMGM_RPF_CALLBACK = fn(
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
pdwInIfIndex: ?*u32,
pdwInIfNextHopAddr: ?*u32,
pdwUpStreamNbr: ?*u32,
dwHdrSize: u32,
pbPacketHdr: ?*u8,
pbRoute: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_CREATION_ALERT_CALLBACK = fn(
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
dwInIfIndex: u32,
dwInIfNextHopAddr: u32,
dwIfCount: u32,
pmieOutIfList: ?*MGM_IF_ENTRY,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_PRUNE_ALERT_CALLBACK = fn(
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
dwIfIndex: u32,
dwIfNextHopAddr: u32,
bMemberDelete: BOOL,
pdwTimeout: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_JOIN_ALERT_CALLBACK = fn(
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
bMemberUpdate: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_WRONG_IF_CALLBACK = fn(
dwSourceAddr: u32,
dwGroupAddr: u32,
dwIfIndex: u32,
dwIfNextHopAddr: u32,
dwHdrSize: u32,
pbPacketHdr: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_LOCAL_JOIN_CALLBACK = fn(
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
dwIfIndex: u32,
dwIfNextHopAddr: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_LOCAL_LEAVE_CALLBACK = fn(
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
dwIfIndex: u32,
dwIfNextHopAddr: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_DISABLE_IGMP_CALLBACK = fn(
dwIfIndex: u32,
dwIfNextHopAddr: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const PMGM_ENABLE_IGMP_CALLBACK = fn(
dwIfIndex: u32,
dwIfNextHopAddr: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const ROUTING_PROTOCOL_CONFIG = extern struct {
dwCallbackFlags: u32,
pfnRpfCallback: ?PMGM_RPF_CALLBACK,
pfnCreationAlertCallback: ?PMGM_CREATION_ALERT_CALLBACK,
pfnPruneAlertCallback: ?PMGM_PRUNE_ALERT_CALLBACK,
pfnJoinAlertCallback: ?PMGM_JOIN_ALERT_CALLBACK,
pfnWrongIfCallback: ?PMGM_WRONG_IF_CALLBACK,
pfnLocalJoinCallback: ?PMGM_LOCAL_JOIN_CALLBACK,
pfnLocalLeaveCallback: ?PMGM_LOCAL_LEAVE_CALLBACK,
pfnDisableIgmpCallback: ?PMGM_DISABLE_IGMP_CALLBACK,
pfnEnableIgmpCallback: ?PMGM_ENABLE_IGMP_CALLBACK,
};
pub const MGM_ENUM_TYPES = enum(i32) {
NY_SOURCE = 0,
LL_SOURCES = 1,
};
pub const ANY_SOURCE = MGM_ENUM_TYPES.NY_SOURCE;
pub const ALL_SOURCES = MGM_ENUM_TYPES.LL_SOURCES;
pub const SOURCE_GROUP_ENTRY = extern struct {
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
};
pub const RTM_REGN_PROFILE = extern struct {
MaxNextHopsInRoute: u32,
MaxHandlesInEnum: u32,
ViewsSupported: u32,
NumberOfViews: u32,
};
pub const RTM_NET_ADDRESS = extern struct {
AddressFamily: u16,
NumBits: u16,
AddrBits: [16]u8,
};
pub const RTM_PREF_INFO = extern struct {
Metric: u32,
Preference: u32,
};
pub const RTM_NEXTHOP_LIST = extern struct {
NumNextHops: u16,
NextHops: [1]isize,
};
pub const RTM_DEST_INFO = extern struct {
DestHandle: isize,
DestAddress: RTM_NET_ADDRESS,
LastChanged: FILETIME,
BelongsToViews: u32,
NumberOfViews: u32,
ViewInfo: [1]extern struct {
ViewId: i32,
NumRoutes: u32,
Route: isize,
Owner: isize,
DestFlags: u32,
HoldRoute: isize,
},
};
pub const RTM_ROUTE_INFO = extern struct {
DestHandle: isize,
RouteOwner: isize,
Neighbour: isize,
State: u8,
Flags1: u8,
Flags: u16,
PrefInfo: RTM_PREF_INFO,
BelongsToViews: u32,
EntitySpecificInfo: ?*anyopaque,
NextHopsList: RTM_NEXTHOP_LIST,
};
pub const RTM_NEXTHOP_INFO = extern struct {
NextHopAddress: RTM_NET_ADDRESS,
NextHopOwner: isize,
InterfaceIndex: u32,
State: u16,
Flags: u16,
EntitySpecificInfo: ?*anyopaque,
RemoteNextHop: isize,
};
pub const RTM_ENTITY_ID = extern struct {
Anonymous: extern union {
Anonymous: extern struct {
EntityProtocolId: u32,
EntityInstanceId: u32,
},
EntityId: u64,
},
};
pub const RTM_ENTITY_INFO = extern struct {
RtmInstanceId: u16,
AddressFamily: u16,
EntityId: RTM_ENTITY_ID,
};
pub const RTM_EVENT_TYPE = enum(i32) {
ENTITY_REGISTERED = 0,
ENTITY_DEREGISTERED = 1,
ROUTE_EXPIRED = 2,
CHANGE_NOTIFICATION = 3,
};
pub const RTM_ENTITY_REGISTERED = RTM_EVENT_TYPE.ENTITY_REGISTERED;
pub const RTM_ENTITY_DEREGISTERED = RTM_EVENT_TYPE.ENTITY_DEREGISTERED;
pub const RTM_ROUTE_EXPIRED = RTM_EVENT_TYPE.ROUTE_EXPIRED;
pub const RTM_CHANGE_NOTIFICATION = RTM_EVENT_TYPE.CHANGE_NOTIFICATION;
pub const RTM_EVENT_CALLBACK = fn(
RtmRegHandle: isize,
EventType: RTM_EVENT_TYPE,
Context1: ?*anyopaque,
Context2: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
pub const RTM_ENTITY_METHOD_INPUT = extern struct {
MethodType: u32,
InputSize: u32,
InputData: [1]u8,
};
pub const RTM_ENTITY_METHOD_OUTPUT = extern struct {
MethodType: u32,
MethodStatus: u32,
OutputSize: u32,
OutputData: [1]u8,
};
pub const RTM_ENTITY_EXPORT_METHOD = fn(
CallerHandle: isize,
CalleeHandle: isize,
Input: ?*RTM_ENTITY_METHOD_INPUT,
Output: ?*RTM_ENTITY_METHOD_OUTPUT,
) callconv(@import("std").os.windows.WINAPI) void;
pub const RTM_ENTITY_EXPORT_METHODS = extern struct {
NumMethods: u32,
Methods: [1]?RTM_ENTITY_EXPORT_METHOD,
};
//--------------------------------------------------------------------------------
// Section: Functions (277)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasDialA(
param0: ?*RASDIALEXTENSIONS,
param1: ?[*:0]const u8,
param2: ?*RASDIALPARAMSA,
param3: u32,
param4: ?*anyopaque,
param5: ?*?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasDialW(
param0: ?*RASDIALEXTENSIONS,
param1: ?[*:0]const u16,
param2: ?*RASDIALPARAMSW,
param3: u32,
param4: ?*anyopaque,
param5: ?*?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumConnectionsA(
param0: ?*RASCONNA,
param1: ?*u32,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumConnectionsW(
param0: ?*RASCONNW,
param1: ?*u32,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumEntriesA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: ?*RASENTRYNAMEA,
param3: ?*u32,
param4: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumEntriesW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: ?*RASENTRYNAMEW,
param3: ?*u32,
param4: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetConnectStatusA(
param0: ?HRASCONN,
param1: ?*RASCONNSTATUSA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetConnectStatusW(
param0: ?HRASCONN,
param1: ?*RASCONNSTATUSW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetErrorStringA(
ResourceId: u32,
lpszString: [*:0]u8,
InBufSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetErrorStringW(
ResourceId: u32,
lpszString: [*:0]u16,
InBufSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasHangUpA(
param0: ?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasHangUpW(
param0: ?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetProjectionInfoA(
param0: ?HRASCONN,
param1: RASPROJECTION,
param2: ?*anyopaque,
param3: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetProjectionInfoW(
param0: ?HRASCONN,
param1: RASPROJECTION,
param2: ?*anyopaque,
param3: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasCreatePhonebookEntryA(
param0: ?HWND,
param1: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasCreatePhonebookEntryW(
param0: ?HWND,
param1: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEditPhonebookEntryA(
param0: ?HWND,
param1: ?[*:0]const u8,
param2: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEditPhonebookEntryW(
param0: ?HWND,
param1: ?[*:0]const u16,
param2: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetEntryDialParamsA(
param0: ?[*:0]const u8,
param1: ?*RASDIALPARAMSA,
param2: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetEntryDialParamsW(
param0: ?[*:0]const u16,
param1: ?*RASDIALPARAMSW,
param2: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEntryDialParamsA(
param0: ?[*:0]const u8,
param1: ?*RASDIALPARAMSA,
param2: ?*i32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEntryDialParamsW(
param0: ?[*:0]const u16,
param1: ?*RASDIALPARAMSW,
param2: ?*i32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumDevicesA(
param0: ?*RASDEVINFOA,
param1: ?*u32,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumDevicesW(
param0: ?*RASDEVINFOW,
param1: ?*u32,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetCountryInfoA(
param0: ?*RASCTRYINFO,
param1: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetCountryInfoW(
param0: ?*RASCTRYINFO,
param1: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEntryPropertiesA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: ?*RASENTRYA,
param3: ?*u32,
param4: ?*u8,
param5: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEntryPropertiesW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: ?*RASENTRYW,
param3: ?*u32,
param4: ?*u8,
param5: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetEntryPropertiesA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: ?*RASENTRYA,
param3: u32,
param4: ?*u8,
param5: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetEntryPropertiesW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: ?*RASENTRYW,
param3: u32,
param4: ?*u8,
param5: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasRenameEntryA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasRenameEntryW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasDeleteEntryA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasDeleteEntryW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasValidateEntryNameA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasValidateEntryNameW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasConnectionNotificationA(
param0: ?HRASCONN,
param1: ?HANDLE,
param2: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasConnectionNotificationW(
param0: ?HRASCONN,
param1: ?HANDLE,
param2: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetSubEntryHandleA(
param0: ?HRASCONN,
param1: u32,
param2: ?*?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetSubEntryHandleW(
param0: ?HRASCONN,
param1: u32,
param2: ?*?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetCredentialsA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: ?*RASCREDENTIALSA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetCredentialsW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: ?*RASCREDENTIALSW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetCredentialsA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: ?*RASCREDENTIALSA,
param3: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetCredentialsW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: ?*RASCREDENTIALSW,
param3: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetSubEntryPropertiesA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: u32,
param3: ?*RASSUBENTRYA,
param4: ?*u32,
param5: ?*u8,
param6: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetSubEntryPropertiesW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: u32,
param3: ?*RASSUBENTRYW,
param4: ?*u32,
param5: ?*u8,
param6: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetSubEntryPropertiesA(
param0: ?[*:0]const u8,
param1: ?[*:0]const u8,
param2: u32,
param3: ?*RASSUBENTRYA,
param4: u32,
param5: ?*u8,
param6: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetSubEntryPropertiesW(
param0: ?[*:0]const u16,
param1: ?[*:0]const u16,
param2: u32,
param3: ?*RASSUBENTRYW,
param4: u32,
param5: ?*u8,
param6: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetAutodialAddressA(
param0: ?[*:0]const u8,
param1: ?*u32,
param2: ?*RASAUTODIALENTRYA,
param3: ?*u32,
param4: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetAutodialAddressW(
param0: ?[*:0]const u16,
param1: ?*u32,
param2: ?*RASAUTODIALENTRYW,
param3: ?*u32,
param4: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetAutodialAddressA(
param0: ?[*:0]const u8,
param1: u32,
param2: ?*RASAUTODIALENTRYA,
param3: u32,
param4: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetAutodialAddressW(
param0: ?[*:0]const u16,
param1: u32,
param2: ?*RASAUTODIALENTRYW,
param3: u32,
param4: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumAutodialAddressesA(
// TODO: what to do with BytesParamIndex 1?
lppRasAutodialAddresses: ?*?PSTR,
lpdwcbRasAutodialAddresses: ?*u32,
lpdwcRasAutodialAddresses: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasEnumAutodialAddressesW(
// TODO: what to do with BytesParamIndex 1?
lppRasAutodialAddresses: ?*?PWSTR,
lpdwcbRasAutodialAddresses: ?*u32,
lpdwcRasAutodialAddresses: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetAutodialEnableA(
param0: u32,
param1: ?*i32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetAutodialEnableW(
param0: u32,
param1: ?*i32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetAutodialEnableA(
param0: u32,
param1: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetAutodialEnableW(
param0: u32,
param1: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetAutodialParamA(
param0: u32,
param1: ?*anyopaque,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetAutodialParamW(
param0: u32,
param1: ?*anyopaque,
param2: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetAutodialParamA(
param0: u32,
param1: ?*anyopaque,
param2: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetAutodialParamW(
param0: u32,
param1: ?*anyopaque,
param2: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "RASAPI32" fn RasGetPCscf(
lpszPCscf: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasInvokeEapUI(
param0: ?HRASCONN,
param1: u32,
param2: ?*RASDIALEXTENSIONS,
param3: ?HWND,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetLinkStatistics(
hRasConn: ?HRASCONN,
dwSubEntry: u32,
lpStatistics: ?*RAS_STATS,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetConnectionStatistics(
hRasConn: ?HRASCONN,
lpStatistics: ?*RAS_STATS,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasClearLinkStatistics(
hRasConn: ?HRASCONN,
dwSubEntry: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasClearConnectionStatistics(
hRasConn: ?HRASCONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEapUserDataA(
hToken: ?HANDLE,
pszPhonebook: ?[*:0]const u8,
pszEntry: ?[*:0]const u8,
pbEapData: ?*u8,
pdwSizeofEapData: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEapUserDataW(
hToken: ?HANDLE,
pszPhonebook: ?[*:0]const u16,
pszEntry: ?[*:0]const u16,
pbEapData: ?*u8,
pdwSizeofEapData: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetEapUserDataA(
hToken: ?HANDLE,
pszPhonebook: ?[*:0]const u8,
pszEntry: ?[*:0]const u8,
pbEapData: ?*u8,
dwSizeofEapData: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetEapUserDataW(
hToken: ?HANDLE,
pszPhonebook: ?[*:0]const u16,
pszEntry: ?[*:0]const u16,
pbEapData: ?*u8,
dwSizeofEapData: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetCustomAuthDataA(
pszPhonebook: ?[*:0]const u8,
pszEntry: ?[*:0]const u8,
// TODO: what to do with BytesParamIndex 3?
pbCustomAuthData: ?*u8,
pdwSizeofCustomAuthData: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetCustomAuthDataW(
pszPhonebook: ?[*:0]const u16,
pszEntry: ?[*:0]const u16,
// TODO: what to do with BytesParamIndex 3?
pbCustomAuthData: ?*u8,
pdwSizeofCustomAuthData: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetCustomAuthDataA(
pszPhonebook: ?[*:0]const u8,
pszEntry: ?[*:0]const u8,
// TODO: what to do with BytesParamIndex 3?
pbCustomAuthData: ?*u8,
dwSizeofCustomAuthData: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasSetCustomAuthDataW(
pszPhonebook: ?[*:0]const u16,
pszEntry: ?[*:0]const u16,
// TODO: what to do with BytesParamIndex 3?
pbCustomAuthData: ?*u8,
dwSizeofCustomAuthData: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEapUserIdentityW(
pszPhonebook: ?[*:0]const u16,
pszEntry: ?[*:0]const u16,
dwFlags: u32,
hwnd: ?HWND,
ppRasEapUserIdentity: ?*?*RASEAPUSERIDENTITYW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasGetEapUserIdentityA(
pszPhonebook: ?[*:0]const u8,
pszEntry: ?[*:0]const u8,
dwFlags: u32,
hwnd: ?HWND,
ppRasEapUserIdentity: ?*?*RASEAPUSERIDENTITYA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasFreeEapUserIdentityW(
pRasEapUserIdentity: ?*RASEAPUSERIDENTITYW,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASAPI32" fn RasFreeEapUserIdentityA(
pRasEapUserIdentity: ?*RASEAPUSERIDENTITYA,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "RASAPI32" fn RasDeleteSubEntryA(
pszPhonebook: ?[*:0]const u8,
pszEntry: ?[*:0]const u8,
dwSubentryId: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.1.2600'
pub extern "RASAPI32" fn RasDeleteSubEntryW(
pszPhonebook: ?[*:0]const u16,
pszEntry: ?[*:0]const u16,
dwSubEntryId: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.1'
pub extern "RASAPI32" fn RasUpdateConnection(
hrasconn: ?HRASCONN,
lprasupdateconn: ?*RASUPDATECONN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.1'
pub extern "RASAPI32" fn RasGetProjectionInfoEx(
hrasconn: ?HRASCONN,
pRasProjection: ?*RAS_PROJECTION_INFO,
lpdwSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASDLG" fn RasPhonebookDlgA(
lpszPhonebook: ?PSTR,
lpszEntry: ?PSTR,
lpInfo: ?*RASPBDLGA,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASDLG" fn RasPhonebookDlgW(
lpszPhonebook: ?PWSTR,
lpszEntry: ?PWSTR,
lpInfo: ?*RASPBDLGW,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASDLG" fn RasEntryDlgA(
lpszPhonebook: ?PSTR,
lpszEntry: ?PSTR,
lpInfo: ?*RASENTRYDLGA,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASDLG" fn RasEntryDlgW(
lpszPhonebook: ?PWSTR,
lpszEntry: ?PWSTR,
lpInfo: ?*RASENTRYDLGW,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASDLG" fn RasDialDlgA(
lpszPhonebook: ?PSTR,
lpszEntry: ?PSTR,
lpszPhoneNumber: ?PSTR,
lpInfo: ?*RASDIALDLG,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windows5.0'
pub extern "RASDLG" fn RasDialDlgW(
lpszPhonebook: ?PWSTR,
lpszEntry: ?PWSTR,
lpszPhoneNumber: ?PWSTR,
lpInfo: ?*RASDIALDLG,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windows6.1'
pub extern "MPRAPI" fn MprAdminConnectionEnumEx(
hRasServer: isize,
pObjectHeader: ?*MPRAPI_OBJECT_HEADER,
dwPreferedMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
ppRasConn: ?*?*RAS_CONNECTION_EX,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.1'
pub extern "MPRAPI" fn MprAdminConnectionGetInfoEx(
hRasServer: isize,
hRasConnection: ?HANDLE,
pRasConnection: ?*RAS_CONNECTION_EX,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprAdminServerGetInfoEx(
hMprServer: isize,
pServerInfo: ?*MPR_SERVER_EX1,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprAdminServerSetInfoEx(
hMprServer: isize,
pServerInfo: ?*MPR_SERVER_SET_CONFIG_EX1,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprConfigServerGetInfoEx(
hMprConfig: ?HANDLE,
pServerInfo: ?*MPR_SERVER_EX1,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprConfigServerSetInfoEx(
hMprConfig: ?HANDLE,
pSetServerConfig: ?*MPR_SERVER_SET_CONFIG_EX1,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "MPRAPI" fn MprAdminUpdateConnection(
hRasServer: isize,
hRasConnection: ?HANDLE,
pRasUpdateConnection: ?*RAS_UPDATE_CONNECTION,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprAdminIsServiceInitialized(
lpwsServerName: ?PWSTR,
fIsServiceInitialized: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2012'
pub extern "MPRAPI" fn MprAdminInterfaceSetCustomInfoEx(
hMprServer: isize,
hInterface: ?HANDLE,
pCustomInfo: ?*MPR_IF_CUSTOMINFOEX2,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2012'
pub extern "MPRAPI" fn MprAdminInterfaceGetCustomInfoEx(
hMprServer: isize,
hInterface: ?HANDLE,
pCustomInfo: ?*MPR_IF_CUSTOMINFOEX2,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2012'
pub extern "MPRAPI" fn MprConfigInterfaceGetCustomInfoEx(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
pCustomInfo: ?*MPR_IF_CUSTOMINFOEX2,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2012'
pub extern "MPRAPI" fn MprConfigInterfaceSetCustomInfoEx(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
pCustomInfo: ?*MPR_IF_CUSTOMINFOEX2,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminConnectionEnum(
hRasServer: isize,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
dwPrefMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminPortEnum(
hRasServer: isize,
dwLevel: u32,
hRasConnection: ?HANDLE,
lplpbBuffer: ?*?*u8,
dwPrefMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminConnectionGetInfo(
hRasServer: isize,
dwLevel: u32,
hRasConnection: ?HANDLE,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminPortGetInfo(
hRasServer: isize,
dwLevel: u32,
hPort: ?HANDLE,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminConnectionClearStats(
hRasServer: isize,
hRasConnection: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminPortClearStats(
hRasServer: isize,
hPort: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminPortReset(
hRasServer: isize,
hPort: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminPortDisconnect(
hRasServer: isize,
hPort: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "MPRAPI" fn MprAdminConnectionRemoveQuarantine(
hRasServer: ?HANDLE,
hRasConnection: ?HANDLE,
fIsIpAddress: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminUserGetInfo(
lpszServer: ?[*:0]const u16,
lpszUser: ?[*:0]const u16,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminUserSetInfo(
lpszServer: ?[*:0]const u16,
lpszUser: ?[*:0]const u16,
dwLevel: u32,
lpbBuffer: ?*const u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminSendUserMessage(
hMprServer: isize,
hConnection: ?HANDLE,
lpwszMessage: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows5.0'
pub extern "MPRAPI" fn MprAdminGetPDCServer(
lpszDomain: ?[*:0]const u16,
lpszServer: ?[*:0]const u16,
lpszPDCServer: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminIsServiceRunning(
lpwsServerName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) BOOL;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminServerConnect(
lpwsServerName: ?PWSTR,
phMprServer: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminServerDisconnect(
hMprServer: isize,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windowsServer2003'
pub extern "MPRAPI" fn MprAdminServerGetCredentials(
hMprServer: isize,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2003'
pub extern "MPRAPI" fn MprAdminServerSetCredentials(
hMprServer: isize,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminBufferFree(
pBuffer: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminGetErrorString(
dwError: u32,
lplpwsErrorString: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminServerGetInfo(
hMprServer: isize,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2003'
pub extern "MPRAPI" fn MprAdminServerSetInfo(
hMprServer: isize,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2003'
pub extern "MPRAPI" fn MprAdminEstablishDomainRasServer(
pszDomain: ?PWSTR,
pszMachine: ?PWSTR,
bEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2003'
pub extern "MPRAPI" fn MprAdminIsDomainRasServer(
pszDomain: ?PWSTR,
pszMachine: ?PWSTR,
pbIsRasServer: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminTransportCreate(
hMprServer: isize,
dwTransportId: u32,
lpwsTransportName: ?PWSTR,
pGlobalInfo: ?*u8,
dwGlobalInfoSize: u32,
pClientInterfaceInfo: ?*u8,
dwClientInterfaceInfoSize: u32,
lpwsDLLPath: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminTransportSetInfo(
hMprServer: isize,
dwTransportId: u32,
pGlobalInfo: ?*u8,
dwGlobalInfoSize: u32,
pClientInterfaceInfo: ?*u8,
dwClientInterfaceInfoSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminTransportGetInfo(
hMprServer: isize,
dwTransportId: u32,
ppGlobalInfo: ?*?*u8,
lpdwGlobalInfoSize: ?*u32,
ppClientInterfaceInfo: ?*?*u8,
lpdwClientInterfaceInfoSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminDeviceEnum(
hMprServer: isize,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
lpdwTotalEntries: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceGetHandle(
hMprServer: isize,
lpwsInterfaceName: ?PWSTR,
phInterface: ?*?HANDLE,
fIncludeClientInterfaces: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceCreate(
hMprServer: isize,
dwLevel: u32,
lpbBuffer: ?*u8,
phInterface: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceGetInfo(
hMprServer: isize,
hInterface: ?HANDLE,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceSetInfo(
hMprServer: isize,
hInterface: ?HANDLE,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceDelete(
hMprServer: isize,
hInterface: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceDeviceGetInfo(
hMprServer: isize,
hInterface: ?HANDLE,
dwIndex: u32,
dwLevel: u32,
lplpBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceDeviceSetInfo(
hMprServer: isize,
hInterface: ?HANDLE,
dwIndex: u32,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceTransportRemove(
hMprServer: isize,
hInterface: ?HANDLE,
dwTransportId: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceTransportAdd(
hMprServer: isize,
hInterface: ?HANDLE,
dwTransportId: u32,
pInterfaceInfo: ?*u8,
dwInterfaceInfoSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceTransportGetInfo(
hMprServer: isize,
hInterface: ?HANDLE,
dwTransportId: u32,
ppInterfaceInfo: ?*?*u8,
lpdwInterfaceInfoSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceTransportSetInfo(
hMprServer: isize,
hInterface: ?HANDLE,
dwTransportId: u32,
pInterfaceInfo: ?*u8,
dwInterfaceInfoSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceEnum(
hMprServer: isize,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
dwPrefMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceSetCredentials(
lpwsServer: ?PWSTR,
lpwsInterfaceName: ?PWSTR,
lpwsUserName: ?PWSTR,
lpwsDomainName: ?PWSTR,
lpwsPassword: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceGetCredentials(
lpwsServer: ?PWSTR,
lpwsInterfaceName: ?PWSTR,
lpwsUserName: ?PWSTR,
lpwsPassword: ?PWSTR,
lpwsDomainName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceSetCredentialsEx(
hMprServer: isize,
hInterface: ?HANDLE,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceGetCredentialsEx(
hMprServer: isize,
hInterface: ?HANDLE,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceConnect(
hMprServer: isize,
hInterface: ?HANDLE,
hEvent: ?HANDLE,
fSynchronous: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceDisconnect(
hMprServer: isize,
hInterface: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceUpdateRoutes(
hMprServer: isize,
hInterface: ?HANDLE,
dwProtocolId: u32,
hEvent: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceQueryUpdateResult(
hMprServer: isize,
hInterface: ?HANDLE,
dwProtocolId: u32,
lpdwUpdateResult: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminInterfaceUpdatePhonebookInfo(
hMprServer: isize,
hInterface: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminRegisterConnectionNotification(
hMprServer: isize,
hEventNotification: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminDeregisterConnectionNotification(
hMprServer: isize,
hEventNotification: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBServerConnect(
lpwsServerName: ?PWSTR,
phMibServer: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBServerDisconnect(
hMibServer: isize,
) callconv(@import("std").os.windows.WINAPI) void;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBEntryCreate(
hMibServer: isize,
dwPid: u32,
dwRoutingPid: u32,
lpEntry: ?*anyopaque,
dwEntrySize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBEntryDelete(
hMibServer: isize,
dwProtocolId: u32,
dwRoutingPid: u32,
lpEntry: ?*anyopaque,
dwEntrySize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBEntrySet(
hMibServer: isize,
dwProtocolId: u32,
dwRoutingPid: u32,
lpEntry: ?*anyopaque,
dwEntrySize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBEntryGet(
hMibServer: isize,
dwProtocolId: u32,
dwRoutingPid: u32,
lpInEntry: ?*anyopaque,
dwInEntrySize: u32,
lplpOutEntry: ?*?*anyopaque,
lpOutEntrySize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBEntryGetFirst(
hMibServer: isize,
dwProtocolId: u32,
dwRoutingPid: u32,
lpInEntry: ?*anyopaque,
dwInEntrySize: u32,
lplpOutEntry: ?*?*anyopaque,
lpOutEntrySize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBEntryGetNext(
hMibServer: isize,
dwProtocolId: u32,
dwRoutingPid: u32,
lpInEntry: ?*anyopaque,
dwInEntrySize: u32,
lplpOutEntry: ?*?*anyopaque,
lpOutEntrySize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprAdminMIBBufferFree(
pBuffer: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigServerInstall(
dwLevel: u32,
pBuffer: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigServerConnect(
lpwsServerName: ?PWSTR,
phMprConfig: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigServerDisconnect(
hMprConfig: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) void;
pub extern "MPRAPI" fn MprConfigServerRefresh(
hMprConfig: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigBufferFree(
pBuffer: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigServerGetInfo(
hMprConfig: ?HANDLE,
dwLevel: u32,
lplpbBuffer: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2003'
pub extern "MPRAPI" fn MprConfigServerSetInfo(
hMprServer: isize,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigServerBackup(
hMprConfig: ?HANDLE,
lpwsPath: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigServerRestore(
hMprConfig: ?HANDLE,
lpwsPath: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigTransportCreate(
hMprConfig: ?HANDLE,
dwTransportId: u32,
lpwsTransportName: ?PWSTR,
// TODO: what to do with BytesParamIndex 4?
pGlobalInfo: ?*u8,
dwGlobalInfoSize: u32,
// TODO: what to do with BytesParamIndex 6?
pClientInterfaceInfo: ?*u8,
dwClientInterfaceInfoSize: u32,
lpwsDLLPath: ?PWSTR,
phRouterTransport: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigTransportDelete(
hMprConfig: ?HANDLE,
hRouterTransport: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigTransportGetHandle(
hMprConfig: ?HANDLE,
dwTransportId: u32,
phRouterTransport: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigTransportSetInfo(
hMprConfig: ?HANDLE,
hRouterTransport: ?HANDLE,
// TODO: what to do with BytesParamIndex 3?
pGlobalInfo: ?*u8,
dwGlobalInfoSize: u32,
// TODO: what to do with BytesParamIndex 5?
pClientInterfaceInfo: ?*u8,
dwClientInterfaceInfoSize: u32,
lpwsDLLPath: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigTransportGetInfo(
hMprConfig: ?HANDLE,
hRouterTransport: ?HANDLE,
ppGlobalInfo: ?*?*u8,
lpdwGlobalInfoSize: ?*u32,
ppClientInterfaceInfo: ?*?*u8,
lpdwClientInterfaceInfoSize: ?*u32,
lplpwsDLLPath: ?*?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigTransportEnum(
hMprConfig: ?HANDLE,
dwLevel: u32,
lplpBuffer: ?*?*u8,
dwPrefMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceCreate(
hMprConfig: ?HANDLE,
dwLevel: u32,
lpbBuffer: ?*u8,
phRouterInterface: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceDelete(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceGetHandle(
hMprConfig: ?HANDLE,
lpwsInterfaceName: ?PWSTR,
phRouterInterface: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceGetInfo(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
dwLevel: u32,
lplpBuffer: ?*?*u8,
lpdwBufferSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceSetInfo(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
dwLevel: u32,
lpbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceEnum(
hMprConfig: ?HANDLE,
dwLevel: u32,
lplpBuffer: ?*?*u8,
dwPrefMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceTransportAdd(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
dwTransportId: u32,
lpwsTransportName: ?PWSTR,
// TODO: what to do with BytesParamIndex 5?
pInterfaceInfo: ?*u8,
dwInterfaceInfoSize: u32,
phRouterIfTransport: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceTransportRemove(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
hRouterIfTransport: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceTransportGetHandle(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
dwTransportId: u32,
phRouterIfTransport: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceTransportGetInfo(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
hRouterIfTransport: ?HANDLE,
ppInterfaceInfo: ?*?*u8,
lpdwInterfaceInfoSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceTransportSetInfo(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
hRouterIfTransport: ?HANDLE,
// TODO: what to do with BytesParamIndex 4?
pInterfaceInfo: ?*u8,
dwInterfaceInfoSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigInterfaceTransportEnum(
hMprConfig: ?HANDLE,
hRouterInterface: ?HANDLE,
dwLevel: u32,
lplpBuffer: ?*?*u8,
dwPrefMaxLen: u32,
lpdwEntriesRead: ?*u32,
lpdwTotalEntries: ?*u32,
lpdwResumeHandle: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigGetFriendlyName(
hMprConfig: ?HANDLE,
pszGuidName: ?PWSTR,
// TODO: what to do with BytesParamIndex 3?
pszBuffer: ?[*]u16,
dwBufferSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprConfigGetGuidName(
hMprConfig: ?HANDLE,
pszFriendlyName: ?PWSTR,
// TODO: what to do with BytesParamIndex 3?
pszBuffer: ?[*]u16,
dwBufferSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprConfigFilterGetInfo(
hMprConfig: ?HANDLE,
dwLevel: u32,
dwTransportId: u32,
lpBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2008'
pub extern "MPRAPI" fn MprConfigFilterSetInfo(
hMprConfig: ?HANDLE,
dwLevel: u32,
dwTransportId: u32,
lpBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoCreate(
dwVersion: u32,
lplpNewHeader: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoDelete(
lpHeader: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoRemoveAll(
lpHeader: ?*anyopaque,
lplpNewHeader: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoDuplicate(
lpHeader: ?*anyopaque,
lplpNewHeader: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoBlockAdd(
lpHeader: ?*anyopaque,
dwInfoType: u32,
dwItemSize: u32,
dwItemCount: u32,
lpItemData: ?*u8,
lplpNewHeader: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoBlockRemove(
lpHeader: ?*anyopaque,
dwInfoType: u32,
lplpNewHeader: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoBlockSet(
lpHeader: ?*anyopaque,
dwInfoType: u32,
dwItemSize: u32,
dwItemCount: u32,
lpItemData: ?*u8,
lplpNewHeader: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoBlockFind(
lpHeader: ?*anyopaque,
dwInfoType: u32,
lpdwItemSize: ?*u32,
lpdwItemCount: ?*u32,
lplpItemData: ?*?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "MPRAPI" fn MprInfoBlockQuerySize(
lpHeader: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmRegisterMProtocol(
prpiInfo: ?*ROUTING_PROTOCOL_CONFIG,
dwProtocolId: u32,
dwComponentId: u32,
phProtocol: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmDeRegisterMProtocol(
hProtocol: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmTakeInterfaceOwnership(
hProtocol: ?HANDLE,
dwIfIndex: u32,
dwIfNextHopAddr: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmReleaseInterfaceOwnership(
hProtocol: ?HANDLE,
dwIfIndex: u32,
dwIfNextHopAddr: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetProtocolOnInterface(
dwIfIndex: u32,
dwIfNextHopAddr: u32,
pdwIfProtocolId: ?*u32,
pdwIfComponentId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmAddGroupMembershipEntry(
hProtocol: ?HANDLE,
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
dwIfIndex: u32,
dwIfNextHopIPAddr: u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmDeleteGroupMembershipEntry(
hProtocol: ?HANDLE,
dwSourceAddr: u32,
dwSourceMask: u32,
dwGroupAddr: u32,
dwGroupMask: u32,
dwIfIndex: u32,
dwIfNextHopIPAddr: u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetMfe(
pimm: ?*MIB_IPMCAST_MFE,
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetFirstMfe(
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
pdwNumEntries: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetNextMfe(
pimmStart: ?*MIB_IPMCAST_MFE,
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
pdwNumEntries: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetMfeStats(
pimm: ?*MIB_IPMCAST_MFE,
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetFirstMfeStats(
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
pdwNumEntries: ?*u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGetNextMfeStats(
pimmStart: ?*MIB_IPMCAST_MFE,
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
pdwNumEntries: ?*u32,
dwFlags: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGroupEnumerationStart(
hProtocol: ?HANDLE,
metEnumType: MGM_ENUM_TYPES,
phEnumHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGroupEnumerationGetNext(
hEnum: ?HANDLE,
pdwBufferSize: ?*u32,
pbBuffer: ?*u8,
pdwNumEntries: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn MgmGroupEnumerationEnd(
hEnum: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "rtm" fn RtmConvertNetAddressToIpv6AddressAndLength(
pNetAddress: ?*RTM_NET_ADDRESS,
pAddress: ?*IN6_ADDR,
pLength: ?*u32,
dwAddressSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "rtm" fn RtmConvertIpv6AddressAndLengthToNetAddress(
pNetAddress: ?*RTM_NET_ADDRESS,
Address: IN6_ADDR,
dwLength: u32,
dwAddressSize: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmRegisterEntity(
RtmEntityInfo: ?*RTM_ENTITY_INFO,
ExportMethods: ?*RTM_ENTITY_EXPORT_METHODS,
EventCallback: ?RTM_EVENT_CALLBACK,
ReserveOpaquePointer: BOOL,
RtmRegProfile: ?*RTM_REGN_PROFILE,
RtmRegHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmDeregisterEntity(
RtmRegHandle: isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetRegisteredEntities(
RtmRegHandle: isize,
NumEntities: ?*u32,
EntityHandles: ?*isize,
EntityInfos: ?*RTM_ENTITY_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseEntities(
RtmRegHandle: isize,
NumEntities: u32,
EntityHandles: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmLockDestination(
RtmRegHandle: isize,
DestHandle: isize,
Exclusive: BOOL,
LockDest: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetOpaqueInformationPointer(
RtmRegHandle: isize,
DestHandle: isize,
OpaqueInfoPointer: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetEntityMethods(
RtmRegHandle: isize,
EntityHandle: isize,
NumMethods: ?*u32,
ExptMethods: ?*?RTM_ENTITY_EXPORT_METHOD,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmInvokeMethod(
RtmRegHandle: isize,
EntityHandle: isize,
Input: ?*RTM_ENTITY_METHOD_INPUT,
OutputSize: ?*u32,
Output: ?*RTM_ENTITY_METHOD_OUTPUT,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmBlockMethods(
RtmRegHandle: isize,
TargetHandle: ?HANDLE,
TargetType: u8,
BlockingFlag: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetEntityInfo(
RtmRegHandle: isize,
EntityHandle: isize,
EntityInfo: ?*RTM_ENTITY_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetDestInfo(
RtmRegHandle: isize,
DestHandle: isize,
ProtocolId: u32,
TargetViews: u32,
DestInfo: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetRouteInfo(
RtmRegHandle: isize,
RouteHandle: isize,
RouteInfo: ?*RTM_ROUTE_INFO,
DestAddress: ?*RTM_NET_ADDRESS,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetNextHopInfo(
RtmRegHandle: isize,
NextHopHandle: isize,
NextHopInfo: ?*RTM_NEXTHOP_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseEntityInfo(
RtmRegHandle: isize,
EntityInfo: ?*RTM_ENTITY_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseDestInfo(
RtmRegHandle: isize,
DestInfo: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseRouteInfo(
RtmRegHandle: isize,
RouteInfo: ?*RTM_ROUTE_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseNextHopInfo(
RtmRegHandle: isize,
NextHopInfo: ?*RTM_NEXTHOP_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmAddRouteToDest(
RtmRegHandle: isize,
RouteHandle: ?*isize,
DestAddress: ?*RTM_NET_ADDRESS,
RouteInfo: ?*RTM_ROUTE_INFO,
TimeToLive: u32,
RouteListHandle: isize,
NotifyType: u32,
NotifyHandle: isize,
ChangeFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmDeleteRouteToDest(
RtmRegHandle: isize,
RouteHandle: isize,
ChangeFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmHoldDestination(
RtmRegHandle: isize,
DestHandle: isize,
TargetViews: u32,
HoldTime: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetRoutePointer(
RtmRegHandle: isize,
RouteHandle: isize,
RoutePointer: ?*?*RTM_ROUTE_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmLockRoute(
RtmRegHandle: isize,
RouteHandle: isize,
Exclusive: BOOL,
LockRoute: BOOL,
RoutePointer: ?*?*RTM_ROUTE_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmUpdateAndUnlockRoute(
RtmRegHandle: isize,
RouteHandle: isize,
TimeToLive: u32,
RouteListHandle: isize,
NotifyType: u32,
NotifyHandle: isize,
ChangeFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetExactMatchDestination(
RtmRegHandle: isize,
DestAddress: ?*RTM_NET_ADDRESS,
ProtocolId: u32,
TargetViews: u32,
DestInfo: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetMostSpecificDestination(
RtmRegHandle: isize,
DestAddress: ?*RTM_NET_ADDRESS,
ProtocolId: u32,
TargetViews: u32,
DestInfo: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetLessSpecificDestination(
RtmRegHandle: isize,
DestHandle: isize,
ProtocolId: u32,
TargetViews: u32,
DestInfo: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetExactMatchRoute(
RtmRegHandle: isize,
DestAddress: ?*RTM_NET_ADDRESS,
MatchingFlags: u32,
RouteInfo: ?*RTM_ROUTE_INFO,
InterfaceIndex: u32,
TargetViews: u32,
RouteHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmIsBestRoute(
RtmRegHandle: isize,
RouteHandle: isize,
BestInViews: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmAddNextHop(
RtmRegHandle: isize,
NextHopInfo: ?*RTM_NEXTHOP_INFO,
NextHopHandle: ?*isize,
ChangeFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmFindNextHop(
RtmRegHandle: isize,
NextHopInfo: ?*RTM_NEXTHOP_INFO,
NextHopHandle: ?*isize,
NextHopPointer: ?*?*RTM_NEXTHOP_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmDeleteNextHop(
RtmRegHandle: isize,
NextHopHandle: isize,
NextHopInfo: ?*RTM_NEXTHOP_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetNextHopPointer(
RtmRegHandle: isize,
NextHopHandle: isize,
NextHopPointer: ?*?*RTM_NEXTHOP_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmLockNextHop(
RtmRegHandle: isize,
NextHopHandle: isize,
Exclusive: BOOL,
LockNextHop: BOOL,
NextHopPointer: ?*?*RTM_NEXTHOP_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmCreateDestEnum(
RtmRegHandle: isize,
TargetViews: u32,
EnumFlags: u32,
NetAddress: ?*RTM_NET_ADDRESS,
ProtocolId: u32,
RtmEnumHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetEnumDests(
RtmRegHandle: isize,
EnumHandle: isize,
NumDests: ?*u32,
DestInfos: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseDests(
RtmRegHandle: isize,
NumDests: u32,
DestInfos: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmCreateRouteEnum(
RtmRegHandle: isize,
DestHandle: isize,
TargetViews: u32,
EnumFlags: u32,
StartDest: ?*RTM_NET_ADDRESS,
MatchingFlags: u32,
CriteriaRoute: ?*RTM_ROUTE_INFO,
CriteriaInterface: u32,
RtmEnumHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetEnumRoutes(
RtmRegHandle: isize,
EnumHandle: isize,
NumRoutes: ?*u32,
RouteHandles: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseRoutes(
RtmRegHandle: isize,
NumRoutes: u32,
RouteHandles: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmCreateNextHopEnum(
RtmRegHandle: isize,
EnumFlags: u32,
NetAddress: ?*RTM_NET_ADDRESS,
RtmEnumHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetEnumNextHops(
RtmRegHandle: isize,
EnumHandle: isize,
NumNextHops: ?*u32,
NextHopHandles: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseNextHops(
RtmRegHandle: isize,
NumNextHops: u32,
NextHopHandles: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmDeleteEnumHandle(
RtmRegHandle: isize,
EnumHandle: isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmRegisterForChangeNotification(
RtmRegHandle: isize,
TargetViews: u32,
NotifyFlags: u32,
NotifyContext: ?*anyopaque,
NotifyHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetChangedDests(
RtmRegHandle: isize,
NotifyHandle: isize,
NumDests: ?*u32,
ChangedDests: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReleaseChangedDests(
RtmRegHandle: isize,
NotifyHandle: isize,
NumDests: u32,
ChangedDests: ?*RTM_DEST_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmIgnoreChangedDests(
RtmRegHandle: isize,
NotifyHandle: isize,
NumDests: u32,
ChangedDests: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetChangeStatus(
RtmRegHandle: isize,
NotifyHandle: isize,
DestHandle: isize,
ChangeStatus: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmMarkDestForChangeNotification(
RtmRegHandle: isize,
NotifyHandle: isize,
DestHandle: isize,
MarkDest: BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmIsMarkedForChangeNotification(
RtmRegHandle: isize,
NotifyHandle: isize,
DestHandle: isize,
DestMarked: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmDeregisterFromChangeNotification(
RtmRegHandle: isize,
NotifyHandle: isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmCreateRouteList(
RtmRegHandle: isize,
RouteListHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmInsertInRouteList(
RtmRegHandle: isize,
RouteListHandle: isize,
NumRoutes: u32,
RouteHandles: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmCreateRouteListEnum(
RtmRegHandle: isize,
RouteListHandle: isize,
RtmEnumHandle: ?*isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmGetListEnumRoutes(
RtmRegHandle: isize,
EnumHandle: isize,
NumRoutes: ?*u32,
RouteHandles: [*]isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmDeleteRouteList(
RtmRegHandle: isize,
RouteListHandle: isize,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windowsServer2000'
pub extern "rtm" fn RtmReferenceHandles(
RtmRegHandle: isize,
NumHandles: u32,
RtmHandles: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) u32;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (60)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
pub const RASCONN = thismodule.RASCONNA;
pub const RASCONNSTATUS = thismodule.RASCONNSTATUSA;
pub const RASDIALPARAMS = thismodule.RASDIALPARAMSA;
pub const RASENTRYNAME = thismodule.RASENTRYNAMEA;
pub const RASAMB = thismodule.RASAMBA;
pub const RASPPPNBF = thismodule.RASPPPNBFA;
pub const RASPPPIP = thismodule.RASPPPIPA;
pub const RASPPPLCP = thismodule.RASPPPLCPA;
pub const RASDEVINFO = thismodule.RASDEVINFOA;
pub const RASENTRY = thismodule.RASENTRYA;
pub const RASADFUNC = thismodule.RASADFUNCA;
pub const RASSUBENTRY = thismodule.RASSUBENTRYA;
pub const RASCREDENTIALS = thismodule.RASCREDENTIALSA;
pub const RASAUTODIALENTRY = thismodule.RASAUTODIALENTRYA;
pub const RASEAPUSERIDENTITY = thismodule.RASEAPUSERIDENTITYA;
pub const RASPBDLGFUNC = thismodule.RASPBDLGFUNCA;
pub const RASNOUSER = thismodule.RASNOUSERA;
pub const RASPBDLG = thismodule.RASPBDLGA;
pub const RASENTRYDLG = thismodule.RASENTRYDLGA;
pub const RasDial = thismodule.RasDialA;
pub const RasEnumConnections = thismodule.RasEnumConnectionsA;
pub const RasEnumEntries = thismodule.RasEnumEntriesA;
pub const RasGetConnectStatus = thismodule.RasGetConnectStatusA;
pub const RasGetErrorString = thismodule.RasGetErrorStringA;
pub const RasHangUp = thismodule.RasHangUpA;
pub const RasGetProjectionInfo = thismodule.RasGetProjectionInfoA;
pub const RasCreatePhonebookEntry = thismodule.RasCreatePhonebookEntryA;
pub const RasEditPhonebookEntry = thismodule.RasEditPhonebookEntryA;
pub const RasSetEntryDialParams = thismodule.RasSetEntryDialParamsA;
pub const RasGetEntryDialParams = thismodule.RasGetEntryDialParamsA;
pub const RasEnumDevices = thismodule.RasEnumDevicesA;
pub const RasGetCountryInfo = thismodule.RasGetCountryInfoA;
pub const RasGetEntryProperties = thismodule.RasGetEntryPropertiesA;
pub const RasSetEntryProperties = thismodule.RasSetEntryPropertiesA;
pub const RasRenameEntry = thismodule.RasRenameEntryA;
pub const RasDeleteEntry = thismodule.RasDeleteEntryA;
pub const RasValidateEntryName = thismodule.RasValidateEntryNameA;
pub const RasConnectionNotification = thismodule.RasConnectionNotificationA;
pub const RasGetSubEntryHandle = thismodule.RasGetSubEntryHandleA;
pub const RasGetCredentials = thismodule.RasGetCredentialsA;
pub const RasSetCredentials = thismodule.RasSetCredentialsA;
pub const RasGetSubEntryProperties = thismodule.RasGetSubEntryPropertiesA;
pub const RasSetSubEntryProperties = thismodule.RasSetSubEntryPropertiesA;
pub const RasGetAutodialAddress = thismodule.RasGetAutodialAddressA;
pub const RasSetAutodialAddress = thismodule.RasSetAutodialAddressA;
pub const RasEnumAutodialAddresses = thismodule.RasEnumAutodialAddressesA;
pub const RasGetAutodialEnable = thismodule.RasGetAutodialEnableA;
pub const RasSetAutodialEnable = thismodule.RasSetAutodialEnableA;
pub const RasGetAutodialParam = thismodule.RasGetAutodialParamA;
pub const RasSetAutodialParam = thismodule.RasSetAutodialParamA;
pub const RasGetEapUserData = thismodule.RasGetEapUserDataA;
pub const RasSetEapUserData = thismodule.RasSetEapUserDataA;
pub const RasGetCustomAuthData = thismodule.RasGetCustomAuthDataA;
pub const RasSetCustomAuthData = thismodule.RasSetCustomAuthDataA;
pub const RasGetEapUserIdentity = thismodule.RasGetEapUserIdentityA;
pub const RasFreeEapUserIdentity = thismodule.RasFreeEapUserIdentityA;
pub const RasDeleteSubEntry = thismodule.RasDeleteSubEntryA;
pub const RasPhonebookDlg = thismodule.RasPhonebookDlgA;
pub const RasEntryDlg = thismodule.RasEntryDlgA;
pub const RasDialDlg = thismodule.RasDialDlgA;
},
.wide => struct {
pub const RASCONN = thismodule.RASCONNW;
pub const RASCONNSTATUS = thismodule.RASCONNSTATUSW;
pub const RASDIALPARAMS = thismodule.RASDIALPARAMSW;
pub const RASENTRYNAME = thismodule.RASENTRYNAMEW;
pub const RASAMB = thismodule.RASAMBW;
pub const RASPPPNBF = thismodule.RASPPPNBFW;
pub const RASPPPIP = thismodule.RASPPPIPW;
pub const RASPPPLCP = thismodule.RASPPPLCPW;
pub const RASDEVINFO = thismodule.RASDEVINFOW;
pub const RASENTRY = thismodule.RASENTRYW;
pub const RASADFUNC = thismodule.RASADFUNCW;
pub const RASSUBENTRY = thismodule.RASSUBENTRYW;
pub const RASCREDENTIALS = thismodule.RASCREDENTIALSW;
pub const RASAUTODIALENTRY = thismodule.RASAUTODIALENTRYW;
pub const RASEAPUSERIDENTITY = thismodule.RASEAPUSERIDENTITYW;
pub const RASPBDLGFUNC = thismodule.RASPBDLGFUNCW;
pub const RASNOUSER = thismodule.RASNOUSERW;
pub const RASPBDLG = thismodule.RASPBDLGW;
pub const RASENTRYDLG = thismodule.RASENTRYDLGW;
pub const RasDial = thismodule.RasDialW;
pub const RasEnumConnections = thismodule.RasEnumConnectionsW;
pub const RasEnumEntries = thismodule.RasEnumEntriesW;
pub const RasGetConnectStatus = thismodule.RasGetConnectStatusW;
pub const RasGetErrorString = thismodule.RasGetErrorStringW;
pub const RasHangUp = thismodule.RasHangUpW;
pub const RasGetProjectionInfo = thismodule.RasGetProjectionInfoW;
pub const RasCreatePhonebookEntry = thismodule.RasCreatePhonebookEntryW;
pub const RasEditPhonebookEntry = thismodule.RasEditPhonebookEntryW;
pub const RasSetEntryDialParams = thismodule.RasSetEntryDialParamsW;
pub const RasGetEntryDialParams = thismodule.RasGetEntryDialParamsW;
pub const RasEnumDevices = thismodule.RasEnumDevicesW;
pub const RasGetCountryInfo = thismodule.RasGetCountryInfoW;
pub const RasGetEntryProperties = thismodule.RasGetEntryPropertiesW;
pub const RasSetEntryProperties = thismodule.RasSetEntryPropertiesW;
pub const RasRenameEntry = thismodule.RasRenameEntryW;
pub const RasDeleteEntry = thismodule.RasDeleteEntryW;
pub const RasValidateEntryName = thismodule.RasValidateEntryNameW;
pub const RasConnectionNotification = thismodule.RasConnectionNotificationW;
pub const RasGetSubEntryHandle = thismodule.RasGetSubEntryHandleW;
pub const RasGetCredentials = thismodule.RasGetCredentialsW;
pub const RasSetCredentials = thismodule.RasSetCredentialsW;
pub const RasGetSubEntryProperties = thismodule.RasGetSubEntryPropertiesW;
pub const RasSetSubEntryProperties = thismodule.RasSetSubEntryPropertiesW;
pub const RasGetAutodialAddress = thismodule.RasGetAutodialAddressW;
pub const RasSetAutodialAddress = thismodule.RasSetAutodialAddressW;
pub const RasEnumAutodialAddresses = thismodule.RasEnumAutodialAddressesW;
pub const RasGetAutodialEnable = thismodule.RasGetAutodialEnableW;
pub const RasSetAutodialEnable = thismodule.RasSetAutodialEnableW;
pub const RasGetAutodialParam = thismodule.RasGetAutodialParamW;
pub const RasSetAutodialParam = thismodule.RasSetAutodialParamW;
pub const RasGetEapUserData = thismodule.RasGetEapUserDataW;
pub const RasSetEapUserData = thismodule.RasSetEapUserDataW;
pub const RasGetCustomAuthData = thismodule.RasGetCustomAuthDataW;
pub const RasSetCustomAuthData = thismodule.RasSetCustomAuthDataW;
pub const RasGetEapUserIdentity = thismodule.RasGetEapUserIdentityW;
pub const RasFreeEapUserIdentity = thismodule.RasFreeEapUserIdentityW;
pub const RasDeleteSubEntry = thismodule.RasDeleteSubEntryW;
pub const RasPhonebookDlg = thismodule.RasPhonebookDlgW;
pub const RasEntryDlg = thismodule.RasEntryDlgW;
pub const RasDialDlg = thismodule.RasDialDlgW;
},
.unspecified => if (@import("builtin").is_test) struct {
pub const RASCONN = *opaque{};
pub const RASCONNSTATUS = *opaque{};
pub const RASDIALPARAMS = *opaque{};
pub const RASENTRYNAME = *opaque{};
pub const RASAMB = *opaque{};
pub const RASPPPNBF = *opaque{};
pub const RASPPPIP = *opaque{};
pub const RASPPPLCP = *opaque{};
pub const RASDEVINFO = *opaque{};
pub const RASENTRY = *opaque{};
pub const RASADFUNC = *opaque{};
pub const RASSUBENTRY = *opaque{};
pub const RASCREDENTIALS = *opaque{};
pub const RASAUTODIALENTRY = *opaque{};
pub const RASEAPUSERIDENTITY = *opaque{};
pub const RASPBDLGFUNC = *opaque{};
pub const RASNOUSER = *opaque{};
pub const RASPBDLG = *opaque{};
pub const RASENTRYDLG = *opaque{};
pub const RasDial = *opaque{};
pub const RasEnumConnections = *opaque{};
pub const RasEnumEntries = *opaque{};
pub const RasGetConnectStatus = *opaque{};
pub const RasGetErrorString = *opaque{};
pub const RasHangUp = *opaque{};
pub const RasGetProjectionInfo = *opaque{};
pub const RasCreatePhonebookEntry = *opaque{};
pub const RasEditPhonebookEntry = *opaque{};
pub const RasSetEntryDialParams = *opaque{};
pub const RasGetEntryDialParams = *opaque{};
pub const RasEnumDevices = *opaque{};
pub const RasGetCountryInfo = *opaque{};
pub const RasGetEntryProperties = *opaque{};
pub const RasSetEntryProperties = *opaque{};
pub const RasRenameEntry = *opaque{};
pub const RasDeleteEntry = *opaque{};
pub const RasValidateEntryName = *opaque{};
pub const RasConnectionNotification = *opaque{};
pub const RasGetSubEntryHandle = *opaque{};
pub const RasGetCredentials = *opaque{};
pub const RasSetCredentials = *opaque{};
pub const RasGetSubEntryProperties = *opaque{};
pub const RasSetSubEntryProperties = *opaque{};
pub const RasGetAutodialAddress = *opaque{};
pub const RasSetAutodialAddress = *opaque{};
pub const RasEnumAutodialAddresses = *opaque{};
pub const RasGetAutodialEnable = *opaque{};
pub const RasSetAutodialEnable = *opaque{};
pub const RasGetAutodialParam = *opaque{};
pub const RasSetAutodialParam = *opaque{};
pub const RasGetEapUserData = *opaque{};
pub const RasSetEapUserData = *opaque{};
pub const RasGetCustomAuthData = *opaque{};
pub const RasSetCustomAuthData = *opaque{};
pub const RasGetEapUserIdentity = *opaque{};
pub const RasFreeEapUserIdentity = *opaque{};
pub const RasDeleteSubEntry = *opaque{};
pub const RasPhonebookDlg = *opaque{};
pub const RasEntryDlg = *opaque{};
pub const RasDialDlg = *opaque{};
} else struct {
pub const RASCONN = @compileError("'RASCONN' requires that UNICODE be set to true or false in the root module");
pub const RASCONNSTATUS = @compileError("'RASCONNSTATUS' requires that UNICODE be set to true or false in the root module");
pub const RASDIALPARAMS = @compileError("'RASDIALPARAMS' requires that UNICODE be set to true or false in the root module");
pub const RASENTRYNAME = @compileError("'RASENTRYNAME' requires that UNICODE be set to true or false in the root module");
pub const RASAMB = @compileError("'RASAMB' requires that UNICODE be set to true or false in the root module");
pub const RASPPPNBF = @compileError("'RASPPPNBF' requires that UNICODE be set to true or false in the root module");
pub const RASPPPIP = @compileError("'RASPPPIP' requires that UNICODE be set to true or false in the root module");
pub const RASPPPLCP = @compileError("'RASPPPLCP' requires that UNICODE be set to true or false in the root module");
pub const RASDEVINFO = @compileError("'RASDEVINFO' requires that UNICODE be set to true or false in the root module");
pub const RASENTRY = @compileError("'RASENTRY' requires that UNICODE be set to true or false in the root module");
pub const RASADFUNC = @compileError("'RASADFUNC' requires that UNICODE be set to true or false in the root module");
pub const RASSUBENTRY = @compileError("'RASSUBENTRY' requires that UNICODE be set to true or false in the root module");
pub const RASCREDENTIALS = @compileError("'RASCREDENTIALS' requires that UNICODE be set to true or false in the root module");
pub const RASAUTODIALENTRY = @compileError("'RASAUTODIALENTRY' requires that UNICODE be set to true or false in the root module");
pub const RASEAPUSERIDENTITY = @compileError("'RASEAPUSERIDENTITY' requires that UNICODE be set to true or false in the root module");
pub const RASPBDLGFUNC = @compileError("'RASPBDLGFUNC' requires that UNICODE be set to true or false in the root module");
pub const RASNOUSER = @compileError("'RASNOUSER' requires that UNICODE be set to true or false in the root module");
pub const RASPBDLG = @compileError("'RASPBDLG' requires that UNICODE be set to true or false in the root module");
pub const RASENTRYDLG = @compileError("'RASENTRYDLG' requires that UNICODE be set to true or false in the root module");
pub const RasDial = @compileError("'RasDial' requires that UNICODE be set to true or false in the root module");
pub const RasEnumConnections = @compileError("'RasEnumConnections' requires that UNICODE be set to true or false in the root module");
pub const RasEnumEntries = @compileError("'RasEnumEntries' requires that UNICODE be set to true or false in the root module");
pub const RasGetConnectStatus = @compileError("'RasGetConnectStatus' requires that UNICODE be set to true or false in the root module");
pub const RasGetErrorString = @compileError("'RasGetErrorString' requires that UNICODE be set to true or false in the root module");
pub const RasHangUp = @compileError("'RasHangUp' requires that UNICODE be set to true or false in the root module");
pub const RasGetProjectionInfo = @compileError("'RasGetProjectionInfo' requires that UNICODE be set to true or false in the root module");
pub const RasCreatePhonebookEntry = @compileError("'RasCreatePhonebookEntry' requires that UNICODE be set to true or false in the root module");
pub const RasEditPhonebookEntry = @compileError("'RasEditPhonebookEntry' requires that UNICODE be set to true or false in the root module");
pub const RasSetEntryDialParams = @compileError("'RasSetEntryDialParams' requires that UNICODE be set to true or false in the root module");
pub const RasGetEntryDialParams = @compileError("'RasGetEntryDialParams' requires that UNICODE be set to true or false in the root module");
pub const RasEnumDevices = @compileError("'RasEnumDevices' requires that UNICODE be set to true or false in the root module");
pub const RasGetCountryInfo = @compileError("'RasGetCountryInfo' requires that UNICODE be set to true or false in the root module");
pub const RasGetEntryProperties = @compileError("'RasGetEntryProperties' requires that UNICODE be set to true or false in the root module");
pub const RasSetEntryProperties = @compileError("'RasSetEntryProperties' requires that UNICODE be set to true or false in the root module");
pub const RasRenameEntry = @compileError("'RasRenameEntry' requires that UNICODE be set to true or false in the root module");
pub const RasDeleteEntry = @compileError("'RasDeleteEntry' requires that UNICODE be set to true or false in the root module");
pub const RasValidateEntryName = @compileError("'RasValidateEntryName' requires that UNICODE be set to true or false in the root module");
pub const RasConnectionNotification = @compileError("'RasConnectionNotification' requires that UNICODE be set to true or false in the root module");
pub const RasGetSubEntryHandle = @compileError("'RasGetSubEntryHandle' requires that UNICODE be set to true or false in the root module");
pub const RasGetCredentials = @compileError("'RasGetCredentials' requires that UNICODE be set to true or false in the root module");
pub const RasSetCredentials = @compileError("'RasSetCredentials' requires that UNICODE be set to true or false in the root module");
pub const RasGetSubEntryProperties = @compileError("'RasGetSubEntryProperties' requires that UNICODE be set to true or false in the root module");
pub const RasSetSubEntryProperties = @compileError("'RasSetSubEntryProperties' requires that UNICODE be set to true or false in the root module");
pub const RasGetAutodialAddress = @compileError("'RasGetAutodialAddress' requires that UNICODE be set to true or false in the root module");
pub const RasSetAutodialAddress = @compileError("'RasSetAutodialAddress' requires that UNICODE be set to true or false in the root module");
pub const RasEnumAutodialAddresses = @compileError("'RasEnumAutodialAddresses' requires that UNICODE be set to true or false in the root module");
pub const RasGetAutodialEnable = @compileError("'RasGetAutodialEnable' requires that UNICODE be set to true or false in the root module");
pub const RasSetAutodialEnable = @compileError("'RasSetAutodialEnable' requires that UNICODE be set to true or false in the root module");
pub const RasGetAutodialParam = @compileError("'RasGetAutodialParam' requires that UNICODE be set to true or false in the root module");
pub const RasSetAutodialParam = @compileError("'RasSetAutodialParam' requires that UNICODE be set to true or false in the root module");
pub const RasGetEapUserData = @compileError("'RasGetEapUserData' requires that UNICODE be set to true or false in the root module");
pub const RasSetEapUserData = @compileError("'RasSetEapUserData' requires that UNICODE be set to true or false in the root module");
pub const RasGetCustomAuthData = @compileError("'RasGetCustomAuthData' requires that UNICODE be set to true or false in the root module");
pub const RasSetCustomAuthData = @compileError("'RasSetCustomAuthData' requires that UNICODE be set to true or false in the root module");
pub const RasGetEapUserIdentity = @compileError("'RasGetEapUserIdentity' requires that UNICODE be set to true or false in the root module");
pub const RasFreeEapUserIdentity = @compileError("'RasFreeEapUserIdentity' requires that UNICODE be set to true or false in the root module");
pub const RasDeleteSubEntry = @compileError("'RasDeleteSubEntry' requires that UNICODE be set to true or false in the root module");
pub const RasPhonebookDlg = @compileError("'RasPhonebookDlg' requires that UNICODE be set to true or false in the root module");
pub const RasEntryDlg = @compileError("'RasEntryDlg' requires that UNICODE be set to true or false in the root module");
pub const RasDialDlg = @compileError("'RasDialDlg' requires that UNICODE be set to true or false in the root module");
},
};
//--------------------------------------------------------------------------------
// Section: Imports (14)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BOOL = @import("../foundation.zig").BOOL;
const CHAR = @import("../foundation.zig").CHAR;
const CRYPTOAPI_BLOB = @import("../security/cryptography.zig").CRYPTOAPI_BLOB;
const FILETIME = @import("../foundation.zig").FILETIME;
const HANDLE = @import("../foundation.zig").HANDLE;
const HINSTANCE = @import("../foundation.zig").HINSTANCE;
const HWND = @import("../foundation.zig").HWND;
const IN6_ADDR = @import("../networking/win_sock.zig").IN6_ADDR;
const IN_ADDR = @import("../networking/win_sock.zig").IN_ADDR;
const LUID = @import("../foundation.zig").LUID;
const MIB_IPMCAST_MFE = @import("../network_management/ip_helper.zig").MIB_IPMCAST_MFE;
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(), "RASDIALFUNC")) { _ = RASDIALFUNC; }
if (@hasDecl(@This(), "RASDIALFUNC1")) { _ = RASDIALFUNC1; }
if (@hasDecl(@This(), "RASDIALFUNC2")) { _ = RASDIALFUNC2; }
if (@hasDecl(@This(), "ORASADFUNC")) { _ = ORASADFUNC; }
if (@hasDecl(@This(), "RASADFUNCA")) { _ = RASADFUNCA; }
if (@hasDecl(@This(), "RASADFUNCW")) { _ = RASADFUNCW; }
if (@hasDecl(@This(), "PFNRASGETBUFFER")) { _ = PFNRASGETBUFFER; }
if (@hasDecl(@This(), "PFNRASFREEBUFFER")) { _ = PFNRASFREEBUFFER; }
if (@hasDecl(@This(), "PFNRASSENDBUFFER")) { _ = PFNRASSENDBUFFER; }
if (@hasDecl(@This(), "PFNRASRECEIVEBUFFER")) { _ = PFNRASRECEIVEBUFFER; }
if (@hasDecl(@This(), "PFNRASRETRIEVEBUFFER")) { _ = PFNRASRETRIEVEBUFFER; }
if (@hasDecl(@This(), "RasCustomScriptExecuteFn")) { _ = RasCustomScriptExecuteFn; }
if (@hasDecl(@This(), "PFNRASSETCOMMSETTINGS")) { _ = PFNRASSETCOMMSETTINGS; }
if (@hasDecl(@This(), "RasCustomHangUpFn")) { _ = RasCustomHangUpFn; }
if (@hasDecl(@This(), "RasCustomDialFn")) { _ = RasCustomDialFn; }
if (@hasDecl(@This(), "RasCustomDeleteEntryNotifyFn")) { _ = RasCustomDeleteEntryNotifyFn; }
if (@hasDecl(@This(), "RASPBDLGFUNCW")) { _ = RASPBDLGFUNCW; }
if (@hasDecl(@This(), "RASPBDLGFUNCA")) { _ = RASPBDLGFUNCA; }
if (@hasDecl(@This(), "RasCustomDialDlgFn")) { _ = RasCustomDialDlgFn; }
if (@hasDecl(@This(), "RasCustomEntryDlgFn")) { _ = RasCustomEntryDlgFn; }
if (@hasDecl(@This(), "PMPRADMINGETIPADDRESSFORUSER")) { _ = PMPRADMINGETIPADDRESSFORUSER; }
if (@hasDecl(@This(), "PMPRADMINRELEASEIPADRESS")) { _ = PMPRADMINRELEASEIPADRESS; }
if (@hasDecl(@This(), "PMPRADMINGETIPV6ADDRESSFORUSER")) { _ = PMPRADMINGETIPV6ADDRESSFORUSER; }
if (@hasDecl(@This(), "PMPRADMINRELEASEIPV6ADDRESSFORUSER")) { _ = PMPRADMINRELEASEIPV6ADDRESSFORUSER; }
if (@hasDecl(@This(), "PMPRADMINACCEPTNEWCONNECTION")) { _ = PMPRADMINACCEPTNEWCONNECTION; }
if (@hasDecl(@This(), "PMPRADMINACCEPTNEWCONNECTION2")) { _ = PMPRADMINACCEPTNEWCONNECTION2; }
if (@hasDecl(@This(), "PMPRADMINACCEPTNEWCONNECTION3")) { _ = PMPRADMINACCEPTNEWCONNECTION3; }
if (@hasDecl(@This(), "PMPRADMINACCEPTNEWLINK")) { _ = PMPRADMINACCEPTNEWLINK; }
if (@hasDecl(@This(), "PMPRADMINCONNECTIONHANGUPNOTIFICATION")) { _ = PMPRADMINCONNECTIONHANGUPNOTIFICATION; }
if (@hasDecl(@This(), "PMPRADMINCONNECTIONHANGUPNOTIFICATION2")) { _ = PMPRADMINCONNECTIONHANGUPNOTIFICATION2; }
if (@hasDecl(@This(), "PMPRADMINCONNECTIONHANGUPNOTIFICATION3")) { _ = PMPRADMINCONNECTIONHANGUPNOTIFICATION3; }
if (@hasDecl(@This(), "PMPRADMINLINKHANGUPNOTIFICATION")) { _ = PMPRADMINLINKHANGUPNOTIFICATION; }
if (@hasDecl(@This(), "PMPRADMINTERMINATEDLL")) { _ = PMPRADMINTERMINATEDLL; }
if (@hasDecl(@This(), "PMPRADMINACCEPTREAUTHENTICATION")) { _ = PMPRADMINACCEPTREAUTHENTICATION; }
if (@hasDecl(@This(), "PMPRADMINACCEPTNEWCONNECTIONEX")) { _ = PMPRADMINACCEPTNEWCONNECTIONEX; }
if (@hasDecl(@This(), "PMPRADMINACCEPTREAUTHENTICATIONEX")) { _ = PMPRADMINACCEPTREAUTHENTICATIONEX; }
if (@hasDecl(@This(), "PMPRADMINACCEPTTUNNELENDPOINTCHANGEEX")) { _ = PMPRADMINACCEPTTUNNELENDPOINTCHANGEEX; }
if (@hasDecl(@This(), "PMPRADMINCONNECTIONHANGUPNOTIFICATIONEX")) { _ = PMPRADMINCONNECTIONHANGUPNOTIFICATIONEX; }
if (@hasDecl(@This(), "PMPRADMINRASVALIDATEPREAUTHENTICATEDCONNECTIONEX")) { _ = PMPRADMINRASVALIDATEPREAUTHENTICATEDCONNECTIONEX; }
if (@hasDecl(@This(), "RASSECURITYPROC")) { _ = RASSECURITYPROC; }
if (@hasDecl(@This(), "PMGM_RPF_CALLBACK")) { _ = PMGM_RPF_CALLBACK; }
if (@hasDecl(@This(), "PMGM_CREATION_ALERT_CALLBACK")) { _ = PMGM_CREATION_ALERT_CALLBACK; }
if (@hasDecl(@This(), "PMGM_PRUNE_ALERT_CALLBACK")) { _ = PMGM_PRUNE_ALERT_CALLBACK; }
if (@hasDecl(@This(), "PMGM_JOIN_ALERT_CALLBACK")) { _ = PMGM_JOIN_ALERT_CALLBACK; }
if (@hasDecl(@This(), "PMGM_WRONG_IF_CALLBACK")) { _ = PMGM_WRONG_IF_CALLBACK; }
if (@hasDecl(@This(), "PMGM_LOCAL_JOIN_CALLBACK")) { _ = PMGM_LOCAL_JOIN_CALLBACK; }
if (@hasDecl(@This(), "PMGM_LOCAL_LEAVE_CALLBACK")) { _ = PMGM_LOCAL_LEAVE_CALLBACK; }
if (@hasDecl(@This(), "PMGM_DISABLE_IGMP_CALLBACK")) { _ = PMGM_DISABLE_IGMP_CALLBACK; }
if (@hasDecl(@This(), "PMGM_ENABLE_IGMP_CALLBACK")) { _ = PMGM_ENABLE_IGMP_CALLBACK; }
if (@hasDecl(@This(), "RTM_EVENT_CALLBACK")) { _ = RTM_EVENT_CALLBACK; }
if (@hasDecl(@This(), "RTM_ENTITY_EXPORT_METHOD")) { _ = RTM_ENTITY_EXPORT_METHOD; }
@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/network_management/rras.zig |
const std = @import("std");
const testing = std.testing;
const StringTable = @import("./strtab.zig").StringTable;
const allocator = std.heap.page_allocator;
pub const Luggage = struct {
const Bag = struct {
code: usize,
children: std.AutoHashMap(usize, usize),
parents: std.AutoHashMap(usize, void),
pub fn init(code: usize) *Bag {
var self = allocator.create(Bag) catch unreachable;
self.* = Bag{
.code = code,
.children = std.AutoHashMap(usize, usize).init(allocator),
.parents = std.AutoHashMap(usize, void).init(allocator),
};
return self;
}
};
colors: StringTable,
bags: std.AutoHashMap(usize, *Bag),
pub fn init() Luggage {
var self = Luggage{
.colors = StringTable.init(allocator),
.bags = std.AutoHashMap(usize, *Bag).init(allocator),
};
return self;
}
pub fn deinit(self: *Luggage) void {
self.bags.deinit();
self.colors.deinit();
}
pub fn add_rule(self: *Luggage, line: []const u8) void {
var pos: usize = 0;
var tone: []const u8 = undefined;
var count: usize = 0;
var buf: [100]u8 = undefined;
var parent: *Bag = undefined;
var it = std.mem.tokenize(u8, line, " .,");
while (it.next()) |str| {
pos += 1;
if (pos == 1) {
tone = str;
continue;
}
if (pos == 2) {
const color = std.fmt.bufPrint(buf[0..], "{s} {s}", .{ tone, str }) catch unreachable;
const code = self.colors.add(color);
// std.debug.warn("PCOLOR [{}] => {}\n", .{ color, code });
parent = Bag.init(code);
_ = self.bags.put(code, parent) catch unreachable;
continue;
}
if (pos < 5) {
continue;
}
var cpos: usize = (pos - 5) % 4;
if (cpos == 0) {
count = std.fmt.parseInt(usize, str, 10) catch 0;
if (count <= 0) {
break;
}
// std.debug.warn("COUNT {}\n", .{count});
continue;
}
if (cpos == 1) {
tone = str;
continue;
}
if (cpos == 2) {
const color = std.fmt.bufPrint(buf[0..], "{s} {s}", .{ tone, str }) catch unreachable;
const code = self.colors.add(color);
// std.debug.warn("CCOLOR [{}] => {}\n", .{ color, code });
_ = parent.children.put(code, count) catch unreachable;
continue;
}
}
}
pub fn compute_parents(self: *Luggage) void {
var itp = self.bags.iterator();
while (itp.next()) |kvp| {
const parent = kvp.value_ptr.*.*;
var itc = parent.children.iterator();
while (itc.next()) |kvc| {
var child = self.bags.get(kvc.key_ptr.*).?;
_ = child.parents.put(parent.code, {}) catch unreachable;
}
}
}
pub fn sum_can_contain(self: *Luggage, color: []const u8) usize {
const code = self.colors.get_pos(color).?;
var seen = std.AutoHashMap(usize, void).init(allocator);
defer seen.deinit();
return self.sum_can_contain_by_code(code, &seen) - 1;
}
fn sum_can_contain_by_code(self: *Luggage, code: usize, seen: *std.AutoHashMap(usize, void)) usize {
if (seen.contains(code)) {
return 0;
}
_ = seen.put(code, {}) catch unreachable;
var count: usize = 1;
const bag = self.bags.get(code).?;
var it = bag.parents.iterator();
while (it.next()) |kv| {
const parent = kv.key_ptr.*;
count += self.sum_can_contain_by_code(parent, seen);
}
return count;
}
pub fn count_contained_bags(self: *Luggage, color: []const u8) usize {
const code = self.colors.get_pos(color).?;
return self.count_contained_bags_by_code(code) - 1;
}
fn count_contained_bags_by_code(self: *Luggage, code: usize) usize {
var count: usize = 1;
const bag = self.bags.get(code).?;
var it = bag.children.iterator();
while (it.next()) |kv| {
const child = kv.key_ptr.*;
count += kv.value_ptr.* * self.count_contained_bags_by_code(child);
}
return count;
}
pub fn show(self: Luggage) void {
std.debug.warn("Luggage with {} bags\n", .{self.bags.count()});
var itp = self.bags.iterator();
while (itp.next()) |kvp| {
const bag: Bag = kvp.value_ptr.*.*;
std.debug.warn(" [{}]\n", .{self.colors.get_str(bag.code).?});
var itc = bag.children.iterator();
while (itc.next()) |kvc| {
std.debug.warn(" can contain {} [{}]\n", .{ kvc.value_ptr.*, self.colors.get_str(kvc.key_ptr.*).? });
}
}
}
};
test "sample parents" {
const data: []const u8 =
\\light red bags contain 1 bright white bag, 2 muted yellow bags.
\\dark orange bags contain 3 bright white bags, 4 muted yellow bags.
\\bright white bags contain 1 shiny gold bag.
\\muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.
\\shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.
\\dark olive bags contain 3 faded blue bags, 4 dotted black bags.
\\vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
\\faded blue bags contain no other bags.
\\dotted black bags contain no other bags.
;
var luggage = Luggage.init();
defer luggage.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
luggage.add_rule(line);
}
// luggage.show();
luggage.compute_parents();
const containers = luggage.sum_can_contain("shiny gold");
try testing.expect(containers == 4);
}
test "sample children 1" {
const data: []const u8 =
\\light red bags contain 1 bright white bag, 2 muted yellow bags.
\\dark orange bags contain 3 bright white bags, 4 muted yellow bags.
\\bright white bags contain 1 shiny gold bag.
\\muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.
\\shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.
\\dark olive bags contain 3 faded blue bags, 4 dotted black bags.
\\vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.
\\faded blue bags contain no other bags.
\\dotted black bags contain no other bags.
;
var luggage = Luggage.init();
defer luggage.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
luggage.add_rule(line);
}
// luggage.show();
const contained = luggage.count_contained_bags("shiny gold");
try testing.expect(contained == 32);
}
test "sample children 2" {
const data: []const u8 =
\\shiny gold bags contain 2 dark red bags.
\\dark red bags contain 2 dark orange bags.
\\dark orange bags contain 2 dark yellow bags.
\\dark yellow bags contain 2 dark green bags.
\\dark green bags contain 2 dark blue bags.
\\dark blue bags contain 2 dark violet bags.
\\dark violet bags contain no other bags.
;
var luggage = Luggage.init();
defer luggage.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
luggage.add_rule(line);
}
// luggage.show();
const contained = luggage.count_contained_bags("shiny gold");
try testing.expect(contained == 126);
} | 2020/p07/luggage.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
//--------------------------------------------------------------------------------------------------
pub fn part1() anyerror!void {
const file = std.fs.cwd().openFile("data/day09_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
const stderr = std.io.getStdErr();
break :label stderr;
};
defer file.close();
var reader = std.io.bufferedReader(file.reader());
var istream = reader.reader();
var buf: [100]u8 = undefined;
var heightmap: [100][100]u8 = undefined;
{
var row: usize = 0;
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| : (row += 1) {
for (line) |char, col| {
_ = char;
heightmap[row][col] = std.fmt.parseInt(u8, buf[col .. col + 1], 10) catch 0;
//std.log.info("[{d}][{d}] = {d}", .{ row, col, heightmap[row][col] });
}
}
}
var sum: u32 = 0;
for (heightmap) |row, i| {
var decreasing = true;
for (row) |entry, j| {
const is_last = (j == row.len - 1);
const will_increase = if (is_last) true else (row[j + 1] > entry);
const will_decrease = if (is_last) false else (row[j + 1] < entry); // NB. notice this isn't exactly !will_increase as that would include equals
// setup next loop iteration, keep previous values for logic below
const was_decreasing = decreasing;
decreasing = will_decrease;
if (was_decreasing and will_increase) {
// At this point the previous value is a minimum in Left and Right direction
// Check Up. If up exists and it's lower, then we are not the min
if ((i > 0) and (heightmap[i - 1][j] < entry)) {
continue;
}
// Check Down. If down exists and it's lower, then we are not the min
if ((i < heightmap.len - 1) and (heightmap[i + 1][j] < entry)) {
continue;
}
// If we reached here we are really the minimum
sum += (entry + 1);
}
}
}
std.log.info("Part 1 sum: {d}", .{sum});
}
//--------------------------------------------------------------------------------------------------
pub fn flood_fill(heightmap: *[100][100]u16, marker: u16, row: usize, col: usize) void {
if (heightmap[row][col] == marker) {
return;
}
if (heightmap[row][col] == 9) {
return;
}
heightmap[row][col] = marker;
if (col < 98) {
flood_fill(heightmap, marker, row, col + 1);
}
if (col > 0) {
flood_fill(heightmap, marker, row, col - 1);
}
if (row < 98) {
flood_fill(heightmap, marker, row + 1, col);
}
if (row > 0) {
flood_fill(heightmap, marker, row - 1, col);
}
}
//--------------------------------------------------------------------------------------------------
pub fn part2() anyerror!void {
const file = std.fs.cwd().openFile("data/day09_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
const stderr = std.io.getStdErr();
break :label stderr;
};
defer file.close();
var reader = std.io.bufferedReader(file.reader());
var istream = reader.reader();
var buf: [100]u8 = undefined;
var heightmap: [100][100]u16 = undefined;
{
var row: usize = 0;
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| : (row += 1) {
for (line) |char, col| {
_ = char;
heightmap[row][col] = std.fmt.parseInt(u8, buf[col .. col + 1], 10) catch 0;
}
}
}
// Mark out basins
var marker: u16 = 10; // mark starting from 10
{
var i: usize = 0;
while (i < heightmap.len) : (i += 1) {
var j: usize = 0;
while (j < heightmap[i].len) : (j += 1) {
if (heightmap[i][j] >= 9) {
continue;
}
flood_fill(&heightmap, marker, i, j);
marker += 1;
}
}
}
// Count basin sizes
const marker_end = marker;
marker = 10; // restart marker starting from 10
var counts = [_]u32{0} ** 3;
// TODO: hashmap would have been much better here
while (marker < marker_end) : (marker += 1) {
var count: u32 = 0;
for (heightmap) |row| {
for (row) |entry| {
if (entry == marker) {
count += 1;
}
}
}
// place the count into the array, if it is a new maximum
if (count > counts[0]) {
// shift right
counts[2] = counts[1];
counts[1] = counts[0];
counts[0] = count;
} else if (count > counts[1]) {
counts[2] = counts[1];
counts[1] = count;
} else if (count > counts[2]) {
counts[2] = count;
}
}
// for (heightmap) |row, i| {
// std.log.info("{d}", .{row});
// }
std.log.info("Part 2 sum: {d}", .{counts[0] * counts[1] * counts[2]});
}
//--------------------------------------------------------------------------------------------------
pub fn main() anyerror!void {
try part1();
try part2();
}
//-------------------------------------------------------------------------------------------------- | src/day09.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const Crabs = ArrayList(u16);
//--------------------------------------------------------------------------------------------------
pub fn sort(crabs: *Crabs) void {
var i: usize = 1;
while (i < crabs.items.len) : (i += 1) {
const x = crabs.items[i];
var j: usize = i;
while (j > 0 and x < crabs.items[j - 1]) : (j -= 1) {
crabs.items[j] = crabs.items[j - 1];
}
crabs.items[j] = x;
}
}
//--------------------------------------------------------------------------------------------------
pub fn part1() anyerror!void {
const file = std.fs.cwd().openFile("data/day07_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
const stderr = std.io.getStdErr();
break :label stderr;
};
defer file.close();
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
const file_size = try file.getEndPos();
std.log.info("File size {}", .{file_size});
var reader = std.io.bufferedReader(file.reader());
var istream = reader.reader();
var crabs = Crabs.init(allocator);
var buf: [4096]u8 = undefined;
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| {
var it = std.mem.tokenize(u8, line, ",");
while (it.next()) |value| {
crabs.append(std.fmt.parseInt(u16, value, 10) catch 0) catch unreachable;
}
}
std.log.info("num crabs: {d}", .{crabs.items.len});
sort(&crabs);
//std.log.info("{d}", .{crabs.items});
const median_idx = crabs.items.len / 2;
var median = crabs.items[median_idx];
if (crabs.items.len % 2 == 0) {
median += crabs.items[median_idx - 1];
median /= 2;
}
std.log.info("final median: {d}", .{median});
var fuel: u32 = 0;
for (crabs.items) |item| {
fuel += if (item > median) item - median else median - item;
}
std.log.info("Part 1: fuel: {d}", .{fuel});
// Part 2
var sum: u64 = 0;
for (crabs.items) |item| {
sum += item;
}
const denom: u32 = @intCast(u32, crabs.items.len);
const m: u32 = @divTrunc(@intCast(u32, sum), denom);
const mean: u32 = m; //if (m * denom != sum) m + 1 else m; // Rounded up value was incorrect answer!?
//std.log.info("sum: {d}", .{sum});
std.log.info("mean: {d}", .{mean});
fuel = 0;
for (crabs.items) |item| {
const dist: u32 = if (item > mean) item - mean else mean - item;
// Closed form solution => [(n^2 - n) / 2] + n
fuel += (((dist * dist) - dist) / 2) + dist;
}
std.log.info("Part 2: fuel: {d}", .{fuel});
}
//--------------------------------------------------------------------------------------------------
pub fn main() anyerror!void {
try part1();
}
//-------------------------------------------------------------------------------------------------- | src/day07.zig |
const wlr = @import("../wlroots.zig");
const wayland = @import("wayland");
const wl = wayland.server.wl;
pub const OutputLayout = extern struct {
pub const State = opaque {};
pub const Output = extern struct {
output: *wlr.Output,
x: c_int,
y: c_int,
/// OutputLayout.outputs
link: wl.list.Link,
state: *State,
events: extern struct {
destroy: wl.Signal(*OutputLayout.Output),
},
};
pub const Direction = extern enum {
up = 1,
down = 2,
left = 4,
right = 8,
};
outputs: wl.list.Head(OutputLayout.Output, "link"),
state: *State,
events: extern struct {
add: wl.Signal(*OutputLayout),
change: wl.Signal(*OutputLayout),
destroy: wl.Signal(*OutputLayout),
},
data: usize,
extern fn wlr_output_layout_create() ?*OutputLayout;
pub const create = wlr_output_layout_create;
extern fn wlr_output_layout_destroy(layout: *OutputLayout) void;
pub const destroy = wlr_output_layout_destroy;
extern fn wlr_output_layout_get(layout: *OutputLayout, reference: *wlr.Output) ?*OutputLayout.Output;
pub const get = wlr_output_layout_get;
extern fn wlr_output_layout_output_at(layout: *OutputLayout, lx: f64, ly: f64) ?*wlr.Output;
pub const outputAt = wlr_output_layout_output_at;
extern fn wlr_output_layout_add(layout: *OutputLayout, output: *wlr.Output, lx: c_int, ly: c_int) void;
pub const add = wlr_output_layout_add;
extern fn wlr_output_layout_move(layout: *OutputLayout, output: *wlr.Output, lx: c_int, ly: c_int) void;
pub const move = wlr_output_layout_move;
extern fn wlr_output_layout_remove(layout: *OutputLayout, output: *wlr.Output) void;
pub const remove = wlr_output_layout_remove;
extern fn wlr_output_layout_output_coords(layout: *OutputLayout, reference: *wlr.Output, lx: *f64, ly: *f64) void;
pub const outputCoords = wlr_output_layout_output_coords;
extern fn wlr_output_layout_contains_point(layout: *OutputLayout, reference: ?*wlr.Output, lx: c_int, ly: c_int) bool;
pub const containsPoint = wlr_output_layout_contains_point;
extern fn wlr_output_layout_intersects(layout: *OutputLayout, reference: ?*wlr.Output, target_lbox: *const wlr.Box) bool;
pub const intersects = wlr_output_layout_intersects;
extern fn wlr_output_layout_closest_point(layout: *OutputLayout, reference: ?*wlr.Output, lx: f64, ly: f64, dest_lx: *f64, dest_ly: *f64) void;
pub const closestPoint = wlr_output_layout_closest_point;
extern fn wlr_output_layout_get_box(layout: *OutputLayout, reference: ?*wlr.Output) *wlr.Box;
pub const getBox = wlr_output_layout_get_box;
extern fn wlr_output_layout_add_auto(layout: *OutputLayout, output: *wlr.Output) void;
pub const addAuto = wlr_output_layout_add_auto;
extern fn wlr_output_layout_get_center_output(layout: *OutputLayout) ?*wlr.Output;
pub const getCenterOutput = wlr_output_layout_get_center_output;
extern fn wlr_output_layout_adjacent_output(layout: *OutputLayout, direction: Direction, reference: *wlr.Output, ref_lx: f64, ref_ly: f64) ?*wlr.Output;
pub const adjacentOutput = wlr_output_layout_adjacent_output;
extern fn wlr_output_layout_farthest_output(layout: *OutputLayout, direction: Direction, reference: *wlr.Output, ref_lx: f64, ref_ly: f64) ?*wlr.Output;
pub const farthestOutput = wlr_output_layout_farthest_output;
}; | src/types/output_layout.zig |
const std = @import("std");
const unistd = @cImport(@cInclude("unistd.h"));
const UPPER_BOUND: i32 = 5_000_000;
const PREFIX: i32 = 32_338;
const Node = struct {
children: std.AutoArrayHashMap(u8, *Node),
terminal: bool = false,
fn init(alloc: *std.mem.Allocator) Node {
return Node{
.children = std.AutoArrayHashMap(u8, *Node).init(alloc),
};
}
};
const Sieve = struct {
limit: i32,
prime: std.DynamicBitSet,
fn init(alloc: *std.mem.Allocator, limit: i32) Sieve {
var self = Sieve{
.limit = limit,
.prime = std.DynamicBitSet.initEmpty(@intCast(usize, limit + 1), alloc) catch unreachable,
};
return self;
}
fn toList(self: *Sieve, alloc: *std.mem.Allocator) std.ArrayList(i32) {
var result = std.ArrayList(i32).init(alloc);
result.appendSlice(&.{ 2, 3 }) catch unreachable;
var p: i32 = 5;
while (p <= self.limit) : (p += 1) {
if (self.prime.isSet(@intCast(usize, p))) {
result.append(p) catch unreachable;
}
}
return result;
}
fn omitSquares(self: *Sieve) *Sieve {
var r: i32 = 5;
while (r * r < self.limit) : (r += 1) {
if (self.prime.isSet(@intCast(usize, r))) {
var i: i32 = r * r;
while (i < self.limit) : (i += r * r) {
self.prime.unset(@intCast(usize, i));
}
}
}
return self;
}
fn step1(self: *Sieve, x: i32, y: i32) void {
const n: i32 = (4 * x * x) + (y * y);
if (n <= self.limit and (@rem(n, 12) == 1 or @rem(n, 12) == 5)) {
self.prime.toggle(@intCast(usize, n));
}
}
fn step2(self: *Sieve, x: i32, y: i32) void {
const n: i32 = (3 * x * x) + (y * y);
if (n <= self.limit and @rem(n, 12) == 7) {
self.prime.toggle(@intCast(usize, n));
}
}
fn step3(self: *Sieve, x: i32, y: i32) void {
const n: i32 = (3 * x * x) - (y * y);
if (x > y and n <= self.limit and @rem(n, 12) == 11) {
self.prime.toggle(@intCast(usize, n));
}
}
fn loopY(self: *Sieve, x: i32) void {
var y: i32 = 1;
while (y * y < self.limit) : (y += 1) {
self.step1(x, y);
self.step2(x, y);
self.step3(x, y);
}
}
fn loopX(self: *Sieve) void {
var x: i32 = 1;
while (x * x < self.limit) : (x += 1) {
self.loopY(x);
}
}
fn calc(self: *Sieve) *Sieve {
self.loopX();
return self.omitSquares();
}
};
fn generateTrie(alloc: *std.mem.Allocator, l: std.ArrayList(i32)) *Node {
var root: *Node = alloc.create(Node) catch unreachable;
root.* = Node.init(alloc);
for (l.items) |el| {
var head = root;
const str_el = std.fmt.allocPrint(alloc, "{}", .{el}) catch unreachable;
for (str_el) |ch| {
if (!head.children.contains(ch)) {
var node = alloc.create(Node) catch unreachable;
node.* = Node.init(alloc);
head.children.put(ch, node) catch unreachable;
}
head = head.children.get(ch) orelse unreachable;
}
head.terminal = true;
}
return root;
}
fn find(alloc: *std.mem.Allocator, upper_bound: i32, prefix: i32) std.ArrayList(i32) {
const primes = Sieve.init(alloc, upper_bound).calc();
const str_prefix = std.fmt.allocPrint(alloc, "{}", .{prefix}) catch unreachable;
var head = generateTrie(alloc, primes.toList(alloc));
for (str_prefix) |ch| {
head = head.children.get(ch) orelse unreachable;
}
const Pair = struct {
node: *Node,
str: []u8,
};
const Q = std.TailQueue(Pair);
var queue = Q{};
var first = Q.Node{ .data = Pair{ .node = head, .str = str_prefix } };
queue.append(&first);
var result = std.ArrayList(i32).init(alloc);
while (queue.len > 0) {
const pair = queue.pop() orelse unreachable;
const top = pair.data.node;
const current_prefix = pair.data.str;
if (top.terminal) {
const v = std.fmt.parseInt(i32, current_prefix, 10) catch unreachable;
result.append(v) catch unreachable;
}
var it = top.children.iterator();
while (it.next()) |kv| {
const str = std.fmt.allocPrint(alloc, "{s}{c}", .{ current_prefix, kv.key_ptr.* }) catch unreachable;
var elem = alloc.create(Q.Node) catch unreachable;
elem.* = Q.Node{ .data = Pair{ .node = kv.value_ptr.*, .str = str } };
queue.prepend(elem);
}
}
return result;
}
fn notify(msg: []const u8) void {
const addr = std.net.Address.parseIp("127.0.0.1", 9001) catch unreachable;
if (std.net.tcpConnectToAddress(addr)) |stream| {
defer stream.close();
_ = stream.write(msg) catch unreachable;
} else |_| {}
}
fn verify(alloc: *std.mem.Allocator) !void {
const left = [_]i32{ 2, 23, 29 };
const right = find(alloc, 100, 2).toOwnedSlice();
var i: usize = 0;
while (i < right.len) : (i += 1) {
if (left[i] != right[i]) {
std.debug.panic("{} != {}\n", .{ left[i], right[i] });
}
}
}
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.c_allocator);
defer arena.deinit();
var alloc: *std.mem.Allocator = &arena.allocator;
try verify(alloc);
const pid = unistd.getpid();
const pid_str = try std.fmt.allocPrint(alloc, "Zig\t{d}", .{pid});
notify(pid_str);
const results = find(alloc, UPPER_BOUND, PREFIX);
notify("stop");
std.debug.print("{d}\n", .{results.items});
} | primes/primes.zig |
const std = @import("std");
const testing = std.testing;
const expect = testing.expect;
const expectEqual = testing.expectEqual;
const expectApproxEqRel = testing.expectApproxEqRel;
const assert = std.debug.assert;
const Vector4 = @import("vector4.zig").Vector4;
const Vector3 = @import("vector3.zig").Vector3;
usingnamespace @import("math.zig");
/// A 4 by 4 matrix with column major memory layout.
pub const Matrix4x4 = packed struct {
m00: f32,
m01: f32,
m02: f32,
m03: f32,
m10: f32,
m11: f32,
m12: f32,
m13: f32,
m20: f32,
m21: f32,
m22: f32,
m23: f32,
m30: f32,
m31: f32,
m32: f32,
m33: f32,
/// Initialize the matrix with scalar values.
/// Arguments are arranged so they are a visual representation of the matrix.
pub fn init(
m00: f32, m10: f32, m20: f32, m30: f32,
m01: f32, m11: f32, m21: f32, m31: f32,
m02: f32, m12: f32, m22: f32, m32: f32,
m03: f32, m13: f32, m23: f32, m33: f32) Matrix4x4 {
return .{
.m00 = m00, .m10 = m10, .m20 = m20, .m30 = m30,
.m01 = m01, .m11 = m11, .m21 = m21, .m31 = m31,
.m02 = m02, .m12 = m12, .m22 = m22, .m32 = m32,
.m03 = m03, .m13 = m13, .m23 = m23, .m33 = m33,
};
}
/// Initialize the matrix from column vectors.
pub fn initColumns(c0: Vector4, c1: Vector4, c2: Vector4, c3: Vector4) Matrix4x4 {
return .{
.m00 = c0.x, .m10 = c1.x, .m20 = c2.x, .m30 = c3.x,
.m01 = c0.y, .m11 = c1.y, .m21 = c2.y, .m31 = c3.y,
.m02 = c0.z, .m12 = c1.z, .m22 = c2.z, .m32 = c3.z,
.m03 = c0.w, .m13 = c1.w, .m23 = c2.w, .m33 = c3.w,
};
}
/// Create an identity matrix.
pub fn identity() Matrix4x4 {
return .{
.m00 = 1, .m10 = 0, .m20 = 0, .m30 = 0,
.m01 = 0, .m11 = 1, .m21 = 0, .m31 = 0,
.m02 = 0, .m12 = 0, .m22 = 1, .m32 = 0,
.m03 = 0, .m13 = 0, .m23 = 0, .m33 = 1,
};
}
/// Return the column at index. Index must be in range [0, 3].
pub fn column(self: Matrix4x4, index: usize) Vector4 {
assert(index >= 0 and index < 4);
return @ptrCast([*]const Vector4, &self.m00)[index];
}
/// Return a pointer to the column at index. Index must be in range [0, 3].
pub fn columnPtr(self: *Matrix4x4, index: usize) *Vector4 {
assert(index >= 0 and index < 4);
return @ptrCast(*Vector4, @ptrCast([*]Vector4, &self.m00) + index);
}
/// Transpose a matrix
pub fn transpose(a: Matrix4x4) Matrix4x4 {
const ac0 = a.column(0);
const ac1 = a.column(1);
const ac2 = a.column(2);
const ac3 = a.column(3);
const c0 = Vector4.init(ac0.x, ac1.x, ac2.x, ac3.x);
const c1 = Vector4.init(ac0.y, ac1.y, ac2.y, ac3.y);
const c2 = Vector4.init(ac0.z, ac1.z, ac2.z, ac3.z);
const c3 = Vector4.init(ac0.w, ac1.w, ac2.w, ac3.w);
return initColumns(c0, c1, c2, c3);
}
/// Multiply two matrices.
pub fn multiply(a: Matrix4x4, b: Matrix4x4) Matrix4x4 {
const ac0 = a.column(0);
const ac1 = a.column(1);
const ac2 = a.column(2);
const ac3 = a.column(3);
const c0 = ac0.multiply(Vector4.set(b.m00))
.add(ac1.multiply(Vector4.set(b.m01)))
.add(ac2.multiply(Vector4.set(b.m02)))
.add(ac3.multiply(Vector4.set(b.m03)));
const c1 = ac0.multiply(Vector4.set(b.m10))
.add(ac1.multiply(Vector4.set(b.m11)))
.add(ac2.multiply(Vector4.set(b.m12)))
.add(ac3.multiply(Vector4.set(b.m13)));
const c2 = ac0.multiply(Vector4.set(b.m20))
.add(ac1.multiply(Vector4.set(b.m21)))
.add(ac2.multiply(Vector4.set(b.m22)))
.add(ac3.multiply(Vector4.set(b.m23)));
const c3 = ac0.multiply(Vector4.set(b.m30))
.add(ac1.multiply(Vector4.set(b.m31)))
.add(ac2.multiply(Vector4.set(b.m32)))
.add(ac3.multiply(Vector4.set(b.m33)));
return initColumns(c0, c1, c2, c3);
}
/// Multiply a matrix by a vector
pub fn multiplyVector(a: Matrix4x4, b: Vector4) Vector4 {
const ac0 = a.column(0);
const ac1 = a.column(1);
const ac2 = a.column(2);
const ac3 = a.column(3);
return ac0.multiply(Vector4.set(b.x))
.add(ac1.multiply(Vector4.set(b.y)))
.add(ac2.multiply(Vector4.set(b.z)))
.add(ac3.multiply(Vector4.set(b.w)));
}
/// Create a matrix containing a translation
pub fn createTranslation(translation: Vector3) Matrix4x4 {
return .{
.m00 = 1, .m10 = 0, .m20 = 0, .m30 = translation.x,
.m01 = 0, .m11 = 1, .m21 = 0, .m31 = translation.y,
.m02 = 0, .m12 = 0, .m22 = 1, .m32 = translation.z,
.m03 = 0, .m13 = 0, .m23 = 0, .m33 = 1,
};
}
/// Create a matrix containing a rotation around the x axis
pub fn createRotationX(angle: f32) Matrix4x4 {
const cs = std.math.cos(angle);
const sn = std.math.sin(angle);
return .{
.m00 = 1, .m10 = 0, .m20 = 0, .m30 = 0,
.m01 = 0, .m11 = cs, .m21 = -sn, .m31 = 0,
.m02 = 0, .m12 = sn, .m22 = cs, .m32 = 0,
.m03 = 0, .m13 = 0, .m23 = 0, .m33 = 1,
};
}
/// Create a matrix containing a rotation around the y axis
pub fn createRotationY(angle: f32) Matrix4x4 {
const cs = std.math.cos(angle);
const sn = std.math.sin(angle);
return .{
.m00 = cs, .m10 = 0, .m20 = sn, .m30 = 0,
.m01 = 0, .m11 = 1, .m21 = 0, .m31 = 0,
.m02 = -sn, .m12 = 0, .m22 = cs, .m32 = 0,
.m03 = 0, .m13 = 0, .m23 = 0, .m33 = 1,
};
}
/// Create a matrix containing a rotation around the z axis
pub fn createRotationZ(angle: f32) Matrix4x4 {
const cs = std.math.cos(angle);
const sn = std.math.sin(angle);
return .{
.m00 = cs, .m10 = -sn, .m20 = 0, .m30 = 0,
.m01 = sn, .m11 = cs, .m21 = 0, .m31 = 0,
.m02 = 0, .m12 = 0, .m22 = 1, .m32 = 0,
.m03 = 0, .m13 = 0, .m23 = 0, .m33 = 1,
};
}
/// Create a matrix containing a scale
pub fn createScale(scale: Vector3) Matrix4x4 {
return .{
.m00 = scale.x, .m10 = 0, .m20 = 0, .m30 = 0,
.m01 = 0, .m11 = scale.y, .m21 = 0, .m31 = 0,
.m02 = 0, .m12 = 0, .m22 = scale.z, .m32 = 0,
.m03 = 0, .m13 = 0, .m23 = 0, .m33 = 1,
};
}
/// Create a projection matrix with the field of view given along the vertical axis
pub fn createPerspectiveProjectionVertical(vertical_fov: f32, aspect: f32, near: f32, far: f32, invert_depth: bool) Matrix4x4 {
assert(vertical_fov > 0);
assert(aspect > 0);
const h = std.math.tan(vertical_fov * 0.5);
const w = h * aspect;
var z: f32 = -1;
if (invert_depth) {
var tmp = near;
near = far;
far = tmp;
z = 1;
}
return .{
.m00 = 1.0/w, .m10 = 0, .m20 = 0, .m30 = 0,
.m01 = 0, .m11 = 1.0/h, .m21 = 0, .m31 = 0,
.m02 = 0, .m12 = 0, .m22 = far / (near - far), .m32 = (far * near) / (near - far),
.m03 = 0, .m13 = 0, .m23 = z, .m33 = 0,
};
}
/// Create a projection matrix with the field of view given along the horizontal axis
pub fn createPerspectiveProjectionHorizontal(horizontal_fov: f32, aspect: f32, near: f32, far: f32, invert_depth: bool) Matrix4x4 {
assert(horizontal_fov > 0);
assert(aspect > 0);
const w = std.math.tan(horizontal_fov * 0.5);
const h = w / aspect;
var z: f32 = -1;
if (invert_depth) {
var tmp = near;
near = far;
far = tmp;
z = 1;
}
return .{
.m00 = 1.0/w, .m10 = 0, .m20 = 0, .m30 = 0,
.m01 = 0, .m11 = 1.0/h, .m21 = 0, .m31 = 0,
.m02 = 0, .m12 = 0, .m22 = far / (near - far), .m32 = (far * near) / (near - far),
.m03 = 0, .m13 = 0, .m23 = z, .m33 = 0,
};
}
/// Create a projection matrix with the field of view given along the shortest axis
pub fn createPerspectiveProjectionShortest(fov: f32, aspect: f32, near: f32, far: f32, invert_depth: bool) Matrix4x4 {
assert(fov > 0);
assert(aspect > 0);
var w: f32 = undefined;
var h: f32 = undefined;
if (aspect < 1) {
w = std.math.tan(fov * 0.5);
h = w / aspect;
} else {
h = std.math.tan(fov * 0.5);
w = h * aspect;
}
var z: f32 = -1;
if (invert_depth) {
var tmp = near;
near = far;
far = tmp;
z = 1;
}
return .{
.m00 = 1.0/w, .m10 = 0, .m20 = 0, .m30 = 0,
.m01 = 0, .m11 = 1.0/h, .m21 = 0, .m31 = 0,
.m02 = 0, .m12 = 0, .m22 = far / (near - far), .m32 = (far * near) / (near - far),
.m03 = 0, .m13 = 0, .m23 = z, .m33 = 0,
};
}
pub fn createTransform(translation: Vector3, rotation: Quaternion, scale: Vector3) Matrix4x4 {
const xx = 2 * rotation.x * rotation.x;
const xy = 2 * rotation.x * rotation.y;
const xz = 2 * rotation.x * rotation.z;
const xw = 2 * rotation.x * rotation.w;
const yy = 2 * rotation.y * rotation.y;
const yz = 2 * rotation.y * rotation.z;
const yw = 2 * rotation.y * rotation.w;
const zz = 2 * rotation.z * rotation.z;
const zw = 2 * rotation.z * rotation.w;
var x_basis = Vector4.init(
1 - yy - zz,
xy + zw,
xz - yw,
0
);
var y_basis = Vector4.init(
xy - zw,
1 - xx - zz,
yz + xw,
0
);
var z_basis = Vector4.init(
xz + yw,
yz - xw,
1 - xx - yy,
0
);
x_basis = x_basis.multiplyScalar(scale.x);
y_basis = x_basis.multiplyScalar(scale.y);
z_basis = x_basis.multiplyScalar(scale.z);
var offset = Vector4.init(translation.x, translation.y, translation.z, 1);
return initColumns(x_basis, y_basis, z_basis, offset);
}
};
fn expectAppproxEq(expected: Vector4, actual: Vector4) !void {
const structType = @typeInfo(@TypeOf(actual)).Struct;
inline for (structType.fields) |field| {
try expectApproxEqRel(@field(expected, field.name), @field(actual, field.name), 0.00001);
}
}
test "Matrix4x4" {
var m: Matrix4x4 = undefined;
var v: Vector4 = undefined;
var m1 = Matrix4x4.init(
1, 5, 9, 13,
2, 6, 10, 14,
3, 7, 11, 15,
4, 8, 12, 16);
var m2 = Matrix4x4.init(
17, 21, 25, 29,
18, 22, 26, 30,
19, 23, 27, 31,
20, 24, 28, 32);
var v1 = Vector4.init(1, 2, 3, 4);
m = Matrix4x4.init(
1, 5, 9, 13,
2, 6, 10, 14,
3, 7, 11, 15,
4, 8, 12, 16);
try expectEqual(@as(f32, 1), m.m00);
try expectEqual(@as(f32, 2), m.m01);
try expectEqual(@as(f32, 3), m.m02);
try expectEqual(@as(f32, 4), m.m03);
try expectEqual(@as(f32, 5), m.m10);
try expectEqual(@as(f32, 6), m.m11);
try expectEqual(@as(f32, 7), m.m12);
try expectEqual(@as(f32, 8), m.m13);
try expectEqual(@as(f32, 9), m.m20);
try expectEqual(@as(f32, 10), m.m21);
try expectEqual(@as(f32, 11), m.m22);
try expectEqual(@as(f32, 12), m.m23);
try expectEqual(@as(f32, 13), m.m30);
try expectEqual(@as(f32, 14), m.m31);
try expectEqual(@as(f32, 15), m.m32);
try expectEqual(@as(f32, 16), m.m33);
try expectEqual(Vector4.init( 1, 2, 3, 4), m.column(0));
try expectEqual(Vector4.init( 5, 6, 7, 8), m.column(1));
try expectEqual(Vector4.init( 9, 10, 11, 12), m.column(2));
try expectEqual(Vector4.init(13, 14, 15, 16), m.column(3));
try expectEqual(Vector4.init( 1, 2, 3, 4), m.columnPtr(0).*);
try expectEqual(Vector4.init( 5, 6, 7, 8), m.columnPtr(1).*);
try expectEqual(Vector4.init( 9, 10, 11, 12), m.columnPtr(2).*);
try expectEqual(Vector4.init(13, 14, 15, 16), m.columnPtr(3).*);
m = Matrix4x4.initColumns(
Vector4.init(1, 2, 3, 4),
Vector4.init(5, 6, 7, 8),
Vector4.init(9, 10, 11, 12),
Vector4.init(13, 14, 15, 16));
try expectEqual(@as(f32, 1), m.m00);
try expectEqual(@as(f32, 2), m.m01);
try expectEqual(@as(f32, 3), m.m02);
try expectEqual(@as(f32, 4), m.m03);
try expectEqual(@as(f32, 5), m.m10);
try expectEqual(@as(f32, 6), m.m11);
try expectEqual(@as(f32, 7), m.m12);
try expectEqual(@as(f32, 8), m.m13);
try expectEqual(@as(f32, 9), m.m20);
try expectEqual(@as(f32, 10), m.m21);
try expectEqual(@as(f32, 11), m.m22);
try expectEqual(@as(f32, 12), m.m23);
try expectEqual(@as(f32, 13), m.m30);
try expectEqual(@as(f32, 14), m.m31);
try expectEqual(@as(f32, 15), m.m32);
try expectEqual(@as(f32, 16), m.m33);
m = Matrix4x4.transpose(m1);
try expectEqual(
Matrix4x4.init(
1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16
), m);
m = Matrix4x4.identity();
try expectEqual(
Matrix4x4.init(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
), m);
m = m1.multiply(m2);
try expectEqual(
Matrix4x4.init(
538, 650, 762, 874,
612, 740, 868, 996,
686, 830, 974, 1118,
760, 920, 1080, 1240
), m);
v = m1.multiplyVector(v1);
try expectEqual(v, Vector4.init(90, 100, 110, 120));
m = Matrix4x4.createTranslation(Vector3.init(1, 2, 3));
try expectEqual(
Matrix4x4.init(
1, 0, 0, 1,
0, 1, 0, 2,
0, 0, 1, 3,
0, 0, 0, 1,
), m);
v = Matrix4x4.createTranslation(Vector3.init(1, -2, 3)).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectEqual(Vector4.init(2, 0, 6, 1), v);
v = Matrix4x4.createRotationX(degToRad(@as(f32, 90))).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectAppproxEq(Vector4.init(1, -3, 2, 1), v);
v = Matrix4x4.createRotationX(degToRad(@as(f32, -90))).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectAppproxEq(Vector4.init(1, 3, -2, 1), v);
v = Matrix4x4.createRotationY(degToRad(@as(f32, 90))).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectAppproxEq(Vector4.init(3, 2, -1, 1), v);
v = Matrix4x4.createRotationY(degToRad(@as(f32, -90))).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectAppproxEq(Vector4.init(-3, 2, 1, 1), v);
v = Matrix4x4.createRotationZ(degToRad(@as(f32, 90))).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectAppproxEq(Vector4.init(-2, 1, 3, 1), v);
v = Matrix4x4.createRotationZ(degToRad(@as(f32, -90))).multiplyVector(Vector4.init(1, 2, 3, 1));
try expectAppproxEq(Vector4.init(2, -1, 3, 1), v);
m = Matrix4x4.createScale(Vector3.init(-1, 2, 3));
try expectEqual(
Matrix4x4.init(
-1, 0, 0, 0,
0, 2, 0, 0,
0, 0, 3, 0,
0, 0, 0, 1,
), m);
} | src/matrix4x4.zig |
const std = @import("std");
const c = @import("c.zig").c;
const Error = @import("errors.zig").Error;
const getError = @import("errors.zig").getError;
/// Returns the GLFW time.
///
/// This function returns the current GLFW time, in seconds. Unless the time
/// has been set using @ref glfwSetTime it measures time elapsed since GLFW was
/// initialized.
///
/// This function and @ref glfwSetTime are helper functions on top of glfw.getTimerFrequency
/// and glfw.getTimerValue.
///
/// The resolution of the timer is system dependent, but is usually on the order
/// of a few micro- or nanoseconds. It uses the highest-resolution monotonic
/// time source on each supported platform.
///
/// @return The current time, in seconds, or zero if an
/// error occurred.
///
/// @thread_safety This function may be called from any thread. Reading and
/// writing of the internal base time is not atomic, so it needs to be
/// externally synchronized with calls to @ref glfwSetTime.
///
/// see also: time
pub inline fn getTime() f64 {
const time = c.glfwGetTime();
// The only error this could return would be glfw.Error.NotInitialized, which should
// definitely have occurred before calls to this. Returning an error here makes the API
// awkward to use, so we discard it instead.
getError() catch {};
return time;
}
/// Sets the GLFW time.
///
/// This function sets the current GLFW time, in seconds. The value must be a positive finite
/// number less than or equal to 18446744073.0, which is approximately 584.5 years.
///
/// This function and @ref glfwGetTime are helper functions on top of glfw.getTimerFrequency and
/// glfw.getTimerValue.
///
/// @param[in] time The new value, in seconds.
///
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.InvalidValue.
///
/// The upper limit of GLFW time is calculated as `floor((2^64 - 1) / 10^9)` and is due to
/// implementations storing nanoseconds in 64 bits. The limit may be increased in the future.
///
/// @thread_safety This function may be called from any thread. Reading and writing of the internal
/// base time is not atomic, so it needs to be externally synchronized with calls to glfw.getTime.
///
/// see also: time
pub inline fn setTime(time: f64) Error!void {
c.glfwSetTime(time);
try getError();
}
/// Returns the current value of the raw timer.
///
/// This function returns the current value of the raw timer, measured in `1/frequency` seconds. To
/// get the frequency, call glfw.getTimerFrequency.
///
/// @return The value of the timer, or zero if an error occurred.
///
/// @thread_safety This function may be called from any thread.
///
/// see also: time, glfw.getTimerFrequency
pub inline fn getTimerValue() u64 {
const value = c.glfwGetTimerValue();
// The only error this could return would be glfw.Error.NotInitialized, which should
// definitely have occurred before calls to this. Returning an error here makes the API
// awkward to use, so we discard it instead.
getError() catch {};
return value;
}
/// Returns the frequency, in Hz, of the raw timer.
///
/// This function returns the frequency, in Hz, of the raw timer.
///
/// @return The frequency of the timer, in Hz, or zero if an error occurred.
///
/// @thread_safety This function may be called from any thread.
///
/// see also: time, glfw.getTimerValue
pub inline fn getTimerFrequency() u64 {
const frequency = c.glfwGetTimerFrequency();
// The only error this could return would be glfw.Error.NotInitialized, which should
// definitely have occurred before calls to this. Returning an error here makes the API
// awkward to use, so we discard it instead.
getError() catch {};
return frequency;
}
test "getTime" {
const glfw = @import("main.zig");
try glfw.init();
defer glfw.terminate();
_ = getTime();
}
test "setTime" {
const glfw = @import("main.zig");
try glfw.init();
defer glfw.terminate();
_ = try glfw.setTime(1234);
}
test "getTimerValue" {
const glfw = @import("main.zig");
try glfw.init();
defer glfw.terminate();
_ = glfw.getTimerValue();
}
test "getTimerFrequency" {
const glfw = @import("main.zig");
try glfw.init();
defer glfw.terminate();
_ = glfw.getTimerFrequency();
} | mach-glfw/src/time.zig |
const std = @import("std");
const mem = std.mem;
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const fs = std.fs;
const C = @This();
const Module = @import("../Module.zig");
const Compilation = @import("../Compilation.zig");
const codegen = @import("../codegen/c.zig");
const link = @import("../link.zig");
const trace = @import("../tracy.zig").trace;
const Type = @import("../type.zig").Type;
const Air = @import("../Air.zig");
const Liveness = @import("../Liveness.zig");
pub const base_tag: link.File.Tag = .c;
pub const zig_h = @embedFile("C/zig.h");
base: link.File,
/// This linker backend does not try to incrementally link output C source code.
/// Instead, it tracks all declarations in this table, and iterates over it
/// in the flush function, stitching pre-rendered pieces of C code together.
decl_table: std.AutoArrayHashMapUnmanaged(Module.Decl.Index, DeclBlock) = .{},
/// Stores Type/Value data for `typedefs` to reference.
/// Accumulates allocations and then there is a periodic garbage collection after flush().
arena: std.heap.ArenaAllocator,
/// Per-declaration data.
const DeclBlock = struct {
code: std.ArrayListUnmanaged(u8) = .{},
fwd_decl: std.ArrayListUnmanaged(u8) = .{},
/// Each Decl stores a mapping of Zig Types to corresponding C types, for every
/// Zig Type used by the Decl. In flush(), we iterate over each Decl
/// and emit the typedef code for all types, making sure to not emit the same thing twice.
/// Any arena memory the Type points to lives in the `arena` field of `C`.
typedefs: codegen.TypedefMap.Unmanaged = .{},
fn deinit(db: *DeclBlock, gpa: Allocator) void {
db.code.deinit(gpa);
db.fwd_decl.deinit(gpa);
for (db.typedefs.values()) |typedef| {
gpa.free(typedef.rendered);
}
db.typedefs.deinit(gpa);
db.* = undefined;
}
};
pub fn openPath(gpa: Allocator, sub_path: []const u8, options: link.Options) !*C {
assert(options.object_format == .c);
if (options.use_llvm) return error.LLVMHasNoCBackend;
if (options.use_lld) return error.LLDHasNoCBackend;
const file = try options.emit.?.directory.handle.createFile(sub_path, .{
// Truncation is done on `flush`.
.truncate = false,
.mode = link.determineMode(options),
});
errdefer file.close();
var c_file = try gpa.create(C);
errdefer gpa.destroy(c_file);
c_file.* = C{
.arena = std.heap.ArenaAllocator.init(gpa),
.base = .{
.tag = .c,
.options = options,
.file = file,
.allocator = gpa,
},
};
return c_file;
}
pub fn deinit(self: *C) void {
const gpa = self.base.allocator;
for (self.decl_table.values()) |*db| {
db.deinit(gpa);
}
self.decl_table.deinit(gpa);
self.arena.deinit();
}
pub fn freeDecl(self: *C, decl_index: Module.Decl.Index) void {
const gpa = self.base.allocator;
if (self.decl_table.fetchSwapRemove(decl_index)) |kv| {
var decl_block = kv.value;
decl_block.deinit(gpa);
}
}
pub fn updateFunc(self: *C, module: *Module, func: *Module.Fn, air: Air, liveness: Liveness) !void {
const tracy = trace(@src());
defer tracy.end();
const decl_index = func.owner_decl;
const gop = try self.decl_table.getOrPut(self.base.allocator, decl_index);
if (!gop.found_existing) {
gop.value_ptr.* = .{};
}
const fwd_decl = &gop.value_ptr.fwd_decl;
const typedefs = &gop.value_ptr.typedefs;
const code = &gop.value_ptr.code;
fwd_decl.shrinkRetainingCapacity(0);
{
for (typedefs.values()) |value| {
module.gpa.free(value.rendered);
}
}
typedefs.clearRetainingCapacity();
code.shrinkRetainingCapacity(0);
var function: codegen.Function = .{
.value_map = codegen.CValueMap.init(module.gpa),
.air = air,
.liveness = liveness,
.func = func,
.object = .{
.dg = .{
.gpa = module.gpa,
.module = module,
.error_msg = null,
.decl_index = decl_index,
.decl = module.declPtr(decl_index),
.fwd_decl = fwd_decl.toManaged(module.gpa),
.typedefs = typedefs.promoteContext(module.gpa, .{ .mod = module }),
.typedefs_arena = self.arena.allocator(),
},
.code = code.toManaged(module.gpa),
.indent_writer = undefined, // set later so we can get a pointer to object.code
},
};
function.object.indent_writer = .{ .underlying_writer = function.object.code.writer() };
defer {
function.value_map.deinit();
function.blocks.deinit(module.gpa);
function.object.code.deinit();
function.object.dg.fwd_decl.deinit();
for (function.object.dg.typedefs.values()) |value| {
module.gpa.free(value.rendered);
}
function.object.dg.typedefs.deinit();
}
codegen.genFunc(&function) catch |err| switch (err) {
error.AnalysisFail => {
try module.failed_decls.put(module.gpa, decl_index, function.object.dg.error_msg.?);
return;
},
else => |e| return e,
};
fwd_decl.* = function.object.dg.fwd_decl.moveToUnmanaged();
typedefs.* = function.object.dg.typedefs.unmanaged;
function.object.dg.typedefs.unmanaged = .{};
code.* = function.object.code.moveToUnmanaged();
// Free excess allocated memory for this Decl.
fwd_decl.shrinkAndFree(module.gpa, fwd_decl.items.len);
code.shrinkAndFree(module.gpa, code.items.len);
}
pub fn updateDecl(self: *C, module: *Module, decl_index: Module.Decl.Index) !void {
const tracy = trace(@src());
defer tracy.end();
const gop = try self.decl_table.getOrPut(self.base.allocator, decl_index);
if (!gop.found_existing) {
gop.value_ptr.* = .{};
}
const fwd_decl = &gop.value_ptr.fwd_decl;
const typedefs = &gop.value_ptr.typedefs;
const code = &gop.value_ptr.code;
fwd_decl.shrinkRetainingCapacity(0);
{
for (typedefs.values()) |value| {
module.gpa.free(value.rendered);
}
}
typedefs.clearRetainingCapacity();
code.shrinkRetainingCapacity(0);
const decl = module.declPtr(decl_index);
var object: codegen.Object = .{
.dg = .{
.gpa = module.gpa,
.module = module,
.error_msg = null,
.decl_index = decl_index,
.decl = decl,
.fwd_decl = fwd_decl.toManaged(module.gpa),
.typedefs = typedefs.promoteContext(module.gpa, .{ .mod = module }),
.typedefs_arena = self.arena.allocator(),
},
.code = code.toManaged(module.gpa),
.indent_writer = undefined, // set later so we can get a pointer to object.code
};
object.indent_writer = .{ .underlying_writer = object.code.writer() };
defer {
object.code.deinit();
object.dg.fwd_decl.deinit();
for (object.dg.typedefs.values()) |value| {
module.gpa.free(value.rendered);
}
object.dg.typedefs.deinit();
}
codegen.genDecl(&object) catch |err| switch (err) {
error.AnalysisFail => {
try module.failed_decls.put(module.gpa, decl_index, object.dg.error_msg.?);
return;
},
else => |e| return e,
};
fwd_decl.* = object.dg.fwd_decl.moveToUnmanaged();
typedefs.* = object.dg.typedefs.unmanaged;
object.dg.typedefs.unmanaged = .{};
code.* = object.code.moveToUnmanaged();
// Free excess allocated memory for this Decl.
fwd_decl.shrinkAndFree(module.gpa, fwd_decl.items.len);
code.shrinkAndFree(module.gpa, code.items.len);
}
pub fn updateDeclLineNumber(self: *C, module: *Module, decl: *Module.Decl) !void {
// The C backend does not have the ability to fix line numbers without re-generating
// the entire Decl.
_ = self;
_ = module;
_ = decl;
}
pub fn flush(self: *C, comp: *Compilation, prog_node: *std.Progress.Node) !void {
return self.flushModule(comp, prog_node);
}
pub fn flushModule(self: *C, comp: *Compilation, prog_node: *std.Progress.Node) !void {
const tracy = trace(@src());
defer tracy.end();
var sub_prog_node = prog_node.start("Flush Module", 0);
sub_prog_node.activate();
defer sub_prog_node.end();
const gpa = comp.gpa;
const module = self.base.options.module.?;
// This code path happens exclusively with -ofmt=c. The flush logic for
// emit-h is in `flushEmitH` below.
var f: Flush = .{};
defer f.deinit(gpa);
// Covers zig.h and err_typedef_item.
try f.all_buffers.ensureUnusedCapacity(gpa, 2);
f.all_buffers.appendAssumeCapacity(.{
.iov_base = zig_h,
.iov_len = zig_h.len,
});
f.file_size += zig_h.len;
const err_typedef_writer = f.err_typedef_buf.writer(gpa);
const err_typedef_index = f.all_buffers.items.len;
f.all_buffers.items.len += 1;
render_errors: {
if (module.global_error_set.size == 0) break :render_errors;
var it = module.global_error_set.iterator();
while (it.next()) |entry| {
try err_typedef_writer.print("#define zig_error_{s} {d}\n", .{ entry.key_ptr.*, entry.value_ptr.* });
}
try err_typedef_writer.writeByte('\n');
}
// Typedefs, forward decls, and non-functions first.
// Unlike other backends, the .c code we are emitting is order-dependent. Therefore
// we must traverse the set of Decls that we are emitting according to their dependencies.
// Our strategy is to populate a set of remaining decls, pop Decls one by one,
// recursively chasing their dependencies.
try f.remaining_decls.ensureUnusedCapacity(gpa, self.decl_table.count());
const decl_keys = self.decl_table.keys();
const decl_values = self.decl_table.values();
for (decl_keys) |decl_index| {
assert(module.declPtr(decl_index).has_tv);
f.remaining_decls.putAssumeCapacityNoClobber(decl_index, {});
}
while (f.remaining_decls.popOrNull()) |kv| {
const decl_index = kv.key;
try flushDecl(self, &f, decl_index);
}
f.all_buffers.items[err_typedef_index] = .{
.iov_base = f.err_typedef_buf.items.ptr,
.iov_len = f.err_typedef_buf.items.len,
};
f.file_size += f.err_typedef_buf.items.len;
// Now the function bodies.
try f.all_buffers.ensureUnusedCapacity(gpa, f.fn_count);
for (decl_keys) |decl_index, i| {
const decl = module.declPtr(decl_index);
if (decl.getFunction() != null) {
const decl_block = &decl_values[i];
const buf = decl_block.code.items;
if (buf.len != 0) {
f.all_buffers.appendAssumeCapacity(.{
.iov_base = buf.ptr,
.iov_len = buf.len,
});
f.file_size += buf.len;
}
}
}
const file = self.base.file.?;
try file.setEndPos(f.file_size);
try file.pwritevAll(f.all_buffers.items, 0);
}
const Flush = struct {
remaining_decls: std.AutoArrayHashMapUnmanaged(Module.Decl.Index, void) = .{},
typedefs: Typedefs = .{},
err_typedef_buf: std.ArrayListUnmanaged(u8) = .{},
/// We collect a list of buffers to write, and write them all at once with pwritev 😎
all_buffers: std.ArrayListUnmanaged(std.os.iovec_const) = .{},
/// Keeps track of the total bytes of `all_buffers`.
file_size: u64 = 0,
fn_count: usize = 0,
const Typedefs = std.HashMapUnmanaged(
Type,
void,
Type.HashContext64,
std.hash_map.default_max_load_percentage,
);
fn deinit(f: *Flush, gpa: Allocator) void {
f.all_buffers.deinit(gpa);
f.err_typedef_buf.deinit(gpa);
f.typedefs.deinit(gpa);
f.remaining_decls.deinit(gpa);
}
};
const FlushDeclError = error{
OutOfMemory,
};
/// Assumes `decl` was in the `remaining_decls` set, and has already been removed.
fn flushDecl(self: *C, f: *Flush, decl_index: Module.Decl.Index) FlushDeclError!void {
const module = self.base.options.module.?;
const decl = module.declPtr(decl_index);
// Before flushing any particular Decl we must ensure its
// dependencies are already flushed, so that the order in the .c
// file comes out correctly.
for (decl.dependencies.keys()) |dep| {
if (f.remaining_decls.swapRemove(dep)) {
try flushDecl(self, f, dep);
}
}
const decl_block = self.decl_table.getPtr(decl_index).?;
const gpa = self.base.allocator;
if (decl_block.typedefs.count() != 0) {
try f.typedefs.ensureUnusedCapacityContext(gpa, @intCast(u32, decl_block.typedefs.count()), .{
.mod = module,
});
var it = decl_block.typedefs.iterator();
while (it.next()) |new| {
const gop = f.typedefs.getOrPutAssumeCapacityContext(new.key_ptr.*, .{
.mod = module,
});
if (!gop.found_existing) {
try f.err_typedef_buf.appendSlice(gpa, new.value_ptr.rendered);
}
}
}
if (decl_block.fwd_decl.items.len != 0) {
const buf = decl_block.fwd_decl.items;
try f.all_buffers.append(gpa, .{
.iov_base = buf.ptr,
.iov_len = buf.len,
});
f.file_size += buf.len;
}
if (decl.getFunction() != null) {
f.fn_count += 1;
} else if (decl_block.code.items.len != 0) {
const buf = decl_block.code.items;
try f.all_buffers.append(gpa, .{
.iov_base = buf.ptr,
.iov_len = buf.len,
});
f.file_size += buf.len;
}
}
pub fn flushEmitH(module: *Module) !void {
const tracy = trace(@src());
defer tracy.end();
const emit_h = module.emit_h orelse return;
// We collect a list of buffers to write, and write them all at once with pwritev 😎
const num_buffers = emit_h.decl_table.count() + 1;
var all_buffers = try std.ArrayList(std.os.iovec_const).initCapacity(module.gpa, num_buffers);
defer all_buffers.deinit();
var file_size: u64 = zig_h.len;
all_buffers.appendAssumeCapacity(.{
.iov_base = zig_h,
.iov_len = zig_h.len,
});
for (emit_h.decl_table.keys()) |decl_index| {
const decl_emit_h = emit_h.declPtr(decl_index);
const buf = decl_emit_h.fwd_decl.items;
all_buffers.appendAssumeCapacity(.{
.iov_base = buf.ptr,
.iov_len = buf.len,
});
file_size += buf.len;
}
const directory = emit_h.loc.directory orelse module.comp.local_cache_directory;
const file = try directory.handle.createFile(emit_h.loc.basename, .{
// We set the end position explicitly below; by not truncating the file, we possibly
// make it easier on the file system by doing 1 reallocation instead of two.
.truncate = false,
});
defer file.close();
try file.setEndPos(file_size);
try file.pwritevAll(all_buffers.items, 0);
}
pub fn updateDeclExports(
self: *C,
module: *Module,
decl_index: Module.Decl.Index,
exports: []const *Module.Export,
) !void {
_ = exports;
_ = decl_index;
_ = module;
_ = self;
} | src/link/C.zig |
const __floattisf = @import("floattisf.zig").__floattisf;
const assert = @import("std").debug.assert;
fn test__floattisf(a: i128, expected: f32) void {
const x = __floattisf(a);
assert(x == expected);
}
test "floattisf" {
test__floattisf(0, 0.0);
test__floattisf(1, 1.0);
test__floattisf(2, 2.0);
test__floattisf(-1, -1.0);
test__floattisf(-2, -2.0);
test__floattisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62);
test__floattisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62);
test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000008000000000), -0x1.FFFFFEp+62);
test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000010000000000), -0x1.FFFFFCp+62);
test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000000), -0x1.000000p+63);
test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000001), -0x1.000000p+63);
test__floattisf(0x0007FB72E8000000, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72EA000000, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72EB000000, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72EC000000, 0x1.FEDCBCp+50);
test__floattisf(0x0007FB72E8000001, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72E6000000, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72E7000000, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72E4000001, 0x1.FEDCBAp+50);
test__floattisf(0x0007FB72E4000000, 0x1.FEDCB8p+50);
test__floattisf(make_ti(0x0007FB72E8000000, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72EA000000, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72EB000000, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72EBFFFFFF, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72EC000000, 0), 0x1.FEDCBCp+114);
test__floattisf(make_ti(0x0007FB72E8000001, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72E6000000, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72E7000000, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72E7FFFFFF, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72E4000001, 0), 0x1.FEDCBAp+114);
test__floattisf(make_ti(0x0007FB72E4000000, 0), 0x1.FEDCB8p+114);
}
fn make_ti(high: u64, low: u64) i128 {
var result: u128 = high;
result <<= 64;
result |= low;
return @bitCast(i128, result);
} | std/special/compiler_rt/floattisf_test.zig |
const std = @import("std");
const Peer = @import("Peer.zig");
const TorrentFile = @import("torrent_file.zig").TorrentFile;
const Worker = @import("worker.zig").Worker;
const Work = @import("worker.zig").Work;
const Client = @import("net/Tcp_client.zig");
const Torrent = @This();
/// peers is a list of seeders we can connect to
peers: []const Peer,
/// unique id to identify ourselves to others
peer_id: [20]u8,
/// the corresponding torrent file that contains its meta data.
file: *TorrentFile,
/// Downloads the torrent and writes to the given stream
pub fn download(self: Torrent, gpa: *std.mem.Allocator, path: []const u8) !void {
std.debug.print("Download started for torrent: {s}\n", .{self.file.name});
var work_pieces = try std.ArrayList(Work).initCapacity(gpa, self.file.piece_hashes.len);
defer work_pieces.deinit();
// Creates jobs for all pieces that needs to be downloaded
for (self.file.piece_hashes) |hash, i| {
var index = @intCast(u32, i);
work_pieces.appendAssumeCapacity(Work.init(index, hash, self.pieceSize(index), gpa));
}
var mutex = std.Thread.Mutex{};
// Create our file with an exclusive lock, so only this process can write to it and
// others cannot temper with it while we're in the process of downloading
const file = try std.fs.cwd().createFile(path, .{ .lock = .Exclusive });
defer file.close();
var worker = Worker.init(gpa, &mutex, &self, &work_pieces, file);
std.debug.print("Peer size: {d}\n", .{self.peers.len});
std.debug.print("Pieces to download: {d}\n", .{work_pieces.items.len});
const threads = try gpa.alloc(*std.Thread, try std.Thread.cpuCount());
defer gpa.free(threads);
for (threads) |*t| {
t.* = try std.Thread.spawn(downloadWork, &worker);
}
std.debug.print("Downloaded\t\tSize\t\t% completed\n", .{});
for (threads) |t| {
t.wait();
}
std.debug.print("\nFinished downloading torrent", .{});
}
/// Sets the `begin` and `end` of a piece for a given `index`
fn bounds(self: Torrent, index: u32, begin: *u32, end: *u32) void {
const meta = self.file;
begin.* = index * @intCast(u32, meta.piece_length);
end.* = blk: {
var length: usize = begin.* + meta.piece_length;
if (length > meta.size) {
length = meta.size;
}
break :blk @intCast(u32, length);
};
}
/// Calculates and returns the piece size for the given `index`
fn pieceSize(self: Torrent, index: u32) u32 {
var begin: u32 = undefined;
var end: u32 = undefined;
self.bounds(index, &begin, &end);
return end - begin;
}
/// Downloads all pieces of work distributed to multiple peers/threads
fn downloadWork(worker: *Worker) !void {
if (worker.getClient()) |*client| {
client.connect() catch return;
defer client.close(worker.gpa);
// try client.send(.unchoke);
try client.send(.interested);
// our work loop, try to download all pieces of work
while (worker.next()) |*work| {
// work is copied by value, so deinit the current object when leaving this function
defer work.deinit();
// if the peer does not have the piece, skip and put the piece back in the queue
if (client.bitfield) |bitfield| {
if (!bitfield.hasPiece(work.index)) {
try worker.put(work.*);
continue;
}
}
// download the piece of work
work.download(client) catch |err| {
try worker.put(work.*);
switch (err) {
error.ConnectionResetByPeer, error.EndOfStream => return, // peer slams the door and disconnects
error.OutOfMemory => return, // we ran out of memory, close this connection to free up some of it
// in other cases, skip this work piece and try again
else => continue,
}
};
// sumcheck of its content, we don't want corrupt/incorrect data
if (!work.eqlHash()) {
try worker.put(work.*);
continue;
}
// notify the peer we have the piece
try client.sendHave(work.index);
try worker.write(work);
}
}
} | src/Torrent.zig |
const std = @import("std");
const ig = @import("imgui");
const engine = @import("engine.zig");
const autogui = @import("autogui.zig");
const math = std.math;
const Allocator = std.mem.Allocator;
const warn = std.debug.warn;
const assert = std.debug.assert;
const heap_allocator = std.heap.c_allocator;
var sim_speed: f32 = 0.1;
var sim_time: f64 = 0;
var frames_per_second: f32 = 90;
var frames_shown: f32 = 30;
var current_frame: f64 = 0;
const MAX_FRAMES = 128;
var rnd = std.rand.DefaultPrng.init(20);
const WindowRenderArgs = struct {
frames_shown: f32,
frame_offset: f32,
max_seq: i64,
};
fn Window(comptime State: type, comptime arraySize: comptime_int, comptime emptyState: State) type {
return struct {
data: [arraySize]State = [_]State{emptyState} ** arraySize,
max_seq: i64 = 0,
pub fn isValid(self: @This(), seq: i64) bool {
return seq <= self.max_seq and seq + arraySize > self.max_seq;
}
pub fn slideTo(self: *@This(), seq: i64, fillState: State) void {
assert(seq + arraySize > self.max_seq);
while (self.max_seq < seq) {
self.max_seq += 1;
self.at(self.max_seq).* = fillState;
}
}
pub fn push(self: *@This(), frame: i64, state: State) void {
self.slideTo(frame, emptyState);
self.at(frame).* = state;
}
pub fn at(self: *@This(), seq: i64) *State {
assert(self.isValid(seq));
return &self.data[@intCast(usize, @mod(seq, arraySize))];
}
pub fn drawUI(self: *@This(), label: ?[*:0]const u8, args: WindowRenderArgs) void {
const style = ig.GetStyle() orelse return;
const drawList = ig.GetWindowDrawList() orelse return;
_ = ig.InvisibleButton("window", .{
.x = ig.CalcItemWidth(),
.y = ig.GetTextLineHeight() + style.FramePadding.y * 2,
});
const min = ig.GetItemRectMin();
const max = ig.GetItemRectMax();
{
drawList.PushClipRectExt(min, max, true);
defer drawList.PopClipRect();
const width = max.x - min.x;
const framesShown = args.frames_shown;
const offset = 1 - args.frame_offset;
const framesToDraw = @floatToInt(i64, math.ceil(framesShown));
const startFrame = args.max_seq - framesToDraw;
const endFrame = args.max_seq;
var currFrame = startFrame;
while (currFrame <= endFrame) : (currFrame += 1) {
var state: State = if (self.isValid(currFrame)) self.at(currFrame).* else .Invalid;
if (state != .Invalid) {
const left = (@intToFloat(f32, endFrame - (currFrame - 1)) - offset) * width / framesShown;
const right = (@intToFloat(f32, endFrame - currFrame) - offset) * width / framesShown;
drawList.AddRectFilled(
.{ .x = max.x - left, .y = min.y },
.{ .x = max.x - right, .y = max.y },
State.colors[@enumToInt(state)],
);
}
}
}
if (label != null) {
drawList.AddTextVec2(.{.x = max.x + style.ItemInnerSpacing.x, .y = min.y + style.FramePadding.y }, ig.GetColorU32(.Text), label);
}
}
};
}
const ServerFrameState = enum {
Invalid,
Unknown,
Known,
Simulated,
Missed,
Retired,
pub const count = @as(comptime_int, @enumToInt(@This().Retired)) + 1;
pub const colors = [count]u32 {
ig.COL32(0, 0, 0, 0),
ig.COL32(0, 0, 255, 255),
ig.COL32(0, 255, 255, 255),
ig.COL32(0, 255, 0, 255),
ig.COL32(255, 0, 0, 255),
ig.COL32(20, 20, 20, 255),
};
};
const NetworkFrameState = enum {
Invalid,
Dropped,
Transmitted,
Received,
pub const count = @as(comptime_int, @enumToInt(@This().Received)) + 1;
pub const colors = [count]u32 {
ig.COL32(0, 0, 0, 0),
ig.COL32(255, 0, 0, 255),
ig.COL32(255, 255, 0, 255),
ig.COL32(0, 255, 0, 255),
};
};
const ClientFrameState = enum {
Invalid,
Transmitted,
Acked,
Missed,
Retired,
pub const count = @as(comptime_int, @enumToInt(@This().Retired)) + 1;
pub const colors = [count]u32 {
ig.COL32(0, 0, 0, 0),
ig.COL32(0, 0, 255, 255),
ig.COL32(0, 255, 255, 255),
ig.COL32(255, 0, 0, 255),
ig.COL32(0, 255, 0, 255),
};
};
const InputPacket = struct {
end_frame: i64,
start_frame: i64,
arrival_time: f64,
};
const OutputPacket = struct {
sim_frame: i64,
ack_frame: i64,
delta_latency: i8,
arrival_time: f64,
};
const NO_DATA: i8 = -128;
const Client = struct {
server_window: Window(ServerFrameState, MAX_FRAMES, .Invalid) = .{},
client_window: Window(ClientFrameState, MAX_FRAMES, .Invalid) = .{},
input_window: Window(NetworkFrameState, MAX_FRAMES, .Invalid) = .{},
output_window: Window(NetworkFrameState, MAX_FRAMES, .Invalid) = .{},
/// History of latency of last 64 frames. Positive numbers indicate
/// late packets, negative numbers indicate early packets. The maximum
/// value in this array indicates how many frames the client should
/// shift in order to have ideal latency.
server_latency_history: Window(i8, 64, NO_DATA) = .{},
/// average round trip time
rtt_average: f32 = 150,
/// percent of average
rtt_variance_percent: f32 = 40,
/// -1 is all rtt is client -> server, 1 is all rtt server -> client
rtt_skew: f32 = 0,
/// percent of packets lost
input_packet_loss_percent: f32 = 10,
output_packet_loss_percent: f32 = 10,
/// client -> server packets
inputs: std.ArrayList(InputPacket) = std.ArrayList(InputPacket).init(heap_allocator),
/// server -> client packets
outputs: std.ArrayList(OutputPacket) = std.ArrayList(OutputPacket).init(heap_allocator),
server_max_acked: i64 = 0,
client_max_simmed: i64 = 0,
client_max_acked: i64 = 0,
client_delta_latency: i8 = 0,
last_client_frame_seq: i64 = 0,
last_client_frame_time: f64 = 0,
client_time_scale: f64 = 1,
pub fn sendInput(self: *Client, frame: i64, sendTime: f64) void {
if (rnd.random.float(f32) * 100 < self.input_packet_loss_percent) {
self.input_window.push(frame, .Dropped);
return; // packet dropped
}
self.input_window.push(frame, .Transmitted);
const rttVariance = self.rtt_variance_percent * self.rtt_average / 200;
const minRtt = math.max(0, self.rtt_average - rttVariance);
const rtt = minRtt + rnd.random.float(f32) * rttVariance * 2;
const inputRttPart = 1 - (self.rtt_skew * 0.5 + 0.5);
const transmitTime = rtt * inputRttPart * 0.001;
const numFrames = math.clamp(frame - self.client_max_acked, 1, 45);
self.inputs.append(.{
.start_frame = frame - numFrames + 1,
.end_frame = frame,
.arrival_time = sendTime + transmitTime,
}) catch unreachable;
}
pub fn sendOutput(self: *Client, simFrame: i64, ackFrame: i64, sendTime: f64) void {
if (rnd.random.float(f32) * 100 < self.output_packet_loss_percent) {
self.output_window.push(simFrame, .Dropped);
return; // packet dropped
}
self.output_window.push(simFrame, .Transmitted);
const rttVariance = self.rtt_variance_percent * self.rtt_average / 200;
const minRtt = math.max(0, self.rtt_average - rttVariance);
const rtt = minRtt + rnd.random.float(f32) * rttVariance * 2;
const outputRttPart = (self.rtt_skew * 0.5 + 0.5);
const transmitTime = rtt * outputRttPart * 0.001;
self.outputs.append(.{
.sim_frame = simFrame,
.ack_frame = ackFrame,
.delta_latency = self.calcTargetLatencyDelta(),
.arrival_time = sendTime + transmitTime,
}) catch unreachable;
}
fn processInputs(self: *Client, simTime: f64, simFrame: i64) void {
var c = self.inputs.items.len;
while (c > 0) {
c -= 1;
if (self.inputs.items[c].arrival_time <= simTime) {
self.processInput(self.inputs.items[c], simFrame);
_ = self.inputs.swapRemove(c);
}
}
}
fn processOutputs(self: *Client, simTime: f64) void {
var anyProcessed = false;
var c = self.outputs.items.len;
while (c > 0) {
c -= 1;
if (self.outputs.items[c].arrival_time <= simTime) {
anyProcessed = true;
self.processOutput(self.outputs.items[c]);
_ = self.outputs.swapRemove(c);
}
}
if (anyProcessed) self.updateClientWindow();
}
fn processInput(self: *Client, input: InputPacket, serverFrame: i64) void {
self.input_window.push(input.end_frame, .Received);
self.server_window.slideTo(input.end_frame, .Invalid);
self.server_latency_history.slideTo(input.end_frame, NO_DATA);
var frame = input.start_frame;
while (frame <= input.end_frame) : (frame += 1) {
if (self.server_window.isValid(frame)) {
const currState = self.server_window.at(frame).*;
const newState = switch (currState) {
.Invalid, .Unknown, .Known => ServerFrameState.Known,
else => |state| state,
};
self.server_window.at(frame).* = newState;
}
if (self.server_latency_history.isValid(frame)) {
const value = self.server_latency_history.at(frame).*;
const latency = (serverFrame + 1) - frame;
if (latency < value or value == NO_DATA) {
self.server_latency_history.push(frame, @intCast(i8, latency));
}
}
}
}
fn processOutput(self: *Client, output: OutputPacket) void {
self.output_window.push(output.sim_frame, .Received);
// Note max sim frame may be larger than max_seq if the client is behind the server somehow
if (output.sim_frame > self.client_max_simmed) {
self.client_max_simmed = output.sim_frame;
self.client_max_acked = output.ack_frame;
self.client_delta_latency = output.delta_latency;
}
}
fn updateClientWindow(self: *Client) void {
var frame = self.client_window.max_seq + 1 - MAX_FRAMES;
while (frame < self.client_window.max_seq) : (frame += 1) {
const current = self.client_window.at(frame).*;
if (current != .Invalid and current != .Missed) {
if (frame <= self.client_max_simmed) {
self.client_window.at(frame).* = .Retired;
} else if (frame <= self.client_max_acked) {
self.client_window.at(frame).* = .Acked;
}
}
}
}
fn calcTargetLatencyDelta(self: *Client) i8 {
var maxDelta: i8 = -127;
for (self.server_latency_history.data) |delta| {
if (delta > maxDelta) maxDelta = delta;
}
return maxDelta;
}
pub fn doClientFrame(self: *Client, simTime: f64) void {
const frame = self.last_client_frame_seq + 1;
self.processOutputs(simTime);
self.client_window.push(frame, .Transmitted);
self.sendInput(frame, simTime);
self.client_time_scale = math.clamp(1 + 0.01 * @intToFloat(f64, self.client_delta_latency), 0.9, 1.4);
self.last_client_frame_time = simTime;
self.last_client_frame_seq = frame;
}
pub fn doServerFrame(self: *Client, simTime: f64, simFrame: i64) void {
// process network inputs
self.processInputs(simTime, simFrame);
// sim one frame
var missedInput = true;
if (self.server_window.isValid(simFrame)) {
const state = self.server_window.at(simFrame).*;
const newState = switch(state) {
.Unknown, .Invalid => ServerFrameState.Missed,
.Known => ServerFrameState.Simulated,
else => unreachable,
};
missedInput = (newState == .Missed);
self.server_window.at(simFrame).* = newState;
} else if (self.server_window.max_seq < simFrame) {
self.server_window.slideTo(simFrame, .Missed);
}
// send frame results and acks
if (!missedInput and self.server_max_acked < simFrame) {
self.server_max_acked = simFrame;
}
while (self.server_window.isValid(self.server_max_acked + 1) and
self.server_window.at(self.server_max_acked + 1).* == .Known) {
self.server_max_acked += 1;
}
self.sendOutput(simFrame, self.server_max_acked, simTime);
}
pub fn nextClientFrameTime(self: *Client) f64 {
const frameTime = 1 / (self.client_time_scale * @floatCast(f64, frames_per_second));
return self.last_client_frame_time + frameTime;
}
pub fn calcWindowFractionalSeq(self: *Client, simTime: f64) f64 {
const extraTime = simTime - self.last_client_frame_time;
const extraFrames = extraTime * frames_per_second * self.client_time_scale;
return @intToFloat(f64, self.last_client_frame_seq) + extraFrames;
}
};
const System = struct {
clients: []Client = &[_]Client{},
last_server_frame_time: f64 = 0,
last_sim_frame: i64 = 0,
sim_time: f64 = 0,
pub fn doServerFrame(self: *System, simTime: f64) void {
const next_frame = self.last_sim_frame + 1;
for (self.clients) |*client| {
client.doServerFrame(simTime, next_frame);
}
self.last_sim_frame = next_frame;
self.last_server_frame_time = simTime;
}
pub fn nextServerFrameTime(self: *System) f64 {
const frameTime = 1 / @floatCast(f64, frames_per_second);
return self.last_server_frame_time + frameTime;
}
pub fn update(self: *System, delta: f64) void {
assert(delta >= 0);
const newSimTime = self.sim_time + delta;
// process updates until we hit the new time
while (true) {
// figure out what system updates next
var nextUpdateTime = self.nextServerFrameTime();
var nextUpdateClient: ?*Client = null;
for (self.clients) |*client| {
const clientUpdateTime = client.nextClientFrameTime();
if (clientUpdateTime < nextUpdateTime) {
nextUpdateTime = clientUpdateTime;
nextUpdateClient = client;
}
}
// if that update is after the new target time, we're done!
if (nextUpdateTime > newSimTime)
break;
// otherwise perform that update and loop
if (nextUpdateClient) |client| {
client.doClientFrame(nextUpdateTime);
} else {
self.doServerFrame(nextUpdateTime);
}
}
// finally, save the new sim time for rendering purposes
self.sim_time = newSimTime;
}
pub fn calcFractionalMaxFrame(self: *System) f64 {
const serverFraction = (self.sim_time - self.last_server_frame_time) / frames_per_second;
var maxFrame = @intToFloat(f32, self.last_sim_frame) + serverFraction;
for (self.clients) |*client| {
const clientFrame = client.calcWindowFractionalSeq(self.sim_time);
if (clientFrame > maxFrame) {
maxFrame = clientFrame;
}
}
return maxFrame;
}
};
var system_initialized = false;
var system = System{};
pub fn drawUI(show: *bool) void {
if (!system_initialized) {
const numClients = 3;
system.clients = heap_allocator.alloc(Client, numClients) catch unreachable;
for (system.clients) |*client| {
client.* = .{};
}
system_initialized = true;
}
const showWindow = ig.BeginExt("Network Test", show, .{});
defer ig.End();
if (!showWindow) return;
ig.LabelText("Time since startup", "%f", engine.time.frameStartSeconds);
ig.LabelText("Frame delta", "%f", @floatCast(f64, engine.time.frameDeltaSeconds));
ig.LabelText("Micros since startup", "%llu", engine.time.frameStartMicros);
ig.LabelText("Frame delta micros", "%u", engine.time.frameDeltaMicros);
ig.LabelText("Epoch millis", "%u", engine.time.frameStartEpochMillis);
ig.LabelText("FPS", "%.1f", @floatCast(f64, 1.0 / engine.time.frameDeltaSeconds));
ig.Separator();
_ = ig.SliderFloat("Sim Speed", &sim_speed, 0, 1);
_ = ig.SliderFloat("Frames Shown", &frames_shown, 1, MAX_FRAMES);
const simDelta = engine.time.frameDeltaSeconds * sim_speed;
system.update(simDelta);
const fractionalMaxFrame = system.calcFractionalMaxFrame();
const frameOffset = @floatCast(f32, @mod(fractionalMaxFrame, 1));
const maxFrame = @floatToInt(i64, fractionalMaxFrame);
ig.LabelText("Sim Time", "%f", system.sim_time);
ig.LabelText("Frame Offset", "%f", @floatCast(f64, frameOffset));
ig.Separator();
const windowArgs: WindowRenderArgs = .{
.frames_shown = frames_shown,
.frame_offset = frameOffset,
.max_seq = maxFrame,
};
var clientBuf: [64]u8 = undefined;
if (ig.CollapsingHeaderExt("Server", .{ .DefaultOpen = true })) {
for (system.clients) |*client, i| {
ig.PushIDInt(@intCast(i32, i));
defer ig.PopID();
const str = std.fmt.bufPrintZ(&clientBuf, "Client {}", .{i}) catch "<error>";
client.server_window.drawUI(str.ptr, windowArgs);
}
}
ig.Separator();
for (system.clients) |*client, i| {
ig.PushIDInt(@intCast(i32, i));
defer ig.PopID();
const str = std.fmt.bufPrintZ(&clientBuf, "Client {}", .{i}) catch "<error>";
if (ig.CollapsingHeaderExt(str.ptr, .{ .DefaultOpen = true })) {
client.server_window.drawUI("Server", windowArgs);
client.input_window.drawUI("Input Packets", windowArgs);
client.output_window.drawUI("Result Packets", windowArgs);
client.client_window.drawUI("Client", windowArgs);
ig.LabelText("Time Scale", "%f", client.client_time_scale);
_ = ig.SliderFloat("Round Trip Time Average", &client.rtt_average, 0, 1000);
_ = ig.SliderFloatExt("Round Trip Time Variance", &client.rtt_variance_percent, 0, 100, "%.1f%%", 1);
_ = ig.SliderFloat("Round Trip Time Skew", &client.rtt_skew, -1, 1);
_ = ig.SliderFloatExt("Input Packet Loss", &client.input_packet_loss_percent, 0, 100, "%.1f%%", 1);
_ = ig.SliderFloatExt("Output Packet Loss", &client.output_packet_loss_percent, 0, 100, "%.1f%%", 1);
}
ig.Separator();
}
ig.LabelText("After", "After");
} | src/nettest.zig |
const __fixsfsi = @import("fixsfsi.zig").__fixsfsi;
const std = @import("std");
const math = std.math;
const testing = std.testing;
const warn = std.debug.warn;
fn test__fixsfsi(a: f32, expected: i32) void {
const x = __fixsfsi(a);
//warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u32, {x})\n", .{a, @bitCast(u32, a), x, x, expected, expected, @bitCast(u32, expected)});
testing.expect(x == expected);
}
test "fixsfsi" {
//warn("\n", .{});
test__fixsfsi(-math.f32_max, math.minInt(i32));
test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32));
test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000);
test__fixsfsi(-0x1.0000000000000p+127, -0x80000000);
test__fixsfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000);
test__fixsfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000);
test__fixsfsi(-0x1.0000000000001p+63, -0x80000000);
test__fixsfsi(-0x1.0000000000000p+63, -0x80000000);
test__fixsfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000);
test__fixsfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000);
test__fixsfsi(-0x1.FFFFFEp+62, -0x80000000);
test__fixsfsi(-0x1.FFFFFCp+62, -0x80000000);
test__fixsfsi(-0x1.000000p+31, -0x80000000);
test__fixsfsi(-0x1.FFFFFFp+30, -0x80000000);
test__fixsfsi(-0x1.FFFFFEp+30, -0x7FFFFF80);
test__fixsfsi(-0x1.FFFFFCp+30, -0x7FFFFF00);
test__fixsfsi(-2.01, -2);
test__fixsfsi(-2.0, -2);
test__fixsfsi(-1.99, -1);
test__fixsfsi(-1.0, -1);
test__fixsfsi(-0.99, 0);
test__fixsfsi(-0.5, 0);
test__fixsfsi(-math.f32_min, 0);
test__fixsfsi(0.0, 0);
test__fixsfsi(math.f32_min, 0);
test__fixsfsi(0.5, 0);
test__fixsfsi(0.99, 0);
test__fixsfsi(1.0, 1);
test__fixsfsi(1.5, 1);
test__fixsfsi(1.99, 1);
test__fixsfsi(2.0, 2);
test__fixsfsi(2.01, 2);
test__fixsfsi(0x1.FFFFFCp+30, 0x7FFFFF00);
test__fixsfsi(0x1.FFFFFEp+30, 0x7FFFFF80);
test__fixsfsi(0x1.FFFFFFp+30, 0x7FFFFFFF);
test__fixsfsi(0x1.000000p+31, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFCp+62, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFEp+62, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF);
test__fixsfsi(0x1.0000000000000p+63, 0x7FFFFFFF);
test__fixsfsi(0x1.0000000000001p+63, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF);
test__fixsfsi(0x1.0000000000000p+127, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF);
test__fixsfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32));
test__fixsfsi(math.f32_max, math.maxInt(i32));
} | lib/std/special/compiler_rt/fixsfsi_test.zig |
const xcb = @import("../xcb.zig");
pub const id = xcb.Extension{ .name = "RECORD", .global_id = 0 };
pub const CONTEXT = u32;
/// @brief Range8
pub const Range8 = struct {
@"first": u8,
@"last": u8,
};
/// @brief Range16
pub const Range16 = struct {
@"first": u16,
@"last": u16,
};
/// @brief ExtRange
pub const ExtRange = struct {
@"major": xcb.record.Range8,
@"minor": xcb.record.Range16,
};
/// @brief Range
pub const Range = struct {
@"core_requests": xcb.record.Range8,
@"core_replies": xcb.record.Range8,
@"ext_requests": xcb.record.ExtRange,
@"ext_replies": xcb.record.ExtRange,
@"delivered_events": xcb.record.Range8,
@"device_events": xcb.record.Range8,
@"errors": xcb.record.Range8,
@"client_started": u8,
@"client_died": u8,
};
pub const ElementHeader = u8;
pub const HType = extern enum(c_uint) {
@"FromServerTime" = 1,
@"FromClientTime" = 2,
@"FromClientSequence" = 4,
};
pub const ClientSpec = u32;
pub const CS = extern enum(c_uint) {
@"CurrentClients" = 1,
@"FutureClients" = 2,
@"AllClients" = 3,
};
/// @brief ClientInfo
pub const ClientInfo = struct {
@"client_resource": xcb.record.ClientSpec,
@"num_ranges": u32,
@"ranges": []xcb.record.Range,
};
/// Opcode for BadContext.
pub const BadContextOpcode = 0;
/// @brief BadContextError
pub const BadContextError = struct {
@"response_type": u8,
@"error_code": u8,
@"sequence": u16,
@"invalid_record": u32,
};
/// @brief QueryVersioncookie
pub const QueryVersioncookie = struct {
sequence: c_uint,
};
/// @brief QueryVersionRequest
pub const QueryVersionRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 0,
@"length": u16,
@"major_version": u16,
@"minor_version": u16,
};
/// @brief QueryVersionReply
pub const QueryVersionReply = struct {
@"response_type": u8,
@"pad0": u8,
@"sequence": u16,
@"length": u32,
@"major_version": u16,
@"minor_version": u16,
};
/// @brief CreateContextRequest
pub const CreateContextRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 1,
@"length": u16,
@"context": xcb.record.CONTEXT,
@"element_header": xcb.record.ElementHeader,
@"pad0": [3]u8,
@"num_client_specs": u32,
@"num_ranges": u32,
@"client_specs": []const xcb.record.ClientSpec,
@"ranges": []const xcb.record.Range,
};
/// @brief RegisterClientsRequest
pub const RegisterClientsRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 2,
@"length": u16,
@"context": xcb.record.CONTEXT,
@"element_header": xcb.record.ElementHeader,
@"pad0": [3]u8,
@"num_client_specs": u32,
@"num_ranges": u32,
@"client_specs": []const xcb.record.ClientSpec,
@"ranges": []const xcb.record.Range,
};
/// @brief UnregisterClientsRequest
pub const UnregisterClientsRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 3,
@"length": u16,
@"context": xcb.record.CONTEXT,
@"num_client_specs": u32,
@"client_specs": []const xcb.record.ClientSpec,
};
/// @brief GetContextcookie
pub const GetContextcookie = struct {
sequence: c_uint,
};
/// @brief GetContextRequest
pub const GetContextRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 4,
@"length": u16,
@"context": xcb.record.CONTEXT,
};
/// @brief GetContextReply
pub const GetContextReply = struct {
@"response_type": u8,
@"enabled": u8,
@"sequence": u16,
@"length": u32,
@"element_header": xcb.record.ElementHeader,
@"pad0": [3]u8,
@"num_intercepted_clients": u32,
@"pad1": [16]u8,
@"intercepted_clients": []xcb.record.ClientInfo,
};
/// @brief EnableContextcookie
pub const EnableContextcookie = struct {
sequence: c_uint,
};
/// @brief EnableContextRequest
pub const EnableContextRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 5,
@"length": u16,
@"context": xcb.record.CONTEXT,
};
/// @brief EnableContextReply
pub const EnableContextReply = struct {
@"response_type": u8,
@"category": u8,
@"sequence": u16,
@"length": u32,
@"element_header": xcb.record.ElementHeader,
@"client_swapped": u8,
@"pad0": [2]u8,
@"xid_base": u32,
@"server_time": u32,
@"rec_sequence_num": u32,
@"pad1": [8]u8,
@"data": []u8,
};
/// @brief DisableContextRequest
pub const DisableContextRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 6,
@"length": u16,
@"context": xcb.record.CONTEXT,
};
/// @brief FreeContextRequest
pub const FreeContextRequest = struct {
@"major_opcode": u8,
@"minor_opcode": u8 = 7,
@"length": u16,
@"context": xcb.record.CONTEXT,
};
test "" {
@import("std").testing.refAllDecls(@This());
} | src/auto/record.zig |
pub const tables = @import("tables.zig");
const warn = @import("std").debug.warn;
pub fn is16(ranges: []const tables.Range16, r: u16) bool {
if (ranges.len <= tables.linear_max or r <= tables.linear_max) {
for (ranges) |*range| {
if (r < range.lo) {
return false;
}
if (r <= range.hi) {
return range.stride == 1 or (r - range.lo) % range.stride == 0;
}
}
return false;
}
var lo: usize = 0;
var hi: usize = ranges.len;
while (lo < hi) {
const m: usize = lo + ((hi - lo) / 2);
const range = &ranges[m];
if (range.lo <= r and r <= range.hi) {
return range.stride == 1 or (r - range.lo) % range.stride == 0;
}
if (r < range.lo) {
hi = m;
} else {
lo = m + 1;
}
}
return false;
}
pub fn is32(ranges: []tables.Range32, r: u32) bool {
if (ranges.len <= tables.linear_max) {
for (ranges) |*range| {
if (r < range.lo) {
return false;
}
if (r <= range.hi) {
return range.stride == 1 or (r - range.lo) % range.stride == 0;
}
}
return false;
}
var lo: usize = 0;
var hi: usize = ranges.len;
while (lo < hi) {
const m: usize = lo + (hi - lo) / 2;
const range = &ranges[m];
if (range.lo <= r and r <= range.hi) {
return range.stride == 1 or (r - range.lo) % range.stride == 0;
}
if (r < range.lo) {
hi = m;
} else {
lo = m + 1;
}
}
return false;
}
pub fn is(range_tab: *const tables.RangeTable, r: i32) bool {
if (range_tab.r16.len > 0 and r <= @intCast(i32, range_tab.r16[range_tab.r16.len - 1].hi)) {
return is16(range_tab.r16, @intCast(u16, r));
}
if (range_tab.r32.len > 0 and r > @intCast(i32, range_tab.r32[0].lo)) {
return is32(range_tab.r32, @intCast(u32, r));
}
return false;
}
pub fn isExcludingLatin(range_tab: *const tables.RangeTable, r: i32) bool {
const off = range_tab.latin_offset;
const r16_len = range_tab.r16.len;
if (r16_len > off and r <= @intCast(i32, range_tab.r16[r16_len - 1].hi)) {
return is16(range_tab.r16[off..], @intCast(u16, r));
}
if (range_tab.r32.len > 0 and r >= @intCast(i32, range_tab.r32[0].lo)) {
return is32(range_tab.r32, @intCast(u32, r));
}
return false;
}
/// isUpper reports whether the rune is an upper case
pub fn isUpper(rune: i32) bool {
if (rune <= tables.max_latin1) {
const p = tables.properties[@intCast(usize, rune)];
return (p & tables.pLmask) == tables.pLu;
}
return isExcludingLatin(tables.Upper, rune);
}
// isLower reports whether the rune is a lower case
pub fn isLower(rune: i32) bool {
if (rune <= tables.max_latin1) {
const p = tables.properties[@intCast(usize, rune)];
return (p & tables.pLmask) == tables.pLl;
}
return isExcludingLatin(tables.Lower, rune);
}
// IsTitle reports whether the rune is a title case
pub fn isTitle(rune: i32) bool {
if (rune <= tables.max_latin1) {
return false;
}
return isExcludingLatin(tables.Title, rune);
}
const toResult = struct {
mapped: i32,
found_mapping: bool,
};
fn to_case(_case: tables.Case, rune: i32, case_range: []tables.CaseRange) toResult {
if (_case.rune() < 0 or tables.Case.Max.rune() <= _case.rune()) {
return toResult{
.mapped = tables.replacement_char,
.found_mapping = false,
};
}
var lo: usize = 0;
var hi = case_range.len;
while (lo < hi) {
const m = lo + (hi - lo) / 2;
const cr = case_range[m];
if (@intCast(i32, cr.lo) <= rune and rune <= @intCast(i32, cr.hi)) {
const delta = cr.delta[@intCast(usize, _case.rune())];
if (delta > @intCast(i32, tables.max_rune)) {
// In an Upper-Lower sequence, which always starts with
// an UpperCase letter, the real deltas always look like:
//{0, 1, 0} UpperCase (Lower is next)
//{-1, 0, -1} LowerCase (Upper, Title are previous)
// The characters at even offsets from the beginning of the
// sequence are upper case; the ones at odd offsets are lower.
// The correct mapping can be done by clearing or setting the low
// bit in the sequence offset.
// The constants UpperCase and TitleCase are even while LowerCase
// is odd so we take the low bit from _case.
var i: i32 = 1;
return toResult{
.mapped = @intCast(i32, cr.lo) + ((rune - @intCast(i32, cr.lo)) & ~i | (_case.rune() & 1)),
.found_mapping = true,
};
}
return toResult{
.mapped = @intCast(i32, @intCast(i32, rune) + delta),
.found_mapping = true,
};
}
if (rune < @intCast(i32, cr.lo)) {
hi = m;
} else {
lo = m + 1;
}
}
return toResult{
.mapped = rune,
.found_mapping = false,
};
}
// to maps the rune to the specified case: UpperCase, LowerCase, or TitleCase.
pub fn to(case: tables.Case, rune: i32) i32 {
const v = to_case(case, rune, tables.CaseRanges);
return v.mapped;
}
pub fn toUpper(rune: i32) i32 {
if (rune <= tables.max_ascii) {
if ('a' <= rune and rune <= 'z') {
return rune - ('a' - 'A');
}
return rune;
}
return to(tables.Case.Upper, rune);
}
pub fn toLower(rune: i32) i32 {
if (rune <= tables.max_ascii) {
if ('A' <= rune and rune <= 'Z') {
return rune + ('a' - 'A');
}
return rune;
}
return to(tables.Case.Lower, rune);
}
pub fn toTitle(rune: i32) i32 {
if (rune <= tables.max_ascii) {
if ('a' <= rune and rune <= 'z') {
return rune - ('a' - 'A');
}
return rune;
}
return to(tables.Case.Title, rune);
}
// SimpleFold iterates over Unicode code points equivalent under
// the Unicode-defined simple case folding. Among the code points
// equivalent to rune (including rune itself), SimpleFold returns the
// smallest rune > r if one exists, or else the smallest rune >= 0.
// If r is not a valid Unicode code point, SimpleFold(r) returns r.
//
// For example:
// SimpleFold('A') = 'a'
// SimpleFold('a') = 'A'
//
// SimpleFold('K') = 'k'
// SimpleFold('k') = '\u212A' (Kelvin symbol, K)
// SimpleFold('\u212A') = 'K'
//
// SimpleFold('1') = '1'
//
// SimpleFold(-2) = -2
//
pub fn simpleFold(r: u32) u32 {
if (r < 0 or r > tables.max_rune) {
return r;
}
const idx = @intCast(usize, r);
if (idx < tables.asciiFold.len) {
return @intCast(u32, tables.asciiFold[idx]);
}
var lo: usize = 0;
var hi = caseOrbit.len;
while (lo < hi) {
const m = lo + (hi - lo) / 2;
if (@intCast(u32, tables.caseOrbit[m].from) < r) {
lo = m + 1;
} else {
hi = m;
}
}
if (lo < tables.caseOrbit.len and @intCast(tables.caseOrbit[lo].from) == r) {
return @intCast(u32, tables.caseOrbit[lo].to);
}
// No folding specified. This is a one- or two-element
// equivalence class containing rune and ToLower(rune)
// and ToUpper(rune) if they are different from rune
const l = toLower(r);
if (l != r) {
return l;
}
return toUpper(r);
}
pub const graphic_ranges = [_]*const tables.RangeTable{
tables.L, tables.M, tables.N, tables.P, tables.S, tables.Zs,
};
pub const print_ranges = [_]*const tables.RangeTable{
tables.L, tables.M, tables.N, tables.P, tables.S,
};
pub fn in(r: i32, ranges: []const *const tables.RangeTable) bool {
for (ranges) |inside| {
if (is(inside, r)) {
return true;
}
}
return false;
}
// IsGraphic reports whether the rune is defined as a Graphic by Unicode.
// Such characters include letters, marks, numbers, punctuation, symbols, and
// spaces, from categories L, M, N, P, S, Zs.
pub fn isGraphic(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pg != 0;
}
return in(r, graphic_ranges[0..]);
}
// IsPrint reports whether the rune is defined as printable by Go. Such
// characters include letters, marks, numbers, punctuation, symbols, and the
// ASCII space character, from categories L, M, N, P, S and the ASCII space
// character. This categorization is the same as IsGraphic except that the
// only spacing character is ASCII space, U+0020
pub fn isPrint(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pp != 0;
}
return in(r, print_ranges[0..]);
}
pub fn isOneOf(ranges: []*tables.RangeTable, r: u32) bool {
return in(r, ranges);
}
// IsControl reports whether the rune is a control character.
// The C (Other) Unicode category includes more code points
// such as surrogates; use Is(C, r) to test for them.
pub fn isControl(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pC != 0;
}
return false;
}
// IsLetter reports whether the rune is a letter (category L).
pub fn isLetter(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pLmask != 0;
}
return isExcludingLatin(tables.Letter, r);
}
// IsMark reports whether the rune is a mark character (category M).
pub fn isMark(r: i32) bool {
// There are no mark characters in Latin-1.
return isExcludingLatin(tables.Mark, r);
}
// IsNumber reports whether the rune is a number (category N).
pub fn isNumber(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pN != 0;
}
return isExcludingLatin(tables.Number, r);
}
// IsPunct reports whether the rune is a Unicode punctuation character
// (category P).
pub fn isPunct(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pP != 0;
}
return is(tables.Punct, r);
}
// IsSpace reports whether the rune is a space character as defined
// by Unicode's White Space property; in the Latin-1 space
// this is
// '\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).
// Other definitions of spacing characters are set by category
// Z and property Pattern_White_Space.
pub fn isSpace(r: i32) bool {
if (r <= tables.max_latin1) {
switch (r) {
'\t', '\n', 0x0B, 0x0C, '\r', ' ', 0x85, 0xA0 => return true,
else => return false,
}
}
return isExcludingLatin(tables.White_Space, r);
}
// IsSymbol reports whether the rune is a symbolic character.
pub fn isSymbol(r: i32) bool {
if (r <= tables.max_latin1) {
return tables.properties[@intCast(usize, r)] & tables.pS != 0;
}
return isExcludingLatin(tables.Symbol, r);
}
// isDigit reports whether the rune is a decimal digit.
pub fn isDigit(r: i32) bool {
if (r <= tables.max_latin1) {
return '0' <= r and r <= '9';
}
return isExcludingLatin(tables.Digit, r);
} | src/unicode/unicode.zig |
const std = @import("std");
const imgui = @import("imgui");
const glfw = @import("glfw");
const GLFW_HAS_WINDOW_TOPMOST = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200); // 3.2+ GLFW_FLOATING
const GLFW_HAS_WINDOW_HOVERED = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300); // 3.3+ GLFW_HOVERED
const GLFW_HAS_WINDOW_ALPHA = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300); // 3.3+ glfwSetWindowOpacity
const GLFW_HAS_PER_MONITOR_DPI = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3300); // 3.3+ glfwGetMonitorContentScale
const GLFW_HAS_VULKAN = (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3200); // 3.2+ glfwCreateWindowSurface
const GLFW_HAS_NEW_CURSORS = @hasDecl(glfw, "GLFW_RESIZE_NESW_CURSOR") and (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 >= 3400); // 3.4+ GLFW_RESIZE_ALL_CURSOR, GLFW_RESIZE_NESW_CURSOR, GLFW_RESIZE_NWSE_CURSOR, GLFW_NOT_ALLOWED_CURSOR
const FLT_MAX = std.math.f32_max;
const GlfwClientApi = enum {
Unknown,
OpenGL,
Vulkan,
};
var g_Window: ?*glfw.GLFWwindow = null;
var g_ClientApi = GlfwClientApi.Unknown;
var g_Time: f64 = 0.0;
var g_MouseJustPressed = [_]bool{ false, false, false, false, false };
var g_MouseCursors = [_]?*glfw.GLFWcursor{null} ** imgui.MouseCursor.COUNT;
var g_InstalledCallbacks = false;
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
var g_PrevUserCallbackMousebutton: glfw.GLFWmousebuttonfun = null;
var g_PrevUserCallbackScroll: glfw.GLFWscrollfun = null;
var g_PrevUserCallbackKey: glfw.GLFWkeyfun = null;
var g_PrevUserCallbackChar: glfw.GLFWcharfun = null;
pub fn InitForOpenGL(window: *glfw.GLFWwindow, install_callbacks: bool) bool {
return Init(window, install_callbacks, .OpenGL);
}
pub fn InitForVulkan(window: *glfw.GLFWwindow, install_callbacks: bool) bool {
return Init(window, install_callbacks, .Vulkan);
}
pub fn Shutdown() void {
if (g_InstalledCallbacks) {
_ = glfw.glfwSetMouseButtonCallback(g_Window, g_PrevUserCallbackMousebutton);
_ = glfw.glfwSetScrollCallback(g_Window, g_PrevUserCallbackScroll);
_ = glfw.glfwSetKeyCallback(g_Window, g_PrevUserCallbackKey);
_ = glfw.glfwSetCharCallback(g_Window, g_PrevUserCallbackChar);
g_InstalledCallbacks = false;
}
for (g_MouseCursors) |*cursor| {
glfw.glfwDestroyCursor(cursor.*);
cursor.* = null;
}
g_ClientApi = .Unknown;
}
pub fn NewFrame() void {
const io = imgui.GetIO();
// "Font atlas not built! It is generally built by the renderer back-end. Missing call to renderer _NewFrame() function? e.g. ImGui_ImplOpenGL3_NewFrame()."
std.debug.assert(io.Fonts.?.IsBuilt());
// Setup display size (every frame to accommodate for window resizing)
var w: c_int = undefined;
var h: c_int = undefined;
var display_w: c_int = undefined;
var display_h: c_int = undefined;
glfw.glfwGetWindowSize(g_Window, &w, &h);
glfw.glfwGetFramebufferSize(g_Window, &display_w, &display_h);
io.DisplaySize = imgui.Vec2{ .x = @intToFloat(f32, w), .y = @intToFloat(f32, h) };
if (w > 0 and h > 0)
io.DisplayFramebufferScale = imgui.Vec2{ .x = @intToFloat(f32, display_w) / @intToFloat(f32, w), .y = @intToFloat(f32, display_h) / @intToFloat(f32, h) };
// Setup time step
const current_time = glfw.glfwGetTime();
io.DeltaTime = if (g_Time > 0.0) @floatCast(f32, current_time - g_Time) else @floatCast(f32, 1.0 / 60.0);
g_Time = current_time;
UpdateMousePosAndButtons();
UpdateMouseCursor();
// Update game controllers (if enabled and available)
UpdateGamepads();
}
fn Init(window: *glfw.GLFWwindow, install_callbacks: bool, client_api: GlfwClientApi) bool {
g_Window = window;
g_Time = 0.0;
// Setup back-end capabilities flags
var io = imgui.GetIO();
io.BackendFlags.HasMouseCursors = true; // We can honor GetMouseCursor() values (optional)
io.BackendFlags.HasSetMousePos = true; // We can honor io.WantSetMousePos requests (optional, rarely used)
io.BackendPlatformName = "imgui_impl_glfw";
// Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array.
io.KeyMap[@enumToInt(imgui.Key.Tab)] = glfw.GLFW_KEY_TAB;
io.KeyMap[@enumToInt(imgui.Key.LeftArrow)] = glfw.GLFW_KEY_LEFT;
io.KeyMap[@enumToInt(imgui.Key.RightArrow)] = glfw.GLFW_KEY_RIGHT;
io.KeyMap[@enumToInt(imgui.Key.UpArrow)] = glfw.GLFW_KEY_UP;
io.KeyMap[@enumToInt(imgui.Key.DownArrow)] = glfw.GLFW_KEY_DOWN;
io.KeyMap[@enumToInt(imgui.Key.PageUp)] = glfw.GLFW_KEY_PAGE_UP;
io.KeyMap[@enumToInt(imgui.Key.PageDown)] = glfw.GLFW_KEY_PAGE_DOWN;
io.KeyMap[@enumToInt(imgui.Key.Home)] = glfw.GLFW_KEY_HOME;
io.KeyMap[@enumToInt(imgui.Key.End)] = glfw.GLFW_KEY_END;
io.KeyMap[@enumToInt(imgui.Key.Insert)] = glfw.GLFW_KEY_INSERT;
io.KeyMap[@enumToInt(imgui.Key.Delete)] = glfw.GLFW_KEY_DELETE;
io.KeyMap[@enumToInt(imgui.Key.Backspace)] = glfw.GLFW_KEY_BACKSPACE;
io.KeyMap[@enumToInt(imgui.Key.Space)] = glfw.GLFW_KEY_SPACE;
io.KeyMap[@enumToInt(imgui.Key.Enter)] = glfw.GLFW_KEY_ENTER;
io.KeyMap[@enumToInt(imgui.Key.Escape)] = glfw.GLFW_KEY_ESCAPE;
io.KeyMap[@enumToInt(imgui.Key.KeyPadEnter)] = glfw.GLFW_KEY_KP_ENTER;
io.KeyMap[@enumToInt(imgui.Key.A)] = glfw.GLFW_KEY_A;
io.KeyMap[@enumToInt(imgui.Key.C)] = glfw.GLFW_KEY_C;
io.KeyMap[@enumToInt(imgui.Key.V)] = glfw.GLFW_KEY_V;
io.KeyMap[@enumToInt(imgui.Key.X)] = glfw.GLFW_KEY_X;
io.KeyMap[@enumToInt(imgui.Key.Y)] = glfw.GLFW_KEY_Y;
io.KeyMap[@enumToInt(imgui.Key.Z)] = glfw.GLFW_KEY_Z;
io.SetClipboardTextFn = @ptrCast(@TypeOf(io.SetClipboardTextFn), SetClipboardText);
io.GetClipboardTextFn = @ptrCast(@TypeOf(io.GetClipboardTextFn), GetClipboardText);
io.ClipboardUserData = g_Window;
if (std.builtin.os.tag == .windows) {
io.ImeWindowHandle = glfw.glfwGetWin32Window(g_Window);
}
// Create mouse cursors
// (By design, on X11 cursors are user configurable and some cursors may be missing. When a cursor doesn't exist,
// GLFW will emit an error which will often be printed by the app, so we temporarily disable error reporting.
// Missing cursors will return NULL and our _UpdateMouseCursor() function will use the Arrow cursor instead.)
const prev_error_callback = glfw.glfwSetErrorCallback(null);
g_MouseCursors[@enumToInt(imgui.MouseCursor.Arrow)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.TextInput)] = glfw.glfwCreateStandardCursor(glfw.GLFW_IBEAM_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNS)] = glfw.glfwCreateStandardCursor(glfw.GLFW_VRESIZE_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeEW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_HRESIZE_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.Hand)] = glfw.glfwCreateStandardCursor(glfw.GLFW_HAND_CURSOR);
if (GLFW_HAS_NEW_CURSORS) {
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeAll)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_ALL_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNESW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_NESW_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNWSE)] = glfw.glfwCreateStandardCursor(glfw.GLFW_RESIZE_NWSE_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.NotAllowed)] = glfw.glfwCreateStandardCursor(glfw.GLFW_NOT_ALLOWED_CURSOR);
} else {
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeAll)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNESW)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.ResizeNWSE)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR);
g_MouseCursors[@enumToInt(imgui.MouseCursor.NotAllowed)] = glfw.glfwCreateStandardCursor(glfw.GLFW_ARROW_CURSOR);
}
_ = glfw.glfwSetErrorCallback(prev_error_callback);
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
g_PrevUserCallbackMousebutton = null;
g_PrevUserCallbackScroll = null;
g_PrevUserCallbackKey = null;
g_PrevUserCallbackChar = null;
if (install_callbacks) {
g_InstalledCallbacks = true;
g_PrevUserCallbackMousebutton = glfw.glfwSetMouseButtonCallback(window, MouseButtonCallback);
g_PrevUserCallbackScroll = glfw.glfwSetScrollCallback(window, ScrollCallback);
g_PrevUserCallbackKey = glfw.glfwSetKeyCallback(window, KeyCallback);
g_PrevUserCallbackChar = glfw.glfwSetCharCallback(window, CharCallback);
}
g_ClientApi = client_api;
return true;
}
fn UpdateMousePosAndButtons() void {
// Update buttons
var io = imgui.GetIO();
for (io.MouseDown) |*down, i| {
// If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
down.* = g_MouseJustPressed[i] or glfw.glfwGetMouseButton(g_Window, @intCast(c_int, i)) != 0;
g_MouseJustPressed[i] = false;
}
// Update mouse position
const mouse_pos_backup = io.MousePos;
io.MousePos = imgui.Vec2{ .x = -FLT_MAX, .y = -FLT_MAX };
const focused = glfw.glfwGetWindowAttrib(g_Window, glfw.GLFW_FOCUSED) != 0;
if (focused) {
if (io.WantSetMousePos) {
glfw.glfwSetCursorPos(g_Window, @floatCast(f64, mouse_pos_backup.x), @floatCast(f64, mouse_pos_backup.y));
} else {
var mouse_x: f64 = undefined;
var mouse_y: f64 = undefined;
glfw.glfwGetCursorPos(g_Window, &mouse_x, &mouse_y);
io.MousePos = imgui.Vec2{ .x = @floatCast(f32, mouse_x), .y = @floatCast(f32, mouse_y) };
}
}
}
fn UpdateMouseCursor() void {
const io = imgui.GetIO();
if (io.ConfigFlags.NoMouseCursorChange or glfw.glfwGetInputMode(g_Window, glfw.GLFW_CURSOR) == glfw.GLFW_CURSOR_DISABLED)
return;
var imgui_cursor = imgui.GetMouseCursor();
if (imgui_cursor == .None or io.MouseDrawCursor) {
// Hide OS mouse cursor if imgui is drawing it or if it wants no cursor
glfw.glfwSetInputMode(g_Window, glfw.GLFW_CURSOR, glfw.GLFW_CURSOR_HIDDEN);
} else {
// Show OS mouse cursor
// FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here.
glfw.glfwSetCursor(g_Window, if (g_MouseCursors[@intCast(u32, @enumToInt(imgui_cursor))]) |cursor| cursor else g_MouseCursors[@intCast(u32, @enumToInt(imgui.MouseCursor.Arrow))]);
glfw.glfwSetInputMode(g_Window, glfw.GLFW_CURSOR, glfw.GLFW_CURSOR_NORMAL);
}
}
fn MAP_BUTTON(io: *imgui.IO, buttons: []const u8, NAV_NO: imgui.NavInput, BUTTON_NO: u32) void {
if (buttons.len > BUTTON_NO and buttons[BUTTON_NO] == glfw.GLFW_PRESS)
io.NavInputs[@intCast(u32, @enumToInt(NAV_NO))] = 1.0;
}
fn MAP_ANALOG(io: *imgui.IO, axes: []const f32, NAV_NO: imgui.NavInput, AXIS_NO: u32, V0: f32, V1: f32) void {
var v = if (axes.len > AXIS_NO) axes[AXIS_NO] else V0;
v = (v - V0) / (V1 - V0);
if (v > 1.0) v = 1.0;
if (io.NavInputs[@intCast(u32, @enumToInt(NAV_NO))] < v)
io.NavInputs[@intCast(u32, @enumToInt(NAV_NO))] = v;
}
fn UpdateGamepads() void {
const io = imgui.GetIO();
std.mem.set(f32, &io.NavInputs, 0);
if (!io.ConfigFlags.NavEnableGamepad)
return;
// Update gamepad inputs
var axes_count: c_int = 0;
var buttons_count: c_int = 0;
const axesRaw = glfw.glfwGetJoystickAxes(glfw.GLFW_JOYSTICK_1, &axes_count);
const buttonsRaw = glfw.glfwGetJoystickButtons(glfw.GLFW_JOYSTICK_1, &buttons_count);
const axes = axesRaw.?[0..@intCast(u32, axes_count)];
const buttons = buttonsRaw.?[0..@intCast(u32, buttons_count)];
MAP_BUTTON(io, buttons, .Activate, 0); // Cross / A
MAP_BUTTON(io, buttons, .Cancel, 1); // Circle / B
MAP_BUTTON(io, buttons, .Menu, 2); // Square / X
MAP_BUTTON(io, buttons, .Input, 3); // Triangle / Y
MAP_BUTTON(io, buttons, .DpadLeft, 13); // D-Pad Left
MAP_BUTTON(io, buttons, .DpadRight, 11); // D-Pad Right
MAP_BUTTON(io, buttons, .DpadUp, 10); // D-Pad Up
MAP_BUTTON(io, buttons, .DpadDown, 12); // D-Pad Down
MAP_BUTTON(io, buttons, .FocusPrev, 4); // L1 / LB
MAP_BUTTON(io, buttons, .FocusNext, 5); // R1 / RB
MAP_BUTTON(io, buttons, .TweakSlow, 4); // L1 / LB
MAP_BUTTON(io, buttons, .TweakFast, 5); // R1 / RB
MAP_ANALOG(io, axes, .LStickLeft, 0, -0.3, -0.9);
MAP_ANALOG(io, axes, .LStickRight, 0, 0.3, 0.9);
MAP_ANALOG(io, axes, .LStickUp, 1, 0.3, 0.9);
MAP_ANALOG(io, axes, .LStickDown, 1, -0.3, -0.9);
io.BackendFlags.HasGamepad = axes_count > 0 and buttons_count > 0;
}
fn GetClipboardText(user_data: ?*c_void) callconv(.C) ?[*:0]const u8 {
return glfw.glfwGetClipboardString(@ptrCast(?*glfw.GLFWwindow, user_data));
}
fn SetClipboardText(user_data: ?*c_void, text: ?[*:0]const u8) callconv(.C) void {
glfw.glfwSetClipboardString(@ptrCast(?*glfw.GLFWwindow, user_data), text);
}
fn MouseButtonCallback(window: ?*glfw.GLFWwindow, button: c_int, action: c_int, mods: c_int) callconv(.C) void {
if (g_PrevUserCallbackMousebutton) |fnPtr| {
fnPtr(window, button, action, mods);
}
if (action == glfw.GLFW_PRESS and button >= 0 and @intCast(usize, button) < g_MouseJustPressed.len)
g_MouseJustPressed[@intCast(usize, button)] = true;
}
fn ScrollCallback(window: ?*glfw.GLFWwindow, xoffset: f64, yoffset: f64) callconv(.C) void {
if (g_PrevUserCallbackScroll) |fnPtr| {
fnPtr(window, xoffset, yoffset);
}
const io = imgui.GetIO();
io.MouseWheelH += @floatCast(f32, xoffset);
io.MouseWheel += @floatCast(f32, yoffset);
}
fn KeyCallback(window: ?*glfw.GLFWwindow, key: c_int, scancode: c_int, action: c_int, mods: c_int) callconv(.C) void {
if (g_PrevUserCallbackKey) |fnPtr| {
fnPtr(window, key, scancode, action, mods);
}
const io = imgui.GetIO();
if (action == glfw.GLFW_PRESS)
io.KeysDown[@intCast(usize, key)] = true;
if (action == glfw.GLFW_RELEASE)
io.KeysDown[@intCast(usize, key)] = false;
// Modifiers are not reliable across systems
io.KeyCtrl = io.KeysDown[glfw.GLFW_KEY_LEFT_CONTROL] or io.KeysDown[glfw.GLFW_KEY_RIGHT_CONTROL];
io.KeyShift = io.KeysDown[glfw.GLFW_KEY_LEFT_SHIFT] or io.KeysDown[glfw.GLFW_KEY_RIGHT_SHIFT];
io.KeyAlt = io.KeysDown[glfw.GLFW_KEY_LEFT_ALT] or io.KeysDown[glfw.GLFW_KEY_RIGHT_ALT];
if (std.builtin.os.tag == .windows) {
io.KeySuper = false;
} else {
io.KeySuper = io.KeysDown[glfw.GLFW_KEY_LEFT_SUPER] or io.KeysDown[glfw.GLFW_KEY_RIGHT_SUPER];
}
}
fn CharCallback(window: ?*glfw.GLFWwindow, c: c_uint) callconv(.C) void {
if (g_PrevUserCallbackChar) |fnPtr| {
fnPtr(window, c);
}
var io = imgui.GetIO();
io.AddInputCharacter(c);
} | src/imgui_impl_glfw.zig |
const std = @import("std");
const fun = @import("fun");
const debug = std.debug;
const heap = std.heap;
const io = std.io;
const math = std.math;
const mem = std.mem;
const os = std.os;
const scan = fun.scan.scan;
pub fn main() !void {
const stdin = &(try io.getStdIn()).inStream().stream;
const stdout = &(try io.getStdOut()).outStream().stream;
var ps = io.PeekStream(1, os.File.InStream.Error).init(stdin);
var direct_allocator = heap.DirectAllocator.init();
const allocator = &direct_allocator.allocator;
defer direct_allocator.deinit();
const tree = try readTree(allocator, &ps);
defer tree.destroy();
try stdout.print("{}\n", metadataSum(tree));
try stdout.print("{}\n", treeValue(tree));
}
fn readTree(allocator: *mem.Allocator, ps: var) !*Tree {
const tree = try Tree.create(allocator);
errdefer tree.destroy();
tree.root = try readNode(&tree.arena.allocator, ps);
return tree;
}
fn readNode(allocator: *mem.Allocator, ps: var) anyerror!Node {
const header = try scan(ps, "{} {} ", struct {
nodes: u8,
meta: u8,
});
var nodes = std.ArrayList(Node).init(allocator);
defer nodes.deinit();
var i: usize = 0;
while (i < header.nodes) : (i += 1)
try nodes.append(try readNode(allocator, ps));
var metadata = std.ArrayList(u8).init(allocator);
defer metadata.deinit();
i = 0;
while (i < header.meta) : (i += 1) {
const res = try scan(ps, "{}", struct {
meta: u8,
});
_ = try ps.stream.readByte();
try metadata.append(res.meta);
}
return Node{
.children = nodes.toOwnedSlice(),
.metadata = metadata.toOwnedSlice(),
};
}
const Tree = struct {
root: Node,
arena: heap.ArenaAllocator,
fn create(allocator: *mem.Allocator) !*Tree {
const tree = try allocator.create(Tree);
tree.* = Tree{
.root = Node{
.children = ([*]Node)(undefined)[0..0],
.metadata = ([*]u8)(undefined)[0..0],
},
.arena = undefined,
};
tree.arena = heap.ArenaAllocator.init(allocator);
return tree;
}
fn destroy(tree: *Tree) void {
const allocator = tree.arena.child_allocator;
tree.arena.deinit();
tree.* = undefined;
allocator.destroy(tree);
}
};
const Node = struct {
children: []Node,
metadata: []u8,
};
fn metadataSum(tree: *const Tree) usize {
const Helper = struct {
fn sum(node: Node) usize {
var res: usize = 0;
for (node.children) |child|
res += sum(child);
for (node.metadata) |data|
res += data;
return res;
}
};
return Helper.sum(tree.root);
}
fn treeValue(tree: *const Tree) usize {
const Helper = struct {
fn nodeValue(node: Node) usize {
var res: usize = 0;
if (node.children.len == 0) {
for (node.metadata) |data|
res += data;
return res;
}
for (node.metadata) |data| {
if (data == 0)
continue;
if (node.children.len < data)
continue;
res += nodeValue(node.children[data - 1]);
}
return res;
}
};
return Helper.nodeValue(tree.root);
} | src/day8.zig |
const std = @import("std");
const os = std.os;
const warn = std.debug.warn;
const syspect = @import("syspect");
pub fn main() !void {
const allocator = std.heap.c_allocator;
const ignore_list = &[_]os.SYS{
.write,
.mprotect,
.mmap,
.munmap,
.brk,
.access,
};
// Setting inverse to true changes how Inspector interacts with ignore_list.
// Usually, the list of syscalls passed in would be the inspected syscalls.
// When inversed, everything outside of the list is inspected, and the syscalls passed in are ignored.
var inspector = syspect.Inspector.init(allocator, ignore_list, .{ .inverse = true });
try init(allocator, &inspector);
defer inspector.deinit();
// We will be caching names so we don't have to do unnecessary work in code that is likely to be hot.
var pid_name_cache = std.AutoHashMap(os.pid_t, []u8).init(allocator);
defer pid_name_cache.deinit();
defer {
var iter = pid_name_cache.iterator();
while (iter.next()) |kv| {
allocator.free(kv.value);
}
}
while (try inspector.next_syscall()) |*syscall| {
switch (syscall.*) {
.pre_call => |context| {
const pid_name = processName(allocator, &pid_name_cache, context.pid);
warn("[{} - {}] starting {}\n", .{ context.pid, pid_name, enumName(context.registers.syscall) });
try inspector.resume_tracee(context.pid);
},
.post_call => |context| {
// Arguments may not be accurate, syscall return value will be accurate.
// Argument registers may have been changed between the initial call and this point in time.
// Unless the system resets registers to their state at the initial call? Seems unlikely.
print_info(context);
const pid_name = processName(allocator, &pid_name_cache, context.pid);
warn("[{} - {}] finished {}\n\n", .{ context.pid, pid_name, enumName(context.registers.syscall) });
try inspector.resume_tracee(context.pid);
},
}
}
}
fn processName(allocator: *std.mem.Allocator, cache: *std.AutoHashMap(os.pid_t, []u8), pid: os.pid_t) ![]const u8 {
if (cache.getValue(pid)) |name| {
return name;
}
var buffer = [_]u8{0} ** 30;
var fbs = std.io.fixedBufferStream(buffer[0..]);
try std.fmt.format(fbs.outStream(), "/proc/{}/comm", .{pid});
const fd = try std.os.open(buffer[0..fbs.pos], 0, os.O_RDONLY);
defer std.os.close(fd);
var chars = try std.os.read(fd, buffer[0..]);
// Remove trailing newlines or spaces
while (chars > 0 and (buffer[chars - 1] == '\n' or buffer[chars - 1] == ' ')) chars -= 1;
var name = try allocator.alloc(u8, chars);
std.mem.copy(u8, name, buffer[0..chars]);
_ = try cache.put(pid, name);
return name;
}
fn enumName(int: var) []const u8 {
inline for (std.meta.fields(os.SYS)) |f| {
if (int == f.value) return f.name;
}
return "???";
}
fn usage(our_name: [*:0]u8) void {
warn("{} requires an argument\n", .{our_name});
}
fn init(allocator: *std.mem.Allocator, inspector: *syspect.Inspector) !void {
if (os.argv.len <= 1) {
usage(os.argv[0]);
os.exit(1);
}
const maybe_pid: ?os.pid_t = std.fmt.parseInt(os.pid_t, std.mem.span(os.argv[1]), 10) catch null;
if (maybe_pid) |pid| {
inspector.attach_to_process(pid) catch |err| {
switch (err) {
error.OperationNotPermitted => {
warn("Operation not permitted. Usually caused by insufficient privileges. Try running the program as sudo!\n", .{});
os.exit(1);
},
else => return err,
}
};
warn("Attached to pid: {}\n", .{pid});
} else {
var target_argv = try allocator.alloc([]u8, os.argv.len - 1);
defer allocator.free(target_argv);
for (os.argv[1..os.argv.len]) |arg, index| {
target_argv[index] = std.mem.span(arg);
}
_ = try inspector.spawn_process(allocator, target_argv);
}
}
/// Prints the system call name and its first four arguments
fn print_info(context: syspect.Context) void {
warn("[{}] ", .{context.pid});
warn("{} ( ", .{enumName(context.registers.syscall)});
warn("{}, ", .{context.registers.arg1});
warn("{}, ", .{context.registers.arg2});
warn("{}, ", .{context.registers.arg3});
warn("{}", .{context.registers.arg4});
warn(" ) = ", .{});
warn("{}\n", .{@intCast(isize, context.registers.result)});
} | examples/print_some_syscalls.zig |
usingnamespace @import("c.zig");
usingnamespace @import("main.zig");
const st = @import("st.zig");
const sendbreak = st.sendbreak;
const toggleprinter = st.toggleprinter;
const printscreen = st.printscreen;
const printsel = st.printsel;
pub const font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
pub const borderpx = 2;
pub const shell = "/bin/sh";
pub const utmp: ?[*:0]const u8 = null;
pub const stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
pub const vtiden = "\x1b[?6c";
pub const cwscale = 1.0;
pub const chscale = 1.0;
pub const worddelimiters = [_]wchar_t{' '};
pub const doubleclicktimeout = 300;
pub const tripleclicktimeout = 600;
pub const allowaltscreen = true;
pub const xfps = 120;
pub const actionfps = 30;
pub const blinktimeout = 800;
pub const cursorthickness = 2;
pub const bellvolume = 0;
pub const termname = "st-256color";
pub const tabspaces = 8;
pub const colorname = [_]?[*:0]const u8{
// 8 normal colors
"black",
"red3",
"green3",
"yellow3",
"blue2",
"magenta3",
"cyan3",
"gray90",
// 8 bright colors
"gray50",
"red",
"green",
"yellow",
"#5c5cff",
"magenta",
"cyan",
"white",
} ++ [_]?[*:0]const u8{null} ** 240 ++ [_]?[*:0]const u8{
"#cccccc",
"#555555",
};
pub const defaultfg = 7;
pub const defaultbg = 0;
pub const defaultcs = 256;
pub const defaultrcs = 257;
pub const cursorshape = 2;
pub const cols = 80;
pub const rows = 24;
pub const mouseshape = XC_xterm;
pub const mousefg = 7;
pub const mousebg = 0;
pub const defaultattr = 11;
const MS = MouseShortcut.init;
pub const mshortcuts = [_]MouseShortcut{
MS(Button4, XK_ANY_MOD, "\x19"),
MS(Button5, XK_ANY_MOD, "\x05"),
};
const MODKEY = Mod1Mask;
const TERMMOD = ControlMask | ShiftMask;
const S = Shortcut.init;
// zig fmt: off
pub const shortcuts = [_]Shortcut{
S(XK_ANY_MOD, XK_Break, sendbreak, .{ .i = 0 }),
S(ControlMask, XK_Print, toggleprinter, .{ .i = 0 }),
S(ShiftMask, XK_Print, printscreen, .{ .i = 0 }),
S(XK_ANY_MOD, XK_Print, printsel, .{ .i = 0 }),
S(TERMMOD, XK_Prior, zoom, .{ .f = 1 }),
S(TERMMOD, XK_Next, zoom, .{ .f = -1 }),
S(TERMMOD, XK_Home, zoomreset, .{ .f = 0 }),
S(TERMMOD, XK_C, clipcopy, .{ .i = 0 }),
S(TERMMOD, XK_V, clippaste, .{ .i = 0 }),
S(TERMMOD, XK_Y, selpaste, .{ .i = 0 }),
S(ShiftMask, XK_Insert, selpaste, .{ .i = 0 }),
S(TERMMOD, XK_Num_Lock, numlock, .{ .i = 0 }),
};
// zig fmt: on
pub const mappedkeys = [_]KeySym{@bitCast(u16, @as(i16, -1))};
pub const ignoremod = Mod2Mask | XK_SWITCH_MOD;
pub const forceselmod = ShiftMask;
const K = Key.init;
// zig fmt: off
pub const key = [_]Key{
K(XK_KP_Home, ShiftMask, "\x1b[2J", 0, -1 ),
K(XK_KP_Home, ShiftMask, "\x1b[1;2H", 0, 1 ),
K(XK_KP_Home, XK_ANY_MOD, "\x1b[H", 0, -1 ),
K(XK_KP_Home, XK_ANY_MOD, "\x1b[1~", 0, 1 ),
K(XK_KP_Up, XK_ANY_MOD, "\x1bOx", 1, 0 ),
K(XK_KP_Up, XK_ANY_MOD, "\x1b[A", 0, -1 ),
K(XK_KP_Up, XK_ANY_MOD, "\x1bOA", 0, 1 ),
K(XK_KP_Down, XK_ANY_MOD, "\x1bOr", 1, 0 ),
K(XK_KP_Down, XK_ANY_MOD, "\x1b[B", 0, -1 ),
K(XK_KP_Down, XK_ANY_MOD, "\x1bOB", 0, 1 ),
K(XK_KP_Left, XK_ANY_MOD, "\x1bOt", 1, 0 ),
K(XK_KP_Left, XK_ANY_MOD, "\x1b[D", 0, -1 ),
K(XK_KP_Left, XK_ANY_MOD, "\x1bOD", 0, 1 ),
K(XK_KP_Right, XK_ANY_MOD, "\x1bOv", 1, 0 ),
K(XK_KP_Right, XK_ANY_MOD, "\x1b[C", 0, -1 ),
K(XK_KP_Right, XK_ANY_MOD, "\x1bOC", 0, 1 ),
K(XK_KP_Prior, ShiftMask, "\x1b[5;2~", 0, 0 ),
K(XK_KP_Prior, XK_ANY_MOD, "\x1b[5~", 0, 0 ),
K(XK_KP_Begin, XK_ANY_MOD, "\x1b[E", 0, 0 ),
K(XK_KP_End, ControlMask, "\x1b[J", -1, 0 ),
K(XK_KP_End, ControlMask, "\x1b[1;5F", 1, 0 ),
K(XK_KP_End, ShiftMask, "\x1b[K", -1, 0 ),
K(XK_KP_End, ShiftMask, "\x1b[1;2F", 1, 0 ),
K(XK_KP_End, XK_ANY_MOD, "\x1b[4~", 0, 0 ),
K(XK_KP_Next, ShiftMask, "\x1b[6;2~", 0, 0 ),
K(XK_KP_Next, XK_ANY_MOD, "\x1b[6~", 0, 0 ),
K(XK_KP_Insert, ShiftMask, "\x1b[2;2~", 1, 0 ),
K(XK_KP_Insert, ShiftMask, "\x1b[4l", -1, 0 ),
K(XK_KP_Insert, ControlMask, "\x1b[L", -1, 0 ),
K(XK_KP_Insert, ControlMask, "\x1b[2;5~", 1, 0 ),
K(XK_KP_Insert, XK_ANY_MOD, "\x1b[4h", -1, 0 ),
K(XK_KP_Insert, XK_ANY_MOD, "\x1b[2~", 1, 0 ),
K(XK_KP_Delete, ControlMask, "\x1b[M", -1, 0 ),
K(XK_KP_Delete, ControlMask, "\x1b[3;5~", 1, 0 ),
K(XK_KP_Delete, ShiftMask, "\x1b[2K", -1, 0 ),
K(XK_KP_Delete, ShiftMask, "\x1b[3;2~", 1, 0 ),
K(XK_KP_Delete, XK_ANY_MOD, "\x1b[P", -1, 0 ),
K(XK_KP_Delete, XK_ANY_MOD, "\x1b[3~", 1, 0 ),
K(XK_KP_Multiply, XK_ANY_MOD, "\x1bOj", 2, 0 ),
K(XK_KP_Add, XK_ANY_MOD, "\x1bOk", 2, 0 ),
K(XK_KP_Enter, XK_ANY_MOD, "\x1bOM", 2, 0 ),
K(XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0 ),
K(XK_KP_Subtract, XK_ANY_MOD, "\x1bOm", 2, 0 ),
K(XK_KP_Decimal, XK_ANY_MOD, "\x1bOn", 2, 0 ),
K(XK_KP_Divide, XK_ANY_MOD, "\x1bOo", 2, 0 ),
K(XK_KP_0, XK_ANY_MOD, "\x1bOp", 2, 0 ),
K(XK_KP_1, XK_ANY_MOD, "\x1bOq", 2, 0 ),
K(XK_KP_2, XK_ANY_MOD, "\x1bOr", 2, 0 ),
K(XK_KP_3, XK_ANY_MOD, "\x1bOs", 2, 0 ),
K(XK_KP_4, XK_ANY_MOD, "\x1bOt", 2, 0 ),
K(XK_KP_5, XK_ANY_MOD, "\x1bOu", 2, 0 ),
K(XK_KP_6, XK_ANY_MOD, "\x1bOv", 2, 0 ),
K(XK_KP_7, XK_ANY_MOD, "\x1bOw", 2, 0 ),
K(XK_KP_8, XK_ANY_MOD, "\x1bOx", 2, 0 ),
K(XK_KP_9, XK_ANY_MOD, "\x1bOy", 2, 0 ),
K(XK_Up, ShiftMask, "\x1b[1;2A", 0, 0 ),
K(XK_Up, Mod1Mask, "\x1b[1;3A", 0, 0 ),
K(XK_Up, ShiftMask | Mod1Mask, "\x1b[1;4A", 0, 0 ),
K(XK_Up, ControlMask, "\x1b[1;5A", 0, 0 ),
K(XK_Up, ShiftMask | ControlMask, "\x1b[1;6A", 0, 0 ),
K(XK_Up, ControlMask | Mod1Mask, "\x1b[1;7A", 0, 0 ),
K(XK_Up, ShiftMask|ControlMask|Mod1Mask,"\x1b[1;8A", 0, 0 ),
K(XK_Up, XK_ANY_MOD, "\x1b[A", 0, -1 ),
K(XK_Up, XK_ANY_MOD, "\x1bOA", 0, 1 ),
K(XK_Down, ShiftMask, "\x1b[1;2B", 0, 0 ),
K(XK_Down, Mod1Mask, "\x1b[1;3B", 0, 0 ),
K(XK_Down, ShiftMask | Mod1Mask, "\x1b[1;4B", 0, 0 ),
K(XK_Down, ControlMask, "\x1b[1;5B", 0, 0 ),
K(XK_Down, ShiftMask | ControlMask, "\x1b[1;6B", 0, 0 ),
K(XK_Down, ControlMask | Mod1Mask, "\x1b[1;7B", 0, 0 ),
K(XK_Down, ShiftMask|ControlMask|Mod1Mask,"\x1b[1;8B", 0, 0 ),
K(XK_Down, XK_ANY_MOD, "\x1b[B", 0, -1 ),
K(XK_Down, XK_ANY_MOD, "\x1bOB", 0, 1 ),
K(XK_Left, ShiftMask, "\x1b[1;2D", 0, 0 ),
K(XK_Left, Mod1Mask, "\x1b[1;3D", 0, 0 ),
K(XK_Left, ShiftMask | Mod1Mask, "\x1b[1;4D", 0, 0 ),
K(XK_Left, ControlMask, "\x1b[1;5D", 0, 0 ),
K(XK_Left, ShiftMask | ControlMask, "\x1b[1;6D", 0, 0 ),
K(XK_Left, ControlMask | Mod1Mask, "\x1b[1;7D", 0, 0 ),
K(XK_Left, ShiftMask|ControlMask|Mod1Mask,"\x1b[1;8D", 0, 0 ),
K(XK_Left, XK_ANY_MOD, "\x1b[D", 0, -1 ),
K(XK_Left, XK_ANY_MOD, "\x1bOD", 0, 1 ),
K(XK_Right, ShiftMask, "\x1b[1;2C", 0, 0 ),
K(XK_Right, Mod1Mask, "\x1b[1;3C", 0, 0 ),
K(XK_Right, ShiftMask | Mod1Mask, "\x1b[1;4C", 0, 0 ),
K(XK_Right, ControlMask, "\x1b[1;5C", 0, 0 ),
K(XK_Right, ShiftMask | ControlMask, "\x1b[1;6C", 0, 0 ),
K(XK_Right, ControlMask | Mod1Mask, "\x1b[1;7C", 0, 0 ),
K(XK_Right, ShiftMask|ControlMask|Mod1Mask,"\x1b[1;8C", 0, 0 ),
K(XK_Right, XK_ANY_MOD, "\x1b[C", 0, -1 ),
K(XK_Right, XK_ANY_MOD, "\x1bOC", 0, 1 ),
K(XK_ISO_Left_Tab, ShiftMask, "\x1b[Z", 0, 0 ),
K(XK_Return, Mod1Mask, "\x1b\r", 0, 0 ),
K(XK_Return, XK_ANY_MOD, "\r", 0, 0 ),
K(XK_Insert, ShiftMask, "\x1b[4l", -1, 0 ),
K(XK_Insert, ShiftMask, "\x1b[2;2~", 1, 0 ),
K(XK_Insert, ControlMask, "\x1b[L", -1, 0 ),
K(XK_Insert, ControlMask, "\x1b[2;5~", 1, 0 ),
K(XK_Insert, XK_ANY_MOD, "\x1b[4h", -1, 0 ),
K(XK_Insert, XK_ANY_MOD, "\x1b[2~", 1, 0 ),
K(XK_Delete, ControlMask, "\x1b[M", -1, 0 ),
K(XK_Delete, ControlMask, "\x1b[3;5~", 1, 0 ),
K(XK_Delete, ShiftMask, "\x1b[2K", -1, 0 ),
K(XK_Delete, ShiftMask, "\x1b[3;2~", 1, 0 ),
K(XK_Delete, XK_ANY_MOD, "\x1b[P", -1, 0 ),
K(XK_Delete, XK_ANY_MOD, "\x1b[3~", 1, 0 ),
K(XK_BackSpace, XK_NO_MOD, "\x7f", 0, 0 ),
K(XK_BackSpace, Mod1Mask, "\x1b\x7f", 0, 0 ),
K(XK_Home, ShiftMask, "\x1b[2J", 0, -1 ),
K(XK_Home, ShiftMask, "\x1b[1;2H", 0, 1 ),
K(XK_Home, XK_ANY_MOD, "\x1b[H", 0, -1 ),
K(XK_Home, XK_ANY_MOD, "\x1b[1~", 0, 1 ),
K(XK_End, ControlMask, "\x1b[J", -1, 0 ),
K(XK_End, ControlMask, "\x1b[1;5F", 1, 0 ),
K(XK_End, ShiftMask, "\x1b[K", -1, 0 ),
K(XK_End, ShiftMask, "\x1b[1;2F", 1, 0 ),
K(XK_End, XK_ANY_MOD, "\x1b[4~", 0, 0 ),
K(XK_Prior, ControlMask, "\x1b[5;5~", 0, 0 ),
K(XK_Prior, ShiftMask, "\x1b[5;2~", 0, 0 ),
K(XK_Prior, XK_ANY_MOD, "\x1b[5~", 0, 0 ),
K(XK_Next, ControlMask, "\x1b[6;5~", 0, 0 ),
K(XK_Next, ShiftMask, "\x1b[6;2~", 0, 0 ),
K(XK_Next, XK_ANY_MOD, "\x1b[6~", 0, 0 ),
K(XK_F1, XK_NO_MOD, "\x1bOP", 0, 0 ),
K(XK_F1, ShiftMask, "\x1b[1;2P", 0, 0 ),
K(XK_F1, ControlMask, "\x1b[1;5P", 0, 0 ),
K(XK_F1, Mod4Mask, "\x1b[1;6P", 0, 0 ),
K(XK_F1, Mod1Mask, "\x1b[1;3P", 0, 0 ),
K(XK_F1, Mod3Mask, "\x1b[1;4P", 0, 0 ),
K(XK_F2, XK_NO_MOD, "\x1bOQ", 0, 0 ),
K(XK_F2, ShiftMask, "\x1b[1;2Q", 0, 0 ),
K(XK_F2, ControlMask, "\x1b[1;5Q", 0, 0 ),
K(XK_F2, Mod4Mask, "\x1b[1;6Q", 0, 0 ),
K(XK_F2, Mod1Mask, "\x1b[1;3Q", 0, 0 ),
K(XK_F2, Mod3Mask, "\x1b[1;4Q", 0, 0 ),
K(XK_F3, XK_NO_MOD, "\x1bOR", 0, 0 ),
K(XK_F3, ShiftMask, "\x1b[1;2R", 0, 0 ),
K(XK_F3, ControlMask, "\x1b[1;5R", 0, 0 ),
K(XK_F3, Mod4Mask, "\x1b[1;6R", 0, 0 ),
K(XK_F3, Mod1Mask, "\x1b[1;3R", 0, 0 ),
K(XK_F3, Mod3Mask, "\x1b[1;4R", 0, 0 ),
K(XK_F4, XK_NO_MOD, "\x1bOS", 0, 0 ),
K(XK_F4, ShiftMask, "\x1b[1;2S", 0, 0 ),
K(XK_F4, ControlMask, "\x1b[1;5S", 0, 0 ),
K(XK_F4, Mod4Mask, "\x1b[1;6S", 0, 0 ),
K(XK_F4, Mod1Mask, "\x1b[1;3S", 0, 0 ),
K(XK_F5, XK_NO_MOD, "\x1b[15~", 0, 0 ),
K(XK_F5, ShiftMask, "\x1b[15;2~", 0, 0 ),
K(XK_F5, ControlMask, "\x1b[15;5~", 0, 0 ),
K(XK_F5, Mod4Mask, "\x1b[15;6~", 0, 0 ),
K(XK_F5, Mod1Mask, "\x1b[15;3~", 0, 0 ),
K(XK_F6, XK_NO_MOD, "\x1b[17~", 0, 0 ),
K(XK_F6, ShiftMask, "\x1b[17;2~", 0, 0 ),
K(XK_F6, ControlMask, "\x1b[17;5~", 0, 0 ),
K(XK_F6, Mod4Mask, "\x1b[17;6~", 0, 0 ),
K(XK_F6, Mod1Mask, "\x1b[17;3~", 0, 0 ),
K(XK_F7, XK_NO_MOD, "\x1b[18~", 0, 0 ),
K(XK_F7, ShiftMask, "\x1b[18;2~", 0, 0 ),
K(XK_F7, ControlMask, "\x1b[18;5~", 0, 0 ),
K(XK_F7, Mod4Mask, "\x1b[18;6~", 0, 0 ),
K(XK_F7, Mod1Mask, "\x1b[18;3~", 0, 0 ),
K(XK_F8, XK_NO_MOD, "\x1b[19~", 0, 0 ),
K(XK_F8, ShiftMask, "\x1b[19;2~", 0, 0 ),
K(XK_F8, ControlMask, "\x1b[19;5~", 0, 0 ),
K(XK_F8, Mod4Mask, "\x1b[19;6~", 0, 0 ),
K(XK_F8, Mod1Mask, "\x1b[19;3~", 0, 0 ),
K(XK_F9, XK_NO_MOD, "\x1b[20~", 0, 0 ),
K(XK_F9, ShiftMask, "\x1b[20;2~", 0, 0 ),
K(XK_F9, ControlMask, "\x1b[20;5~", 0, 0 ),
K(XK_F9, Mod4Mask, "\x1b[20;6~", 0, 0 ),
K(XK_F9, Mod1Mask, "\x1b[20;3~", 0, 0 ),
K(XK_F10, XK_NO_MOD, "\x1b[21~", 0, 0 ),
K(XK_F10, ShiftMask, "\x1b[21;2~", 0, 0 ),
K(XK_F10, ControlMask, "\x1b[21;5~", 0, 0 ),
K(XK_F10, Mod4Mask, "\x1b[21;6~", 0, 0 ),
K(XK_F10, Mod1Mask, "\x1b[21;3~", 0, 0 ),
K(XK_F11, XK_NO_MOD, "\x1b[23~", 0, 0 ),
K(XK_F11, ShiftMask, "\x1b[23;2~", 0, 0 ),
K(XK_F11, ControlMask, "\x1b[23;5~", 0, 0 ),
K(XK_F11, Mod4Mask, "\x1b[23;6~", 0, 0 ),
K(XK_F11, Mod1Mask, "\x1b[23;3~", 0, 0 ),
K(XK_F12, XK_NO_MOD, "\x1b[24~", 0, 0 ),
K(XK_F12, ShiftMask, "\x1b[24;2~", 0, 0 ),
K(XK_F12, ControlMask, "\x1b[24;5~", 0, 0 ),
K(XK_F12, Mod4Mask, "\x1b[24;6~", 0, 0 ),
K(XK_F12, Mod1Mask, "\x1b[24;3~", 0, 0 ),
K(XK_F13, XK_NO_MOD, "\x1b[1;2P", 0, 0 ),
K(XK_F14, XK_NO_MOD, "\x1b[1;2Q", 0, 0 ),
K(XK_F15, XK_NO_MOD, "\x1b[1;2R", 0, 0 ),
K(XK_F16, XK_NO_MOD, "\x1b[1;2S", 0, 0 ),
K(XK_F17, XK_NO_MOD, "\x1b[15;2~", 0, 0 ),
K(XK_F18, XK_NO_MOD, "\x1b[17;2~", 0, 0 ),
K(XK_F19, XK_NO_MOD, "\x1b[18;2~", 0, 0 ),
K(XK_F20, XK_NO_MOD, "\x1b[19;2~", 0, 0 ),
K(XK_F21, XK_NO_MOD, "\x1b[20;2~", 0, 0 ),
K(XK_F22, XK_NO_MOD, "\x1b[21;2~", 0, 0 ),
K(XK_F23, XK_NO_MOD, "\x1b[23;2~", 0, 0 ),
K(XK_F24, XK_NO_MOD, "\x1b[24;2~", 0, 0 ),
K(XK_F25, XK_NO_MOD, "\x1b[1;5P", 0, 0 ),
K(XK_F26, XK_NO_MOD, "\x1b[1;5Q", 0, 0 ),
K(XK_F27, XK_NO_MOD, "\x1b[1;5R", 0, 0 ),
K(XK_F28, XK_NO_MOD, "\x1b[1;5S", 0, 0 ),
K(XK_F29, XK_NO_MOD, "\x1b[15;5~", 0, 0 ),
K(XK_F30, XK_NO_MOD, "\x1b[17;5~", 0, 0 ),
K(XK_F31, XK_NO_MOD, "\x1b[18;5~", 0, 0 ),
K(XK_F32, XK_NO_MOD, "\x1b[19;5~", 0, 0 ),
K(XK_F33, XK_NO_MOD, "\x1b[20;5~", 0, 0 ),
K(XK_F34, XK_NO_MOD, "\x1b[21;5~", 0, 0 ),
K(XK_F35, XK_NO_MOD, "\x1b[23;5~", 0, 0 ),
};
// zig fmt: on
pub const selmasks = [_]u32{ 0, 0, Mod1Mask };
pub const ascii_printable =
\\ !\"#$%&'()*+,-./0123456789:;<=>?"
\\@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
\\`abcdefghijklmnopqrstuvwxyz{|}~"
; | src/config.zig |
pub const struct_NVGcontext = opaque {};
pub const NVGcontext = struct_NVGcontext;
pub const struct_NVGcolor = extern struct {
r: f32,
g: f32,
b: f32,
a: f32,
};
pub const NVGcolor = struct_NVGcolor;
pub const struct_NVGpaint = extern struct {
xform: [6]f32,
extent: [2]f32,
radius: f32,
feather: f32,
innerColor: NVGcolor,
outerColor: NVGcolor,
image: c_int,
};
pub const NVGpaint = struct_NVGpaint;
pub const NVG_CCW: c_int = 1;
pub const NVG_CW: c_int = 2;
pub const enum_NVGwinding = c_uint;
pub const NVG_SOLID: c_int = 1;
pub const NVG_HOLE: c_int = 2;
pub const enum_NVGsolidity = c_uint;
pub const NVG_BUTT: c_int = 0;
pub const NVG_ROUND: c_int = 1;
pub const NVG_SQUARE: c_int = 2;
pub const NVG_BEVEL: c_int = 3;
pub const NVG_MITER: c_int = 4;
pub const enum_NVGlineCap = c_uint;
pub const NVG_ALIGN_LEFT: c_int = 1;
pub const NVG_ALIGN_CENTER: c_int = 2;
pub const NVG_ALIGN_RIGHT: c_int = 4;
pub const NVG_ALIGN_TOP: c_int = 8;
pub const NVG_ALIGN_MIDDLE: c_int = 16;
pub const NVG_ALIGN_BOTTOM: c_int = 32;
pub const NVG_ALIGN_BASELINE: c_int = 64;
pub const enum_NVGalign = c_uint;
pub const NVG_ZERO: c_int = 1;
pub const NVG_ONE: c_int = 2;
pub const NVG_SRC_COLOR: c_int = 4;
pub const NVG_ONE_MINUS_SRC_COLOR: c_int = 8;
pub const NVG_DST_COLOR: c_int = 16;
pub const NVG_ONE_MINUS_DST_COLOR: c_int = 32;
pub const NVG_SRC_ALPHA: c_int = 64;
pub const NVG_ONE_MINUS_SRC_ALPHA: c_int = 128;
pub const NVG_DST_ALPHA: c_int = 256;
pub const NVG_ONE_MINUS_DST_ALPHA: c_int = 512;
pub const NVG_SRC_ALPHA_SATURATE: c_int = 1024;
pub const enum_NVGblendFactor = c_uint;
pub const NVG_SOURCE_OVER: c_int = 0;
pub const NVG_SOURCE_IN: c_int = 1;
pub const NVG_SOURCE_OUT: c_int = 2;
pub const NVG_ATOP: c_int = 3;
pub const NVG_DESTINATION_OVER: c_int = 4;
pub const NVG_DESTINATION_IN: c_int = 5;
pub const NVG_DESTINATION_OUT: c_int = 6;
pub const NVG_DESTINATION_ATOP: c_int = 7;
pub const NVG_LIGHTER: c_int = 8;
pub const NVG_COPY: c_int = 9;
pub const NVG_XOR: c_int = 10;
pub const enum_NVGcompositeOperation = c_uint;
pub const struct_NVGcompositeOperationState = extern struct {
srcRGB: c_int,
dstRGB: c_int,
srcAlpha: c_int,
dstAlpha: c_int,
};
pub const NVGcompositeOperationState = struct_NVGcompositeOperationState;
pub const struct_NVGglyphPosition = extern struct {
str: [*c]const u8,
x: f32,
minx: f32,
maxx: f32,
};
pub const NVGglyphPosition = struct_NVGglyphPosition;
pub const struct_NVGtextRow = extern struct {
start: [*c]const u8,
end: [*c]const u8,
next: [*c]const u8,
width: f32,
minx: f32,
maxx: f32,
};
pub const NVGtextRow = struct_NVGtextRow;
pub const NVG_IMAGE_GENERATE_MIPMAPS: c_int = 1;
pub const NVG_IMAGE_REPEATX: c_int = 2;
pub const NVG_IMAGE_REPEATY: c_int = 4;
pub const NVG_IMAGE_FLIPY: c_int = 8;
pub const NVG_IMAGE_PREMULTIPLIED: c_int = 16;
pub const NVG_IMAGE_NEAREST: c_int = 32;
pub const enum_NVGimageFlags = c_uint;
pub const NANOVG_H = "";
pub const NVG_PI = @as(f32, 3.14159265358979323846264338327);
pub const NVGwinding = enum_NVGwinding;
pub const NVGsolidity = enum_NVGsolidity;
pub const NVGlineCap = enum_NVGlineCap;
pub const NVGalign = enum_NVGalign;
pub const NVGblendFactor = enum_NVGblendFactor;
pub const NVGcompositeOperation = enum_NVGcompositeOperation;
pub const NVGimageFlags = enum_NVGimageFlags;
pub const NVGtexture = enum_NVGtexture;
pub extern fn nvgBeginFrame(ctx: ?*NVGcontext, windowWidth: f32, windowHeight: f32, devicePixelRatio: f32) void;
pub extern fn nvgCancelFrame(ctx: ?*NVGcontext) void;
pub extern fn nvgEndFrame(ctx: ?*NVGcontext) void;
pub extern fn nvgGlobalCompositeOperation(ctx: ?*NVGcontext, op: c_int) void;
pub extern fn nvgGlobalCompositeBlendFunc(ctx: ?*NVGcontext, sfactor: c_int, dfactor: c_int) void;
pub extern fn nvgGlobalCompositeBlendFuncSeparate(ctx: ?*NVGcontext, srcRGB: c_int, dstRGB: c_int, srcAlpha: c_int, dstAlpha: c_int) void;
pub extern fn nvgRGB(r: u8, g: u8, b: u8) NVGcolor;
pub extern fn nvgRGBf(r: f32, g: f32, b: f32) NVGcolor;
pub extern fn nvgRGBA(r: u8, g: u8, b: u8, a: u8) NVGcolor;
pub extern fn nvgRGBAf(r: f32, g: f32, b: f32, a: f32) NVGcolor;
pub extern fn nvgLerpRGBA(c0: NVGcolor, c1: NVGcolor, u: f32) NVGcolor;
pub extern fn nvgTransRGBA(c0: NVGcolor, a: u8) NVGcolor;
pub extern fn nvgTransRGBAf(c0: NVGcolor, a: f32) NVGcolor;
pub extern fn nvgHSL(h: f32, s: f32, l: f32) NVGcolor;
pub extern fn nvgHSLA(h: f32, s: f32, l: f32, a: u8) NVGcolor;
pub extern fn nvgSave(ctx: ?*NVGcontext) void;
pub extern fn nvgRestore(ctx: ?*NVGcontext) void;
pub extern fn nvgReset(ctx: ?*NVGcontext) void;
pub extern fn nvgShapeAntiAlias(ctx: ?*NVGcontext, enabled: c_int) void;
pub extern fn nvgStrokeColor(ctx: ?*NVGcontext, color: NVGcolor) void;
pub extern fn nvgStrokePaint(ctx: ?*NVGcontext, paint: NVGpaint) void;
pub extern fn nvgFillColor(ctx: ?*NVGcontext, color: NVGcolor) void;
pub extern fn nvgFillPaint(ctx: ?*NVGcontext, paint: NVGpaint) void;
pub extern fn nvgMiterLimit(ctx: ?*NVGcontext, limit: f32) void;
pub extern fn nvgStrokeWidth(ctx: ?*NVGcontext, size: f32) void;
pub extern fn nvgLineCap(ctx: ?*NVGcontext, cap: c_int) void;
pub extern fn nvgLineJoin(ctx: ?*NVGcontext, join: c_int) void;
pub extern fn nvgGlobalAlpha(ctx: ?*NVGcontext, alpha: f32) void;
pub extern fn nvgGlobalTint(ctx: ?*NVGcontext, tint: NVGcolor) void;
pub extern fn nvgGetGlobalTint(ctx: ?*NVGcontext) NVGcolor;
pub extern fn nvgAlpha(ctx: ?*NVGcontext, alpha: f32) void;
pub extern fn nvgTint(ctx: ?*NVGcontext, tint: NVGcolor) void;
pub extern fn nvgResetTransform(ctx: ?*NVGcontext) void;
pub extern fn nvgTransform(ctx: ?*NVGcontext, a: f32, b: f32, c: f32, d: f32, e: f32, f: f32) void;
pub extern fn nvgTranslate(ctx: ?*NVGcontext, x: f32, y: f32) void;
pub extern fn nvgRotate(ctx: ?*NVGcontext, angle: f32) void;
pub extern fn nvgSkewX(ctx: ?*NVGcontext, angle: f32) void;
pub extern fn nvgSkewY(ctx: ?*NVGcontext, angle: f32) void;
pub extern fn nvgScale(ctx: ?*NVGcontext, x: f32, y: f32) void;
pub extern fn nvgCurrentTransform(ctx: ?*NVGcontext, xform: [*c]f32) void;
pub extern fn nvgTransformIdentity(dst: [*c]f32) void;
pub extern fn nvgTransformTranslate(dst: [*c]f32, tx: f32, ty: f32) void;
pub extern fn nvgTransformScale(dst: [*c]f32, sx: f32, sy: f32) void;
pub extern fn nvgTransformRotate(dst: [*c]f32, a: f32) void;
pub extern fn nvgTransformSkewX(dst: [*c]f32, a: f32) void;
pub extern fn nvgTransformSkewY(dst: [*c]f32, a: f32) void;
pub extern fn nvgTransformMultiply(dst: [*c]f32, src: [*c]const f32) void;
pub extern fn nvgTransformPremultiply(dst: [*c]f32, src: [*c]const f32) void;
pub extern fn nvgTransformInverse(dst: [*c]f32, src: [*c]const f32) c_int;
pub extern fn nvgTransformPoint(dstx: [*c]f32, dsty: [*c]f32, xform: [*c]const f32, srcx: f32, srcy: f32) void;
pub extern fn nvgDegToRad(deg: f32) f32;
pub extern fn nvgRadToDeg(rad: f32) f32;
pub extern fn nvgCreateImage(ctx: ?*NVGcontext, filename: [*c]const u8, imageFlags: c_int) c_int;
pub extern fn nvgCreateImageMem(ctx: ?*NVGcontext, imageFlags: c_int, data: [*c]u8, ndata: c_int) c_int;
pub extern fn nvgCreateImageRGBA(ctx: ?*NVGcontext, w: c_int, h: c_int, imageFlags: c_int, data: [*c]const u8) c_int;
pub extern fn nvgUpdateImage(ctx: ?*NVGcontext, image: c_int, data: [*c]const u8) void;
pub extern fn nvgUpdateImageRegion(ctx: ?*NVGcontext, image: c_int, data: [*c]const u8, x: c_int, y: c_int, w: c_int, h: c_int) void;
pub extern fn nvgImageSize(ctx: ?*NVGcontext, image: c_int, w: [*c]c_int, h: [*c]c_int) void;
pub extern fn nvgDeleteImage(ctx: ?*NVGcontext, image: c_int) void;
pub extern fn nvgLinearGradient(ctx: ?*NVGcontext, sx: f32, sy: f32, ex: f32, ey: f32, icol: NVGcolor, ocol: NVGcolor) NVGpaint;
pub extern fn nvgBoxGradient(ctx: ?*NVGcontext, x: f32, y: f32, w: f32, h: f32, r: f32, f: f32, icol: NVGcolor, ocol: NVGcolor) NVGpaint;
pub extern fn nvgRadialGradient(ctx: ?*NVGcontext, cx: f32, cy: f32, inr: f32, outr: f32, icol: NVGcolor, ocol: NVGcolor) NVGpaint;
pub extern fn nvgImagePattern(ctx: ?*NVGcontext, ox: f32, oy: f32, ex: f32, ey: f32, angle: f32, image: c_int, alpha: f32) NVGpaint;
pub extern fn nvgScissor(ctx: ?*NVGcontext, x: f32, y: f32, w: f32, h: f32) void;
pub extern fn nvgIntersectScissor(ctx: ?*NVGcontext, x: f32, y: f32, w: f32, h: f32) void;
pub extern fn nvgResetScissor(ctx: ?*NVGcontext) void;
pub extern fn nvgBeginPath(ctx: ?*NVGcontext) void;
pub extern fn nvgMoveTo(ctx: ?*NVGcontext, x: f32, y: f32) void;
pub extern fn nvgLineTo(ctx: ?*NVGcontext, x: f32, y: f32) void;
pub extern fn nvgBezierTo(ctx: ?*NVGcontext, c1x: f32, c1y: f32, c2x: f32, c2y: f32, x: f32, y: f32) void;
pub extern fn nvgQuadTo(ctx: ?*NVGcontext, cx: f32, cy: f32, x: f32, y: f32) void;
pub extern fn nvgArcTo(ctx: ?*NVGcontext, x1: f32, y1: f32, x2: f32, y2: f32, radius: f32) void;
pub extern fn nvgClosePath(ctx: ?*NVGcontext) void;
pub extern fn nvgPathWinding(ctx: ?*NVGcontext, dir: c_int) void;
pub extern fn nvgArc(ctx: ?*NVGcontext, cx: f32, cy: f32, r: f32, a0: f32, a1: f32, dir: c_int) void;
pub extern fn nvgRect(ctx: ?*NVGcontext, x: f32, y: f32, w: f32, h: f32) void;
pub extern fn nvgRoundedRect(ctx: ?*NVGcontext, x: f32, y: f32, w: f32, h: f32, r: f32) void;
pub extern fn nvgRoundedRectVarying(ctx: ?*NVGcontext, x: f32, y: f32, w: f32, h: f32, radTopLeft: f32, radTopRight: f32, radBottomRight: f32, radBottomLeft: f32) void;
pub extern fn nvgEllipse(ctx: ?*NVGcontext, cx: f32, cy: f32, rx: f32, ry: f32) void;
pub extern fn nvgCircle(ctx: ?*NVGcontext, cx: f32, cy: f32, r: f32) void;
pub extern fn nvgFill(ctx: ?*NVGcontext) void;
pub extern fn nvgStroke(ctx: ?*NVGcontext) void;
pub extern fn nvgCreateFont(ctx: ?*NVGcontext, name: [*c]const u8, filename: [*c]const u8) c_int;
pub extern fn nvgCreateFontAtIndex(ctx: ?*NVGcontext, name: [*c]const u8, filename: [*c]const u8, fontIndex: c_int) c_int;
pub extern fn nvgCreateFontMem(ctx: ?*NVGcontext, name: [*c]const u8, data: [*c]u8, ndata: c_int, freeData: c_int) c_int;
pub extern fn nvgCreateFontMemAtIndex(ctx: ?*NVGcontext, name: [*c]const u8, data: [*c]u8, ndata: c_int, freeData: c_int, fontIndex: c_int) c_int;
pub extern fn nvgFindFont(ctx: ?*NVGcontext, name: [*c]const u8) c_int;
pub extern fn nvgAddFallbackFontId(ctx: ?*NVGcontext, baseFont: c_int, fallbackFont: c_int) c_int;
pub extern fn nvgAddFallbackFont(ctx: ?*NVGcontext, baseFont: [*c]const u8, fallbackFont: [*c]const u8) c_int;
pub extern fn nvgResetFallbackFontsId(ctx: ?*NVGcontext, baseFont: c_int) void;
pub extern fn nvgResetFallbackFonts(ctx: ?*NVGcontext, baseFont: [*c]const u8) void;
pub extern fn nvgFontSize(ctx: ?*NVGcontext, size: f32) void;
pub extern fn nvgFontBlur(ctx: ?*NVGcontext, blur: f32) void;
pub extern fn nvgTextLetterSpacing(ctx: ?*NVGcontext, spacing: f32) void;
pub extern fn nvgTextLineHeight(ctx: ?*NVGcontext, lineHeight: f32) void;
pub extern fn nvgTextAlign(ctx: ?*NVGcontext, @"align": c_int) void;
pub extern fn nvgFontFaceId(ctx: ?*NVGcontext, font: c_int) void;
pub extern fn nvgFontFace(ctx: ?*NVGcontext, font: [*c]const u8) void;
pub extern fn nvgText(ctx: ?*NVGcontext, x: f32, y: f32, string: [*c]const u8, end: [*c]const u8) f32;
pub extern fn nvgTextBox(ctx: ?*NVGcontext, x: f32, y: f32, breakRowWidth: f32, string: [*c]const u8, end: [*c]const u8) void;
pub extern fn nvgTextBounds(ctx: ?*NVGcontext, x: f32, y: f32, string: [*c]const u8, end: [*c]const u8, bounds: [*c]f32) f32;
pub extern fn nvgTextBoxBounds(ctx: ?*NVGcontext, x: f32, y: f32, breakRowWidth: f32, string: [*c]const u8, end: [*c]const u8, bounds: [*c]f32) void;
pub extern fn nvgTextGlyphPositions(ctx: ?*NVGcontext, x: f32, y: f32, string: [*c]const u8, end: [*c]const u8, positions: [*c]NVGglyphPosition, maxPositions: c_int) c_int;
pub extern fn nvgTextMetrics(ctx: ?*NVGcontext, ascender: [*c]f32, descender: [*c]f32, lineh: [*c]f32) void;
pub extern fn nvgTextBreakLines(ctx: ?*NVGcontext, string: [*c]const u8, end: [*c]const u8, breakRowWidth: f32, rows: [*c]NVGtextRow, maxRows: c_int) c_int;
pub extern fn nvgGetDrawCallCount(ctx: ?*NVGcontext) c_int;
pub const NVG_TEXTURE_ALPHA: c_int = 1;
pub const NVG_TEXTURE_RGBA: c_int = 2;
pub const enum_NVGtexture = c_uint;
pub extern fn nvgCreateGL3(flags: c_int) ?*NVGcontext;
pub extern fn nvgDeleteGL3(ctx: ?*NVGcontext) void;
pub const NVG_ANTIALIAS = 1 << 0;
pub const NVG_STENCIL_STROKES = 1 << 1;
pub const NVG_DEBUG = 1 << 2; | src/deps/nanovg/c.zig |
const std = @import("std");
const Builder = std.build.Builder;
const Pkg = std.build.Pkg;
pub fn pkg(b: *Builder, build_options: Pkg) Pkg {
const dirname = comptime std.fs.path.dirname(@src().file) orelse ".";
const source = .{ .path = dirname ++ "/src/lib/pkmn.zig" };
const package = if (@hasField(Pkg, "path"))
Pkg{ .name = "pkmn", .path = source, .dependencies = &.{build_options} }
else
Pkg{ .name = "pkmn", .source = source, .dependencies = &.{build_options} };
return b.dupePkg(package);
}
pub fn build(b: *Builder) !void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
var parser = std.json.Parser.init(b.allocator, false);
defer parser.deinit();
var tree = try parser.parse(@embedFile("package.json"));
defer tree.deinit();
const version = tree.root.Object.get("version").?.String;
const showdown =
b.option(bool, "showdown", "Enable Pokémon Showdown compatability mode") orelse false;
const strip = b.option(bool, "strip", "Strip debugging symbols from binary") orelse false;
const trace = b.option(bool, "trace", "Enable trace logs") orelse false;
const options = b.addOptions();
options.addOption(bool, "showdown", showdown);
options.addOption(bool, "trace", trace);
const build_options = options.getPackage("build_options");
const pkmn = pkg(b, build_options);
const lib = if (showdown) "pkmn-showdown" else "pkmn";
const static_lib = b.addStaticLibrary(lib, "src/lib/binding/c.zig");
static_lib.addOptions("build_options", options);
static_lib.setBuildMode(mode);
static_lib.setTarget(target);
static_lib.addIncludeDir("src/include");
static_lib.strip = strip;
static_lib.install();
const versioned = .{ .versioned = try std.builtin.Version.parse(version) };
const dynamic_lib = b.addSharedLibrary(lib, "src/lib/binding/c.zig", versioned);
dynamic_lib.addOptions("build_options", options);
dynamic_lib.setBuildMode(mode);
dynamic_lib.setTarget(target);
dynamic_lib.addIncludeDir("src/include");
dynamic_lib.strip = strip;
dynamic_lib.install();
const node_headers = b.option([]const u8, "node-headers", "Path to node-headers");
if (node_headers) |headers| {
const name = b.fmt("{s}.node", .{lib});
const node_lib = b.addSharedLibrary(name, "src/lib/binding/node.zig", .unversioned);
node_lib.addSystemIncludeDir(headers);
node_lib.addOptions("build_options", options);
node_lib.setBuildMode(mode);
node_lib.setTarget(target);
node_lib.linkLibC();
node_lib.linker_allow_shlib_undefined = true;
node_lib.strip = strip;
// Always emit to build/lib because this is where the driver code expects to find it
// TODO: find alternative to emit_to that works properly with .install()
node_lib.emit_bin = .{ .emit_to = b.fmt("build/lib/{s}", .{name}) };
b.getInstallStep().dependOn(&node_lib.step);
}
const header = b.addInstallFileWithDir(
.{ .path = "src/include/pkmn.h" },
.header,
"pkmn.h",
);
b.getInstallStep().dependOn(&header.step);
{
const pc = b.fmt("lib{s}.pc", .{lib});
const file = try std.fs.path.join(
b.allocator,
&.{ b.cache_root, pc },
);
const pkgconfig_file = try std.fs.cwd().createFile(file, .{});
const suffix = if (showdown) " Showdown!" else "";
const writer = pkgconfig_file.writer();
try writer.print(
\\prefix={0s}
\\includedir=${{prefix}}/include
\\libdir=${{prefix}}/lib
\\
\\Name: lib{1s}
\\URL: https://github.com/pkmn/engine
\\Description: Library for simulating Pokémon{2s} battles.
\\Version: {3s}
\\Cflags: -I${{includedir}}
\\Libs: -L${{libdir}} -l{1s}
, .{ b.install_prefix, lib, suffix, version });
defer pkgconfig_file.close();
b.installFile(file, b.fmt("share/pkgconfig/{s}", .{pc}));
}
const coverage = b.option([]const u8, "test-coverage", "Generate test coverage");
const test_file =
b.option([]const u8, "test-file", "Input file for test") orelse "src/lib/test.zig";
const test_bin = b.option([]const u8, "test-bin", "Emit test binary to");
const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
const test_no_exec =
b.option(bool, "test-no-exec", "Compiles test binary without running it") orelse false;
const tests = if (test_no_exec) b.addTestExe("test_exe", test_file) else b.addTest(test_file);
tests.setMainPkgPath("./");
tests.setFilter(test_filter);
tests.addOptions("build_options", options);
tests.setBuildMode(mode);
tests.setTarget(target);
tests.single_threaded = true;
tests.strip = strip;
if (test_bin) |bin| {
tests.name = std.fs.path.basename(bin);
if (std.fs.path.dirname(bin)) |dir| tests.setOutputDir(dir);
}
if (coverage) |path| {
tests.setExecCmd(&.{ "kcov", "--include-pattern=src/lib", path, null });
}
const test_step = if (test_filter != null) null else &tests.step;
const format = b.addFmt(&.{"."});
const lint = b.addExecutable("lint", "src/tools/lint.zig").run();
lint.step.dependOn(b.getInstallStep());
const benchmark =
tool(b, &.{pkmn}, "src/test/benchmark.zig", showdown, true, test_step, .ReleaseFast);
const fuzz =
tool(b, &.{pkmn}, "src/test/benchmark.zig", showdown, false, test_step, .ReleaseSafe);
const rng =
tool(b, &.{pkmn}, "src/tools/rng.zig", showdown, strip, test_step, null);
const serde =
tool(b, &.{pkmn}, "src/tools/serde.zig", showdown, strip, test_step, null);
const protocol =
tool(b, &.{pkmn}, "src/tools/protocol.zig", showdown, strip, test_step, null);
b.step("benchmark", "Run benchmark code").dependOn(&benchmark.step);
b.step("format", "Format source files").dependOn(&format.step);
b.step("fuzz", "Run fuzz tester").dependOn(&fuzz.step);
b.step("lint", "Lint source files").dependOn(&lint.step);
b.step("protocol", "Run protocol dump tool").dependOn(&protocol.step);
b.step("rng", "Run RNG calculator tool").dependOn(&rng.step);
b.step("serde", "Run serialization/deserialization tool").dependOn(&serde.step);
b.step("test", "Run all tests").dependOn(&tests.step);
}
fn tool(
b: *Builder,
pkgs: []Pkg,
path: []const u8,
showdown: bool,
strip: bool,
test_step: ?*std.build.Step,
mode: ?std.builtin.Mode,
) *std.build.RunStep {
var name = std.fs.path.basename(path);
const index = std.mem.lastIndexOfScalar(u8, name, '.');
if (index) |i| name = name[0..i];
if (showdown) name = b.fmt("{s}-showdown", .{name});
const exe = b.addExecutable(name, path);
for (pkgs) |p| exe.addPackage(p);
exe.setBuildMode(mode orelse b.standardReleaseOptions());
exe.single_threaded = true;
exe.strip = strip;
if (test_step) |ts| ts.dependOn(&exe.step);
const run_exe = exe.run();
run_exe.step.dependOn(b.getInstallStep());
if (b.args) |args| run_exe.addArgs(args);
return run_exe;
} | build.zig |
const c = @import("c");
const intToError = @import("error.zig").intToError;
const Error = @import("error.zig").Error;
const Glyph = @import("Glyph.zig");
const Library = @import("freetype.zig").Library;
const Face = @import("freetype.zig").Face;
const RenderMode = @import("freetype.zig").RenderMode;
const Matrix = @import("types.zig").Matrix;
const Outline = @import("image.zig").Outline;
const GlyphFormat = @import("image.zig").GlyphFormat;
const Vector = @import("image.zig").Vector;
const GlyphMetrics = @import("image.zig").GlyphMetrics;
const Bitmap = @import("image.zig").Bitmap;
const GlyphSlot = @This();
pub const SubGlyphInfo = struct {
index: i32,
flags: u32,
arg1: i32,
arg2: i32,
transform: Matrix,
};
handle: c.FT_GlyphSlot,
pub fn library(self: GlyphSlot) Library {
return .{ .handle = self.handle.*.library };
}
pub fn face(self: GlyphSlot) Face {
return .{ .handle = self.handle.*.face };
}
pub fn next(self: GlyphSlot) GlyphSlot {
return .{ .handle = self.handle.*.next };
}
pub fn glyphIndex(self: GlyphSlot) u32 {
return self.handle.*.glyph_index;
}
pub fn metrics(self: GlyphSlot) GlyphMetrics {
return self.handle.*.metrics;
}
pub fn linearHoriAdvance(self: GlyphSlot) i32 {
return @intCast(i32, self.handle.*.linearHoriAdvance);
}
pub fn linearVertAdvance(self: GlyphSlot) i32 {
return @intCast(i32, self.handle.*.linearVertAdvance);
}
pub fn advance(self: GlyphSlot) Vector {
return self.handle.*.advance;
}
pub fn format(self: GlyphSlot) GlyphFormat {
return @intToEnum(GlyphFormat, self.handle.*.format);
}
pub fn bitmap(self: GlyphSlot) Bitmap {
return .{ .handle = self.handle.*.bitmap };
}
pub fn bitmapLeft(self: GlyphSlot) i32 {
return self.handle.*.bitmap_left;
}
pub fn bitmapTop(self: GlyphSlot) i32 {
return self.handle.*.bitmap_top;
}
pub fn outline(self: GlyphSlot) ?Outline {
return if (self.format() == .outline) .{ .handle = &self.handle.*.outline } else null;
}
pub fn lsbDelta(self: GlyphSlot) i32 {
return @intCast(i32, self.handle.*.lsb_delta);
}
pub fn rsbDelta(self: GlyphSlot) i32 {
return @intCast(i32, self.handle.*.rsb_delta);
}
pub fn render(self: GlyphSlot, render_mode: RenderMode) Error!void {
return intToError(c.FT_Render_Glyph(self.handle, @enumToInt(render_mode)));
}
pub fn getSubGlyphInfo(self: GlyphSlot, sub_index: u32) Error!SubGlyphInfo {
var info: SubGlyphInfo = undefined;
try intToError(c.FT_Get_SubGlyph_Info(self.handle, sub_index, &info.index, &info.flags, &info.arg1, &info.arg2, &info.transform));
return info;
}
pub fn getGlyph(self: GlyphSlot) Error!Glyph {
var res: c.FT_Glyph = undefined;
try intToError(c.FT_Get_Glyph(self.handle, &res));
return Glyph{ .handle = res };
} | freetype/src/freetype/GlyphSlot.zig |
const std = @import("std");
const testing = std.testing;
pub const nil: ?id = null;
const objc = @import("objc.zig");
pub const object = objc.object;
pub const Class = objc.Class;
pub const id = objc.id;
pub const SEL = objc.SEL;
pub const IMP = objc.IMP;
pub const sel_registerName = objc.sel_registerName;
pub const sel_getUid = objc.sel_getUid;
const runtime = @import("runtime.zig");
pub const Method = runtime.Method;
pub const Ivar = runtime.Ivar;
pub const Category = runtime.Category;
pub const Property = runtime.Property;
pub const Protocol = runtime.Protocol;
pub const object_getClass = runtime.object_getClass;
pub const object_getInstanceVariable = runtime.object_getInstanceVariable;
pub const getClass = runtime.getClass;
pub const getMetaClass = runtime.getMetaClass;
pub const lookUpClass = runtime.lookUpClass;
pub const class_getClassVariable = runtime.class_getClassVariable;
pub const class_getInstanceMethod = runtime.class_getInstanceMethod;
pub const class_getClassMethod = runtime.class_getClassMethod;
pub const class_respondsToSelector = runtime.class_respondsToSelector;
pub const class_conformsToProtocol = runtime.class_conformsToProtocol;
pub const allocateClassPair = runtime.allocateClassPair;
pub const registerClassPair = runtime.registerClassPair;
pub const disposeClassPair = runtime.disposeClassPair;
pub const class_addMethod = runtime.class_addMethod;
pub const class_replaceMethod = runtime.class_replaceMethod;
pub const class_addIvar = runtime.class_addIvar;
pub const method_setImplementation = runtime.method_setImplementation;
pub const getProtocol = runtime.getProtocol;
const message = @import("message.zig");
pub const msgSend = message.msgSend;
const type_encoding = @import("type-encoding.zig");
const writeEncodingForType = type_encoding.writeEncodingForType;
pub const Error = error{
ClassDoesNotRespondToSelector,
InstanceDoesNotRespondToSelector,
FailedToAddIvarToClass,
FailedToAddMethodToClass,
};
/// Checks whether the target implements the method described by selector and then sends a message
/// Returns the return value of the called method or an error if the target does not implement the corresponding method
pub fn msgSendChecked(comptime ReturnType: type, target: anytype, selector: SEL, args: anytype) !ReturnType {
switch (@TypeOf(target)) {
Class => {
if (class_getClassMethod(target, selector) == null) return Error.ClassDoesNotRespondToSelector;
},
id => {
const class = try object_getClass(target);
if (class_getInstanceMethod(class, selector) == null) return Error.InstanceDoesNotRespondToSelector;
},
else => @compileError("Invalid msgSend target type. Must be a Class or id"),
}
return msgSend(ReturnType, target, selector, args);
}
/// The same as calling msgSendChecked except takes a selector name instead of a selector
pub fn msgSendByName(comptime ReturnType: type, target: anytype, sel_name: [:0]const u8, args: anytype) !ReturnType {
const selector = try sel_getUid(sel_name);
return msgSendChecked(ReturnType, target, selector, args);
}
/// The same as calling msgSend except takes a selector name instead of a selector
pub fn msgSendByNameUnchecked(comptime ReturnType: type, target: anytype, sel_name: [:0]const u8, args: anytype) !ReturnType {
const selector = try sel_getUid(sel_name);
return msgSend(ReturnType, target, selector, args);
}
/// Convenience fn for sending an new message to a Class object
/// Which is equivilent to sending an alloc message to a Class object followed by an init message to the returned Class instance
pub fn new(class: Class) !id {
const new_sel = try sel_getUid("new");
return msgSend(id, class, new_sel, .{});
}
/// Convenience fn for sending a dealloc message to object
pub fn dealloc(instance: id) !void {
const dealloc_sel = try sel_getUid("dealloc");
msgSend(void, instance, dealloc_sel, .{});
}
/// Convenience fn for defining and registering a new Class
/// dispose of the resultng class using `disposeClassPair`
pub fn defineAndRegisterClass(name: [:0]const u8, superclass: Class, ivars: anytype, methods: anytype) !Class {
const class = try allocateClassPair(superclass, name, 0);
errdefer disposeClassPair(class);
// reuseable buffer for type encoding strings
var type_encoding_buf = [_]u8{0} ** 256;
// add ivars to class
inline for (ivars) |ivar| {
const ivar_name = ivar.@"0";
const ivar_type = ivar.@"1";
const type_enc_str = encode: {
var fbs = std.io.fixedBufferStream(&type_encoding_buf);
try writeEncodingForType(ivar_type, fbs.writer());
const len = fbs.getWritten().len + 1;
break :encode type_encoding_buf[0..len :0];
};
var ivar_name_terminated = [_]u8{0} ** (ivar_name.len + 1);
std.mem.copy(u8, &ivar_name_terminated, ivar_name);
if (class_addIvar(class, ivar_name_terminated[0..ivar_name.len :0], @sizeOf(ivar_type), @alignOf(ivar_type), type_enc_str) == false) {
return Error.FailedToAddIvarToClass;
}
std.mem.set(u8, &type_encoding_buf, 0);
}
// add methods to class
inline for (methods) |m| {
const fn_name = m.@"0";
const func = m.@"1";
const FnType = @TypeOf(func);
const type_enc_str = encode: {
var fbs = std.io.fixedBufferStream(&type_encoding_buf);
try writeEncodingForType(FnType, fbs.writer());
const len = fbs.getWritten().len + 1;
break :encode type_encoding_buf[0..len :0];
};
const selector = try sel_registerName(fn_name);
const result = class_addMethod(
class,
selector,
func,
type_enc_str,
);
if (result == false) {
return Error.FailedToAddMethodToClass;
}
std.mem.set(u8, &type_encoding_buf, 0);
}
registerClassPair(class);
return class;
}
test {
testing.refAllDecls(@This());
}
test "new/dealloc NSObject" {
const NSObject = try getClass("NSObject");
const new_obj = try new(NSObject);
try dealloc(new_obj);
}
test "register/call/deregister Objective-C Class" {
try struct {
pub fn runTest() !void {
const NSObject = try getClass("NSObject");
const TestClass = try defineAndRegisterClass(
"TestClass",
NSObject,
.{
.{ "foo", c_int },
},
.{
.{ "add", add },
},
);
const instance = try new(TestClass);
try testing.expectEqual(
@as(c_int, 3),
try msgSendByName(c_int, instance, "add", .{ @as(c_int, 1), @as(c_int, 2) }),
);
try dealloc(instance);
}
pub fn add(_: id, _: SEL, a: c_int, b: c_int) callconv(.C) c_int {
return a + b;
}
}.runTest();
} | modules/platform/vendored/zig-objcrt/src/main.zig |
const std = @import("std");
const ThreadPool = @This();
lock: std.Mutex = .{},
is_running: bool = true,
allocator: *std.mem.Allocator,
running: usize = 0,
threads: []*std.Thread,
run_queue: RunQueue = .{},
idle_queue: IdleQueue = .{},
const IdleQueue = std.SinglyLinkedList(std.AutoResetEvent);
const RunQueue = std.SinglyLinkedList(Runnable);
const Runnable = struct {
runFn: fn (*Runnable) void,
};
pub fn init(self: *ThreadPool, allocator: *std.mem.Allocator) !void {
self.* = .{
.allocator = allocator,
.threads = &[_]*std.Thread{},
};
if (std.builtin.single_threaded)
return;
errdefer self.deinit();
var num_threads = std.Thread.cpuCount() catch 1;
if (num_threads > 0)
self.threads = try allocator.alloc(*std.Thread, num_threads);
while (num_threads > 0) : (num_threads -= 1) {
const thread = try std.Thread.spawn(self, runWorker);
self.threads[self.running] = thread;
self.running += 1;
}
}
pub fn deinit(self: *ThreadPool) void {
self.shutdown();
std.debug.assert(!self.is_running);
for (self.threads[0..self.running]) |thread|
thread.wait();
defer self.threads = &[_]*std.Thread{};
if (self.running > 0)
self.allocator.free(self.threads);
}
pub fn shutdown(self: *ThreadPool) void {
const held = self.lock.acquire();
if (!self.is_running)
return held.release();
var idle_queue = self.idle_queue;
self.idle_queue = .{};
self.is_running = false;
held.release();
while (idle_queue.popFirst()) |idle_node|
idle_node.data.set();
}
pub fn spawn(self: *ThreadPool, comptime func: anytype, args: anytype) !void {
if (std.builtin.single_threaded) {
@call(.{}, func, args);
return;
}
const Args = @TypeOf(args);
const Closure = struct {
arguments: Args,
pool: *ThreadPool,
run_node: RunQueue.Node = .{ .data = .{ .runFn = runFn } },
fn runFn(runnable: *Runnable) void {
const run_node = @fieldParentPtr(RunQueue.Node, "data", runnable);
const closure = @fieldParentPtr(@This(), "run_node", run_node);
const result = @call(.{}, func, closure.arguments);
closure.pool.allocator.destroy(closure);
}
};
const closure = try self.allocator.create(Closure);
closure.* = .{
.arguments = args,
.pool = self,
};
const held = self.lock.acquire();
self.run_queue.prepend(&closure.run_node);
const idle_node = self.idle_queue.popFirst();
held.release();
if (idle_node) |node|
node.data.set();
}
fn runWorker(self: *ThreadPool) void {
while (true) {
const held = self.lock.acquire();
if (self.run_queue.popFirst()) |run_node| {
held.release();
(run_node.data.runFn)(&run_node.data);
continue;
}
if (!self.is_running) {
held.release();
return;
}
var idle_node = IdleQueue.Node{ .data = .{} };
self.idle_queue.prepend(&idle_node);
held.release();
idle_node.data.wait();
}
} | src/ThreadPool.zig |
const std = @import("std");
const glfw = @import("glfw");
const zt = @import("../zt.zig");
const gl = @import("gl");
const ig = @import("imgui");
// OpenGL Data
var g_GlVersion: gl.GLuint = 0; // Extracted at runtime using gl.GL_MAJOR_VERSION, gl.GL_MINOR_VERSION queries.
var g_GlslVersionStringMem: [32]u8 = undefined; // Specified by user or detected based on compile time GL settings.
var g_GlslVersionString: []u8 = &g_GlslVersionStringMem; // slice of g_GlslVersionStringMem
pub var g_FontTexture: c_uint = 0;
var g_ShaderHandle: c_uint = 0;
var g_VertHandle: c_uint = 0;
var g_FragHandle: c_uint = 0;
var g_AttribLocationTex: i32 = 0;
var g_AttribLocationProjMtx: i32 = 0; // Uniforms location
var g_AttribLocationVtxPos: i32 = 0;
var g_AttribLocationVtxUV: i32 = 0;
var g_AttribLocationVtxColor: i32 = 0; // Vertex attributes location
var g_VboHandle: c_uint = 0;
var g_ElementsHandle: c_uint = 0;
// Functions
pub fn init(glsl_version_opt: ?[:0]const u8) void {
var ctx = ig.igCreateContext(null);
ig.igSetCurrentContext(ctx);
// Query for GL version
var major: gl.GLint = undefined;
var minor: gl.GLint = undefined;
gl.glGetIntegerv(gl.GL_MAJOR_VERSION, &major);
gl.glGetIntegerv(gl.GL_MINOR_VERSION, &minor);
g_GlVersion = @intCast(gl.GLuint, major * 1000 + minor);
// Setup back-end capabilities flags
var io = ig.igGetIO();
io.*.BackendRendererName = "imgui_impl_opengl3";
io.*.IniFilename = "workspace";
// Sensible memory-friendly initial mouse position.
io.*.MousePos = .{ .x = 0, .y = 0 };
// Store GLSL version string so we can refer to it later in case we recreate shaders.
// Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
var glsl_version: [:0]const u8 = undefined;
if (glsl_version_opt) |value| {
glsl_version = value;
} else {
glsl_version = "#version 130";
}
std.debug.assert(glsl_version.len + 2 < g_GlslVersionStringMem.len);
std.mem.copy(u8, g_GlslVersionStringMem[0..glsl_version.len], glsl_version);
g_GlslVersionStringMem[glsl_version.len] = '\n';
g_GlslVersionStringMem[glsl_version.len + 1] = 0;
g_GlslVersionString = g_GlslVersionStringMem[0..glsl_version.len];
// Make a dummy GL call (we don't actually need the result)
// IF YOU GET A CRASH HERE: it probably means that you haven't initialized the OpenGL function loader used by this code.
// Desktop OpenGL 3/4 need a function loader. See the IMGUI_IMPL_OPENGL_LOADER_xxx explanation above.
var current_texture: gl.GLint = undefined;
gl.glGetIntegerv(gl.GL_TEXTURE_BINDING_2D, ¤t_texture);
CreateDeviceObjects();
io.*.KeyMap[ig.ImGuiKey_Tab] = glfw.GLFW_KEY_TAB;
io.*.KeyMap[ig.ImGuiKey_Home] = glfw.GLFW_KEY_HOME;
io.*.KeyMap[ig.ImGuiKey_Insert] = glfw.GLFW_KEY_INSERT;
io.*.KeyMap[ig.ImGuiKey_KeyPadEnter] = glfw.GLFW_KEY_KP_ENTER;
io.*.KeyMap[ig.ImGuiKey_Escape] = glfw.GLFW_KEY_ESCAPE;
io.*.KeyMap[ig.ImGuiKey_Backspace] = glfw.GLFW_KEY_BACKSPACE;
io.*.KeyMap[ig.ImGuiKey_End] = glfw.GLFW_KEY_END;
io.*.KeyMap[ig.ImGuiKey_Enter] = glfw.GLFW_KEY_ENTER;
io.*.KeyMap[ig.ImGuiKey_LeftArrow] = glfw.GLFW_KEY_LEFT;
io.*.KeyMap[ig.ImGuiKey_RightArrow] = glfw.GLFW_KEY_RIGHT;
io.*.KeyMap[ig.ImGuiKey_UpArrow] = glfw.GLFW_KEY_UP;
io.*.KeyMap[ig.ImGuiKey_DownArrow] = glfw.GLFW_KEY_DOWN;
io.*.KeyMap[ig.ImGuiKey_PageUp] = glfw.GLFW_KEY_PAGE_UP;
io.*.KeyMap[ig.ImGuiKey_PageDown] = glfw.GLFW_KEY_PAGE_DOWN;
io.*.KeyMap[ig.ImGuiKey_Space] = glfw.GLFW_KEY_SPACE;
io.*.KeyMap[ig.ImGuiKey_V] = glfw.GLFW_KEY_V;
io.*.KeyMap[ig.ImGuiKey_X] = glfw.GLFW_KEY_X;
io.*.KeyMap[ig.ImGuiKey_Z] = glfw.GLFW_KEY_Z;
io.*.KeyMap[ig.ImGuiKey_A] = glfw.GLFW_KEY_A;
io.*.KeyMap[ig.ImGuiKey_C] = glfw.GLFW_KEY_C;
}
pub fn Shutdown() void {
DestroyDeviceObjects();
}
fn SetupRenderState(draw_data: *ig.ImDrawData, fb_width: c_int, fb_height: c_int, vertex_array_object: gl.GLuint) void {
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
gl.glEnable(gl.GL_BLEND);
gl.glBlendEquation(gl.GL_FUNC_ADD);
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA);
gl.glDisable(gl.GL_CULL_FACE);
gl.glDisable(gl.GL_DEPTH_TEST);
gl.glEnable(gl.GL_SCISSOR_TEST);
if (@hasDecl(gl, "glPolygonMode")) {
gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL);
}
// Setup viewport, orthographic projection matrix
// Our visible imgui space lies from draw_data.DisplayPos (top left) to draw_data.DisplayPos+data_data.DisplaySize (bottom right). DisplayPos is (0,0) for single viewport apps.
gl.glViewport(0, 0, @intCast(gl.GLsizei, fb_width), @intCast(gl.GLsizei, fb_height));
var L = draw_data.DisplayPos.x;
var R = draw_data.DisplayPos.x + draw_data.DisplaySize.x;
var T = draw_data.DisplayPos.y;
var B = draw_data.DisplayPos.y + draw_data.DisplaySize.y;
const ortho_projection = [4][4]f32{
[4]f32{ 2.0 / (R - L), 0.0, 0.0, 0.0 },
[4]f32{ 0.0, 2.0 / (T - B), 0.0, 0.0 },
[4]f32{ 0.0, 0.0, -1.0, 0.0 },
[4]f32{ (R + L) / (L - R), (T + B) / (B - T), 0.0, 1.0 },
};
var shader = zt.gl.Shader.from(g_ShaderHandle);
shader.bind();
gl.glUniform1i(g_AttribLocationTex, 0);
gl.glUniformMatrix4fv(g_AttribLocationProjMtx, 1, gl.GL_FALSE, &ortho_projection[0][0]);
if (@hasDecl(gl, "glBindSampler")) {
gl.glBindSampler(0, 0);
}
gl.glBindVertexArray(vertex_array_object);
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, g_VboHandle);
gl.glBindBuffer(gl.GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
gl.glEnableVertexAttribArray(@intCast(c_uint, g_AttribLocationVtxPos));
gl.glEnableVertexAttribArray(@intCast(c_uint, g_AttribLocationVtxUV));
gl.glEnableVertexAttribArray(@intCast(c_uint, g_AttribLocationVtxColor));
gl.glVertexAttribPointer(
@intCast(c_uint, g_AttribLocationVtxPos),
2,
gl.GL_FLOAT,
gl.GL_FALSE,
@sizeOf(ig.ImDrawVert),
@intToPtr(?*anyopaque, @offsetOf(ig.ImDrawVert, "pos")),
);
gl.glVertexAttribPointer(
@intCast(c_uint, g_AttribLocationVtxUV),
2,
gl.GL_FLOAT,
gl.GL_FALSE,
@sizeOf(ig.ImDrawVert),
@intToPtr(?*anyopaque, @offsetOf(ig.ImDrawVert, "uv")),
);
gl.glVertexAttribPointer(
@intCast(c_uint, g_AttribLocationVtxColor),
4,
gl.GL_UNSIGNED_BYTE,
gl.GL_TRUE,
@sizeOf(ig.ImDrawVert),
@intToPtr(?*anyopaque, @offsetOf(ig.ImDrawVert, "col")),
);
}
fn getGLInt(name: gl.GLenum) gl.GLint {
var value: gl.GLint = undefined;
gl.glGetIntegerv(name, &value);
return value;
}
fn getGLInts(name: gl.GLenum, comptime N: comptime_int) [N]gl.GLint {
var value: [N]gl.GLint = undefined;
gl.glGetIntegerv(name, &value);
return value;
}
pub fn RenderDrawData(draw_data: *ig.ImDrawData) void {
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
var fb_width = @floatToInt(c_int, draw_data.DisplaySize.x * draw_data.FramebufferScale.x);
var fb_height = @floatToInt(c_int, draw_data.DisplaySize.y * draw_data.FramebufferScale.y);
if (fb_width <= 0 or fb_height <= 0)
return;
var vertex_array_object: gl.GLuint = 0;
gl.glGenVertexArrays(1, &vertex_array_object);
SetupRenderState(draw_data, fb_width, fb_height, vertex_array_object);
var clip_off = draw_data.DisplayPos; // (0,0) unless using multi-viewports
var clip_scale = draw_data.FramebufferScale; // (1,1) unless using retina display which are often (2,2)
if (draw_data.CmdListsCount > 0) {
for (draw_data.CmdLists.?[0..@intCast(usize, draw_data.CmdListsCount)]) |cmd_list| {
// Upload vertex/index buffers
gl.glBufferData(gl.GL_ARRAY_BUFFER, @intCast(gl.GLsizeiptr, cmd_list.*.VtxBuffer.Size * @sizeOf(ig.ImDrawVert)), cmd_list.*.VtxBuffer.Data, gl.GL_STREAM_DRAW);
gl.glBufferData(gl.GL_ELEMENT_ARRAY_BUFFER, @intCast(gl.GLsizeiptr, cmd_list.*.IdxBuffer.Size * @sizeOf(ig.ImDrawIdx)), cmd_list.*.IdxBuffer.Data, gl.GL_STREAM_DRAW);
for (cmd_list.*.CmdBuffer.Data[0..@intCast(usize, cmd_list.*.CmdBuffer.Size)]) |pcmd| {
if (pcmd.UserCallback) |fnPtr| {
fnPtr(cmd_list, &pcmd);
} else {
// Project scissor/clipping rectangles into framebuffer space
var clip_rect = ig.ImVec4{
.x = (pcmd.ClipRect.x - clip_off.x) * clip_scale.x,
.y = (pcmd.ClipRect.y - clip_off.y) * clip_scale.y,
.z = (pcmd.ClipRect.z - clip_off.x) * clip_scale.x,
.w = (pcmd.ClipRect.w - clip_off.y) * clip_scale.y,
};
if (clip_rect.x < @intToFloat(f32, fb_width) and clip_rect.y < @intToFloat(f32, fb_height) and clip_rect.z >= 0.0 and clip_rect.w >= 0.0) {
gl.glScissor(@floatToInt(c_int, clip_rect.x), fb_height - @floatToInt(c_int, clip_rect.w), @floatToInt(c_int, clip_rect.z - clip_rect.x), @floatToInt(c_int, clip_rect.w - clip_rect.y));
// Bind texture, Draw
var texture = zt.gl.Texture.from(@intCast(gl.GLuint, @ptrToInt(pcmd.TextureId)), false);
texture.bind();
if (g_GlVersion >= 3200) {
gl.glDrawElementsBaseVertex(
gl.GL_TRIANGLES,
@intCast(gl.GLsizei, pcmd.ElemCount),
if (@sizeOf(ig.ImDrawIdx) == 2) gl.GL_UNSIGNED_SHORT else gl.GL_UNSIGNED_INT,
@intToPtr(?*const anyopaque, pcmd.IdxOffset * @sizeOf(ig.ImDrawIdx)),
@intCast(gl.GLint, pcmd.VtxOffset),
);
} else {
gl.glDrawElements(
gl.GL_TRIANGLES,
@intCast(gl.GLsizei, pcmd.ElemCount),
if (@sizeOf(ig.ImDrawIdx) == 2) gl.GL_UNSIGNED_SHORT else gl.GL_UNSIGNED_INT,
@intToPtr(?*const anyopaque, pcmd.IdxOffset * @sizeOf(ig.ImDrawIdx)),
);
}
}
}
}
}
}
// Destroy the temporary VAO
gl.glDeleteVertexArrays(1, &vertex_array_object);
gl.glScissor(0, 0, fb_width, fb_height);
}
fn CreateFontsTexture() bool {
// Build texture atlas
const io = ig.igGetIO();
var pixels: [*c]u8 = undefined;
var width: i32 = undefined;
var height: i32 = undefined;
ig.ImFontAtlas_GetTexDataAsRGBA32(io.*.Fonts, &pixels, &width, &height, null); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a hig.igher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
// Upload texture to graphics system
gl.glGenTextures(1, &g_FontTexture);
gl.glBindTexture(gl.GL_TEXTURE_2D, g_FontTexture);
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR);
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR);
if (@hasDecl(gl, "gl.GL_UNPACK_ROW_LENGTH"))
gl.glPixelStorei(gl.GL_UNPACK_ROW_LENGTH, 0);
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, width, height, 0, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, pixels);
// Store our identifier
io.*.Fonts.*.TexID = @intToPtr(*anyopaque, g_FontTexture);
return true;
}
fn DestroyFontsTexture() void {
if (g_FontTexture != 0) {
const io = ig.igGetIO();
gl.glDeleteTextures(1, &g_FontTexture);
io.*.Fonts.*.TexID = null;
g_FontTexture = 0;
}
}
fn CreateDeviceObjects() void {
// Parse GLSL version string
var glsl_version: u32 = 130;
const numberPart = g_GlslVersionStringMem["#version ".len..g_GlslVersionString.len];
if (std.fmt.parseInt(u32, numberPart, 10)) |value| {
glsl_version = value;
} else |_| {
std.debug.print("Couldn't parse glsl version from '{any}', '{any}'\n", .{ g_GlslVersionString, numberPart });
}
const vertex_shader_glsl_120 = "uniform mat4 ProjMtx;\n" ++
"attribute vec2 Position;\n" ++
"attribute vec2 UV;\n" ++
"attribute vec4 Color;\n" ++
"varying vec2 Frag_UV;\n" ++
"varying vec4 Frag_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Frag_UV = UV;\n" ++
" Frag_Color = Color;\n" ++
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" ++
"}\n";
const vertex_shader_glsl_130 = "uniform mat4 ProjMtx;\n" ++
"in vec2 Position;\n" ++
"in vec2 UV;\n" ++
"in vec4 Color;\n" ++
"out vec2 Frag_UV;\n" ++
"out vec4 Frag_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Frag_UV = UV;\n" ++
" Frag_Color = Color;\n" ++
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" ++
"}\n";
const vertex_shader_glsl_300_es = "precision mediump float;\n" ++
"layout (location = 0) in vec2 Position;\n" ++
"layout (location = 1) in vec2 UV;\n" ++
"layout (location = 2) in vec4 Color;\n" ++
"uniform mat4 ProjMtx;\n" ++
"out vec2 Frag_UV;\n" ++
"out vec4 Frag_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Frag_UV = UV;\n" ++
" Frag_Color = Color;\n" ++
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" ++
"}\n";
const vertex_shader_glsl_410_core = "layout (location = 0) in vec2 Position;\n" ++
"layout (location = 1) in vec2 UV;\n" ++
"layout (location = 2) in vec4 Color;\n" ++
"uniform mat4 ProjMtx;\n" ++
"out vec2 Frag_UV;\n" ++
"out vec4 Frag_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Frag_UV = UV;\n" ++
" Frag_Color = Color;\n" ++
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n" ++
"}\n";
const fragment_shader_glsl_120 = "#ifdef gl.GL_ES\n" ++
" precision mediump float;\n" ++
"#endif\n" ++
"uniform sampler2D Texture;\n" ++
"varying vec2 Frag_UV;\n" ++
"varying vec4 Frag_Color;\n" ++
"void main()\n" ++
"{\n" ++
" gl_FragColor = Frag_Color * texture2D(Texture, Frag_UV.st);\n" ++
"}\n";
const fragment_shader_glsl_130 = "uniform sampler2D Texture;\n" ++
"in vec2 Frag_UV;\n" ++
"in vec4 Frag_Color;\n" ++
"out vec4 Out_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" ++
"}\n";
const fragment_shader_glsl_300_es = "precision mediump float;\n" ++
"uniform sampler2D Texture;\n" ++
"in vec2 Frag_UV;\n" ++
"in vec4 Frag_Color;\n" ++
"layout (location = 0) out vec4 Out_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" ++
"}\n";
const fragment_shader_glsl_410_core = "in vec2 Frag_UV;\n" ++
"in vec4 Frag_Color;\n" ++
"uniform sampler2D Texture;\n" ++
"layout (location = 0) out vec4 Out_Color;\n" ++
"void main()\n" ++
"{\n" ++
" Out_Color = Frag_Color * texture(Texture, Frag_UV.st);\n" ++
"}\n";
// Select shaders matching our GLSL versions
var vertex_shader: [*]const u8 = undefined;
var fragment_shader: [*]const u8 = undefined;
if (glsl_version < 130) {
vertex_shader = vertex_shader_glsl_120;
fragment_shader = fragment_shader_glsl_120;
} else if (glsl_version >= 410) {
vertex_shader = vertex_shader_glsl_410_core;
fragment_shader = fragment_shader_glsl_410_core;
} else if (glsl_version == 300) {
vertex_shader = vertex_shader_glsl_300_es;
fragment_shader = fragment_shader_glsl_300_es;
} else {
vertex_shader = vertex_shader_glsl_130;
fragment_shader = fragment_shader_glsl_130;
}
// Create shaders
const vertex_shader_with_version = [_][*]const u8{ &g_GlslVersionStringMem, vertex_shader };
g_VertHandle = gl.glCreateShader(gl.GL_VERTEX_SHADER);
gl.glShaderSource(g_VertHandle, 2, &vertex_shader_with_version, null);
gl.glCompileShader(g_VertHandle);
const fragment_shader_with_version = [_][*]const u8{ &g_GlslVersionStringMem, fragment_shader };
g_FragHandle = gl.glCreateShader(gl.GL_FRAGMENT_SHADER);
gl.glShaderSource(g_FragHandle, 2, &fragment_shader_with_version, null);
gl.glCompileShader(g_FragHandle);
g_ShaderHandle = gl.glCreateProgram();
gl.glAttachShader(g_ShaderHandle, g_VertHandle);
gl.glAttachShader(g_ShaderHandle, g_FragHandle);
gl.glLinkProgram(g_ShaderHandle);
g_AttribLocationTex = gl.glGetUniformLocation(g_ShaderHandle, "Texture");
g_AttribLocationProjMtx = gl.glGetUniformLocation(g_ShaderHandle, "ProjMtx");
g_AttribLocationVtxPos = gl.glGetAttribLocation(g_ShaderHandle, "Position");
g_AttribLocationVtxUV = gl.glGetAttribLocation(g_ShaderHandle, "UV");
g_AttribLocationVtxColor = gl.glGetAttribLocation(g_ShaderHandle, "Color");
// Create buffers
gl.glGenBuffers(1, &g_VboHandle);
gl.glGenBuffers(1, &g_ElementsHandle);
_ = CreateFontsTexture();
}
fn DestroyDeviceObjects() void {
if (g_VboHandle != 0) {
gl.glDeleteBuffers(1, &g_VboHandle);
g_VboHandle = 0;
}
if (g_ElementsHandle != 0) {
gl.glDeleteBuffers(1, &g_ElementsHandle);
g_ElementsHandle = 0;
}
if (g_ShaderHandle != 0 and g_VertHandle != 0) {
gl.glDetachShader(g_ShaderHandle, g_VertHandle);
}
if (g_ShaderHandle != 0 and g_FragHandle != 0) {
gl.glDetachShader(g_ShaderHandle, g_FragHandle);
}
if (g_VertHandle != 0) {
gl.glDeleteShader(g_VertHandle);
g_VertHandle = 0;
}
if (g_FragHandle != 0) {
gl.glDeleteShader(g_FragHandle);
g_FragHandle = 0;
}
if (g_ShaderHandle != 0) {
gl.glDeleteProgram(g_ShaderHandle);
g_ShaderHandle = 0;
}
DestroyFontsTexture();
} | src/zt/imguiImplementation.zig |
const std = @import("std");
const expect = std.testing.expect;
const expectError = std.testing.expectError;
const expectEqual = std.testing.expectEqual;
test "switch prong with variable" {
try switchProngWithVarFn(SwitchProngWithVarEnum{ .One = 13 });
try switchProngWithVarFn(SwitchProngWithVarEnum{ .Two = 13.0 });
try switchProngWithVarFn(SwitchProngWithVarEnum{ .Meh = {} });
}
const SwitchProngWithVarEnum = union(enum) {
One: i32,
Two: f32,
Meh: void,
};
fn switchProngWithVarFn(a: SwitchProngWithVarEnum) !void {
switch (a) {
SwitchProngWithVarEnum.One => |x| {
try expect(x == 13);
},
SwitchProngWithVarEnum.Two => |x| {
try expect(x == 13.0);
},
SwitchProngWithVarEnum.Meh => |x| {
const v: void = x;
_ = v;
},
}
}
test "switch on enum using pointer capture" {
try testSwitchEnumPtrCapture();
comptime try testSwitchEnumPtrCapture();
}
fn testSwitchEnumPtrCapture() !void {
var value = SwitchProngWithVarEnum{ .One = 1234 };
switch (value) {
SwitchProngWithVarEnum.One => |*x| x.* += 1,
else => unreachable,
}
switch (value) {
SwitchProngWithVarEnum.One => |x| try expect(x == 1235),
else => unreachable,
}
}
test "switch handles all cases of number" {
try testSwitchHandleAllCases();
comptime try testSwitchHandleAllCases();
}
fn testSwitchHandleAllCases() !void {
try expect(testSwitchHandleAllCasesExhaustive(0) == 3);
try expect(testSwitchHandleAllCasesExhaustive(1) == 2);
try expect(testSwitchHandleAllCasesExhaustive(2) == 1);
try expect(testSwitchHandleAllCasesExhaustive(3) == 0);
try expect(testSwitchHandleAllCasesRange(100) == 0);
try expect(testSwitchHandleAllCasesRange(200) == 1);
try expect(testSwitchHandleAllCasesRange(201) == 2);
try expect(testSwitchHandleAllCasesRange(202) == 4);
try expect(testSwitchHandleAllCasesRange(230) == 3);
}
fn testSwitchHandleAllCasesExhaustive(x: u2) u2 {
return switch (x) {
0 => @as(u2, 3),
1 => 2,
2 => 1,
3 => 0,
};
}
fn testSwitchHandleAllCasesRange(x: u8) u8 {
return switch (x) {
0...100 => @as(u8, 0),
101...200 => 1,
201, 203 => 2,
202 => 4,
204...255 => 3,
};
}
test "switch all prongs unreachable" {
try testAllProngsUnreachable();
comptime try testAllProngsUnreachable();
}
fn testAllProngsUnreachable() !void {
try expect(switchWithUnreachable(1) == 2);
try expect(switchWithUnreachable(2) == 10);
}
fn switchWithUnreachable(x: i32) i32 {
while (true) {
switch (x) {
1 => return 2,
2 => break,
else => continue,
}
}
return 10;
}
fn return_a_number() anyerror!i32 {
return 1;
}
test "capture value of switch with all unreachable prongs" {
const x = return_a_number() catch |err| switch (err) {
else => unreachable,
};
try expect(x == 1);
}
test "anon enum literal used in switch on union enum" {
const Foo = union(enum) {
a: i32,
};
var foo = Foo{ .a = 1234 };
switch (foo) {
.a => |x| {
try expect(x == 1234);
},
}
}
test "else prong of switch on error set excludes other cases" {
const S = struct {
fn doTheTest() !void {
try expectError(error.C, bar());
}
const E = error{
A,
B,
} || E2;
const E2 = error{
C,
D,
};
fn foo() E!void {
return error.C;
}
fn bar() E2!void {
foo() catch |err| switch (err) {
error.A, error.B => {},
else => |e| return e,
};
}
};
try S.doTheTest();
comptime try S.doTheTest();
}
test "switch prongs with error set cases make a new error set type for capture value" {
const S = struct {
fn doTheTest() !void {
try expectError(error.B, bar());
}
const E = E1 || E2;
const E1 = error{
A,
B,
};
const E2 = error{
C,
D,
};
fn foo() E!void {
return error.B;
}
fn bar() E1!void {
foo() catch |err| switch (err) {
error.A, error.B => |e| return e,
else => {},
};
}
};
try S.doTheTest();
comptime try S.doTheTest();
}
test "return result loc and then switch with range implicit casted to error union" {
const S = struct {
fn doTheTest() !void {
try expect((func(0xb) catch unreachable) == 0xb);
}
fn func(d: u8) anyerror!u8 {
return switch (d) {
0xa...0xf => d,
else => unreachable,
};
}
};
try S.doTheTest();
comptime try S.doTheTest();
}
test "switch with null and T peer types and inferred result location type" {
const S = struct {
fn doTheTest(c: u8) !void {
if (switch (c) {
0 => true,
else => null,
}) |v| {
_ = v;
@panic("fail");
}
}
};
try S.doTheTest(1);
comptime try S.doTheTest(1);
}
test "switch prongs with cases with identical payload types" {
const Union = union(enum) {
A: usize,
B: isize,
C: usize,
};
const S = struct {
fn doTheTest() !void {
try doTheSwitch1(Union{ .A = 8 });
try doTheSwitch2(Union{ .B = -8 });
}
fn doTheSwitch1(u: Union) !void {
switch (u) {
.A, .C => |e| {
try expect(@TypeOf(e) == usize);
try expect(e == 8);
},
.B => |e| {
_ = e;
@panic("fail");
},
}
}
fn doTheSwitch2(u: Union) !void {
switch (u) {
.A, .C => |e| {
_ = e;
@panic("fail");
},
.B => |e| {
try expect(@TypeOf(e) == isize);
try expect(e == -8);
},
}
}
};
try S.doTheTest();
comptime try S.doTheTest();
}
test "switch on pointer type" {
const S = struct {
const X = struct {
field: u32,
};
const P1 = @intToPtr(*X, 0x400);
const P2 = @intToPtr(*X, 0x800);
const P3 = @intToPtr(*X, 0xC00);
fn doTheTest(arg: *X) i32 {
switch (arg) {
P1 => return 1,
P2 => return 2,
else => return 3,
}
}
};
try expect(1 == S.doTheTest(S.P1));
try expect(2 == S.doTheTest(S.P2));
try expect(3 == S.doTheTest(S.P3));
comptime try expect(1 == S.doTheTest(S.P1));
comptime try expect(2 == S.doTheTest(S.P2));
comptime try expect(3 == S.doTheTest(S.P3));
}
test "switch on error set with single else" {
const S = struct {
fn doTheTest() !void {
var some: error{Foo} = error.Foo;
try expect(switch (some) {
else => |a| blk: {
a catch {};
break :blk true;
},
});
}
};
try S.doTheTest();
comptime try S.doTheTest();
}
test "switch capture copies its payload" {
const S = struct {
fn doTheTest() !void {
var tmp: union(enum) {
A: u8,
B: u32,
} = .{ .A = 42 };
switch (tmp) {
.A => |value| {
// Modify the original union
tmp = .{ .B = 0x10101010 };
try expectEqual(@as(u8, 42), value);
},
else => unreachable,
}
}
};
try S.doTheTest();
comptime try S.doTheTest();
} | test/behavior/switch_stage1.zig |
const std = @import("std");
const builtin = @import("builtin");
const zwl = @import("zwl.zig");
const Allocator = std.mem.Allocator;
const log = std.log.scoped(.zwl);
pub fn Platform(comptime Parent: anytype) type {
return struct {
const c = @cImport({
@cInclude("X11/X.h");
@cInclude("X11/Xlib.h");
if (Parent.settings.backends_enabled.opengl) {
@cInclude("GL/gl.h");
@cInclude("GL/glx.h");
}
});
const Self = @This();
const GlXCreateContextAttribsARB = fn (
dpy: *c.Display,
config: c.GLXFBConfig,
share_context: c.GLXContext,
direct: c.Bool,
attrib_list: [*:0]const c_int,
) c.GLXContext;
const PlatformGLData = struct {
glxCreateContextAttribsARB: GlXCreateContextAttribsARB,
};
parent: Parent,
display: *c.Display,
root_window: c_ulong,
gl: if (Parent.settings.backends_enabled.opengl) PlatformGLData else void,
pub fn init(allocator: Allocator, options: zwl.PlatformOptions) !*Parent {
var self = try allocator.create(Self);
errdefer allocator.destroy(self);
var display = c.XOpenDisplay(null) orelse return error.FailedToOpenDisplay;
errdefer _ = c.XCloseDisplay(display);
var root = DefaultRootWindow(display); //orelse return error.FailedToGetRootWindow;
self.* = .{
.parent = .{
.allocator = allocator,
.type = .Xlib,
.window = undefined,
.windows = if (!Parent.settings.single_window) &[0]*Parent.Window{} else undefined,
},
.display = display,
.root_window = root,
.gl = undefined,
};
if (Parent.settings.backends_enabled.opengl) {
self.gl.glxCreateContextAttribsARB = @ptrCast(
GlXCreateContextAttribsARB,
c.glXGetProcAddress("glXCreateContextAttribsARB") orelse return error.InvalidOpenGL,
);
var glx_major: c_int = 0;
var glx_minor: c_int = 0;
// FBConfigs were added in GLX version 1.3.
if (0 == c.glXQueryVersion(display, &glx_major, &glx_minor))
return error.GlxFailure;
if ((glx_major < 1) or ((glx_major == 1) and (glx_minor < 3)))
return error.UnsupportedGlxVersion;
const extensions = std.mem.span(c.glXQueryExtensionsString(
display,
DefaultScreen(display),
));
var ext_iter = std.mem.tokenize(extensions, " ");
const has_ext = while (ext_iter.next()) |extension| {
if (std.mem.eql(u8, extension, "GLX_ARB_create_context"))
break true;
} else false;
if (!has_ext)
return error.UnsupportedGlxVersion;
}
std.log.scoped(.zwl).info("Platform Initialized: Xlib", .{});
return @ptrCast(*Parent, self);
}
pub fn deinit(self: *Self) void {
_ = c.XCloseDisplay(self.display);
self.parent.allocator.destroy(self);
}
pub fn waitForEvent(self: *Self) error{}!Parent.Event {
while (true) {
var xev = std.mem.zeroes(c.XEvent);
_ = c.XNextEvent(self.display, &xev);
switch (xev.type) {
c.Expose => {
const ev = xev.xexpose;
if (self.getWindowById(ev.window)) |window| {
_ = c.XSendEvent(
self.display,
ev.window,
c.False,
c.ExposureMask,
&c.XEvent{
.xexpose = .{
.type = c.Expose,
.serial = 0,
.send_event = c.False,
.display = self.display,
.window = ev.window,
.x = 0,
.y = 0,
.width = window.width,
.height = window.height,
.count = 0,
},
},
);
return Parent.Event{
.WindowDamaged = .{
.window = &window.parent,
.x = @intCast(u16, ev.x),
.y = @intCast(u16, ev.y),
.w = @intCast(u16, ev.width),
.h = @intCast(u16, ev.height),
},
};
}
},
c.KeyPress,
c.KeyRelease,
=> {
const ev = xev.xkey;
if (self.getWindowById(ev.window)) |window| {
var kev = zwl.KeyEvent{
.scancode = @intCast(u8, ev.keycode - 8),
};
return switch (ev.type) {
c.KeyPress => Parent.Event{ .KeyDown = kev },
c.KeyRelease => Parent.Event{ .KeyUp = kev },
else => unreachable,
};
}
},
c.ButtonPress,
c.ButtonRelease,
=> {
const ev = xev.xbutton;
if (self.getWindowById(ev.window)) |window| {
var bev = zwl.MouseButtonEvent{
.x = @intCast(i16, ev.x),
.y = @intCast(i16, ev.y),
.button = @intToEnum(zwl.MouseButton, @intCast(u8, ev.button)),
};
return switch (ev.type) {
c.ButtonPress => Parent.Event{ .MouseButtonDown = bev },
c.ButtonRelease => Parent.Event{ .MouseButtonUp = bev },
else => unreachable,
};
}
},
c.MotionNotify => {
const ev = xev.xmotion;
if (self.getWindowById(ev.window)) |window| {
return Parent.Event{
.MouseMotion = zwl.MouseMotionEvent{
.x = @intCast(i16, ev.x),
.y = @intCast(i16, ev.y),
},
};
}
},
c.CirculateNotify, c.CreateNotify, c.GravityNotify, c.MapNotify, c.ReparentNotify, c.UnmapNotify => {
// Whatever
},
c.ConfigureNotify => {
const ev = xev.xconfigure;
if (self.getWindowById(ev.window)) |window| {
if (window.width != ev.width or window.height != ev.height) {
window.width = @intCast(u16, ev.width);
window.height = @intCast(u16, ev.height);
return Parent.Event{ .WindowResized = @ptrCast(*Parent.Window, window) };
}
}
},
c.DestroyNotify => {
const ev = xev.xdestroywindow;
if (self.getWindowById(ev.window)) |window| {
window.window = 0;
return Parent.Event{ .WindowDestroyed = @ptrCast(*Parent.Window, window) };
}
},
else => {
log.info("unhandled event {}", .{xev.type});
},
}
}
}
pub fn getOpenGlProcAddress(self: *Self, entry_point: [:0]const u8) ?*c_void {
return @intToPtr(?*c_void, @ptrToInt(c.glXGetProcAddress(entry_point.ptr)));
}
pub fn createWindow(self: *Self, options: zwl.WindowOptions) !*Parent.Window {
var window = try self.parent.allocator.create(Window);
errdefer self.parent.allocator.destroy(window);
try window.init(self, options);
return @ptrCast(*Parent.Window, window);
}
fn getWindowById(self: *Self, id: c.Window) ?*Window {
if (Parent.settings.single_window) {
const win = @ptrCast(*Window, self.parent.window);
if (id == win.window)
return win;
} else {
return for (self.parent.windows) |pwin| {
const win = @ptrCast(*Window, pwin);
if (win.window == id)
return win;
} else null;
}
return null;
}
const WindowGLData = struct {
glx_context: c.GLXContext,
};
pub const Window = struct {
parent: Parent.Window,
width: u16,
height: u16,
window: c.Window,
gl: if (Parent.settings.backends_enabled.opengl) ?WindowGLData else void,
pub fn init(self: *Window, parent: *Self, options: zwl.WindowOptions) !void {
self.* = .{
.parent = .{
.platform = @ptrCast(*Parent, parent),
},
.width = options.width orelse 800,
.height = options.height orelse 600,
.window = undefined,
.gl = if (Parent.settings.backends_enabled.opengl) null else {},
};
switch (options.backend) {
.opengl => |version| {
try self.initGL(parent, options);
return;
},
.none => {},
else => return error.NotImplementedYet,
}
var swa = std.mem.zeroes(c.XSetWindowAttributes);
swa.event_mask = c.StructureNotifyMask;
swa.event_mask |= if (options.track_damage == true) c.ExposureMask else 0;
swa.event_mask |= if (options.track_mouse == true) c.ButtonPressMask | c.ButtonReleaseMask | c.PointerMotionMask else 0;
swa.event_mask |= if (options.track_keyboard == true) c.KeyPressMask | c.KeyReleaseMask else 0;
self.window = c.XCreateWindow(
parent.display,
DefaultRootWindow(parent.display),
0,
0,
self.width,
self.height,
0,
c.CopyFromParent,
c.InputOutput,
c.CopyFromParent,
c.CWEventMask,
&swa,
);
_ = c.XMapWindow(parent.display, self.window);
_ = c.XStoreName(parent.display, self.window, "VERY SIMPLE APPLICATION");
}
fn initGL(self: *Window, parent: *Self, options: zwl.WindowOptions) !void {
if (!Parent.settings.backends_enabled.opengl) {
return error.PlatformNotEnabled;
}
const visual_attribs = [_:0]c_int{
c.GLX_X_RENDERABLE, c.True,
c.GLX_DRAWABLE_TYPE, c.GLX_WINDOW_BIT,
c.GLX_RENDER_TYPE, c.GLX_RGBA_BIT,
c.GLX_X_VISUAL_TYPE, c.GLX_TRUE_COLOR,
c.GLX_RED_SIZE, 8,
c.GLX_GREEN_SIZE, 8,
c.GLX_BLUE_SIZE, 8,
c.GLX_ALPHA_SIZE, 8,
c.GLX_DEPTH_SIZE, 24,
c.GLX_STENCIL_SIZE, 8,
c.GLX_DOUBLEBUFFER, c.True,
//GLX_SAMPLE_BUFFERS , 1,
//GLX_SAMPLES , 4,
c.None,
};
var fbcount: c_int = 0;
const fbc: [*]c.GLXFBConfig = c.glXChooseFBConfig(
parent.display,
DefaultScreen(parent.display),
&visual_attribs,
&fbcount,
) orelse return error.GlxFailure;
defer _ = c.XFree(fbc);
// Pick the FB config/visual with the most samples per pixel
var best_fbc: c_int = -1;
var best_num_samp: c_int = -1;
var i: c_int = 0;
while (i < fbcount) : (i += 1) {
const current_fbc = fbc[@intCast(usize, i)];
const vi: *c.XVisualInfo = c.glXGetVisualFromFBConfig(
parent.display,
current_fbc,
) orelse continue;
defer _ = c.XFree(vi);
var samp_buf: c_int = 0;
var samples: c_int = 0;
_ = c.glXGetFBConfigAttrib(
parent.display,
current_fbc,
c.GLX_SAMPLE_BUFFERS,
&samp_buf,
);
_ = c.glXGetFBConfigAttrib(
parent.display,
current_fbc,
c.GLX_SAMPLES,
&samples,
);
if (best_fbc < 0 or samp_buf != 0 and samples > best_num_samp) {
best_fbc = i;
best_num_samp = samples;
}
}
var bestFbc = fbc[@intCast(usize, best_fbc)];
// Get a visual
const vi: *c.XVisualInfo = c.glXGetVisualFromFBConfig(
parent.display,
bestFbc,
) orelse return error.GlxFailure;
defer _ = c.XFree(vi);
const colormap: c.Colormap = c.XCreateColormap(
parent.display,
RootWindow(parent.display, vi.screen),
vi.visual,
c.AllocNone,
);
var swa = std.mem.zeroes(c.XSetWindowAttributes);
swa.colormap = colormap;
swa.event_mask = c.StructureNotifyMask;
swa.background_pixmap = c.None;
swa.border_pixel = 0;
swa.event_mask |= if (options.track_damage == true) c.ExposureMask else 0;
swa.event_mask |= if (options.track_mouse == true) c.ButtonPressMask | c.ButtonReleaseMask | c.PointerMotionMask else 0;
swa.event_mask |= if (options.track_keyboard == true) c.KeyPressMask | c.KeyReleaseMask else 0;
self.window = c.XCreateWindow(
parent.display,
RootWindow(parent.display, vi.screen),
0,
0,
self.width,
self.height,
0,
vi.depth,
c.InputOutput,
vi.visual,
c.CWBorderPixel | c.CWColormap | c.CWEventMask,
&swa,
);
if (self.window == 0)
return error.CouldNotCreateWindow;
_ = c.XMapWindow(parent.display, self.window);
_ = c.XStoreName(parent.display, self.window, "VERY SIMPLE APPLICATION");
const version = options.backend.opengl;
self.gl = WindowGLData{
.glx_context = parent.gl.glxCreateContextAttribsARB(
parent.display,
bestFbc,
null,
c.True,
&[_:0]c_int{
c.GLX_CONTEXT_MAJOR_VERSION_ARB, version.major,
c.GLX_CONTEXT_MINOR_VERSION_ARB, version.minor,
c.GLX_CONTEXT_FLAGS_ARB, c.GLX_CONTEXT_DEBUG_BIT_ARB | c.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
c.GLX_CONTEXT_PROFILE_MASK_ARB, if (version.core) c.GLX_CONTEXT_CORE_PROFILE_BIT_ARB else c.GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
0,
},
) orelse return error.InvalidOpenGL,
};
_ = c.glXMakeCurrent(
parent.display,
self.window,
self.gl.?.glx_context,
);
}
pub fn deinit(self: *Window) void {
var platform = @ptrCast(*Self, self.parent.platform);
if (Parent.settings.backends_enabled.opengl) {
if (self.gl) |gl| {
c.glXDestroyContext(platform.display, gl.glx_context);
}
}
if (self.window != 0) {
_ = c.XDestroyWindow(platform.display, self.window);
}
platform.parent.allocator.destroy(self);
}
pub fn present(self: *Window) void {
c.glXSwapBuffers(@ptrCast(*Self, self.parent.platform).display, self.window);
}
pub fn configure(self: *Window, options: zwl.WindowOptions) !void {
// Do
}
pub fn getSize(self: *Window) [2]u16 {
return [2]u16{ self.width, self.height };
}
pub fn mapPixels(self: *Window) !zwl.PixelBuffer {
return error.Unimplemented;
}
pub fn submitPixels(self: *Window, pdates: []const zwl.UpdateArea) !void {
return error.Unimplemented;
}
};
inline fn RootWindow(dpy: *c.Display, screen: c_int) c.Window {
const private_display = @ptrCast(c._XPrivDisplay, @alignCast(@alignOf(c._XPrivDisplay), dpy));
return ScreenOfDisplay(
private_display,
@intCast(usize, screen),
).root;
}
inline fn DefaultRootWindow(dpy: *c.Display) c.Window {
const private_display = @ptrCast(c._XPrivDisplay, @alignCast(@alignOf(c._XPrivDisplay), dpy));
return ScreenOfDisplay(
private_display,
@intCast(usize, private_display.*.default_screen),
).root;
}
inline fn DefaultScreen(dpy: *c.Display) c_int {
return @ptrCast(c._XPrivDisplay, @alignCast(@alignOf(c._XPrivDisplay), dpy)).*.default_screen;
}
inline fn ScreenOfDisplay(dpy: c._XPrivDisplay, scr: usize) *c.Screen {
return @ptrCast(*c.Screen, &dpy.*.screens[scr]);
}
};
} | didot-zwl/zwl/src/xlib.zig |
const std = @import("std");
const fs = std.fs;
const mem = std.mem;
const hm = std.hash_map;
const print = std.debug.print;
const assert = std.debug.assert;
const BlackTileMap = hm.HashMap(Pos, bool, hashPos, eqlPos, 80);
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = &gpa.allocator;
const input = try fs.cwd().readFileAlloc(allocator, "data/input_24_1.txt", std.math.maxInt(usize));
var black_tiles = BlackTileMap.init(allocator);
defer black_tiles.deinit();
{ // Solution 1
var lines = mem.tokenize(input, "\n");
while (lines.next()) |raw_line| {
const line = mem.trim(u8, raw_line, " \r\n");
if (line.len == 0) break;
var p = Pos.init(0, 0);
{ var i: usize = 0; while (i < line.len) : (i += 1) {
switch (line[i]) {
'n' => {
i += 1;
p.y -= 1;
if ((p.y & 1) == 0 and line[i] == 'e') {
p.x += 1;
}
else if ((p.y & 1) == 1 and line[i] == 'w') {
p.x -= 1;
}
},
's' => {
i += 1;
p.y += 1;
if ((p.y & 1) == 0 and line[i] == 'e') {
p.x += 1;
}
else if ((p.y & 1) == 1 and line[i] == 'w') {
p.x -= 1;
}
},
'e' => { p.x += 1; },
'w' => { p.x -= 1; },
else => unreachable
}
}}
if (black_tiles.remove(p) == null) {
try black_tiles.put(p, true);
//print("Flipped to black: ({}, {})\n", .{p.x, p.y});
} else {
//print("Flipped to white: ({}, {})\n", .{p.x, p.y});
}
}
print("Day 24 - Solution 1: {}\n", .{ black_tiles.count() });
}
{ // Solution 2
var floor = try Floor.initFromTiles(black_tiles);
defer floor.deinit();
var day: usize = 0;
while (day < 100) : (day += 1) {
try updateFloor(allocator, &floor);
//print("Day {}: Black tiles: {}\n", .{ day + 1, floor.blacks.count() });
}
print("Day 24 - Solution 2: {}\n", .{floor.blacks.count()});
}
}
const Pos = struct {
x: i32 = 0,
y: i32 = 0,
const Self = @This();
pub fn init(x: i32, y: i32) Self {
return .{ .x = x, .y = y };
}
pub fn range(s: Self, e: Self) Range {
assert(e.x >= s.x);
assert(e.y >= s.y);
return Range{ .first_x = s.x, .curr = s, .last = e };
}
const Range = struct {
first_x: i32,
curr: Self,
last: Self,
pub fn next(r: *Range) ?Self {
if (r.curr.y == r.last.y) return null;
var res = r.curr;
r.curr.x += 1;
if (r.curr.x == r.last.x) {
r.curr.x = r.first_x;
r.curr.y += 1;
}
return res;
}
};
};
fn eqlPos(a: Pos, b: Pos) bool {
return a.x == b.x and a.y == b.y;
}
fn hashPos(p: Pos) u64 {
const v = @as(i64, p.x) + @as(i64, p.y) << 32;
var hasher = std.hash.Wyhash.init(0);
std.hash.autoHash(&hasher, v);
return hasher.final();
}
const Floor = struct {
blacks: BlackTileMap,
min: Pos = Pos.init(0, 0),
max: Pos = Pos.init(0, 0),
const Self = @This();
pub fn init(a: *std.mem.Allocator) Self {
return .{ .blacks = BlackTileMap.init(a) };
}
pub fn initFromTiles(bts: BlackTileMap) !Self {
var r = Self{ .blacks = try bts.clone() };
var it = bts.iterator();
while (it.next()) |entry| {
r.updateBounds(entry.key);
}
return r;
}
pub fn deinit(s: *Self) void {
s.blacks.deinit();
}
fn updateBounds(s: *Self, p: Pos) void {
s.min.x = std.math.min(s.min.x, p.x - 2);
s.min.y = std.math.min(s.min.y, p.y - 2);
s.max.x = std.math.max(s.max.x, p.x + 3);
s.max.y = std.math.max(s.max.y, p.y + 3);
}
fn insertBlack(s: *Self, p: Pos) !void {
try s.blacks.put(p, true);
s.updateBounds(p);
}
};
fn updateFloor(a: *std.mem.Allocator, f: *Floor) !void {
var range = f.min.range(f.max);
var new_floor = Floor.init(a);
// print("Updating between: ({}, {}) - ({}, {})\n", .{f.min.x, f.min.y, f.max.x, f.max.y});
while (range.next()) |pos| {
// print("Testing position: ({}, {})\n", .{pos.x, pos.y});
const black = f.blacks.contains(pos);
const c = countBlackNeighbors(f, pos);
if (black) {
if (c == 1 or c == 2) {
try new_floor.insertBlack(pos);
}
}
else {
if (c == 2) {
try new_floor.insertBlack(pos);
}
}
}
f.deinit();
f.* = new_floor;
}
fn countBlackNeighbors(f: *const Floor, p: Pos) u32 {
var nb: [6]Pos = undefined;
nb[0] = Pos.init(p.x - 1, p.y);
nb[1] = Pos.init(p.x + 1, p.y);
if ((p.y & 1) == 0) {
nb[2] = Pos.init(p.x - 1 , p.y - 1);
nb[3] = Pos.init(p.x, p.y - 1);
nb[4] = Pos.init(p.x - 1, p.y + 1);
nb[5] = Pos.init(p.x, p.y + 1);
}
else {
nb[2] = Pos.init(p.x, p.y - 1);
nb[3] = Pos.init(p.x + 1, p.y - 1);
nb[4] = Pos.init(p.x, p.y + 1);
nb[5] = Pos.init(p.x + 1, p.y + 1);
}
var count: u32 = 0;
for (nb) |n| {
if (f.blacks.contains(n)) {
count += 1;
}
}
return count;
} | 2020/src/day_24.zig |
const std = @import("std");
const mem = std.mem;
const ArrayList = std.ArrayList;
const node = @import("node.zig");
const Document = node.Document;
const Element = node.Element;
const Token = @import("token.zig").Token;
const Tokenizer = @import("tokenizer.zig").Tokenizer;
const ParseError = @import("parse_error.zig").ParseError;
pub const Parser = struct {
const Self = @This();
/// The insertion mode is a state variable that controls the primary operation of the tree construction stage.
/// https://html.spec.whatwg.org/multipage/parsing.html#the-insertion-mode
pub const InsertionMode = enum {
Initial,
BeforeHtml,
BeforeHead,
InHead,
InHeadNoscript,
AfterHead,
InBody,
Text,
InTable,
InTableText,
InCaption,
InColumnGroup,
InTableBody,
InRow,
InCell,
InSelect,
InSelectInTable,
InTemplate,
AfterBody,
InFrameset,
AfterFrameset,
AfterAfterBody,
AfterAfterFrameset,
};
allocator: *mem.Allocator,
tokenizer: *Tokenizer,
stackOfOpenElements: ArrayList(Element),
insertionMode: InsertionMode,
reprocess: bool = false,
lastToken: Token = undefined,
context: ?Element = null,
pub fn init(allocator: *mem.Allocator, tokenizer: *Tokenizer) Parser {
var stackOfOpenElements = ArrayList(Element).init(allocator);
return Parser {
.allocator = allocator,
.tokenizer = tokenizer,
.stackOfOpenElements = stackOfOpenElements,
.insertionMode = .Initial,
};
}
pub fn adjustedCurrentNode(self: *Self) Element {
// The adjusted current node is the context element if the parser was created as part of the HTML fragment
// parsing algorithm and the stack of open elements has only one element in it (fragment case); otherwise,
// the adjusted current node is the current node.
if (self.context) |ctx| {
if (self.stackOfOpenElements.items.len == 1) {
return ctx;
}
}
var elementStack = self.stackOfOpenElements.items;
return elementStack[elementStack.len - 1];
}
pub fn parse(self: *Self) !Document {
var document = Document.init(self.allocator);
while (true) {
var token: ?Token = null;
if (self.reprocess) {
token = self.lastToken;
} else {
token = self.tokenizer.nextToken() catch |err| {
document.parseErrors.append(err) catch unreachable;
continue;
};
}
if (token) |tok| {
self.lastToken = tok;
if (// If the stack of open elements is empty
(self.stackOfOpenElements.items.len == 0) or
// If the adjusted current node is an element in the HTML namespace
(self.adjustedCurrentNode().isInNamespace(.HTML)) or
// If the adjusted current node is a MathML text integration point and the token is a start tag
// whose tag name is neither "mglyph" nor "malignmark"
(self.adjustedCurrentNode().isMathMLTextIntegrationPoint() and
tok == Token.StartTag and
(mem.eql(u8, tok.StartTag.name.?, "mglyph")
or (mem.eql(u8, tok.StartTag.name.?, "malignmark")))) or
// If the adjusted current node is a MathML text integration point and the token is a character token
(self.adjustedCurrentNode().isMathMLTextIntegrationPoint() and
tok == Token.Character) or
// If the adjusted current node is a MathML annotation-xml element and the token is a start tag whose tag name is "svg"
(mem.eql(u8, self.adjustedCurrentNode().name, "annotation-xml") and
tok == Token.StartTag and
mem.eql(u8, tok.StartTag.name.?, "svg")) or
// If the adjusted current node is an HTML integration point and the token is a start tag
(self.adjustedCurrentNode().isHTMLIntegrationPoint() and tok == Token.StartTag) or
// If the adjusted current node is an HTML integration point and the token is a character token
(self.adjustedCurrentNode().isHTMLIntegrationPoint() and tok == Token.Character) or
// If the token is an end-of-file token
(tok == Token.EndOfFile)) {
switch (self.insertionMode) {
.Initial => {
self.handleInitialInsertionMode(&document, tok);
},
.BeforeHtml => {
self.handleBeforeHtmlInsertionMode(&document, tok);
},
else => {
std.debug.warn("{}\n", .{ self.insertionMode });
break;
}
}
} else {
// TODO: Process the token according to the rules given in the section for parsing tokens in foreign content.
unreachable;
}
}
}
return document;
}
// pub fn parseFragment(self: *Self, input: []const u8) !Document { }
fn handleInitialInsertionMode(self: *Self, document: *Document, token: Token) void {
switch (token) {
Token.Character => |tok| {
if (tok.data == '\t' or tok.data == ' ' or tok.data == 0x000A or
tok.data == 0x000C or tok.data == 0x000D) {
// Ignore and do nothing
return;
}
},
Token.Comment => |tok| {
document.appendNode(node.Node { .Comment = .{ .data = tok.data.? } });
return;
},
Token.DOCTYPE => |tok| {
if ((tok.name != null and !mem.eql(u8, tok.name.?, "html")) or
(tok.publicIdentifier != null and tok.publicIdentifier.?.len != 0) or
(tok.systemIdentifier != null and !mem.eql(u8, tok.systemIdentifier.?, "about:legacy-compat"))) {
document.parseErrors.append(ParseError.Default) catch unreachable;
}
var doctype = node.DocumentType {
.name = if (tok.name == null) "" else tok.name.?,
.publicId = if (tok.publicIdentifier == null) "" else tok.publicIdentifier.?,
.systemId = if (tok.systemIdentifier == null) "" else tok.systemIdentifier.?,
};
document.appendNode(node.Node { .DocumentType = doctype });
document.doctype = doctype;
if (tok.forceQuirks or
mem.eql(u8, doctype.publicId, "-//W3O//DTD W3 HTML Strict 3.0//EN//") or
mem.eql(u8, doctype.publicId, "-/W3C/DTD HTML 4.0 Transitional/EN") or
mem.eql(u8, doctype.publicId, "HTML") or
mem.eql(u8, doctype.systemId, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") or
mem.startsWith(u8, doctype.publicId, "+//Silmaril//dtd html Pro v0r11 19970101//") or
mem.startsWith(u8, doctype.publicId, "-//AS//DTD HTML 3.0 asWedit + extensions//") or
mem.startsWith(u8, doctype.publicId, "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.0 Level 1//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.0 Level 2//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.0 Strict Level 1//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.0 Strict Level 2//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.0 Strict//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.0//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 2.1E//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 3.0//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 3.2 Final//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 3.2//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML 3//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Level 0//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Level 1//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Level 2//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Level 3//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Strict Level 0//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Strict Level 1//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Strict Level 2//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Strict Level 3//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML Strict//") or
mem.startsWith(u8, doctype.publicId, "-//IETF//DTD HTML//") or
mem.startsWith(u8, doctype.publicId, "-//Metrius//DTD Metrius Presentational//") or
mem.startsWith(u8, doctype.publicId, "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//") or
mem.startsWith(u8, doctype.publicId, "-//Microsoft//DTD Internet Explorer 2.0 HTML//") or
mem.startsWith(u8, doctype.publicId, "-//Microsoft//DTD Internet Explorer 2.0 Tables//") or
mem.startsWith(u8, doctype.publicId, "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//") or
mem.startsWith(u8, doctype.publicId, "-//Microsoft//DTD Internet Explorer 3.0 HTML//") or
mem.startsWith(u8, doctype.publicId, "-//Microsoft//DTD Internet Explorer 3.0 Tables//") or
mem.startsWith(u8, doctype.publicId, "-//Netscape Comm. Corp.//DTD HTML//") or
mem.startsWith(u8, doctype.publicId, "-//Netscape Comm. Corp.//DTD Strict HTML//") or
mem.startsWith(u8, doctype.publicId, "-//O'Reilly and Associates//DTD HTML 2.0//") or
mem.startsWith(u8, doctype.publicId, "-//O'Reilly and Associates//DTD HTML Extended 1.0//") or
mem.startsWith(u8, doctype.publicId, "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//") or
mem.startsWith(u8, doctype.publicId, "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//") or
mem.startsWith(u8, doctype.publicId, "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//") or
mem.startsWith(u8, doctype.publicId, "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//") or
mem.startsWith(u8, doctype.publicId, "-//Spyglass//DTD HTML 2.0 Extended//") or
mem.startsWith(u8, doctype.publicId, "-//Sun Microsystems Corp.//DTD HotJava HTML//") or
mem.startsWith(u8, doctype.publicId, "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 3 1995-03-24//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 3.2 Draft//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 3.2 Final//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 3.2//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 3.2S Draft//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 4.0 Frameset//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML 4.0 Transitional//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML Experimental 19960712//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD HTML Experimental 970421//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD W3 HTML//") or
mem.startsWith(u8, doctype.publicId, "-//W3O//DTD W3 HTML 3.0//") or
mem.startsWith(u8, doctype.publicId, "-//WebTechs//DTD Mozilla HTML 2.0//") or
mem.startsWith(u8, doctype.publicId, "-//WebTechs//DTD Mozilla HTML//") or
mem.startsWith(u8, doctype.systemId, "-//W3C//DTD HTML 4.01 Frameset//") or
mem.startsWith(u8, doctype.systemId, "-//W3C//DTD HTML 4.01 Transitional//")) {
document.quirksMode = true;
return;
} else if (mem.startsWith(u8, doctype.publicId, "-//W3C//DTD XHTML 1.0 Frameset//") or
mem.startsWith(u8, doctype.publicId, "-//W3C//DTD XHTML 1.0 Transitional//") or
(doctype.systemId.len != 0 and mem.startsWith(u8, doctype.systemId, "-//W3C//DTD HTML 4.01 Frameset//")) or
(doctype.systemId.len != 0 and mem.startsWith(u8, doctype.systemId, "-//W3C//DTD HTML 4.01 Transitional//"))) {
self.insertionMode = .BeforeHtml;
return;
}
},
else => {}
}
self.reprocess = true;
self.insertionMode = .BeforeHtml;
document.quirksMode = true;
document.parseErrors.append(ParseError.Default) catch unreachable;
}
fn handleBeforeHtmlInsertionMode(self: *Self, document: *Document, token: Token) void {
switch (token) {
Token.DOCTYPE => {
document.parseErrors.append(ParseError.Default) catch unreachable;
return;
},
Token.Comment => |tok| {
document.appendNode(node.Node { .Comment = .{ .data = tok.data.? } });
return;
},
Token.Character => |tok| {
if (tok.data == '\t' or tok.data == ' ' or tok.data == 0x000A or
tok.data == 0x000C or tok.data == 0x000D) {
// Ignore and do nothing
return;
}
},
Token.StartTag => |tok| {
if (mem.eql(u8, tok.name.?, "html")) {
var element = self.createElementForToken(document, token);
}
},
else => {}
}
}
fn createElementForToken(self: Self, document: *Document, token: Token) Element {
var local_name = token.StartTag.name.?;
var is = token.StartTag.attributes.get("is");
var definition: ?Element = null; // TODO: Look up custom element definition
var will_execute_script = definition != null and self.context == null;
if (will_execute_script) {
// will execute script
document.throwOnDynamicMarkupInsertionCounter += 1;
// TODO: If the JavaScript execution context stack is empty, then perform a microtask checkpoint.
// TODO: Push a new element queue onto document's relevant agent's custom element reactions stack.
}
var element = Element.init();
}
}; | src/parser.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day11.txt");
pub const OctapusGrid = struct {
const Self = @This();
values: []u8,
width: u32,
allocator: *util.Allocator,
pub fn initFromSerializedData(allocator: *util.Allocator, serialized_data: []const u8) !Self {
var width: u32 = 0;
const values = blk: {
var values_list = util.List(u8).init(allocator);
defer values_list.deinit();
var it = util.tokenize(u8, serialized_data, "\n");
// Parse each row
while (it.next()) |row_data| {
if (row_data.len == 0) continue; // Just in case we get an extra newline
width = @intCast(u32, row_data.len);
// For each row, parse the numbers (no in-row separator)
for (row_data) |int_data| {
if (int_data < '0' or int_data > '9') return error.InvalidInput;
try values_list.append(int_data - '0');
}
}
break :blk values_list.toOwnedSlice();
};
errdefer allocator.free(values);
// Return grid
return Self{ .values = values, .width = width, .allocator = allocator };
}
/// Deallocates underlying representation of the grid.
pub fn deinit(self: *Self) void {
self.allocator.free(self.values);
}
/// Performs a "step" as per problem 1 description, returning the number of flashes that
/// occur.
pub fn doStep(self: *Self) !u32 {
// Keeps track of items we're dequeueing when going through flashes
var queue = util.List(util.Point(i32)).init(self.allocator);
defer queue.deinit();
// Increment all energy levels by 1, and queue up any position that will initially flash.
for (self.values) |*val, idx| {
val.* += 1;
if (val.* > 9) {
try queue.append(util.Point(i32).fromIndex(idx, self.width));
}
}
// Keep track of anything that flashes this step, so we can avoid flashing it twice and set
// its energy level appropriately
var visited = util.Map(util.Point(i32), void).init(self.allocator);
defer visited.deinit();
var flashes: u32 = 0;
while (queue.items.len != 0) {
// Conduct flood fill from each point that is flashing
const cur_pos = queue.orderedRemove(0);
if (visited.contains(cur_pos)) continue;
// Record that a flash has occured.
flashes += 1;
// Add to visited set to ensure we don't flash the same cell twice
try visited.put(cur_pos, {});
// Set current value to 0
self.values[cur_pos.toIndex(self.width)] = 0;
// Increment all neighboring cells if they haven't already flashed, and add them to
// the queue if the addition will make them flash
for (util.eightWayNeighbors) |direction| {
const neighbor = util.Point(i32).add(cur_pos, direction);
// Out of map bounds, or already flashed
if (neighbor.x < 0 or neighbor.x >= self.width or neighbor.y < 0 or neighbor.y >= self.height()) continue;
if (visited.contains(neighbor)) continue;
// Increment value and add to queue if the increment results in a flash
const neighbor_idx = neighbor.toIndex(self.width);
self.values[neighbor_idx] += 1;
if (self.values[neighbor_idx] > 9) {
try queue.append(neighbor);
}
}
}
return flashes;
}
pub fn height(self: Self) u32 {
return @intCast(u32, self.values.len / self.width);
}
};
pub fn main() !void {
defer {
const leaks = util.gpa_impl.deinit();
std.debug.assert(!leaks);
}
var grid = try OctapusGrid.initFromSerializedData(util.gpa, data);
defer grid.deinit();
// Go through steps until we've extracted the required data
var step: u32 = 1;
var step_100_flashes: u32 = 0;
var first_simultaneous_flash: u32 = 0;
while (true) : (step += 1) {
const current_step_flashes = try grid.doStep();
if (step <= 100) {
step_100_flashes += current_step_flashes;
}
if (first_simultaneous_flash == 0 and current_step_flashes == grid.values.len) {
first_simultaneous_flash = step;
}
// Just in case the first flash happens before step 100, we will ensure we get both results.
if (step >= 100 and first_simultaneous_flash != 0) break;
}
util.print("Part 1: Number of flashes after 100 steps is {d}\n", .{step_100_flashes});
util.print("Part 2: First simultaneous flash occured on step {d}\n", .{first_simultaneous_flash});
} | src/day11.zig |
// The bud disappears when the blossom breaks through, and we might say
// that the former is refuted by the latter; in the same way when the
// fruit comes, the blossom may be explained to be a false form of the
// plant’s existence, for the fruit appears as its true nature in place
// of the blossom. The ceaseless activity of their own inherent nature
// makes these stages moments of an organic unity, where they not merely
// do not contradict one another, but where one is as necessary as the
// other; and constitutes thereby the life of the whole.
const std = @import("std");
const Instruction = @import("instruction.zig").Instruction;
const VM = @import("vm.zig").VM;
const Assembler = @import("asm.zig").Assembler;
const binary = @import("binary.zig");
pub const VERSION = "AgarVM version 0.0.2";
pub const FILE_MAX_SIZE = 4194304; //~ 4MB
pub const AGAR_VM_VERSION: u16 = 0x00; //WARN: Update this every time the instruction set changes
/// Run code in a virtual machine
fn run(program: []const u32, allocator: std.mem.Allocator) !void {
// Create the VM struct
var vm = VM{
.program = program,
};
// Run the VM and print it's result code
std.log.info("VM exited with code: x{x}", .{try vm.run(allocator, allocator)});
defer vm.deinit();
}
/// Bytecompile the file with assembly in it
fn byteCompile(allocator: std.mem.Allocator, src_path: []const u8) []u32 {
// Open file
const src_file = std.fs.cwd().openFile(src_path, .{ .read = true }) catch {
std.log.err("Cannot open file or directory", .{});
return allocator.alloc(u32, 0) catch unreachable;
};
// Read the file, max size of the file is 4MB, this can be changed, but a max file size must exist
const src = src_file.readToEndAlloc(allocator, FILE_MAX_SIZE) catch {
std.log.err("File exceeded the FILE_MAX_SIZE {any} < {any}", .{ FILE_MAX_SIZE, (src_file.stat() catch unreachable).size });
return allocator.alloc(u32, 0) catch unreachable;
};
defer allocator.free(src);
// Initiate an assembler (a tool to compile from assembly to bytecode)
var assembler = Assembler.init(allocator, src) catch unreachable;
defer assembler.deinit();
// Run the assembly pass, multiple passes are possible but right now unnecessary
assembler.assembly_pass() catch unreachable;
// Duplicate the program from the assembler as assembler's memory will be freed
const result = allocator.dupe(u32, assembler.instruction_buffer) catch unreachable;
return result;
}
/// Write help to stdout
fn printHelp() void {
const help =
\\ Usage: agar assemble [input-file] -o [output-file]
\\ agar run [input-binary-file]
\\ agar assemble [input-file] run
\\
\\Supported file types:
\\ .agar Agar binary file (ELF)
\\ .algae Agar assembly file
\\ .elf/.o/.a/.out Generic ELF file (compiled with Agar)
\\General Options:
\\ -h, --help Prints this help
\\ -V, --version Prints version info
;
std.log.info("{s}", .{help});
}
/// Parse arguments from the command line
fn parseArguments() !void {
// Cretae the argument allocator
// I use arena, because I can free the memory all at once and the memory required is not that large
var arg_arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arg_arena.deinit();
// Load the process arguments
var iter = std.process.args();
// Check if any arguments were passed or print help
const subcommand = try iter.next(arg_arena.allocator()) orelse {
return printHelp();
};
// If first argument is assemble
if (std.mem.eql(u8, "assemble", subcommand)) {
// Check if user passed source .algae file
const src_path = try iter.next(arg_arena.allocator()) orelse {
std.log.info("Expected a source file!", .{});
return printHelp();
};
// Create an allocator for the whole program
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
// Bytecompile the file
const program = byteCompile(gpa.allocator(), src_path);
defer gpa.allocator().free(program);
const next_command = iter.next(arg_arena.allocator());
// If there's no other arguments passed or user specified --output/-o
// write the bytecode to the output file
if (next_command == null or std.mem.eql(u8, "-o", try next_command.?) or std.mem.eql(u8, "--output", try next_command.?)) {
const dest_path = try iter.next(arg_arena.allocator()) orelse "./output.agar";
try binary.write(dest_path, std.mem.sliceAsBytes(program));
}
// If user passed run
// run the program in a virtual machine
else if (std.mem.eql(u8, "run", try next_command.?)) {
return try run(program, gpa.allocator());
} else {
std.log.err("Unrecognized command line option {s}", .{try next_command.?});
return printHelp();
}
}
// If user's argument was run, open the specified file and run it in a virtual machine
else if (std.mem.eql(u8, "run", subcommand)) {
const src_path = try iter.next(arg_arena.allocator()) orelse {
std.log.info("Expected a file to run!", .{});
return printHelp();
};
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const program: []const u32 = try binary.read(src_path, gpa.allocator());
defer gpa.allocator().free(program);
try run(program, gpa.allocator());
}
// Print help
else if (std.mem.eql(u8, "help", subcommand) or std.mem.eql(u8, "--help", subcommand) or std.mem.eql(u8, "-h", subcommand)) {
return printHelp();
}
// Print version
else if (std.mem.eql(u8, "--version", subcommand) or std.mem.eql(u8, "-V", subcommand)) {
return std.log.info("{s}", .{VERSION});
} else {
std.log.err("Unrecognized command line option {s}", .{subcommand});
return printHelp();
}
}
pub fn main() !void {
try parseArguments();
} | src/main.zig |
const std = @import("std");
const builtin = @import("builtin");
const zp = @import("../../zplay.zig");
const event = zp.event;
const sdl = zp.deps.sdl;
const c = @import("c.zig");
const string_c = @cImport({
@cInclude("string.h");
});
extern fn SDL_free(mem: ?*anyopaque) void;
var performance_frequency: u64 = undefined;
const BackendData = struct {
window: *sdl.c.SDL_Window,
time: u64,
mouse_pressed: [3]bool,
mouse_cursors: [c.ImGuiMouseCursor_COUNT]?*sdl.c.SDL_Cursor,
clipboard_text_data: ?[*c]u8,
mouse_can_use_global_state: bool,
};
pub fn init(window: *sdl.c.SDL_Window) !void {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
if (io.BackendPlatformUserData != null) {
std.debug.panic("already initialized!", .{});
}
var mouse_can_use_global_state = false;
const backend = @ptrCast(?[*:0]const u8, sdl.c.SDL_GetCurrentVideoDriver());
if (backend) |bkd| {
const global_mouse_whitelist = .{
"windows",
"cocoa",
"x11",
"DIVE",
"VMAN",
};
inline for (global_mouse_whitelist) |wh| {
if (string_c.strcmp(wh, bkd) == 0) {
mouse_can_use_global_state = true;
}
}
}
const bd = try std.heap.c_allocator.create(BackendData);
bd.window = window;
bd.time = 0;
bd.mouse_pressed = [_]bool{false} ** bd.mouse_pressed.len;
bd.mouse_cursors = [_]?*sdl.c.SDL_Cursor{null} ** bd.mouse_cursors.len;
bd.clipboard_text_data = null;
bd.mouse_can_use_global_state = mouse_can_use_global_state;
io.BackendPlatformUserData = bd;
io.BackendPlatformName = "imgui_impl_sdl";
io.BackendFlags |= c.ImGuiBackendFlags_HasMouseCursors;
io.BackendFlags |= c.ImGuiBackendFlags_HasSetMousePos;
// keyboard mapping. Dear ImGui will use those indices to peek into the io.KeysDown[] array.
io.KeyMap[c.ImGuiKey_Tab] = sdl.c.SDL_SCANCODE_TAB;
io.KeyMap[c.ImGuiKey_LeftArrow] = sdl.c.SDL_SCANCODE_LEFT;
io.KeyMap[c.ImGuiKey_RightArrow] = sdl.c.SDL_SCANCODE_RIGHT;
io.KeyMap[c.ImGuiKey_UpArrow] = sdl.c.SDL_SCANCODE_UP;
io.KeyMap[c.ImGuiKey_DownArrow] = sdl.c.SDL_SCANCODE_DOWN;
io.KeyMap[c.ImGuiKey_PageUp] = sdl.c.SDL_SCANCODE_PAGEUP;
io.KeyMap[c.ImGuiKey_PageDown] = sdl.c.SDL_SCANCODE_PAGEDOWN;
io.KeyMap[c.ImGuiKey_Home] = sdl.c.SDL_SCANCODE_HOME;
io.KeyMap[c.ImGuiKey_End] = sdl.c.SDL_SCANCODE_END;
io.KeyMap[c.ImGuiKey_Insert] = sdl.c.SDL_SCANCODE_INSERT;
io.KeyMap[c.ImGuiKey_Delete] = sdl.c.SDL_SCANCODE_DELETE;
io.KeyMap[c.ImGuiKey_Backspace] = sdl.c.SDL_SCANCODE_BACKSPACE;
io.KeyMap[c.ImGuiKey_Space] = sdl.c.SDL_SCANCODE_SPACE;
io.KeyMap[c.ImGuiKey_Enter] = sdl.c.SDL_SCANCODE_RETURN;
io.KeyMap[c.ImGuiKey_Escape] = sdl.c.SDL_SCANCODE_ESCAPE;
io.KeyMap[c.ImGuiKey_KeyPadEnter] = sdl.c.SDL_SCANCODE_KP_ENTER;
io.KeyMap[c.ImGuiKey_A] = sdl.c.SDL_SCANCODE_A;
io.KeyMap[c.ImGuiKey_C] = sdl.c.SDL_SCANCODE_C;
io.KeyMap[c.ImGuiKey_V] = sdl.c.SDL_SCANCODE_V;
io.KeyMap[c.ImGuiKey_X] = sdl.c.SDL_SCANCODE_X;
io.KeyMap[c.ImGuiKey_Y] = sdl.c.SDL_SCANCODE_Y;
io.KeyMap[c.ImGuiKey_Z] = sdl.c.SDL_SCANCODE_Z;
// clipboard callbacks
io.SetClipboardTextFn = setClipboardText;
io.GetClipboardTextFn = getClipboardText;
io.ClipboardUserData = null;
// load mouse cursors
bd.mouse_cursors[c.ImGuiMouseCursor_Arrow] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_ARROW);
bd.mouse_cursors[c.ImGuiMouseCursor_TextInput] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_IBEAM);
bd.mouse_cursors[c.ImGuiMouseCursor_ResizeAll] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_SIZEALL);
bd.mouse_cursors[c.ImGuiMouseCursor_ResizeNS] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_SIZENS);
bd.mouse_cursors[c.ImGuiMouseCursor_ResizeEW] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_SIZEWE);
bd.mouse_cursors[c.ImGuiMouseCursor_ResizeNESW] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_SIZENESW);
bd.mouse_cursors[c.ImGuiMouseCursor_ResizeNWSE] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_SIZENWSE);
bd.mouse_cursors[c.ImGuiMouseCursor_Hand] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_HAND);
bd.mouse_cursors[c.ImGuiMouseCursor_NotAllowed] = sdl.c.SDL_CreateSystemCursor(sdl.c.SDL_SYSTEM_CURSOR_NO);
// Set SDL hint to receive mouse click events on window focus, otherwise SDL doesn't emit the event.
// Without this, when clicking to gain focus, our widgets wouldn't activate even though they showed as hovered.
// (This is unfortunately a global SDL setting, so enabling it might have a side-effect on your application.
// It is unlikely to make a difference, but if your app absolutely needs to ignore the initial on-focus click:
// you can ignore SDL_MOUSEBUTTONDOWN events coming right after a SDL_WINDOWEVENT_FOCUS_GAINED)
_ = sdl.c.SDL_SetHint(sdl.c.SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
performance_frequency = sdl.c.SDL_GetPerformanceFrequency();
}
pub fn deinit() void {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
const bd = getBackendData().?;
if (bd.clipboard_text_data) |data| {
SDL_free(data);
}
for (bd.mouse_cursors) |cursor| {
sdl.c.SDL_FreeCursor(cursor);
}
io.BackendPlatformUserData = null;
io.BackendPlatformName = null;
std.heap.c_allocator.destroy(bd);
}
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear c wants to use your inputs.
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
// Generally you may always pass all inputs to dear c, and hide them from your application based on those two flags.
// If you have multiple SDL events and some of them are not meant to be used by dear c, you may need to filter events based on their windowID field.
pub fn processEvent(e: event.Event) bool {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
const bd = getBackendData().?;
switch (e) {
.mouse_event => |ee| {
switch (ee.data) {
.button => |button| {
if (button.clicked) {
var idx: i32 = switch (button.btn) {
.left => 0,
.right => 1,
.middle => 2,
else => -1,
};
if (idx >= 0) {
bd.mouse_pressed[@intCast(u32, idx)] = true;
}
}
},
.wheel => |wheel| {
if (wheel.scroll_x > 0) io.MouseWheelH += 1;
if (wheel.scroll_x < 0) io.MouseWheelH -= 1;
if (wheel.scroll_y > 0) io.MouseWheel += 1;
if (wheel.scroll_y < 0) io.MouseWheel -= 1;
},
else => {},
}
},
.text_input_event => |ee| {
c.ImGuiIO_AddInputCharactersUTF8(io, &ee.text);
},
.keyboard_event => |ee| {
const key = ee.scan_code;
const mod_state = sdl.c.SDL_GetModState();
io.KeysDown[@intCast(u32, @enumToInt(key))] = (ee.trigger_type == .down);
io.KeyShift = ((mod_state & sdl.c.KMOD_SHIFT) != 0);
io.KeyCtrl = ((mod_state & sdl.c.KMOD_CTRL) != 0);
io.KeyAlt = ((mod_state & sdl.c.KMOD_ALT) != 0);
if (builtin.os.tag == .windows) {
io.KeySuper = false;
} else {
io.KeySuper = ((mod_state & sdl.c.KMOD_GUI) != 0);
}
},
else => {
return false;
},
}
return true;
}
// begin new frame for gui rendering
pub fn newFrame() void {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
const bd = getBackendData().?;
// Setup display size (every frame to accommodate for window resizing)
var w: c_int = undefined;
var h: c_int = undefined;
var display_w: c_int = undefined;
var display_h: c_int = undefined;
sdl.c.SDL_GetWindowSize(bd.window, &w, &h);
if ((sdl.c.SDL_GetWindowFlags(bd.window) & sdl.c.SDL_WINDOW_MINIMIZED) != 0) {
w = 0;
h = 0;
}
sdl.c.SDL_GL_GetDrawableSize(bd.window, &display_w, &display_h);
io.DisplaySize = .{
.x = @intToFloat(f32, w),
.y = @intToFloat(f32, h),
};
if (w > 0 and h > 0) {
io.DisplayFramebufferScale = .{
.x = @intToFloat(f32, display_w) / @intToFloat(f32, w),
.y = @intToFloat(f32, display_h) / @intToFloat(f32, h),
};
}
// Setup time step (we don't use SDL_GetTicks() because it is using millisecond resolution)
const current_time = sdl.c.SDL_GetPerformanceCounter();
if (bd.time > 0) {
io.DeltaTime = @floatCast(f32, @intToFloat(f64, current_time - bd.time) / @intToFloat(f64, performance_frequency));
} else {
io.DeltaTime = 1.0 / 60.0;
}
bd.time = current_time;
updateMousePosAndButtons();
updateMouseCursor();
// Update game controllers (if enabled and available)
updateGamePads();
}
// backend data stored in io.BackendPlatformUserData to allow support for multiple Dear ImGui contexts
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
fn getBackendData() ?*BackendData {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
const context = @ptrCast(?*c.ImGuiContext, c.igGetCurrentContext());
if (context) |_| {
return @ptrCast(
?*BackendData,
@alignCast(@alignOf(*BackendData), io.BackendPlatformUserData),
);
}
return null;
}
// clipboard callback
fn getClipboardText(_: ?*anyopaque) callconv(.C) [*c]u8 {
const bd = getBackendData().?;
if (bd.clipboard_text_data) |data| {
SDL_free(data);
}
bd.clipboard_text_data = @ptrCast([*c]u8, sdl.c.SDL_GetClipboardText());
return bd.clipboard_text_data.?;
}
// clipboard callback
fn setClipboardText(_: ?*anyopaque, text: [*c]const u8) callconv(.C) void {
_ = sdl.c.SDL_SetClipboardText(text);
}
fn updateMousePosAndButtons() void {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
const bd = getBackendData().?;
const mouse_pos_prev = io.MousePos;
io.MousePos = .{
.x = -std.math.f32_max,
.y = -std.math.f32_max,
};
// update mouse buttons
var mouse_x_local: c_int = undefined;
var mouse_y_local: c_int = undefined;
const mouse_buttons = @bitCast(c_int, sdl.c.SDL_GetMouseState(&mouse_x_local, &mouse_y_local));
io.MouseDown[0] = bd.mouse_pressed[0] or (mouse_buttons & SDL_BUTTON_LMASK) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
io.MouseDown[1] = bd.mouse_pressed[1] or (mouse_buttons & SDL_BUTTON_RMASK) != 0;
io.MouseDown[2] = bd.mouse_pressed[2] or (mouse_buttons & SDL_BUTTON_MMASK) != 0;
bd.mouse_pressed[0] = false;
bd.mouse_pressed[1] = false;
bd.mouse_pressed[2] = false;
// Obtain focused and hovered window. We forward mouse input when focused or when hovered (and no other window is capturing)
const focused_window = sdl.c.SDL_GetKeyboardFocus();
const hovered_window = sdl.c.SDL_GetMouseFocus();
var mouse_window: ?*sdl.c.SDL_Window = null;
if (hovered_window != null and bd.window == hovered_window.?) {
mouse_window = hovered_window;
} else if (focused_window != null and bd.window == focused_window.?) {
mouse_window = focused_window;
}
// SDL_CaptureMouse() let the OS know e.g. that our c drag outside the SDL window boundaries shouldn't e.g. trigger other operations outside
_ = sdl.c.SDL_CaptureMouse(if (c.igIsAnyMouseDown())
sdl.c.SDL_TRUE
else
sdl.c.SDL_FALSE);
if (mouse_window == null) return;
// Set OS mouse position from Dear ImGui if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
if (io.WantSetMousePos) {
sdl.c.SDL_WarpMouseInWindow(
bd.window,
@floatToInt(i32, mouse_pos_prev.x),
@floatToInt(i32, mouse_pos_prev.y),
);
}
// Set Dear ImGui mouse position from OS position + get buttons. (this is the common behavior)
if (bd.mouse_can_use_global_state) {
var mouse_x_global: c_int = undefined;
var mouse_y_global: c_int = undefined;
var window_x: c_int = undefined;
var window_y: c_int = undefined;
_ = sdl.c.SDL_GetGlobalMouseState(&mouse_x_global, &mouse_y_global);
_ = sdl.c.SDL_GetWindowPosition(mouse_window, &window_x, &window_y);
io.MousePos = .{
.x = @intToFloat(f32, mouse_x_global - window_x),
.y = @intToFloat(f32, mouse_y_global - window_y),
};
} else {
io.MousePos = .{
.x = @intToFloat(f32, mouse_x_local),
.y = @intToFloat(f32, mouse_y_local),
};
}
}
fn updateMouseCursor() void {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
const bd = getBackendData().?;
if ((io.ConfigFlags & c.ImGuiConfigFlags_NoMouseCursorChange) != 0) {
return;
}
const cursor = c.igGetMouseCursor();
if (io.MouseDrawCursor or cursor == c.ImGuiMouseCursor_None) {
// hide OS mouse cursor if c is drawing it or if it wants no cursor
_ = sdl.c.SDL_ShowCursor(sdl.c.SDL_FALSE);
} else {
// show OS mouse cursor
if (bd.mouse_cursors[@intCast(u32, cursor)]) |cs| {
sdl.c.SDL_SetCursor(cs);
} else {
sdl.c.SDL_SetCursor(bd.mouse_cursors[c.ImGuiMouseCursor_Arrow]);
}
_ = sdl.c.SDL_ShowCursor(sdl.c.SDL_TRUE);
}
}
fn updateGamePads() void {
const io = @ptrCast(*c.ImGuiIO, c.igGetIO());
@memset(@ptrCast([*]u8, &io.NavInputs), 0, @sizeOf(@TypeOf(io.NavInputs)));
if ((io.ConfigFlags & c.ImGuiConfigFlags_NavEnableGamepad) == 0) {
return;
}
// get gamepad
const controller = sdl.c.SDL_GameControllerOpen(0);
if (controller == null) {
io.BackendFlags &= ~c.ImGuiBackendFlags_HasGamepad;
}
// update gamepad inputs
const thumb_dead_zone = 8000; // SDL_gamecontroller.h suggests using this value.
mapButton(io, controller, c.ImGuiNavInput_Activate, sdl.c.SDL_CONTROLLER_BUTTON_A); // Cross / A
mapButton(io, controller, c.ImGuiNavInput_Cancel, sdl.c.SDL_CONTROLLER_BUTTON_B); // Circle / B
mapButton(io, controller, c.ImGuiNavInput_Menu, sdl.c.SDL_CONTROLLER_BUTTON_X); // Square / X
mapButton(io, controller, c.ImGuiNavInput_Input, sdl.c.SDL_CONTROLLER_BUTTON_Y); // Triangle / Y
mapButton(io, controller, c.ImGuiNavInput_DpadLeft, sdl.c.SDL_CONTROLLER_BUTTON_DPAD_LEFT); // D-Pad Left
mapButton(io, controller, c.ImGuiNavInput_DpadRight, sdl.c.SDL_CONTROLLER_BUTTON_DPAD_RIGHT); // D-Pad Right
mapButton(io, controller, c.ImGuiNavInput_DpadUp, sdl.c.SDL_CONTROLLER_BUTTON_DPAD_UP); // D-Pad Up
mapButton(io, controller, c.ImGuiNavInput_DpadDown, sdl.c.SDL_CONTROLLER_BUTTON_DPAD_DOWN); // D-Pad Down
mapButton(io, controller, c.ImGuiNavInput_FocusPrev, sdl.c.SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
mapButton(io, controller, c.ImGuiNavInput_FocusNext, sdl.c.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
mapButton(io, controller, c.ImGuiNavInput_TweakSlow, sdl.c.SDL_CONTROLLER_BUTTON_LEFTSHOULDER); // L1 / LB
mapButton(io, controller, c.ImGuiNavInput_TweakFast, sdl.c.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); // R1 / RB
mapAnalog(io, controller, c.ImGuiNavInput_LStickLeft, sdl.c.SDL_CONTROLLER_AXIS_LEFTX, -thumb_dead_zone, -32768);
mapAnalog(io, controller, c.ImGuiNavInput_LStickRight, sdl.c.SDL_CONTROLLER_AXIS_LEFTX, thumb_dead_zone, 32767);
mapAnalog(io, controller, c.ImGuiNavInput_LStickUp, sdl.c.SDL_CONTROLLER_AXIS_LEFTY, -thumb_dead_zone, -32767);
mapAnalog(io, controller, c.ImGuiNavInput_LStickDown, sdl.c.SDL_CONTROLLER_AXIS_LEFTY, thumb_dead_zone, 32767);
io.BackendFlags |= c.ImGuiBackendFlags_HasGamepad;
}
inline fn mapButton(
io: *c.ImGuiIO,
controller: ?*sdl.c.SDL_GameController,
input: c_int,
button: c_int,
) void {
if (sdl.c.SDL_GameControllerGetButton(controller, button) != 0) {
io.NavInputs[@intCast(u32, input)] = 1.0;
} else {
io.NavInputs[@intCast(u32, input)] = 0.0;
}
}
inline fn mapAnalog(
io: *c.ImGuiIO,
controller: ?*sdl.c.SDL_GameController,
input: c.ImGuiNavInput,
axis: c_int,
v0: i16,
v1: i16,
) void {
var vn = @intToFloat(f32, sdl.c.SDL_GameControllerGetAxis(controller, axis) - v0) / @intToFloat(f32, v1 - v0);
if (vn > 1.0)
vn = 1.0;
if (vn > 0 and vn > io.NavInputs[@intCast(u32, input)])
io.NavInputs[@intCast(u32, input)] = vn;
}
// TODO: use sdl binding if possible, have to get my own because of compile issue
inline fn SDL_BUTTON(X: c_int) c_int {
return @as(c_int, 1) << @intCast(u5, X - @as(c_int, 1));
}
const SDL_BUTTON_LEFT = @as(c_int, 1);
const SDL_BUTTON_MIDDLE = @as(c_int, 2);
const SDL_BUTTON_RIGHT = @as(c_int, 3);
const SDL_BUTTON_X1 = @as(c_int, 4);
const SDL_BUTTON_X2 = @as(c_int, 5);
const SDL_BUTTON_LMASK = SDL_BUTTON(SDL_BUTTON_LEFT);
const SDL_BUTTON_MMASK = SDL_BUTTON(SDL_BUTTON_MIDDLE);
const SDL_BUTTON_RMASK = SDL_BUTTON(SDL_BUTTON_RIGHT);
const SDL_BUTTON_X1MASK = SDL_BUTTON(SDL_BUTTON_X1);
const SDL_BUTTON_X2MASK = SDL_BUTTON(SDL_BUTTON_X2); | src/deps/imgui/sdl_impl.zig |
const std = @import("std");
const net = std.net;
const Reader = std.io.Reader;
const meta = std.meta;
const Allocator = std.mem.Allocator;
const Thread = std.Thread;
const log = std.log;
const time = std.time;
const event = std.event;
const atomic = std.atomic;
const math = std.math;
const Uuid = @import("uuid6");
const serde = @import("serde.zig");
const mcp = @import("mcproto.zig");
const mcn = @import("mcnet.zig");
const nbt = @import("nbt.zig");
const mcg = @import("game.zig");
pub fn handleStatus(alloc: Allocator, cl: anytype) !void {
defer cl.close();
const request_packet = try cl.readPacket(mcp.S.SB, alloc);
defer mcp.S.SB.deinit(request_packet, alloc);
std.log.info("packet data: {any}", .{request_packet});
if (request_packet != .request) {
std.log.info("didnt receive a request", .{});
return;
}
var response_data =
\\{
\\ "version": {
\\ "name": "crappy server 1.18.1",
\\ "protocol": 757
\\ },
\\ "players": {
\\ "max": 69,
\\ "online": 0
\\ },
\\ "description": {
\\ "text": "zig test server status"
\\ }
\\}
;
try cl.writePacket(mcp.S.CB, .{ .response = response_data });
const ping_packet = try cl.readPacket(mcp.S.SB, alloc);
defer mcp.S.SB.deinit(ping_packet, alloc);
if (ping_packet != .ping) {
std.log.info("didnt receive a ping", .{});
return;
}
try cl.writePacket(mcp.S.CB, .{ .pong = ping_packet.ping });
std.log.info("done", .{});
}
pub fn handleLogin(alloc: Allocator, game: *mcg.Game, cl: anytype) !void {
errdefer cl.close();
const login_start_packet = try cl.readPacket(mcp.L.SB, alloc);
defer mcp.L.SB.deinit(login_start_packet, alloc);
if (login_start_packet != .login_start) {
std.log.info("didnt receive login start", .{});
return;
}
const username_s = login_start_packet.login_start;
const username = std.mem.sliceTo(&username_s, 0);
std.log.info("\"{s}\" trying to connect", .{username});
const uuid = try mcp.uuidFromUsername(username);
var can_join: ?[]const u8 = null;
game.players_lock.lock();
for (game.players.items) |player| {
if (std.mem.eql(u8, &player.uuid.bytes, &uuid.bytes)) {
can_join = "{\"text\":\"You are already in the server\"}";
break;
}
}
game.players_lock.unlock();
if (can_join) |kick_msg| {
try cl.writePacket(mcp.L.CB, .{ .disconnect = kick_msg });
return error{PlayerAlreadyInServer}.PlayerAlreadyInServer;
} else {
log.info("trying to write packet", .{});
try cl.writePacket(mcp.L.CB, mcp.L.CB.UserType{ .login_success = .{ .username = username_s, .uuid = uuid } });
}
log.info("hey 5", .{});
// play state now
const dimension_names = [_][]const u8{
"minecraft:overworld",
};
const eid: i32 = game.getEid();
errdefer {
game.returnEid(eid) catch |err| {
log.err("lost eid {}: {any}", .{ eid, err });
};
// if allocation failure, then oops, guess we're never using that eid again
}
try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{
.join_game = .{
.entity_id = eid,
.is_hardcore = false,
.gamemode = .Creative,
.previous_gamemode = .None,
.dimension_names = std.mem.span(&dimension_names),
.dimension_codec = mcp.DEFUALT_DIMENSION_CODEC,
.dimension = mcp.DEFAULT_DIMENSION_TYPE_ELEMENT, //default_dimension_codec.@"minecraft:dimension_type".value[0].element,
.dimension_name = "minecraft:overworld",
.hashed_seed = 1,
.max_players = 69,
.view_distance = 12,
.simulation_distance = 12,
.reduced_debug_info = false,
.enable_respawn_screen = false,
.is_debug = false,
.is_flat = true,
},
});
std.log.info("sent join game", .{});
try cl.writePacket(mcp.P.CB, .{
.plugin_message = .{
.channel = "minecraft:brand",
.data = &[_]u8{ 5, 'z', 'i', 'g', 'm', 'c' },
},
});
std.log.info("sent difficulty", .{});
try cl.writePacket(mcp.P.CB, .{
.server_difficulty = .{
.difficulty = .Peaceful,
.difficulty_locked = true,
},
});
std.log.info("sent player abilities", .{});
try cl.writePacket(mcp.P.CB, .{
.player_abilities = .{
.flags = .{
.invulnerable = true,
.flying = false,
.allow_flying = true,
.creative_mode = true,
},
.flying_speed = 0.05,
.field_of_view_modifier = 0.1,
},
});
var packet = try cl.readPacket(mcp.P.SB, alloc);
std.log.info("packet {any}", .{packet});
defer mcp.P.SB.deinit(packet, alloc);
while (packet != .client_settings) {
if (packet == .plugin_message) {
if (std.mem.eql(u8, packet.plugin_message.channel, "minecraft:brand")) {
std.log.info("client brand is \"{s}\"", .{packet.plugin_message.data[1..]});
}
} else {
std.log.info("unexpected packet {any}", .{packet});
}
mcp.P.SB.deinit(packet, alloc);
packet = try cl.readPacket(mcp.P.SB, alloc);
}
std.log.info("client settings: {any}", .{packet.client_settings});
const client_settings = packet.client_settings;
try cl.writePacket(mcp.P.CB, .{ .held_item_change = 0 });
try cl.writePacket(mcp.P.CB, .{ .declare_recipes = .{
.{
.type = "crafting_shapeless",
.recipe_id = "minecraft:recipe_flint_and_steel",
.data = .{ .crafting_shapeless = .{
.group = "steel",
.ingredients = .{
&[_]mcp.Slot.UserType{.{
.item_id = 762,
.item_count = 1,
.nbt = &.{},
}},
&[_]mcp.Slot.UserType{.{
.item_id = 692,
.item_count = 1,
.nbt = &.{},
}},
},
.result = .{
.item_id = 680,
.item_count = 1,
.nbt = &.{},
},
} },
},
} });
//try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{
// .tags = &[_]meta.Child(mcp.Tags.UserType){
// .{
// .tag_type = "minecraft:block",
// .tags = &[_]mcp.TagEntries.UserType{.{
// .tag_name = "mineable/shovel",
// .entries = &[_]i32{9}, // 9 is dirt probably
// }},
// },
// .{
// .tag_type = "minecraft:item",
// .tags = &[_]mcp.TagEntries.UserType{},
// },
// .{
// .tag_type = "minecraft:fluid",
// .tags = &[_]mcp.TagEntries.UserType{},
// },
// .{
// .tag_type = "minecraft:entity_type",
// .tags = &[_]mcp.TagEntries.UserType{},
// },
// .{
// .tag_type = "minecraft:game_event",
// .tags = &[_]mcp.TagEntries.UserType{},
// },
// },
//});
try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .entity_status = .{ .entity_id = eid, .entity_status = 28 } }); // set op level to 4
const teleport_id: i32 = 5;
const pos_and_look = .{ .player_position_and_look = .{
.x = 0,
.y = 32,
.z = 0,
.yaw = 0.0,
.pitch = 0.0,
.relative = .{
.x = false,
.y = false,
.z = false,
.y_rot = false,
.x_rot = false,
},
.teleport_id = teleport_id,
.dismount_vehicle = false,
} };
try cl.writePacket(mcp.P.CB, pos_and_look);
try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .player_info = .{
.add_player = &[_]meta.Child(mcp.PlayerInfo.UnionType.Specs[0].UserType){
.{
.uuid = uuid,
.data = .{
.name = username_s,
.properties = &[_]mcp.PlayerProperty.UserType{},
.gamemode = .Creative,
.ping = 0,
.display_name = null,
},
},
},
} });
{
game.players_lock.lock();
defer game.players_lock.unlock();
for (game.players.items) |player| {
var player_username = [_:0]u8{0} ** (16 * 4);
std.mem.copy(u8, player_username[0..player.username.len], player.username);
try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .player_info = .{
.add_player = &[_]meta.Child(mcp.PlayerInfo.UnionType.Specs[0].UserType){
.{
.uuid = player.uuid,
.data = .{
.name = player_username,
.properties = &[_]mcp.PlayerProperty.UserType{},
.gamemode = .Creative,
.ping = player.ping.load(.Unordered),
.display_name = null,
},
},
},
} });
}
}
try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .player_info = .{
.update_latency = &[_]meta.Child(mcp.PlayerInfo.UnionType.Specs[2].UserType){
.{
.uuid = uuid,
.data = 0,
},
},
} });
try cl.writePacket(mcp.P.CB, .{ .update_view_position = .{ .chunk_x = 0, .chunk_z = 0 } });
// isnert chunk code here
var k: i32 = -5;
while (k <= 5) : (k += 1) {
var j: i32 = -5;
while (j <= 5) : (j += 1) {
const chunk = mcp.chunk.Chunk{
.chunk_x = k,
.chunk_z = j,
.block_entities = .{},
.sections = mcp.chunk.DEFAULT_FLAT_SECTIONS,
.height_map = mcp.chunk.Chunk.generateHeightMap(&mcp.chunk.DEFAULT_FLAT_SECTIONS),
};
try chunk.send(cl);
std.log.info("writing chunk xz: {} {}", .{ k, j });
}
}
try cl.writePacket(mcp.P.CB, .{ .world_border_center = .{ .x = 0.0, .z = 0.0 } });
try cl.writePacket(mcp.P.CB, .{ .world_border_size = 128.0 });
try cl.writePacket(mcp.P.CB, .{ .spawn_position = .{
.location = .{
.x = 0,
.z = 0,
.y = 32,
},
.angle = 0.0,
} });
try cl.writePacket(mcp.P.CB, pos_and_look);
const teleport_confirm_packet = try cl.readPacket(mcp.P.SB, alloc);
defer mcp.P.SB.deinit(teleport_confirm_packet, alloc);
if (teleport_confirm_packet == .teleport_confirm) {
std.debug.assert(teleport_confirm_packet.teleport_confirm == teleport_id);
} else {
std.log.info("unexpected packet {any}", .{teleport_confirm_packet});
}
const pos_rot_packet = try cl.readPacket(mcp.P.SB, alloc);
defer mcp.P.SB.deinit(pos_rot_packet, alloc);
if (pos_rot_packet == .player_position_and_rotation) {
std.log.info("got pos rot {any}", .{pos_rot_packet});
} else {
std.log.info("unexpected packet {any}", .{teleport_confirm_packet});
}
var player = try alloc.create(mcg.Player);
errdefer {
alloc.destroy(player);
cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .disconnect = "{\"text\":\"internal error\"}" }) catch |err| {
log.err("error during player disconnect for internal error: {any}", .{err});
};
}
var alloced_settings = try alloc.create(mcp.ClientSettings.UserType);
alloced_settings.* = client_settings;
player.* = mcg.Player{
.inner = cl.*,
.eid = eid,
.uuid = uuid,
.username = try alloc.dupe(u8, username),
.settings = .{ .value = alloced_settings },
.player_data = .{
.x = 0,
.y = 32,
.z = 0,
.yaw = 0,
.pitch = 0,
.on_ground = false,
},
};
{
game.players_lock.lock();
defer game.players_lock.unlock();
try game.players.append(player);
}
game.broadcastExcept(mcp.P.CB, mcp.P.CB.UserType{ .player_info = .{ .add_player = &[_]meta.Child(mcp.PlayerInfo.UnionType.Specs[0].UserType){
.{
.uuid = uuid,
.data = .{
.name = username_s,
.properties = &[_]mcp.PlayerProperty.UserType{},
.gamemode = mcp.Gamemode.Creative,
.ping = 0,
.display_name = null,
},
},
} } }, player);
{
game.players_lock.lock();
defer game.players_lock.unlock();
for (game.players.items) |other_player| {
if (other_player == player) continue;
other_player.player_data_lock.lock();
defer other_player.player_data_lock.unlock();
try cl.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .spawn_player = .{
.entity_id = other_player.eid,
.player_uuid = other_player.uuid,
.x = other_player.player_data.x,
.y = other_player.player_data.y,
.z = other_player.player_data.z,
.yaw = mcp.intoAngle(other_player.player_data.yaw),
.pitch = mcp.intoAngle(other_player.player_data.pitch),
} });
}
}
{
const unfmt_text =
\\{"text":"","color":"yellow","extra":[{"text":" joined the game","color":"white"}]}
;
var buf: [unfmt_text.len + 64]u8 = undefined;
const formatted_msg = std.fmt.bufPrint(&buf,
\\{{"text":"{s}","color":"yellow","extra":[{{"text":" joined the game","color":"white"}}]}}
, .{username}) catch unreachable; // given that username is max 16 unicode characters, this should never fail
player.broadcastChatMessage(game, formatted_msg);
}
player.player_data_lock.lock();
game.broadcastExcept(mcp.P.CB, mcp.P.CB.UserType{ .spawn_player = .{
.entity_id = player.eid,
.player_uuid = player.uuid,
.x = player.player_data.x,
.y = player.player_data.y,
.z = player.player_data.z,
.yaw = mcp.intoAngle(player.player_data.yaw),
.pitch = mcp.intoAngle(player.player_data.pitch),
} }, player);
player.player_data_lock.unlock();
const thread = try Thread.spawn(.{}, mcg.Player.run, .{ player, alloc, game });
thread.detach();
}
pub fn handleClient(alloc: Allocator, game: *mcg.Game, conn: net.StreamServer.Connection) !void {
std.log.info("connection", .{});
var cl = mcn.packetClient(conn, conn.stream.reader(), conn.stream.writer(), null);
const handshake_packet = try cl.readHandshakePacket(mcp.H.SB, alloc);
std.log.info("handshake: {any}", .{handshake_packet});
if (handshake_packet == .legacy) {
std.log.info("legacy ping...", .{});
return;
}
switch (handshake_packet.handshake.next_state) {
.Status => try handleStatus(alloc, &cl),
.Login => {
if (handshake_packet.handshake.protocol_version != @as(i32, mcp.PROTOCOL_VERSION)) {
defer cl.close();
var buf: [128]u8 = undefined;
var disconnect_msg = std.fmt.bufPrint(&buf,
\\{{"text":"Incorrect protocol version; this server is on {}. You are on {}."}}
, .{ mcp.PROTOCOL_VERSION, handshake_packet.handshake.protocol_version }) catch
\\{"text":"Incorrect protocol version; this server is on
++ std.fmt.comptimePrint("{}", .{mcp.PROTOCOL_VERSION}) ++
\\"}
;
try cl.writePacket(mcp.L.CB, .{ .disconnect = disconnect_msg });
} else {
try handleLogin(alloc, game, &cl);
}
},
}
}
pub fn main() anyerror!void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
var alloc = gpa.allocator();
var game = mcg.Game{
.alloc = alloc,
.players = std.ArrayList(*mcg.Player).init(alloc),
.alive = atomic.Atomic(bool).init(true),
.available_eids = std.ArrayList(i32).init(alloc),
};
var game_thread = try Thread.spawn(.{}, mcg.Game.run, .{&game});
game_thread.detach();
const address = net.Address.initIp4(.{ 127, 0, 0, 1 }, 25400);
var server = net.StreamServer.init(.{ .reuse_address = true });
defer server.deinit();
try server.listen(address);
std.log.info("Listening on 127.0.0.1:25400", .{});
while (true) {
const conn = try server.accept();
handleClient(alloc, &game, conn) catch |err| {
if (err != error.EndOfStream) {
std.log.err("failed to handle client: {}", .{err});
}
};
}
} | src/main.zig |
const std = @import("std");
const slideszig = @import("slides.zig");
// for ImVec4 and stuff
const upaya = @import("upaya");
// NOTE:
// why we have context.current_context:
// @pop some_shit
// # now current_context is loaded with the pushed values, like the color etc
//
// @box x= y=
// # parsing context is loaded with x and y
// text text
// # text is added to the parsing context
//
// @pop other_shit
// # at this moment, the parsing context is complete, it can be commited
// # hence, the above @box with all text will be committed
// # before that: the parsing context is merged with the current context, so the text color is set etc
//
// # then other_shit is popped and put into the current_context
// # while parsing the other_shit line, parsing_context will be used
//
// @box
// more text
usingnamespace upaya.imgui;
usingnamespace slideszig;
pub const ParserError = error{ Internal, Syntax };
pub const ParserErrorContext = struct {
parser_error: anyerror,
line_number: usize = 0,
line_offset: usize = 0,
message: ?[]const u8,
formatted: ?[:0]const u8 = null,
pub fn getFormattedStr(self: *ParserErrorContext, allocator: *std.mem.Allocator) ![*:0]const u8 {
if (self.formatted) |txt| {
return txt.ptr;
}
if (self.message) |msg| {
self.formatted = try std.fmt.allocPrintZ(allocator, "line {d}: {s} ({s})", .{ self.line_number, self.parser_error, msg });
} else {
self.formatted = try std.fmt.allocPrintZ(allocator, "line {d}: {s}", .{ self.line_number, self.parser_error });
}
return self.formatted.?.ptr;
}
};
pub const ParserContext = struct {
allocator: *std.mem.Allocator,
input: []const u8 = undefined,
parsed_line_number: usize = 0,
parsed_line_offset: usize = 0,
parser_errors: std.ArrayList(ParserErrorContext) = undefined,
first_slide_emitted: bool = false,
slideshow: *SlideShow = undefined,
push_contexts: std.StringHashMap(ItemContext),
push_slides: std.StringHashMap(*Slide),
current_context: ItemContext = ItemContext{},
current_slide: *Slide,
allErrorsCstrArray: ?[][*]const u8 = null,
fn new(a: *std.mem.Allocator) !*ParserContext {
// .
var self = try a.create(ParserContext);
self.* = ParserContext{
.allocator = a,
.push_contexts = std.StringHashMap(ItemContext).init(a),
.push_slides = std.StringHashMap(*Slide).init(a),
.current_slide = try Slide.new(a),
.parser_errors = std.ArrayList(ParserErrorContext).init(a),
.allErrorsCstrArray = null,
};
return self;
}
fn deinit(self: *ParserContext) void {
self.parser_errors.deinit();
self.push_contexts.deinit();
self.push_slides.deinit();
}
fn logAllErrors(self: *ParserContext) void {
for (self.parser_errors.items) |err| {
if (err.message) |msg| {
std.log.err("line {d}: {s} ({s})", .{ err.line_number, err.parser_error, msg });
} else {
std.log.err("line {d}: {s}", .{ err.line_number, err.parser_error });
}
}
}
pub fn allErrorsToCstrArray(self: *ParserContext, allocator: *std.mem.Allocator) ![*]const [*]const u8 {
if (self.allErrorsCstrArray) |ret| {
return ret.ptr;
}
const howmany = self.parser_errors.items.len;
var stringarray = try allocator.alloc([*]const u8, howmany);
var i: usize = 0;
for (self.parser_errors.items) |err| {
// err is const, so this doesn't work: stringarray[i] = try err.getFormattedStr(allocator);
var err2: ParserErrorContext = err;
stringarray[i] = try err2.getFormattedStr(allocator);
i += 1;
}
self.allErrorsCstrArray = stringarray;
return stringarray.ptr;
}
};
fn reportErrorInContext(err: anyerror, ctx: *ParserContext, msg: ?[]const u8) void {
const pec = ParserErrorContext{
.parser_error = err,
.line_number = ctx.parsed_line_number,
.line_offset = ctx.parsed_line_offset,
.message = msg,
};
ctx.parser_errors.append(pec) catch |internal_err| {
std.log.crit("Could not add error to error list!", .{});
std.log.crit(" The error to be reported: {any}", .{err});
std.log.crit(" The error that prevented it: {any}", .{internal_err});
};
}
fn reportErrorInParsingContext(err: anyerror, pctx: *ItemContext, ctx: *ParserContext, msg: ?[]const u8) void {
const pec = ParserErrorContext{
.parser_error = err,
.line_number = pctx.line_number,
.line_offset = pctx.line_offset,
.message = msg,
};
ctx.parser_errors.append(pec) catch |internal_err| {
std.log.crit("Could not add error to error list!", .{});
std.log.crit(" The error to be reported: {any}", .{err});
std.log.crit(" The error that prevented it: {any}", .{internal_err});
};
}
pub fn constructSlidesFromBuf(input: []const u8, slideshow: *SlideShow, allocator: *std.mem.Allocator) !*ParserContext {
var context: *ParserContext = try ParserContext.new(allocator);
context.slideshow = slideshow;
context.input = try allocator.dupeZ(u8, input);
// std.log.info("input len: {d}, context.input len: {d}", .{ input.len, context.input.len });
var start: usize = if (std.mem.startsWith(u8, context.input, "\xEF\xBB\xBF")) 3 else 0;
var it = std.mem.split(context.input[start..], "\n");
var parsing_item_context = ItemContext{};
while (it.next()) |line_untrimmed| {
{
const line = std.mem.trimRight(u8, line_untrimmed, " \t");
context.parsed_line_number += 1;
defer context.parsed_line_offset += line_untrimmed.len + 1;
if (line.len == 0) {
continue;
}
if (line[0] == 0) {
break;
}
std.log.info("Parsing line {d} at offset {d}", .{ context.parsed_line_number, context.parsed_line_offset });
if (context.input[context.parsed_line_offset] != line[0]) {
std.log.alert("line {d} assumed to start at offset {} but saw {c}({}) instead of {c}({})", .{ context.parsed_line_number, context.parsed_line_offset, line[0], line[0], context.input[context.parsed_line_offset], context.input[context.parsed_line_offset] });
return error.Overflow;
}
if (std.mem.startsWith(u8, line, "#")) {
continue;
}
if (std.mem.startsWith(u8, line, "@font")) {
parseFontGlobals(line, slideshow, context) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
continue;
}
if (std.mem.startsWith(u8, line, "@underline_width=")) {
parseUnderlineWidth(line, slideshow, context) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
continue;
}
if (std.mem.startsWith(u8, line, "@color=")) {
parseDefaultColor(line, slideshow, context) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
continue;
}
if (std.mem.startsWith(u8, line, "@bullet_color=")) {
parseDefaultBulletColor(line, slideshow, context) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
continue;
}
if (std.mem.startsWith(u8, line, "@bullet_symbol=")) {
parseDefaultBulletSymbol(line, slideshow, context) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
continue;
}
if (std.mem.startsWith(u8, line, "@")) {
// commit current parsing_item_context
commitParsingContext(&parsing_item_context, context) catch |err| {
reportErrorInContext(err, context, null);
};
// then parse current item context
parsing_item_context = parseItemAttributes(line, context) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
parsing_item_context.line_number = context.parsed_line_number;
parsing_item_context.line_offset = context.parsed_line_offset;
} else {
// add text lines to current parsing context
var text: []const u8 = undefined;
var the_line = line;
// make _ line an empty line
if (line.len == 1 and line[0] == '_') {
the_line = " ";
}
if (parsing_item_context.text) |txt| {
text = std.fmt.allocPrint(context.allocator, "{s}\n{s}", .{ txt, the_line }) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
} else {
text = std.fmt.allocPrint(context.allocator, "{s}", .{the_line}) catch |err| {
reportErrorInContext(err, context, null);
continue;
};
}
parsing_item_context.text = text;
}
}
}
// commit last slide
commitParsingContext(&parsing_item_context, context) catch |err| {
reportErrorInContext(err, context, null);
};
context.slideshow.slides.append(context.current_slide) catch |err| {
reportErrorInContext(err, context, null);
};
if (context.parser_errors.items.len == 0) {
// std.log.info("OK. There were no errors.", .{});
} else {
// std.log.info("There were errors!", .{});
context.logAllErrors();
}
return context;
}
fn parseFontGlobals(line: []const u8, slideshow: *SlideShow, context: *ParserContext) !void {
var it = std.mem.tokenize(line, "=");
if (it.next()) |word| {
if (std.mem.eql(u8, word, "@fontsize")) {
if (it.next()) |sizestr| {
slideshow.default_fontsize = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "@fonsize value not int-parseable");
return;
};
std.log.debug("global fontsize: {d}", .{slideshow.default_fontsize});
}
}
if (std.mem.eql(u8, word, "@font")) {
if (it.next()) |font| {
slideshow.default_font = try context.allocator.dupe(u8, font);
std.log.debug("global font: {s}", .{slideshow.default_font});
}
}
if (std.mem.eql(u8, word, "@font_bold")) {
if (it.next()) |font_bold| {
slideshow.default_font_bold = try context.allocator.dupe(u8, font_bold);
std.log.debug("global font_bold: {s}", .{slideshow.default_font_bold});
}
}
if (std.mem.eql(u8, word, "@font_italic")) {
if (it.next()) |font_italic| {
slideshow.default_font_italic = try context.allocator.dupe(u8, font_italic);
std.log.debug("global font_italic: {s}", .{slideshow.default_font_italic});
}
}
if (std.mem.eql(u8, word, "@font_bold_italic")) {
if (it.next()) |font_bold_italic| {
slideshow.default_font_bold_italic = try context.allocator.dupe(u8, font_bold_italic);
std.log.debug("global font_bold_italic: {s}", .{slideshow.default_font_bold_italic});
}
}
}
}
fn parseUnderlineWidth(line: []const u8, slideshow: *SlideShow, context: *ParserContext) !void {
var it = std.mem.tokenize(line, "=");
if (it.next()) |word| {
if (std.mem.eql(u8, word, "@underline_width")) {
if (it.next()) |sizestr| {
slideshow.default_underline_width = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "@underline_width value not int-parseable");
return;
};
std.log.debug("global underline_width: {d}", .{slideshow.default_underline_width});
}
}
}
}
fn parseDefaultColor(line: []const u8, slideshow: *SlideShow, context: *ParserContext) !void {
var it = std.mem.tokenize(line, "=");
if (it.next()) |word| {
if (std.mem.eql(u8, word, "@color")) {
slideshow.default_color = try parseColor(line[1..], context);
std.log.debug("global default_color: {any}", .{slideshow.default_color});
}
}
}
fn parseDefaultBulletColor(line: []const u8, slideshow: *SlideShow, context: *ParserContext) !void {
var it = std.mem.tokenize(line, "=");
if (it.next()) |word| {
if (std.mem.eql(u8, word, "@bullet_color")) {
slideshow.default_bullet_color = try parseColor(line[8..], context);
std.log.debug("global default_bullet_color: {any}", .{slideshow.default_bullet_color});
}
}
}
fn parseDefaultBulletSymbol(line: []const u8, slideshow: *SlideShow, context: *ParserContext) !void {
var it = std.mem.tokenize(line, "=");
if (it.next()) |word| {
if (std.mem.eql(u8, word, "@bullet_symbol")) {
if (it.next()) |sym| {
slideshow.default_bullet_symbol = try context.allocator.dupe(u8, sym);
std.log.debug("global default_bullet_symbol: {s}", .{slideshow.default_bullet_symbol});
}
}
}
}
fn parseColor(s: []const u8, context: *ParserContext) !ImVec4 {
var it = std.mem.tokenize(s, "=");
var ret = ImVec4{};
if (it.next()) |word| {
if (std.mem.eql(u8, word, "color")) {
if (it.next()) |colorstr| {
ret = try parseColorLiteral(colorstr, context);
}
}
}
return ret;
}
fn parseColorLiteral(colorstr: []const u8, context: *ParserContext) !ImVec4 {
var ret = ImVec4{};
if (colorstr.len != 9 or colorstr[0] != '#') {
const errmsg = try std.fmt.allocPrint(context.allocator, "color string '{s}' not 9 chars long or missing #", .{colorstr});
reportErrorInContext(ParserError.Syntax, context, errmsg);
return ParserError.Syntax;
}
var temp: ImVec4 = undefined;
var coloru32 = std.fmt.parseInt(c_uint, colorstr[1..], 16) catch |err| {
const errmsg = try std.fmt.allocPrint(context.allocator, "color string '{s}' not hex-parsable", .{colorstr});
reportErrorInContext(err, context, errmsg);
return ParserError.Syntax;
};
igColorConvertU32ToFloat4(&temp, coloru32);
ret.x = temp.w;
ret.y = temp.z;
ret.z = temp.y;
ret.w = temp.x;
return ret;
}
fn parseItemAttributes(line: []const u8, context: *ParserContext) !ItemContext {
var item_context = ItemContext{};
var word_it = std.mem.tokenize(line, " \t");
if (word_it.next()) |directive| {
item_context.directive = directive;
} else {
return ParserError.Internal;
}
// check if directive needs to be followed by a name
if (std.mem.eql(u8, item_context.directive, "@push") or std.mem.eql(u8, item_context.directive, "@pop") or std.mem.eql(u8, item_context.directive, "@pushslide") or std.mem.eql(u8, item_context.directive, "@popslide")) {
if (word_it.next()) |name| {
item_context.context_name = name;
// std.log.info("context name : {s}", .{item_context.context_name.?});
} else {
reportErrorInContext(ParserError.Syntax, context, "context name missing!");
return ParserError.Syntax;
}
}
std.log.debug("Parsing {s}", .{item_context.directive});
var text_words = std.ArrayList([]const u8).init(context.allocator);
defer text_words.deinit();
var after_text_directive = false;
while (word_it.next()) |word| {
if (!after_text_directive) {
var attr_it = std.mem.tokenize(word, "=");
if (attr_it.next()) |attrname| {
if (std.mem.eql(u8, attrname, "x")) {
if (attr_it.next()) |sizestr| {
var size = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "cannot parse x=");
continue;
};
var pos: ImVec2 = .{};
if (item_context.position) |position| {
pos = position;
}
pos.x = @intToFloat(f32, size);
item_context.position = pos;
}
}
if (std.mem.eql(u8, attrname, "y")) {
if (attr_it.next()) |sizestr| {
var size = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "cannot parse y=");
continue;
};
var pos: ImVec2 = .{};
if (item_context.position) |position| {
pos = position;
}
pos.y = @intToFloat(f32, size);
item_context.position = pos;
}
}
if (std.mem.eql(u8, attrname, "w")) {
if (attr_it.next()) |sizestr| {
var width = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "cannot parse w=");
continue;
};
var size: ImVec2 = .{};
if (item_context.size) |csize| {
size = csize;
}
size.x = @intToFloat(f32, width);
item_context.size = size;
}
}
if (std.mem.eql(u8, attrname, "h")) {
if (attr_it.next()) |sizestr| {
var height = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "cannot parse h=");
continue;
};
var size: ImVec2 = .{};
if (item_context.size) |csize| {
size = csize;
}
size.y = @intToFloat(f32, height);
item_context.size = size;
}
}
if (std.mem.eql(u8, attrname, "fontsize")) {
if (attr_it.next()) |sizestr| {
var size = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "cannot parse fontsize=");
continue;
};
item_context.fontSize = size;
}
}
if (std.mem.eql(u8, attrname, "color")) {
if (attr_it.next()) |colorstr| {
var color = parseColorLiteral(colorstr, context) catch |err| {
reportErrorInContext(err, context, "cannot parse color=");
continue;
};
item_context.color = color;
}
}
if (std.mem.eql(u8, attrname, "bullet_color")) {
if (attr_it.next()) |colorstr| {
var color = parseColorLiteral(colorstr, context) catch |err| {
reportErrorInContext(err, context, "cannot parse bullet_color=");
continue;
};
item_context.bullet_color = color;
}
}
if (std.mem.eql(u8, attrname, "bullet_symbol")) {
if (attr_it.next()) |sym| {
item_context.bullet_symbol = try context.allocator.dupe(u8, sym);
}
}
if (std.mem.eql(u8, attrname, "underline_width")) {
if (attr_it.next()) |sizestr| {
var width = std.fmt.parseInt(i32, sizestr, 10) catch |err| {
reportErrorInContext(err, context, "cannot parse underline_width=");
continue;
};
item_context.underline_width = width;
}
}
if (std.mem.eql(u8, attrname, "text")) {
after_text_directive = true;
if (attr_it.next()) |textafterequal| {
try text_words.append(textafterequal);
}
}
if (std.mem.eql(u8, attrname, "img")) {
if (attr_it.next()) |imgpath| {
item_context.img_path = imgpath;
}
}
}
} else {
try text_words.append(word);
}
}
if (text_words.items.len > 0) {
item_context.text = try std.mem.join(context.allocator, " ", text_words.items);
}
return item_context;
}
// - @push -- merge: parser context, current item context --> pushed item
// - @pushslide -- pushed slide just from parser context, clear current item context just as with @page
// - @pop -- merge: current item context with parser context --> current item context
// e.g. "@pop some_shit x=1" -- pop and override
// - @popslide -- just pop the slide, clear current item context
// - @slide -- just create and emit slide with parser context (and not item context!), clear current item context
// we don't want to merge current item context with @slide: we would inherit the shit from any
// previous item!
// - @box -- merge: parser context, current item context -> emitted box
// diese Software eure "normale" Software ist und also, see override rules below for instantiating a box.
// - @bg -- merge: parser context, current item context -> emitted bg item
//
//
// Instantiating a box:
// override all unset settings by:
// - item context values : use SlideItem.applyContext(ItemContext)
// - slide defaults
// - slideshow defaults
//
fn mergeParserAndItemContext(parsing_item_context: *ItemContext, item_context: *ItemContext) void {
if (parsing_item_context.text == null) parsing_item_context.text = item_context.text;
if (parsing_item_context.fontSize == null) parsing_item_context.fontSize = item_context.fontSize;
if (parsing_item_context.color == null) parsing_item_context.color = item_context.color;
if (parsing_item_context.position == null) parsing_item_context.position = item_context.position;
if (parsing_item_context.size == null) parsing_item_context.size = item_context.size;
if (parsing_item_context.underline_width == null) parsing_item_context.underline_width = item_context.underline_width;
if (parsing_item_context.bullet_color == null) parsing_item_context.bullet_color = item_context.bullet_color;
}
fn commitParsingContext(parsing_item_context: *ItemContext, context: *ParserContext) !void {
// .
std.log.debug("{s} : text=`{s}`", .{ parsing_item_context.directive, parsing_item_context.text });
// switch over directives
if (std.mem.eql(u8, parsing_item_context.directive, "@push")) {
mergeParserAndItemContext(parsing_item_context, &context.current_context);
if (parsing_item_context.context_name) |context_name| {
try context.push_contexts.put(context_name, parsing_item_context.*);
}
// just to make sure this context remains active -- TODO: why?!??!? isn't it better cleared out after the push?
// context.current_context = parsing_item_context.*;
// context.current_context.text = null;
// context.current_context.img_path = null;
context.current_context = .{}; // TODO: we better cleared the context after the push
return;
}
if (std.mem.eql(u8, parsing_item_context.directive, "@pushslide")) {
context.current_slide.applyContext(parsing_item_context);
if (parsing_item_context.context_name) |context_name| {
try context.push_slides.put(context_name, context.current_slide);
}
context.current_slide = try Slide.new(context.allocator);
}
if (std.mem.eql(u8, parsing_item_context.directive, "@pop")) {
// pop the context if present
// also set the parsing context to the current context
if (parsing_item_context.context_name) |context_name| {
const ctx_opt = context.push_contexts.get(context_name);
if (ctx_opt) |ctx| {
context.current_context = ctx;
context.current_context.text = null;
context.current_context.img_path = null;
parsing_item_context.applyOtherIfNull(ctx);
} else {
const errmsg = try std.fmt.allocPrint(context.allocator, "cannot @pop `{s}` : was not pushed!", .{context_name});
reportErrorInParsingContext(ParserError.Syntax, parsing_item_context, context, errmsg);
}
_ = try commitItemToSlide(parsing_item_context, context);
}
return;
}
if (std.mem.eql(u8, parsing_item_context.directive, "@popslide")) {
// emit the current slide (if present) into the slideshow
// then create a new slide (NOT deiniting the current one) with the **parsing** context's overrides
// and make it the current slide
// after that, clear the current item context
if (context.first_slide_emitted) {
context.current_slide.applyContext(parsing_item_context); // ignore current item context, it's a @slide
try context.slideshow.slides.append(context.current_slide);
}
context.first_slide_emitted = true;
// pop the slide and reset the item context
// (the latter is done by continue)
if (parsing_item_context.context_name) |context_name| {
const sld_opt = context.push_slides.get(context_name);
if (sld_opt) |sld| {
context.current_slide = try Slide.fromSlide(sld, context.allocator);
context.current_slide.pos_in_editor = parsing_item_context.line_offset;
context.current_slide.line_in_editor = parsing_item_context.line_number;
} else {
const errmsg = try std.fmt.allocPrint(context.allocator, "cannot @popslide `{s}` : was not pushed!", .{context_name});
reportErrorInParsingContext(ParserError.Syntax, parsing_item_context, context, errmsg);
}
// new slide, clear the current item context
context.current_context = .{};
}
return;
}
if (std.mem.eql(u8, parsing_item_context.directive, "@slide")) {
// emit the current slide (if present) into the slideshow
// then create a new slide (NOT deiniting the current one) with the **parsing** context's overrides
// and make it the current slide
// after that, clear the current item context
if (context.first_slide_emitted) {
context.current_slide.applyContext(parsing_item_context); // ignore current item context, it's a @slide
try context.slideshow.slides.append(context.current_slide);
}
context.first_slide_emitted = true;
context.current_slide = try Slide.new(context.allocator);
context.current_slide.pos_in_editor = parsing_item_context.line_offset; //context.parsed_line_offset;
context.current_slide.line_in_editor = parsing_item_context.line_number; // context.parsed_line_number;
context.current_context = .{}; // clear the current item context, to start fresh in each new slide
return;
}
if (std.mem.eql(u8, parsing_item_context.directive, "@box")) {
// set kind to img if img attribute is present else set it to textbox
// but first, merge shit
// - @box -- merge: parser context, current item context -> emitted box
// also, see override rules below for instantiating a box.
//
// Instantiating a box:
// override all unset settings by:
// - item context values : use SlideItem.applyContext(ItemContext)
// - slide defaults
// - slideshow defaults
const slide_item = try commitItemToSlide(parsing_item_context, context);
var text = slide_item.text orelse "";
// std.log.info("added a box item: `{s}`", .{text});
return;
}
// @bg is just for convenience. x=0, y=0, w=render_width, h=render_hight
if (std.mem.eql(u8, parsing_item_context.directive, "@bg")) {
// well, we can see if fun features emerge when we do all the merges
parsing_item_context.position = ImVec2{};
_ = try commitItemToSlide(parsing_item_context, context);
return;
}
}
fn commitItemToSlide(parsing_item_context: *ItemContext, parser_context: *ParserContext) !*SlideItem {
mergeParserAndItemContext(parsing_item_context, &parser_context.current_context);
var slide_item = try SlideItem.new(parser_context.allocator);
slide_item.applyContext(parsing_item_context.*);
slide_item.applySlideDefaultsIfNecessary(parser_context.current_slide);
slide_item.applySlideShowDefaultsIfNecessary(parser_context.slideshow);
if (slide_item.img_path) |img_path| {
slide_item.kind = .img;
if (std.mem.eql(u8, parsing_item_context.directive, "@bg")) {
slide_item.kind = .background;
}
} else {
slide_item.kind = .textbox;
}
// std.log.info("\n\n\n ADDING {s} as {any}", .{ parsing_item_context.directive, slide_item.kind });
try parser_context.current_slide.items.append(slide_item.*);
slide_item.sanityCheck() catch |err| {
reportErrorInParsingContext(err, parsing_item_context, parser_context, "item sanity check failed");
};
return slide_item; // just FYI
} | src/parser.zig |
//--------------------------------------------------------------------------------
// Section: Types (9)
//--------------------------------------------------------------------------------
const IID_ICompositionDrawingSurfaceInterop_Value = Guid.initString("fd04e6e3-fe0c-4c3c-ab19-a07601a576ee");
pub const IID_ICompositionDrawingSurfaceInterop = &IID_ICompositionDrawingSurfaceInterop_Value;
pub const ICompositionDrawingSurfaceInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
BeginDraw: fn(
self: *const ICompositionDrawingSurfaceInterop,
updateRect: ?*const RECT,
iid: ?*const Guid,
updateObject: ?*?*anyopaque,
updateOffset: ?*POINT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndDraw: fn(
self: *const ICompositionDrawingSurfaceInterop,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Resize: fn(
self: *const ICompositionDrawingSurfaceInterop,
sizePixels: SIZE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Scroll: fn(
self: *const ICompositionDrawingSurfaceInterop,
scrollRect: ?*const RECT,
clipRect: ?*const RECT,
offsetX: i32,
offsetY: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResumeDraw: fn(
self: *const ICompositionDrawingSurfaceInterop,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SuspendDraw: fn(
self: *const ICompositionDrawingSurfaceInterop,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop_BeginDraw(self: *const T, updateRect: ?*const RECT, iid: ?*const Guid, updateObject: ?*?*anyopaque, updateOffset: ?*POINT) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop.VTable, self.vtable).BeginDraw(@ptrCast(*const ICompositionDrawingSurfaceInterop, self), updateRect, iid, updateObject, updateOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop_EndDraw(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop.VTable, self.vtable).EndDraw(@ptrCast(*const ICompositionDrawingSurfaceInterop, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop_Resize(self: *const T, sizePixels: SIZE) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop.VTable, self.vtable).Resize(@ptrCast(*const ICompositionDrawingSurfaceInterop, self), sizePixels);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop_Scroll(self: *const T, scrollRect: ?*const RECT, clipRect: ?*const RECT, offsetX: i32, offsetY: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop.VTable, self.vtable).Scroll(@ptrCast(*const ICompositionDrawingSurfaceInterop, self), scrollRect, clipRect, offsetX, offsetY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop_ResumeDraw(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop.VTable, self.vtable).ResumeDraw(@ptrCast(*const ICompositionDrawingSurfaceInterop, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop_SuspendDraw(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop.VTable, self.vtable).SuspendDraw(@ptrCast(*const ICompositionDrawingSurfaceInterop, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICompositionDrawingSurfaceInterop2_Value = Guid.initString("41e64aae-98c0-4239-8e95-a330dd6aa18b");
pub const IID_ICompositionDrawingSurfaceInterop2 = &IID_ICompositionDrawingSurfaceInterop2_Value;
pub const ICompositionDrawingSurfaceInterop2 = extern struct {
pub const VTable = extern struct {
base: ICompositionDrawingSurfaceInterop.VTable,
CopySurface: fn(
self: *const ICompositionDrawingSurfaceInterop2,
destinationResource: ?*IUnknown,
destinationOffsetX: i32,
destinationOffsetY: i32,
sourceRectangle: ?*const RECT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ICompositionDrawingSurfaceInterop.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionDrawingSurfaceInterop2_CopySurface(self: *const T, destinationResource: ?*IUnknown, destinationOffsetX: i32, destinationOffsetY: i32, sourceRectangle: ?*const RECT) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionDrawingSurfaceInterop2.VTable, self.vtable).CopySurface(@ptrCast(*const ICompositionDrawingSurfaceInterop2, self), destinationResource, destinationOffsetX, destinationOffsetY, sourceRectangle);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICompositionGraphicsDeviceInterop_Value = Guid.initString("a116ff71-f8bf-4c8a-9c98-70779a32a9c8");
pub const IID_ICompositionGraphicsDeviceInterop = &IID_ICompositionGraphicsDeviceInterop_Value;
pub const ICompositionGraphicsDeviceInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetRenderingDevice: fn(
self: *const ICompositionGraphicsDeviceInterop,
value: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRenderingDevice: fn(
self: *const ICompositionGraphicsDeviceInterop,
value: ?*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 ICompositionGraphicsDeviceInterop_GetRenderingDevice(self: *const T, value: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionGraphicsDeviceInterop.VTable, self.vtable).GetRenderingDevice(@ptrCast(*const ICompositionGraphicsDeviceInterop, self), value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionGraphicsDeviceInterop_SetRenderingDevice(self: *const T, value: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionGraphicsDeviceInterop.VTable, self.vtable).SetRenderingDevice(@ptrCast(*const ICompositionGraphicsDeviceInterop, self), value);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICompositorInterop_Value = Guid.initString("25297d5c-3ad4-4c9c-b5cf-e36a38512330");
pub const IID_ICompositorInterop = &IID_ICompositorInterop_Value;
pub const ICompositorInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateCompositionSurfaceForHandle: fn(
self: *const ICompositorInterop,
swapChain: ?HANDLE,
result: ?**struct{comment: []const u8 = "MissingClrType ICompositionSurface.Windows.UI.Composition"},
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateCompositionSurfaceForSwapChain: fn(
self: *const ICompositorInterop,
swapChain: ?*IUnknown,
result: ?**struct{comment: []const u8 = "MissingClrType ICompositionSurface.Windows.UI.Composition"},
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateGraphicsDevice: fn(
self: *const ICompositorInterop,
renderingDevice: ?*IUnknown,
result: ?**struct{comment: []const u8 = "MissingClrType CompositionGraphicsDevice.Windows.UI.Composition"},
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositorInterop_CreateCompositionSurfaceForHandle(self: *const T, swapChain: ?HANDLE, result: ?**struct{comment: []const u8 = "MissingClrType ICompositionSurface.Windows.UI.Composition"}) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositorInterop.VTable, self.vtable).CreateCompositionSurfaceForHandle(@ptrCast(*const ICompositorInterop, self), swapChain, result);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositorInterop_CreateCompositionSurfaceForSwapChain(self: *const T, swapChain: ?*IUnknown, result: ?**struct{comment: []const u8 = "MissingClrType ICompositionSurface.Windows.UI.Composition"}) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositorInterop.VTable, self.vtable).CreateCompositionSurfaceForSwapChain(@ptrCast(*const ICompositorInterop, self), swapChain, result);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositorInterop_CreateGraphicsDevice(self: *const T, renderingDevice: ?*IUnknown, result: ?**struct{comment: []const u8 = "MissingClrType CompositionGraphicsDevice.Windows.UI.Composition"}) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositorInterop.VTable, self.vtable).CreateGraphicsDevice(@ptrCast(*const ICompositorInterop, self), renderingDevice, result);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ISwapChainInterop_Value = Guid.initString("26f496a0-7f38-45fb-88f7-faaabe67dd59");
pub const IID_ISwapChainInterop = &IID_ISwapChainInterop_Value;
pub const ISwapChainInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetSwapChain: fn(
self: *const ISwapChainInterop,
swapChain: ?*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 ISwapChainInterop_SetSwapChain(self: *const T, swapChain: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ISwapChainInterop.VTable, self.vtable).SetSwapChain(@ptrCast(*const ISwapChainInterop, self), swapChain);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IVisualInteractionSourceInterop_Value = Guid.initString("11f62cd1-2f9d-42d3-b05f-d6790d9e9f8e");
pub const IID_IVisualInteractionSourceInterop = &IID_IVisualInteractionSourceInterop_Value;
pub const IVisualInteractionSourceInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
TryRedirectForManipulation: fn(
self: *const IVisualInteractionSourceInterop,
pointerInfo: ?*const POINTER_INFO,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IVisualInteractionSourceInterop_TryRedirectForManipulation(self: *const T, pointerInfo: ?*const POINTER_INFO) callconv(.Inline) HRESULT {
return @ptrCast(*const IVisualInteractionSourceInterop.VTable, self.vtable).TryRedirectForManipulation(@ptrCast(*const IVisualInteractionSourceInterop, self), pointerInfo);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICompositionCapabilitiesInteropFactory_Value = Guid.initString("2c9db356-e70d-4642-8298-bc4aa5b4865c");
pub const IID_ICompositionCapabilitiesInteropFactory = &IID_ICompositionCapabilitiesInteropFactory_Value;
pub const ICompositionCapabilitiesInteropFactory = extern struct {
pub const VTable = extern struct {
base: IInspectable.VTable,
GetForWindow: fn(
self: *const ICompositionCapabilitiesInteropFactory,
hwnd: ?HWND,
result: ?**struct{comment: []const u8 = "MissingClrType CompositionCapabilities.Windows.UI.Composition"},
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IInspectable.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositionCapabilitiesInteropFactory_GetForWindow(self: *const T, hwnd: ?HWND, result: ?**struct{comment: []const u8 = "MissingClrType CompositionCapabilities.Windows.UI.Composition"}) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositionCapabilitiesInteropFactory.VTable, self.vtable).GetForWindow(@ptrCast(*const ICompositionCapabilitiesInteropFactory, self), hwnd, result);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ICompositorDesktopInterop_Value = Guid.initString("29e691fa-4567-4dca-b319-d0f207eb6807");
pub const IID_ICompositorDesktopInterop = &IID_ICompositorDesktopInterop_Value;
pub const ICompositorDesktopInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateDesktopWindowTarget: fn(
self: *const ICompositorDesktopInterop,
hwndTarget: ?HWND,
isTopmost: BOOL,
result: ?**struct{comment: []const u8 = "MissingClrType DesktopWindowTarget.Windows.UI.Composition.Desktop"},
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnsureOnThread: fn(
self: *const ICompositorDesktopInterop,
threadId: 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 ICompositorDesktopInterop_CreateDesktopWindowTarget(self: *const T, hwndTarget: ?HWND, isTopmost: BOOL, result: ?**struct{comment: []const u8 = "MissingClrType DesktopWindowTarget.Windows.UI.Composition.Desktop"}) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositorDesktopInterop.VTable, self.vtable).CreateDesktopWindowTarget(@ptrCast(*const ICompositorDesktopInterop, self), hwndTarget, isTopmost, result);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ICompositorDesktopInterop_EnsureOnThread(self: *const T, threadId: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ICompositorDesktopInterop.VTable, self.vtable).EnsureOnThread(@ptrCast(*const ICompositorDesktopInterop, self), threadId);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDesktopWindowTargetInterop_Value = Guid.initString("35dbf59e-e3f9-45b0-81e7-fe75f4145dc9");
pub const IID_IDesktopWindowTargetInterop = &IID_IDesktopWindowTargetInterop_Value;
pub const IDesktopWindowTargetInterop = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
// TODO: this function has a "SpecialName", should Zig do anything with this?
get_Hwnd: fn(
self: *const IDesktopWindowTargetInterop,
value: ?*?HWND,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDesktopWindowTargetInterop_get_Hwnd(self: *const T, value: ?*?HWND) callconv(.Inline) HRESULT {
return @ptrCast(*const IDesktopWindowTargetInterop.VTable, self.vtable).get_Hwnd(@ptrCast(*const IDesktopWindowTargetInterop, self), value);
}
};}
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 (11)
//--------------------------------------------------------------------------------
const Guid = @import("../../zig.zig").Guid;
const BOOL = @import("../../foundation.zig").BOOL;
const HANDLE = @import("../../foundation.zig").HANDLE;
const HRESULT = @import("../../foundation.zig").HRESULT;
const HWND = @import("../../foundation.zig").HWND;
const IInspectable = @import("../../system/win_rt.zig").IInspectable;
const IUnknown = @import("../../system/com.zig").IUnknown;
const POINT = @import("../../foundation.zig").POINT;
const POINTER_INFO = @import("../../ui/input/pointer.zig").POINTER_INFO;
const RECT = @import("../../foundation.zig").RECT;
const SIZE = @import("../../foundation.zig").SIZE;
test {
@setEvalBranchQuota(
@import("std").meta.declarations(@This()).len * 3
);
// reference all the pub declarations
if (!@import("builtin").is_test) return;
inline for (@import("std").meta.declarations(@This())) |decl| {
if (decl.is_pub) {
_ = decl;
}
}
} | win32/system/win_rt/composition.zig |
const std = @import("std");
//--------------------------------------------------------------------------------------------------
pub fn part1() anyerror!void {
const file = std.fs.cwd().openFile("data/day03_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
const stderr = std.io.getStdErr();
break :label stderr;
};
defer file.close();
const file_size = try file.getEndPos();
std.log.info("File size {}", .{file_size});
var reader = std.io.bufferedReader(file.reader());
var istream = reader.reader();
var buf: [12]u8 = undefined;
var counts = [_]u32{0} ** 12;
var line_count: u32 = 0;
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) {
//std.log.info("{s}", .{line});
line_count += 1;
for (buf) |char, i| {
if (char == '1') {
counts[i] += 1;
}
}
}
var gamma_rate: u16 = 0;
var epsilon_rate: u16 = 0;
for (counts) |count, i| {
if (count > line_count / 2) { // most common bit is 1
gamma_rate |= (@as(u16, 1) << @truncate(u4, 11 - i));
} else {
epsilon_rate |= (@as(u16, 1) << @truncate(u4, 11 - i)); // least common bit is 1
}
}
std.log.info("Part 1 counts={d}, gamma_rate={b}, epsilon_rate={b}, answer={d}", .{ counts, gamma_rate, epsilon_rate, gamma_rate * @as(u32, epsilon_rate) });
}
//--------------------------------------------------------------------------------------------------
pub fn copy_array(input: [12]u8) [12]u8 {
var res = [_]u8{0} ** 12;
var i: u32 = 0;
while (i < 12) : (i += 1) {
res[i] = input[i];
}
return res;
}
//--------------------------------------------------------------------------------------------------
pub fn eq_array(lhs: [12]u8, rhs: [12]u8, limit: u32) bool {
var i: u32 = 0;
while (i < 12 and i < limit) : (i += 1) {
if (lhs[i] != rhs[i]) {
return false;
}
}
return true;
}
//--------------------------------------------------------------------------------------------------
pub fn array_to_int(input: [12]u8) u32 {
var res: u32 = 0;
var i: u32 = 0;
while (i < 12) : (i += 1) {
if (input[i] == '1') {
res |= (@as(u32, 1) << @truncate(u4, 11 - i));
}
}
return res;
}
//--------------------------------------------------------------------------------------------------
pub fn part2() anyerror!void {
const file = std.fs.cwd().openFile("data/day03_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
const stderr = std.io.getStdErr();
break :label stderr;
};
defer file.close();
const file_size = try file.getEndPos();
std.log.info("File size {}", .{file_size});
var reader = std.io.bufferedReader(file.reader());
var buf: [12]u8 = undefined;
var oxygen = [_]u8{'0'} ** 12;
var oxygen_lines_count: u32 = 0;
var oxygen_set_count: u32 = 0;
var co2 = [_]u8{'0'} ** 12;
var co2_lines_count: u32 = 0;
var co2_set_count: u32 = 0;
var final_oxygen = [_]u8{'0'} ** 12;
var final_co2 = [_]u8{'0'} ** 12;
for (buf) |digit, col_idx| {
_ = digit;
oxygen_lines_count = 0;
oxygen_set_count = 0;
co2_lines_count = 0;
co2_set_count = 0;
// Read the whole file. But just examining one column (digit)
try file.seekTo(0);
var istream = reader.reader();
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) {
//std.log.info("{s}", .{line});
var is_oxygen = eq_array(oxygen, buf, @truncate(u32, col_idx));
var is_co2 = eq_array(co2, buf, @truncate(u32, col_idx));
if (is_oxygen) {
final_oxygen = copy_array(buf);
oxygen_lines_count += 1;
// Total count of 1 digits
if (buf[col_idx] == '1') {
oxygen_set_count += 1;
}
}
if (is_co2) {
co2_lines_count += 1;
final_co2 = copy_array(buf);
// Total count of 1 digits
if (buf[col_idx] == '1') {
co2_set_count += 1;
}
}
} // while file
// Calculate the most common bit (oxygen) and place it into a filter
if (oxygen_set_count >= (oxygen_lines_count - oxygen_set_count)) { // most common bit is 1
oxygen[col_idx] = '1';
}
if (co2_set_count < (co2_lines_count - co2_set_count)) { // least common bit is 1
co2[col_idx] = '1';
}
} // for digit
const res_oxygen = array_to_int(final_oxygen);
const res_co2 = array_to_int(final_co2);
const answer = res_oxygen * res_co2;
std.log.info("Part 2 oxygen={b}, co2={b}, answer={d}", .{ res_oxygen, res_co2, answer });
}
//--------------------------------------------------------------------------------------------------
const Allocator = std.mem.Allocator;
//--------------------------------------------------------------------------------------------------
const Node = struct {
value: u32,
l: ?*Node,
r: ?*Node,
pub fn init() Node {
return Node{
.value = 0,
.l = null,
.r = null,
};
}
};
//--------------------------------------------------------------------------------------------------
pub fn create_node(allocator: *Allocator) ?*Node {
const ptr: ?*Node = allocator.create(Node) catch return null;
ptr.?.* = Node.init();
return ptr;
}
//--------------------------------------------------------------------------------------------------
pub fn tree_add(head: *Node, input: []u8, allocator: *Allocator) void {
(head.*).value += 1;
if (input.len == 0) {
return;
} else if (input[0] == '1') {
if (head.l == null) {
head.l = create_node(allocator).?;
}
tree_add(head.l.?, input[1..], allocator);
} else {
if (head.r == null) {
head.r = create_node(allocator).?;
}
tree_add(head.r.?, input[1..], allocator);
}
}
//--------------------------------------------------------------------------------------------------
pub fn tree_print(head: *Node) void {
std.log.info("val={d}", .{head.value});
if (head.l != null) {
tree_print(head.l.?);
}
if (head.r != null) {
tree_print(head.r.?);
}
}
//--------------------------------------------------------------------------------------------------
pub fn tree_most_common(head: *Node, result: []u8) void {
var left_count: u32 = 0;
var right_count: u32 = 0;
if (head.l != null) {
left_count = head.l.?.value;
}
if (head.r != null) {
right_count = head.r.?.value;
}
// Go left (1) on tie breaker
if (left_count >= right_count and head.l != null) {
//std.log.info("1 <= {d}/{d}", .{ left_count, right_count });
result[0] = '1';
tree_most_common(head.l.?, result[1..]);
} else if (head.r != null) {
//std.log.info("0 <= {d}/{d}", .{ left_count, right_count });
result[0] = '0';
tree_most_common(head.r.?, result[1..]);
}
}
//--------------------------------------------------------------------------------------------------
pub fn tree_least_common(head: *Node, result: []u8) void {
var left_count: u32 = 0;
var right_count: u32 = 0;
if (head.l != null) {
left_count = head.l.?.value;
}
if (head.r != null) {
right_count = head.r.?.value;
}
// Go right (0) on tie breaker
if ((right_count == 0 or left_count < right_count) and head.l != null) {
//std.log.info("1 <= {d}/{d}", .{ left_count, right_count });
result[0] = '1';
tree_least_common(head.l.?, result[1..]);
} else if (head.r != null) {
//std.log.info("0 <= {d}/{d}", .{ left_count, right_count });
result[0] = '0';
tree_least_common(head.r.?, result[1..]);
}
}
//--------------------------------------------------------------------------------------------------
pub fn part2_with_tree() anyerror!void {
const file = std.fs.cwd().openFile("data/day03_input.txt", .{}) catch |err| label: {
std.debug.print("unable to open file: {e}\n", .{err});
const stderr = std.io.getStdErr();
break :label stderr;
};
defer file.close();
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
var allocator = arena.allocator();
var reader = std.io.bufferedReader(file.reader());
var istream = reader.reader();
var buf: [12]u8 = undefined;
var head = create_node(&allocator).?;
// Traverse file and build tree
while (try istream.readUntilDelimiterOrEof(&buf, '\n')) |line| {
_ = line;
tree_add(head, buf[0..12], &allocator);
} // while file
var most_common_result: [12]u8 = undefined;
var least_common_result: [12]u8 = undefined;
tree_most_common(head, most_common_result[0..]);
tree_least_common(head, least_common_result[0..]);
//tree_print(head);
const oxygen: u32 = array_to_int(most_common_result);
const co2: u32 = array_to_int(least_common_result);
std.log.info("Part 2 oxygen={s}, co2={s}, answer={d}", .{ most_common_result, least_common_result, oxygen * co2 });
}
//--------------------------------------------------------------------------------------------------
pub fn main() anyerror!void {
//try part1();
try part2_with_tree();
}
//-------------------------------------------------------------------------------------------------- | src/day03.zig |
const std = @import("std");
const print = std.debug.print;
pub fn main() anyerror!void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var allocator = &gpa.allocator;
var file = try std.fs.cwd().openFile(
"./inputs/day17.txt",
.{
.read = true,
},
);
var reader = std.io.bufferedReader(file.reader()).reader();
var line_buffer: [4]u8 = undefined;
var containers = std.ArrayList(usize).init(allocator);
defer containers.deinit();
while (try reader.readUntilDelimiterOrEof(&line_buffer, '\n')) |line| {
try containers.append(try std.fmt.parseInt(usize, line, 10));
}
const count = ways(150, containers.items);
print("Part 1: {d}\n", .{count});
var counts = std.AutoHashMap(usize, usize).init(allocator);
defer counts.deinit();
try ways_container_count(&counts, 0, 150, containers.items);
var min_count = containers.items.len;
var counts_it = counts.keyIterator();
while (counts_it.next()) |k| {
min_count = std.math.min(min_count, k.*);
}
print("Part 2: {d}\n", .{counts.get(min_count).?});
}
fn ways(n: usize, containers: []usize) usize {
if (n == 0) {
return 1;
}
if (containers.len == 0) {
return 0;
}
const head = containers[0];
const tail = containers[1..];
if (n >= head) {
return ways(n - head, tail) + ways(n, tail);
} else {
return ways(n, tail);
}
}
fn ways_container_count(c_counts: *std.AutoHashMap(usize, usize), c_count: usize, n: usize, containers: []usize) anyerror!void {
if (n == 0) {
if (c_counts.getPtr(c_count)) |w| {
w.* += 1;
} else {
try c_counts.put(c_count, 1);
}
return;
}
if (containers.len == 0) {
return;
}
const head = containers[0];
const tail = containers[1..];
if (n >= head) {
try ways_container_count(c_counts, c_count + 1, n - head, tail);
}
try ways_container_count(c_counts, c_count, n, tail);
} | src/day17.zig |
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
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 GuiRenderer = common.GuiRenderer;
const c = common.c;
const zm = @import("zmath");
const zbt = @import("zbullet");
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: intro 6";
const window_width = 1920;
const window_height = 1080;
const Pso_DrawConst = struct {
object_to_world: [16]f32,
};
const Pso_FrameConst = struct {
world_to_clip: [16]f32,
};
const Pso_Vertex = struct {
position: [3]f32,
normal: [3]f32,
};
const DemoState = struct {
gctx: zd3d12.GraphicsContext,
guir: GuiRenderer,
frame_stats: common.FrameStats,
simple_pso: zd3d12.PipelineHandle,
vertex_buffer: zd3d12.ResourceHandle,
index_buffer: zd3d12.ResourceHandle,
depth_texture: zd3d12.ResourceHandle,
depth_texture_dsv: d3d12.CPU_DESCRIPTOR_HANDLE,
mesh_num_vertices: u32,
mesh_num_indices: u32,
physics: struct {
world: *const zbt.World,
shapes: std.ArrayList(*const zbt.Shape),
},
camera: struct {
position: [3]f32 = .{ 0.0, 10.0, -10.0 },
forward: [3]f32 = .{ 0.0, 0.0, 1.0 },
pitch: f32 = 0.25 * math.pi,
yaw: f32 = 0.0,
} = .{},
mouse: struct {
cursor_prev_x: i32 = 0,
cursor_prev_y: i32 = 0,
} = .{},
};
fn init(allocator: std.mem.Allocator) !DemoState {
const window = try common.initWindow(allocator, window_name, window_width, window_height);
var arena_allocator_state = std.heap.ArenaAllocator.init(allocator);
defer arena_allocator_state.deinit();
const arena_allocator = arena_allocator_state.allocator();
var gctx = zd3d12.GraphicsContext.init(allocator, window);
// Enable vsync.
gctx.present_flags = 0;
gctx.present_interval = 1;
const simple_pso = blk: {
const input_layout_desc = [_]d3d12.INPUT_ELEMENT_DESC{
d3d12.INPUT_ELEMENT_DESC.init("POSITION", 0, .R32G32B32_FLOAT, 0, 0, .PER_VERTEX_DATA, 0),
d3d12.INPUT_ELEMENT_DESC.init("_Normal", 0, .R32G32B32_FLOAT, 0, 12, .PER_VERTEX_DATA, 0),
};
var pso_desc = d3d12.GRAPHICS_PIPELINE_STATE_DESC.initDefault();
pso_desc.InputLayout = .{
.pInputElementDescs = &input_layout_desc,
.NumElements = input_layout_desc.len,
};
pso_desc.RTVFormats[0] = .R8G8B8A8_UNORM;
pso_desc.NumRenderTargets = 1;
pso_desc.DSVFormat = .D32_FLOAT;
pso_desc.BlendState.RenderTarget[0].RenderTargetWriteMask = 0xf;
pso_desc.PrimitiveTopologyType = .TRIANGLE;
break :blk gctx.createGraphicsShaderPipeline(
arena_allocator,
&pso_desc,
content_dir ++ "shaders/intro3.vs.cso",
content_dir ++ "shaders/intro3.ps.cso",
);
};
// Load a mesh from file and store the data in temporary arrays.
var mesh_indices = std.ArrayList(u32).init(arena_allocator);
var mesh_positions = std.ArrayList([3]f32).init(arena_allocator);
var mesh_normals = std.ArrayList([3]f32).init(arena_allocator);
{
const data = common.parseAndLoadGltfFile(content_dir ++ "cube.gltf");
defer c.cgltf_free(data);
common.appendMeshPrimitive(data, 0, 0, &mesh_indices, &mesh_positions, &mesh_normals, null, null);
}
const mesh_num_indices = @intCast(u32, mesh_indices.items.len);
const mesh_num_vertices = @intCast(u32, mesh_positions.items.len);
const vertex_buffer = gctx.createCommittedResource(
.DEFAULT,
d3d12.HEAP_FLAG_NONE,
&d3d12.RESOURCE_DESC.initBuffer(mesh_num_vertices * @sizeOf(Pso_Vertex)),
d3d12.RESOURCE_STATE_COPY_DEST,
null,
) catch |err| hrPanic(err);
const index_buffer = gctx.createCommittedResource(
.DEFAULT,
d3d12.HEAP_FLAG_NONE,
&d3d12.RESOURCE_DESC.initBuffer(mesh_num_indices * @sizeOf(u32)),
d3d12.RESOURCE_STATE_COPY_DEST,
null,
) catch |err| hrPanic(err);
const depth_texture = gctx.createCommittedResource(
.DEFAULT,
d3d12.HEAP_FLAG_NONE,
&blk: {
var desc = d3d12.RESOURCE_DESC.initTex2d(.D32_FLOAT, gctx.viewport_width, gctx.viewport_height, 1);
desc.Flags = d3d12.RESOURCE_FLAG_ALLOW_DEPTH_STENCIL | d3d12.RESOURCE_FLAG_DENY_SHADER_RESOURCE;
break :blk desc;
},
d3d12.RESOURCE_STATE_DEPTH_WRITE,
&d3d12.CLEAR_VALUE.initDepthStencil(.D32_FLOAT, 1.0, 0),
) catch |err| hrPanic(err);
const depth_texture_dsv = gctx.allocateCpuDescriptors(.DSV, 1);
gctx.device.CreateDepthStencilView(
gctx.lookupResource(depth_texture).?,
null,
depth_texture_dsv,
);
const physics_world = try zbt.World.init(.{});
//var physics_debug = allocator.create(zbt.DebugDrawer) catch unreachable;
//physics_debug.* = zbt.DebugDrawer.init(allocator);
//physics_world.setDebugDrawer(&physics_debug.getDebugDraw());
//physics_world.setDebugMode(zbt.dbgmode_draw_wireframe);
const physics_shapes = blk: {
var shapes = std.ArrayList(*const zbt.Shape).init(allocator);
const box_shape = try zbt.BoxShape.init(&.{ 0.5, 0.5, 0.5 });
try shapes.append(box_shape.asShape());
const ground_shape = try zbt.BoxShape.init(&.{ 100.0, 0.2, 100.0 });
try shapes.append(ground_shape.asShape());
const box_body = try zbt.Body.init(
1.0,
&zm.mat43ToArray(zm.translation(0.0, 3.0, 0.0)),
box_shape.asShape(),
);
physics_world.addBody(box_body);
const ground_body = try zbt.Body.init(
0.0,
&zm.mat43ToArray(zm.identity()),
ground_shape.asShape(),
);
physics_world.addBody(ground_body);
break :blk shapes;
};
gctx.beginFrame();
var guir = GuiRenderer.init(arena_allocator, &gctx, 1, content_dir);
// Fill vertex buffer with vertex data.
{
const verts = gctx.allocateUploadBufferRegion(Pso_Vertex, mesh_num_vertices);
for (mesh_positions.items) |_, i| {
verts.cpu_slice[i].position = mesh_positions.items[i];
verts.cpu_slice[i].normal = mesh_normals.items[i];
}
gctx.cmdlist.CopyBufferRegion(
gctx.lookupResource(vertex_buffer).?,
0,
verts.buffer,
verts.buffer_offset,
verts.cpu_slice.len * @sizeOf(@TypeOf(verts.cpu_slice[0])),
);
}
// Fill index buffer with index data.
{
const indices = gctx.allocateUploadBufferRegion(u32, mesh_num_indices);
for (mesh_indices.items) |_, i| {
indices.cpu_slice[i] = mesh_indices.items[i];
}
gctx.cmdlist.CopyBufferRegion(
gctx.lookupResource(index_buffer).?,
0,
indices.buffer,
indices.buffer_offset,
indices.cpu_slice.len * @sizeOf(@TypeOf(indices.cpu_slice[0])),
);
}
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();
return DemoState{
.gctx = gctx,
.guir = guir,
.frame_stats = common.FrameStats.init(),
.simple_pso = simple_pso,
.vertex_buffer = vertex_buffer,
.index_buffer = index_buffer,
.depth_texture = depth_texture,
.depth_texture_dsv = depth_texture_dsv,
.mesh_num_vertices = mesh_num_vertices,
.mesh_num_indices = mesh_num_indices,
.physics = .{
.world = physics_world,
.shapes = physics_shapes,
},
};
}
fn deinit(demo: *DemoState, allocator: std.mem.Allocator) void {
demo.gctx.finishGpuCommands();
{
var i = demo.physics.world.getNumBodies() - 1;
while (i >= 0) : (i -= 1) {
const body = demo.physics.world.getBody(i);
demo.physics.world.removeBody(body);
body.deinit();
}
}
for (demo.physics.shapes.items) |shape|
shape.deinit();
demo.physics.shapes.deinit();
demo.physics.world.deinit();
demo.guir.deinit(&demo.gctx);
demo.gctx.deinit(allocator);
common.deinitWindow(allocator);
demo.* = undefined;
}
fn update(demo: *DemoState) void {
demo.frame_stats.update(demo.gctx.window, window_name);
const dt = demo.frame_stats.delta_time;
_ = demo.physics.world.stepSimulation(dt, .{});
common.newImGuiFrame(dt);
c.igSetNextWindowPos(
.{ .x = @intToFloat(f32, demo.gctx.viewport_width) - 600.0 - 20, .y = 20.0 },
c.ImGuiCond_FirstUseEver,
.{ .x = 0.0, .y = 0.0 },
);
c.igSetNextWindowSize(.{ .x = 600.0, .y = -1 }, c.ImGuiCond_Always);
_ = c.igBegin(
"Demo Settings",
null,
c.ImGuiWindowFlags_NoMove | c.ImGuiWindowFlags_NoResize | c.ImGuiWindowFlags_NoSavedSettings,
);
c.igBulletText("", "");
c.igSameLine(0, -1);
c.igTextColored(.{ .x = 0, .y = 0.8, .z = 0, .w = 1 }, "Right Mouse Button + drag", "");
c.igSameLine(0, -1);
c.igText(" : rotate camera", "");
c.igBulletText("", "");
c.igSameLine(0, -1);
c.igTextColored(.{ .x = 0, .y = 0.8, .z = 0, .w = 1 }, "W, A, S, D", "");
c.igSameLine(0, -1);
c.igText(" : move camera", "");
c.igEnd();
// Handle camera rotation with mouse.
{
var pos: w32.POINT = undefined;
_ = w32.GetCursorPos(&pos);
const delta_x = @intToFloat(f32, pos.x) - @intToFloat(f32, demo.mouse.cursor_prev_x);
const delta_y = @intToFloat(f32, pos.y) - @intToFloat(f32, demo.mouse.cursor_prev_y);
demo.mouse.cursor_prev_x = pos.x;
demo.mouse.cursor_prev_y = pos.y;
if (w32.GetAsyncKeyState(w32.VK_RBUTTON) < 0) {
demo.camera.pitch += 0.0025 * delta_y;
demo.camera.yaw += 0.0025 * delta_x;
demo.camera.pitch = math.min(demo.camera.pitch, 0.48 * math.pi);
demo.camera.pitch = math.max(demo.camera.pitch, -0.48 * math.pi);
demo.camera.yaw = zm.modAngle(demo.camera.yaw);
}
}
// Handle camera movement with 'WASD' keys.
{
const speed = zm.f32x4s(10.0);
const delta_time = zm.f32x4s(demo.frame_stats.delta_time);
const transform = zm.mul(zm.rotationX(demo.camera.pitch), zm.rotationY(demo.camera.yaw));
var forward = zm.normalize3(zm.mul(zm.f32x4(0.0, 0.0, 1.0, 0.0), transform));
zm.store(demo.camera.forward[0..], forward, 3);
const right = speed * delta_time * zm.normalize3(zm.cross3(zm.f32x4(0.0, 1.0, 0.0, 0.0), forward));
forward = speed * delta_time * forward;
var cpos = zm.load(demo.camera.position[0..], zm.Vec, 3);
if (w32.GetAsyncKeyState('W') < 0) {
cpos += forward;
} else if (w32.GetAsyncKeyState('S') < 0) {
cpos -= forward;
}
if (w32.GetAsyncKeyState('D') < 0) {
cpos += right;
} else if (w32.GetAsyncKeyState('A') < 0) {
cpos -= right;
}
zm.store(demo.camera.position[0..], cpos, 3);
}
}
fn draw(demo: *DemoState) void {
var gctx = &demo.gctx;
const cam_world_to_view = zm.lookToLh(
zm.load(demo.camera.position[0..], zm.Vec, 3),
zm.load(demo.camera.forward[0..], zm.Vec, 3),
zm.f32x4(0.0, 1.0, 0.0, 0.0),
);
const cam_view_to_clip = zm.perspectiveFovLh(
0.25 * math.pi,
@intToFloat(f32, gctx.viewport_width) / @intToFloat(f32, gctx.viewport_height),
0.01,
200.0,
);
const cam_world_to_clip = zm.mul(cam_world_to_view, cam_view_to_clip);
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,
&demo.depth_texture_dsv,
);
gctx.cmdlist.ClearRenderTargetView(
back_buffer.descriptor_handle,
&.{ 0.1, 0.1, 0.1, 1.0 },
0,
null,
);
gctx.cmdlist.ClearDepthStencilView(demo.depth_texture_dsv, d3d12.CLEAR_FLAG_DEPTH, 1.0, 0, 0, null);
// Set input assembler (IA) state.
gctx.cmdlist.IASetPrimitiveTopology(.TRIANGLELIST);
gctx.cmdlist.IASetVertexBuffers(0, 1, &[_]d3d12.VERTEX_BUFFER_VIEW{.{
.BufferLocation = gctx.lookupResource(demo.vertex_buffer).?.GetGPUVirtualAddress(),
.SizeInBytes = demo.mesh_num_vertices * @sizeOf(Pso_Vertex),
.StrideInBytes = @sizeOf(Pso_Vertex),
}});
gctx.cmdlist.IASetIndexBuffer(&.{
.BufferLocation = gctx.lookupResource(demo.index_buffer).?.GetGPUVirtualAddress(),
.SizeInBytes = demo.mesh_num_indices * @sizeOf(u32),
.Format = .R32_UINT,
});
gctx.setCurrentPipeline(demo.simple_pso);
// Upload per-frame constant data (camera xform).
{
const mem = gctx.allocateUploadMemory(Pso_FrameConst, 1);
zm.storeMat(mem.cpu_slice[0].world_to_clip[0..], zm.transpose(cam_world_to_clip));
gctx.cmdlist.SetGraphicsRootConstantBufferView(1, mem.gpu_base);
}
// For each object, upload per-draw constant data (object to world xform) and draw.
{
const body = demo.physics.world.getBody(0);
// Get transform matrix from the physics simulator.
const object_to_world = blk: {
var transform: [12]f32 = undefined;
body.getGraphicsWorldTransform(&transform);
break :blk zm.loadMat43(transform[0..]);
};
const mem = gctx.allocateUploadMemory(Pso_DrawConst, 1);
zm.storeMat(mem.cpu_slice[0].object_to_world[0..], zm.transpose(object_to_world));
gctx.cmdlist.SetGraphicsRootConstantBufferView(0, mem.gpu_base);
gctx.cmdlist.DrawIndexedInstanced(demo.mesh_num_indices, 1, 0, 0, 0);
}
demo.guir.draw(gctx);
//demo.physics.world.drawDebug();
gctx.addTransitionBarrier(back_buffer.resource_handle, d3d12.RESOURCE_STATE_PRESENT);
gctx.flushResourceBarriers();
gctx.endFrame();
}
pub fn main() !void {
common.init();
defer common.deinit();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
// Init zbullet library.
zbt.init();
defer zbt.deinit();
var demo = try init(allocator);
defer deinit(&demo, allocator);
while (common.handleWindowEvents()) {
update(&demo);
draw(&demo);
}
} | samples/intro/src/intro6.zig |
const std = @import("std");
const heap = std.heap;
const io = std.io;
const mem = std.mem;
const testing = std.testing;
/// A scanner reads tokens from a stream. Tokens are byte slices delimited by a set of possible bytes.
/// The BufferSize must be big enough to hold a single token
///
/// For example, here's how to scan for lines:
///
/// var line_scanner = Scanner(...).init(reader, "\n");
/// while (try line_scanner.scan()) {
/// var token = line_scanner.token();
/// }
///
/// The token is only valid for a single scan call: if you want to keep it you need to duplicate it.
pub fn Scanner(comptime Reader: type, comptime BufferSize: comptime_int) type {
return struct {
const Self = @This();
allocator: *mem.Allocator,
reader: Reader,
delimiter_bytes: []const u8,
previous_buffer: [BufferSize]u8,
previous_buffer_slice: []u8,
buffer: [BufferSize]u8,
buffer_slice: []u8,
remaining: usize,
token: []const u8,
pub fn init(allocator: *mem.Allocator, reader: Reader, delimiter_bytes: []const u8) Self {
return Self{
.allocator = allocator,
.reader = reader,
.delimiter_bytes = delimiter_bytes,
.previous_buffer = undefined,
.previous_buffer_slice = &[_]u8{},
.buffer = undefined,
.buffer_slice = &[_]u8{},
.remaining = 0,
.token = undefined,
};
}
fn refill(self: *Self) !void {
const n = try self.reader.readAll(&self.buffer);
self.buffer_slice = self.buffer[0..n];
self.remaining = n;
}
fn isSplitByte(self: Self, c: u8) bool {
for (self.delimiter_bytes) |b| {
if (b == c) {
return true;
}
}
return false;
}
/// Get the current token if any.
/// If there is no previous succcessful call to `scan` the token returned is undefined memory.
pub fn getToken(self: Self) []const u8 {
return self.token;
}
/// Scans for the next token.
/// Returns true if a token is found, false otherwise.
///
/// The token can be obtained with `getToken()`.
/// The token is only valid for a single call, if you want
/// to keep a reference to it you need to duplicate it.
pub fn scan(self: *Self) !bool {
comptime var i = 0;
// Only need two iterations because we only have 2 buffers.
// If we would continue to loop we would lose data starting from the 3 iteration.
//
// We _could_ have multiple buffers to solve that but there's not much point when
// it's just easier to simply increase the buffer size.
inline while (i < 2) : (i += 1) {
if (self.remaining == 0) _ = try self.refill();
if (self.remaining <= 0) return false;
var j: usize = 0;
while (j < self.buffer_slice.len) : (j += 1) {
self.remaining -= 1;
if (self.isSplitByte(self.buffer_slice[j])) {
// Only allocate a new string if the previous buffer is non empty.
const line = if (self.previous_buffer_slice.len > 0)
try mem.concat(self.allocator, u8, &[_][]const u8{
self.previous_buffer_slice,
self.buffer_slice[0..j],
})
else
self.buffer_slice[0..j];
mem.set(u8, &self.previous_buffer, 0);
self.previous_buffer_slice = &[_]u8{};
self.buffer_slice = self.buffer_slice[j + 1 .. self.buffer_slice.len];
self.token = line;
return true;
}
}
mem.copy(u8, &self.previous_buffer, self.buffer_slice);
self.previous_buffer_slice = self.previous_buffer[0..self.buffer_slice.len];
self.buffer_slice = &[_]u8{};
}
return false;
}
};
}
fn testScanner(comptime BufferSize: comptime_int) !void {
var arena = heap.ArenaAllocator.init(testing.allocator);
defer arena.deinit();
const data = "foobar\nhello\rbonjour\x00";
var fbs = io.fixedBufferStream(data);
var reader = fbs.reader();
var scanner = Scanner(@TypeOf(reader), BufferSize).init(&arena.allocator, reader, "\r\n\x00");
try testing.expect(try scanner.scan());
try testing.expectEqualSlices(u8, "foobar", scanner.getToken());
try testing.expect(try scanner.scan());
try testing.expectEqualSlices(u8, "hello", scanner.getToken());
try testing.expect(try scanner.scan());
try testing.expectEqualSlices(u8, "bonjour", scanner.getToken());
try testing.expect((try scanner.scan()) == false);
}
test "line scanner: scan" {
try testScanner(8);
try testScanner(50);
try testScanner(1024);
} | scanner.zig |
const std = @import("std");
const Answer = struct { @"0": u32, @"1": u32 };
const BingoBoard = struct {
const Self = @This();
numbers: []u32,
marks: []bool,
dim: usize,
allocator: *std.mem.Allocator,
pub fn init(n: usize, allocator: *std.mem.Allocator) !Self {
const numbers = try allocator.alloc(u32, n * n);
const marks = try allocator.alloc(bool, n * n);
var i: usize = 0;
while (i < marks.len) : (i += 1) {
marks[i] = false;
}
return Self{
.numbers = numbers,
.marks = marks,
.dim = n,
.allocator = allocator,
};
}
pub fn deinit(self: Self) void {
self.allocator.free(self.numbers);
self.allocator.free(self.marks);
}
pub fn ix(self: Self, row: usize, col: usize) *u32 {
return &self.numbers[row * self.dim + col];
}
pub fn mark_ix(self: Self, row: usize, col: usize) *bool {
return &self.marks[row * self.dim + col];
}
pub fn mark(self: Self, val: u32) void {
for (self.numbers) |number, idx| {
if (number == val) {
self.marks[idx] = true;
}
}
}
pub fn unmark_all(self: Self) void {
var i: usize = 0;
while (i < self.marks.len) : (i += 1) {
self.marks[i] = false;
}
}
pub fn has_won(self: Self) bool {
{
var i: usize = 0;
while (i < self.dim) : (i += 1) {
// Horizontal
{
var j: usize = 0;
while (j < self.dim) : (j += 1) {
if (!self.marks[i * self.dim + j]) {
break;
}
} else {
return true;
}
}
// Vertical
{
var j: usize = 0;
while (j < self.dim) : (j += 1) {
if (!self.marks[j * self.dim + i]) {
break;
}
} else {
return true;
}
}
}
}
return false;
}
pub fn eval_score(self: Self, last_draw: u32) u32 {
var score: u32 = 0;
for (self.numbers) |number, i| {
if (!self.marks[i]) {
score += number;
}
}
score *= last_draw;
return score;
}
};
fn run(filename: []const u8) !Answer {
const file = try std.fs.cwd().openFile(filename, .{ .read = true });
defer file.close();
var reader = std.io.bufferedReader(file.reader()).reader();
var buffer: [1024]u8 = undefined;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var drawn_numbers = std.ArrayList(u32).init(&gpa.allocator);
defer drawn_numbers.deinit();
{
const line0 = (try reader.readUntilDelimiterOrEof(&buffer, '\n')).?;
var line0_tokens = std.mem.tokenize(u8, line0, ",");
while (line0_tokens.next()) |token| {
try drawn_numbers.append(try std.fmt.parseInt(u32, token, 10));
}
}
var boards = std.ArrayList(BingoBoard).init(&gpa.allocator);
defer boards.deinit();
{
while (try reader.readUntilDelimiterOrEof(&buffer, '\n')) |empty_line| {
std.debug.assert(empty_line.len == 0);
var i: usize = 0;
var board = try BingoBoard.init(5, &gpa.allocator);
while (i < 5) : (i += 1) {
const line = (try reader.readUntilDelimiterOrEof(&buffer, '\n')).?;
var tokens = std.mem.tokenize(u8, line, " ");
var j: usize = 0;
while (tokens.next()) |token| : (j += 1) {
const number = try std.fmt.parseInt(u32, token, 10);
board.ix(i, j).* = number;
}
}
try boards.append(board);
}
}
// Part 1
var first_win_draw_idx: usize = drawn_numbers.items.len;
var first_win_board_idx: usize = undefined;
// Part 2
var last_win_draw_idx: usize = 0;
var last_win_board_idx: usize = undefined;
for (boards.items) |board, bi| {
for (drawn_numbers.items) |number, ni| {
board.mark(number);
if (board.has_won()) {
if (ni < first_win_draw_idx) {
first_win_draw_idx = ni;
first_win_board_idx = bi;
}
if (ni > last_win_draw_idx) {
last_win_draw_idx = ni;
last_win_board_idx = bi;
}
break;
}
}
}
const score1 = boards.items[first_win_board_idx].eval_score(drawn_numbers.items[first_win_draw_idx]);
const score2: u32 = boards.items[last_win_board_idx].eval_score(drawn_numbers.items[last_win_draw_idx]);
for (boards.items) |board| {
board.deinit();
}
return Answer{ .@"0" = score1, .@"1" = score2 };
}
pub fn main() !void {
const answer = try run("inputs/" ++ @typeName(@This()) ++ ".txt");
std.debug.print("{d}\n", .{answer.@"0"});
std.debug.print("{d}\n", .{answer.@"1"});
}
test {
const answer = try run("test-inputs/" ++ @typeName(@This()) ++ ".txt");
try std.testing.expectEqual(answer.@"0", 4512);
try std.testing.expectEqual(answer.@"1", 1924);
} | src/day04.zig |
const std = @import("std");
const upaya = @import("upaya");
const zlm = @import("zlm");
const objects = @import("didot-objects");
const graphics = @import("didot-graphics");
usingnamespace @import("scene.zig");
usingnamespace upaya.imgui;
usingnamespace @cImport({
@cDefine("GL_GLEXT_PROTOTYPES", "1");
@cInclude("GL/glcorearb.h");
});
var propertiesShow: bool = true;
var sceneGraphShow: bool = true;
var scene: ?*objects.Scene = null;
var selectedObject: ?*objects.GameObject = undefined;
var gp: std.heap.GeneralPurposeAllocator(.{}) = .{};
var allocator = &gp.allocator;
var fbo: GLuint = undefined;
var rbo: GLuint = undefined;
var renderTexture: GLuint = undefined;
var render_texture: upaya.sokol.sg_image = undefined;
extern fn _ogImage(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2) void;
fn toggleSceneGraph() void {
sceneGraphShow = !sceneGraphShow;
}
fn toggleProperties() void {
propertiesShow = !propertiesShow;
}
pub fn main() !void {
upaya.run(.{
.init = init,
.update = updateUpaya,
.setupDockLayout = setupDockLayout,
.docking = true,
});
}
fn init() void {
var io = igGetIO();
//var cwd = std.process.getCwdAlloc(upaya.mem.tmp_allocator) catch unreachable;
//var dupe = upaya.mem.tmp_allocator.dupeZ(u8, cwd) catch unreachable;
//_ = upaya.filebrowser.openFileDialog("test", dupe, "*");
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glGenTextures(1, &renderTexture);
glBindTexture(GL_TEXTURE_2D, renderTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 800, 600, 0, GL_RGB, GL_UNSIGNED_BYTE, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, renderTexture, 0);
glGenRenderbuffers(1, &rbo);
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, 800, 600);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
std.debug.warn("framebuffer error\n", .{});
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
scene = loadFrom(allocator, @embedFile("../example-scene.json")) catch unreachable;
objects.initPrimitives();
scene.?.assetManager.put("Meshes/Primitives/Cube", .{
.objectPtr = @ptrToInt(&objects.PrimitiveCubeMesh),
.unloadable = false,
.objectType = .Mesh
}) catch unreachable;
scene.?.assetManager.put("Meshes/Primitives/Plane", .{
.objectPtr = @ptrToInt(&objects.PrimitivePlaneMesh),
.unloadable = false,
.objectType = .Mesh
}) catch unreachable;
var img_desc = std.mem.zeroes(upaya.sokol.sg_image_desc);
img_desc.render_target = true;
img_desc.width = 800;
img_desc.height = 600;
img_desc.pixel_format = .SG_PIXELFORMAT_RGBA8;
img_desc.min_filter = .SG_FILTER_LINEAR;
img_desc.mag_filter = .SG_FILTER_LINEAR;
img_desc.gl_textures[0] = renderTexture;
render_texture = upaya.sokol.sg_make_image(&img_desc);
}
fn onExit() void {
upaya.quit();
}
fn updateUpaya() void {
update() catch unreachable;
}
fn update() !void {
if (scene) |scn| {
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glDisable(GL_STENCIL_TEST);
glDepthFunc(GL_LESS);
glDepthMask(GL_TRUE);
glClearColor(0, 0, 0, 1);
var program: GLint = undefined;
glGetIntegerv(GL_CURRENT_PROGRAM, &program);
glClearDepth(1);
try scn.renderOffscreen(zlm.vec4(0, 0, 800, 600));
const err = glGetError();
if (err != 0) {
std.debug.warn("gl error: {}\n", .{err});
}
glUseProgram(@bitCast(c_uint, program));
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FRAMEBUFFER_SRGB);
glBindVertexArray(3);
}
upaya.menu.draw(&[_]upaya.MenuItem{
.{
.label = "File",
.children = &[_]upaya.MenuItem{
.{ .label = "New" },
.{ .label = "Load"},
.{ .label = "Save", .shortcut = "Ctrl+S" },
.{ .label = "Exit", .action = onExit }
}
},
.{
.label = "Game",
.children = &[_]upaya.MenuItem{
.{ .label = "Run", .shortcut = "F6" }
}
},
.{
.label = "View",
.children = &[_]upaya.MenuItem {
.{ .label = "Scene Graph", .action = toggleSceneGraph },
.{ .label = "Properties", .action = toggleProperties }
}
}
});
if (sceneGraphShow) {
if (igBegin("Scene Graph", null, ImGuiWindowFlags_None)) {
igText("Objects:");
if (scene) |scn| {
for (scn.gameObject.childrens.items) |*obj| {
var dupe = try upaya.mem.tmp_allocator.dupeZ(u8, obj.name);
defer upaya.mem.tmp_allocator.free(dupe);
if (igTreeNodeExStr(dupe, if (obj.childrens.items.len == 0)
ImGuiTreeNodeFlags_Leaf
else ImGuiTreeNodeFlags_None)) {
igTreePop();
if (igIsItemClicked(ImGuiMouseButton_Left)) {
selectedObject = obj;
}
}
}
}
}
igEnd();
}
if (propertiesShow) {
if (igBegin("Properties", null, ImGuiWindowFlags_None)) {
if (selectedObject) |selected| {
var buf: [1024]u8 = undefined;
igText(try std.fmt.bufPrintZ(&buf, "{}", .{selected.name}));
igText(try std.fmt.bufPrintZ(&buf, "Type: {}", .{selected.objectType}));
igSeparator();
igText("Position:");
var min: f32 = 0.0;
_ = igDragScalar("Position X", ImGuiDataType_Float, &selected.position.x, 0.005, &min, &min, "%f", 2);
_ = igDragScalar("Position Y", ImGuiDataType_Float, &selected.position.y, 0.005, &min, &min, "%f", 2);
_ = igDragScalar("Position Z", ImGuiDataType_Float, &selected.position.z, 0.005, &min, &min, "%f", 2);
igSpacing();
igText("Scale:");
_ = igDragScalar("Scale X", ImGuiDataType_Float, &selected.scale.x, 0.005, &min, &min, "%f", 2);
_ = igDragScalar("Scale Y", ImGuiDataType_Float, &selected.scale.y, 0.005, &min, &min, "%f", 2);
_ = igDragScalar("Scale Z", ImGuiDataType_Float, &selected.scale.z, 0.005, &min, &min, "%f", 2);
igSeparator();
igTextWrapped(try std.fmt.bufPrintZ(&buf, "Mesh: {}", .{selected.meshPath}));
igSeparator();
_ = ogButton("Delete");
} else {
igText("Please select a game object.");
}
}
igEnd();
}
igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, .{});
if (igBegin("Game", null, ImGuiWindowFlags_AlwaysAutoResize)) {
if (scene) |scn| {
const size = ImVec2{ .x = 800.0, .y = 600.0 };
_ogImage(@intToPtr(*c_void, render_texture.id), size, .{.y = 1}, .{ .x=1 });
} else {
igText("Please open a scene.");
}
}
igEnd();
igPopStyleVar(1);
if (igBegin("Assets", null, ImGuiWindowFlags_None)) {
igText("Assets: TODO");
}
igEnd();
//igShowDemoWindow(null);
}
fn setupDockLayout(id: ImGuiID) void {
var left_id = id;
const right_id = igDockBuilderSplitNode(left_id, ImGuiDir_Right, 0.35, null, &left_id);
igDockBuilderDockWindow("Properties", right_id);
igDockBuilderDockWindow("Scene Graph", left_id);
igDockBuilderFinish(id);
} | src/main.zig |
const std = @import("std");
const constants = @import("../constants.zig");
const logger = std.log.scoped(.dx_point_data);
const DXHeader = @import("dx_header.zig").DXHeader;
const DXRecordHeader = @import("dx_record_header.zig").DXRecordHeader;
const DXS1 = @import("dx_s1.zig").DXS1;
const DXADD1 = @import("dx_add1.zig").DXADD1;
const DXS2 = @import("dx_s2.zig").DXS2;
const DXS3 = @import("dx_s3.zig").DXS3;
const DXADD3 = @import("dx_add3.zig").DXADD3;
const DXS4 = @import("dx_s4.zig").DXS4;
pub const DXPointData = struct {
dx_s1: DXS1,
dx_add1: ?DXADD1,
dx_s2: ?DXS2,
dx_s3: DXS3,
dx_add3: ?DXADD3,
dx_s4: ?DXS4,
/// Return the size that this data would have in bytes
/// when serialized to the DX data format.
pub fn sizeBytes(self: *DXPointData) usize {
var size: usize = constants.DXS1_SIZE;
if (self.dx_add1) |_| {
// can't use the captured variable because it is const *
size += self.dx_add1.?.sizeBytes();
}
if (self.dx_s2) |_| {
size += constants.DXS2_SIZE;
}
size += constants.DXS3_SIZE;
if (self.dx_add3) |_| {
size += constants.ADD3_SIZE;
}
if (self.dx_s4) |_| {
size += constants.DXS4_SIZE;
}
return size;
}
pub fn fromBuffer(
allocator: std.mem.Allocator,
buffer: []const u8,
header: DXHeader,
) !DXPointData {
var cur: u32 = 0;
// NOTE: each fromReader call seeks through the buffer.
// ex: the fromReader call below will consume 5 bytes from the buffer
const dx_s1 = DXS1.fromBuffer(buffer[cur .. cur + constants.DXS1_SIZE]);
cur += constants.DXS1_SIZE;
const nbytes = header.nchans - 2;
var dx_add1: ?DXADD1 = null;
if (nbytes > 0) {
logger.debug("Reading {d} bytes for dxadd1 data", .{nbytes});
dx_add1 = DXADD1.fromBuffer(allocator, buffer[cur .. cur + nbytes]) catch |err| {
logger.debug("Error reading dxadd1 data: {}", .{err});
return err;
};
cur += nbytes;
}
var dx_s2: ?DXS2 = null;
if (dx_s1.noday == 0) {
// logger.debug("Reading dxs2 data", .{});
// 5 bytes
dx_s2 = DXS2.fromBuffer(buffer[cur .. cur + constants.DXS2_SIZE]);
cur += constants.DXS2_SIZE;
}
const dx_s3 = DXS3.fromBuffer(buffer[cur .. cur + constants.DXS3_SIZE]);
cur += constants.DXS3_SIZE;
var dx_add3: ?DXADD3 = null;
if (header.sattyp == -3 or header.sattyp == 1 or header.sattyp == 2) {
logger.debug("Reading dxadd3 data", .{});
dx_add3 = DXADD3.fromBuffer(buffer[cur .. cur + constants.ADD3_SIZE]);
cur += constants.ADD3_SIZE;
}
var dx_s4: ?DXS4 = null;
if (dx_s1.noday == 0) {
// logger.debug("Reading dxs4 data", .{});
dx_s4 = DXS4.fromBuffer(buffer[cur .. cur + constants.DXS4_SIZE]);
cur += constants.DXS4_SIZE;
}
return DXPointData{
.dx_s1 = dx_s1,
.dx_add1 = dx_add1,
.dx_s2 = dx_s2,
.dx_s3 = dx_s3,
.dx_add3 = dx_add3,
.dx_s4 = dx_s4,
};
}
//https://isccp.giss.nasa.gov/pub/documents/d-doc.pdf
pub fn deinit(self: *DXPointData) void {
self.dx_s1.deinit();
self.dx_add1.deinit();
self.dx_s2.deinit();
self.dx_s3.deinit();
self.dx_add3.deinit();
self.dx_s4.deinit();
self.* = undefined;
}
}; | zig-dxread/src/models/dx_point_data.zig |
const sabaton = @import("root").sabaton;
const std = @import("std");
var data: []u8 = undefined;
const BE = sabaton.util.BigEndian;
const Header = packed struct {
magic: BE(u32),
totalsize: BE(u32),
off_dt_struct: BE(u32),
off_dt_strings: BE(u32),
off_mem_rsvmap: BE(u32),
version: BE(u32),
last_comp_version: BE(u32),
boot_cpuid_phys: BE(u32),
size_dt_strings: BE(u32),
size_dt_struct: BE(u32),
};
pub fn find_cpu_id(dtb_id: usize) ?u32 {
var cpu_name_buf = [_]u8{undefined} ** 32;
cpu_name_buf[0] = 'c';
cpu_name_buf[1] = 'p';
cpu_name_buf[2] = 'u';
cpu_name_buf[3] = '@';
const buf_len = sabaton.util.write_int_decimal(cpu_name_buf[4..], dtb_id) + 4;
const id_bytes = (find(cpu_name_buf[0..buf_len], "reg") catch return null)[0..4];
return std.mem.readIntBig(u32, id_bytes[0..4]);
}
comptime {
asm (
\\.section .text.smp_stub
\\.global smp_stub
\\smp_stub:
\\ DSB SY
\\ LDR X1, [X0, #8]
\\ MOV SP, X1
);
}
export fn smp_entry(context: u64) linksection(".text.smp_entry") noreturn {
@call(.{ .modifier = .always_inline }, sabaton.stivale2_smp_ready, .{context});
}
pub fn psci_smp(comptime methods: ?sabaton.psci.Mode) void {
const psci_method = blk: {
if (comptime (methods == null)) {
const method_str = (sabaton.dtb.find("psci", "method") catch return)[0..3];
sabaton.puts("PSCI method: ");
sabaton.print_str(method_str);
sabaton.putchar('\n');
break :blk method_str;
}
break :blk undefined;
};
const num_cpus = blk: {
var count: u32 = 1;
while (true) : (count += 1) {
_ = find_cpu_id(count) orelse break :blk count;
}
};
sabaton.log_hex("Number of CPUs found: ", num_cpus);
if (num_cpus == 1)
return;
const smp_tag = sabaton.pmm.alloc_aligned(40 + num_cpus * @sizeOf(sabaton.stivale.SMPTagEntry), .Hole);
const entry = @ptrToInt(sabaton.near("smp_stub").addr(u32));
const smp_header = @intToPtr(*sabaton.stivale.SMPTagHeader, @ptrToInt(smp_tag.ptr));
smp_header.tag.ident = 0x34d1d96339647025;
smp_header.cpu_count = num_cpus;
var cpu_num: u32 = 1;
while (cpu_num < num_cpus) : (cpu_num += 1) {
const id = find_cpu_id(cpu_num) orelse unreachable;
const tag_addr = @ptrToInt(smp_tag.ptr) + 40 + cpu_num * @sizeOf(sabaton.stivale.SMPTagEntry);
const tag_entry = @intToPtr(*sabaton.stivale.SMPTagEntry, tag_addr);
tag_entry.acpi_id = cpu_num;
tag_entry.cpu_id = id;
const stack = sabaton.pmm.alloc_aligned(0x1000, .Hole);
tag_entry.stack = @ptrToInt(stack.ptr) + 0x1000;
// Make sure we've written everything we need to memory before waking this CPU up
asm volatile ("DSB ST\n" ::: "memory");
if (comptime (methods == null)) {
if (std.mem.eql(u8, psci_method, "smc")) {
_ = sabaton.psci.wake_cpu(entry, id, tag_addr, .SMC);
continue;
}
if (std.mem.eql(u8, psci_method, "hvc")) {
_ = sabaton.psci.wake_cpu(entry, id, tag_addr, .HVC);
continue;
}
} else {
_ = sabaton.psci.wake_cpu(entry, id, tag_addr, comptime (methods.?));
continue;
}
if (comptime !sabaton.safety)
unreachable;
@panic("Unknown PSCI method!");
}
sabaton.add_tag(&smp_header.tag);
}
pub fn find(node_prefix: []const u8, prop_name: []const u8) ![]u8 {
const dtb = sabaton.platform.get_dtb();
const header = @ptrCast(*Header, dtb.ptr);
std.debug.assert(header.magic.read() == 0xD00DFEED);
std.debug.assert(header.totalsize.read() == dtb.len);
var curr = @ptrCast([*]BE(u32), dtb.ptr + header.off_dt_struct.read());
var current_depth: usize = 0;
var found_at_depth: ?usize = null;
while (true) {
const opcode = curr[0].read();
curr += 1;
switch (opcode) {
0x00000001 => { // FDT_BEGIN_NODE
const name = @ptrCast([*:0]u8, curr);
const namelen = sabaton.util.strlen(name);
if (sabaton.debug)
sabaton.log("FDT_BEGIN_NODE(\"{s}\", {})\n", .{ name[0..namelen], namelen });
current_depth += 1;
if (found_at_depth == null and namelen >= node_prefix.len) {
if (std.mem.eql(u8, name[0..node_prefix.len], node_prefix)) {
found_at_depth = current_depth;
}
}
curr += (namelen + 4) / 4;
},
0x00000002 => { // FDT_END_NODE
if (sabaton.debug)
sabaton.log("FDT_END_NODE\n", .{});
if (found_at_depth) |d| {
if (d == current_depth) {
found_at_depth = null;
}
}
current_depth -= 1;
},
0x00000003 => { // FDT_PROP
const nameoff = curr[1].read();
var len = curr[0].read();
const name = @ptrCast([*:0]u8, dtb.ptr + header.off_dt_strings.read() + nameoff);
if (sabaton.debug)
sabaton.log("FDT_PROP(\"{s}\"), len 0x{X}\n", .{ name, len });
if (found_at_depth) |d| {
if (d == current_depth) {
// DID WE FIND IT??
if (std.mem.eql(u8, name[0..prop_name.len], prop_name) and name[prop_name.len] == 0)
return @ptrCast([*]u8, curr + 2)[0..len];
}
}
len += 3;
curr += len / 4 + 2;
},
0x00000004 => {}, // FDT_NOP
0x00000009 => break, // FDT_END
else => {
if (sabaton.safety) {
sabaton.log_hex("Unknown DTB opcode: ", opcode);
}
unreachable;
},
}
}
return error.NotFound;
} | src/lib/dtb.zig |
const std = @import("std");
const Arena = std.heap.ArenaAllocator;
const expectEqual = std.testing.expectEqual;
const expectEqualStrings = std.testing.expectEqualStrings;
const yeti = @import("yeti");
const initCodebase = yeti.initCodebase;
const tokenize = yeti.tokenize;
const parse = yeti.parse;
const analyzeSemantics = yeti.analyzeSemantics;
const codegen = yeti.codegen;
const printWasm = yeti.printWasm;
const components = yeti.components;
const literalOf = yeti.query.literalOf;
const typeOf = yeti.query.typeOf;
const MockFileSystem = yeti.FileSystem;
test "tokenize for" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const module = try codebase.createEntity(.{});
const code = "for";
var tokens = try tokenize(module, code);
{
const token = tokens.next().?;
try expectEqual(token.get(components.TokenKind), .for_);
try expectEqual(token.get(components.Span), .{
.begin = .{ .column = 0, .row = 0 },
.end = .{ .column = 3, .row = 0 },
});
}
try expectEqual(tokens.next(), null);
}
test "parse for loop" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const module = try codebase.createEntity(.{});
const code =
\\start() i32 {
\\ sum = 0
\\ for(0:10) {
\\ sum += it
\\ }
\\ sum
\\}
;
var tokens = try tokenize(module, code);
try parse(module, &tokens);
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start");
const overloads = start.get(components.Overloads).slice();
try expectEqual(overloads.len, 1);
const body = overloads[0].get(components.Body).slice();
try expectEqual(body.len, 3);
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqualStrings(literalOf(define.get(components.Name).entity), "sum");
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
try expectEqualStrings(literalOf(iterator.get(components.First).entity), "0");
try expectEqualStrings(literalOf(iterator.get(components.Last).entity), "10");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const plus_equal = for_body[0];
const arguments = plus_equal.get(components.Arguments).slice();
try expectEqualStrings(literalOf(arguments[0]), "sum");
try expectEqualStrings(literalOf(arguments[1]), "it");
const sum = body[2];
try expectEqual(sum.get(components.AstKind), .symbol);
try expectEqualStrings(literalOf(sum), "sum");
}
test "parse for loop named loop variable" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const module = try codebase.createEntity(.{});
const code =
\\start() i32 {
\\ sum = 0
\\ for(0:10) (i) {
\\ sum += i
\\ }
\\ sum
\\}
;
var tokens = try tokenize(module, code);
try parse(module, &tokens);
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start");
const overloads = start.get(components.Overloads).slice();
try expectEqual(overloads.len, 1);
const body = overloads[0].get(components.Body).slice();
try expectEqual(body.len, 3);
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqualStrings(literalOf(define.get(components.Name).entity), "sum");
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
try expectEqualStrings(literalOf(iterator.get(components.First).entity), "0");
try expectEqualStrings(literalOf(iterator.get(components.Last).entity), "10");
const i = for_.get(components.LoopVariable).entity;
try expectEqualStrings(literalOf(i), "i");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const plus_equal = for_body[0];
const arguments = plus_equal.get(components.Arguments).slice();
try expectEqualStrings(literalOf(arguments[0]), "sum");
try expectEqualStrings(literalOf(arguments[1]), "i");
const sum = body[2];
try expectEqual(sum.get(components.AstKind), .symbol);
try expectEqualStrings(literalOf(sum), "sum");
}
test "parse for loop named loop variable omit parens" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const module = try codebase.createEntity(.{});
const code =
\\start() i32 {
\\ sum = 0
\\ for(0:10) i {
\\ sum += i
\\ }
\\ sum
\\}
;
var tokens = try tokenize(module, code);
try parse(module, &tokens);
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start");
const overloads = start.get(components.Overloads).slice();
try expectEqual(overloads.len, 1);
const body = overloads[0].get(components.Body).slice();
try expectEqual(body.len, 3);
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqualStrings(literalOf(define.get(components.Name).entity), "sum");
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
try expectEqualStrings(literalOf(iterator.get(components.First).entity), "0");
try expectEqualStrings(literalOf(iterator.get(components.Last).entity), "10");
const i = for_.get(components.LoopVariable).entity;
try expectEqualStrings(literalOf(i), "i");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const plus_equal = for_body[0];
const arguments = plus_equal.get(components.Arguments).slice();
try expectEqualStrings(literalOf(arguments[0]), "sum");
try expectEqualStrings(literalOf(arguments[1]), "i");
const sum = body[2];
try expectEqual(sum.get(components.AstKind), .symbol);
try expectEqualStrings(literalOf(sum), "sum");
}
test "analyze semantics of for loop" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const builtins = codebase.get(components.Builtins);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ for(0:10) {
\\ sum += it
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start").get(components.Overloads).slice()[0];
try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo");
try expectEqualStrings(literalOf(start.get(components.Name).entity), "start");
try expectEqual(start.get(components.Parameters).len(), 0);
try expectEqual(start.get(components.ReturnType).entity, builtins.I32);
const body = start.get(components.Body).slice();
try expectEqual(body.len, 3);
const sum = blk: {
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
try expectEqual(typeOf(for_), builtins.Void);
const i = blk: {
const define = for_.get(components.LoopVariable).entity;
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
const first = iterator.get(components.First).entity;
try expectEqual(typeOf(first), builtins.I32);
try expectEqualStrings(literalOf(first), "0");
const last = iterator.get(components.Last).entity;
try expectEqual(typeOf(last), builtins.I32);
try expectEqualStrings(literalOf(last), "10");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const assign = for_body[0];
try expectEqual(assign.get(components.AstKind), .assign);
try expectEqual(typeOf(assign), builtins.Void);
try expectEqual(assign.get(components.Local).entity, sum);
const value = assign.get(components.Value).entity;
try expectEqual(value.get(components.AstKind), .intrinsic);
try expectEqual(value.get(components.Intrinsic), .add);
const arguments = value.get(components.Arguments).slice();
try expectEqual(arguments.len, 2);
try expectEqual(arguments[0], sum);
try expectEqual(arguments[1], i);
try expectEqual(body[2], sum);
}
test "analyze semantics of for loop explicit loop variable" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const builtins = codebase.get(components.Builtins);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ for(0:10) (i) {
\\ sum += i
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start").get(components.Overloads).slice()[0];
try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo");
try expectEqualStrings(literalOf(start.get(components.Name).entity), "start");
try expectEqual(start.get(components.Parameters).len(), 0);
try expectEqual(start.get(components.ReturnType).entity, builtins.I32);
const body = start.get(components.Body).slice();
try expectEqual(body.len, 3);
const sum = blk: {
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
try expectEqual(typeOf(for_), builtins.Void);
const i = blk: {
const define = for_.get(components.LoopVariable).entity;
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "i");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
const first = iterator.get(components.First).entity;
try expectEqual(typeOf(first), builtins.I32);
try expectEqualStrings(literalOf(first), "0");
const last = iterator.get(components.Last).entity;
try expectEqual(typeOf(last), builtins.I32);
try expectEqualStrings(literalOf(last), "10");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const assign = for_body[0];
try expectEqual(assign.get(components.AstKind), .assign);
try expectEqual(typeOf(assign), builtins.Void);
try expectEqual(assign.get(components.Local).entity, sum);
const value = assign.get(components.Value).entity;
try expectEqual(value.get(components.AstKind), .intrinsic);
try expectEqual(value.get(components.Intrinsic), .add);
const arguments = value.get(components.Arguments).slice();
try expectEqual(arguments.len, 2);
try expectEqual(arguments[0], sum);
try expectEqual(arguments[1], i);
try expectEqual(body[2], sum);
}
test "analyze semantics of for loop explicit loop variable omit paren" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const builtins = codebase.get(components.Builtins);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ for(0:10) i {
\\ sum += i
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start").get(components.Overloads).slice()[0];
try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo");
try expectEqualStrings(literalOf(start.get(components.Name).entity), "start");
try expectEqual(start.get(components.Parameters).len(), 0);
try expectEqual(start.get(components.ReturnType).entity, builtins.I32);
const body = start.get(components.Body).slice();
try expectEqual(body.len, 3);
const sum = blk: {
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
try expectEqual(typeOf(for_), builtins.Void);
const i = blk: {
const define = for_.get(components.LoopVariable).entity;
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "i");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
const first = iterator.get(components.First).entity;
try expectEqual(typeOf(first), builtins.I32);
try expectEqualStrings(literalOf(first), "0");
const last = iterator.get(components.Last).entity;
try expectEqual(typeOf(last), builtins.I32);
try expectEqualStrings(literalOf(last), "10");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const assign = for_body[0];
try expectEqual(assign.get(components.AstKind), .assign);
try expectEqual(typeOf(assign), builtins.Void);
try expectEqual(assign.get(components.Local).entity, sum);
const value = assign.get(components.Value).entity;
try expectEqual(value.get(components.AstKind), .intrinsic);
try expectEqual(value.get(components.Intrinsic), .add);
const arguments = value.get(components.Arguments).slice();
try expectEqual(arguments.len, 2);
try expectEqual(arguments[0], sum);
try expectEqual(arguments[1], i);
try expectEqual(body[2], sum);
}
test "analyze semantics of for loop implicit range start" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const builtins = codebase.get(components.Builtins);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ for(:10) {
\\ sum += it
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start").get(components.Overloads).slice()[0];
try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo");
try expectEqualStrings(literalOf(start.get(components.Name).entity), "start");
try expectEqual(start.get(components.Parameters).len(), 0);
try expectEqual(start.get(components.ReturnType).entity, builtins.I32);
const body = start.get(components.Body).slice();
try expectEqual(body.len, 3);
const sum = blk: {
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const for_ = body[1];
try expectEqual(for_.get(components.AstKind), .for_);
try expectEqual(typeOf(for_), builtins.Void);
const i = blk: {
const define = for_.get(components.LoopVariable).entity;
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
const first = iterator.get(components.First).entity;
try expectEqual(typeOf(first), builtins.I32);
try expectEqualStrings(literalOf(first), "0");
const last = iterator.get(components.Last).entity;
try expectEqual(typeOf(last), builtins.I32);
try expectEqualStrings(literalOf(last), "10");
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const assign = for_body[0];
try expectEqual(assign.get(components.AstKind), .assign);
try expectEqual(typeOf(assign), builtins.Void);
try expectEqual(assign.get(components.Local).entity, sum);
const value = assign.get(components.Value).entity;
try expectEqual(value.get(components.AstKind), .intrinsic);
try expectEqual(value.get(components.Intrinsic), .add);
const arguments = value.get(components.Arguments).slice();
try expectEqual(arguments.len, 2);
try expectEqual(arguments[0], sum);
try expectEqual(arguments[1], i);
try expectEqual(body[2], sum);
}
test "analyze semantics of for loop non int literal last" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
const builtins = codebase.get(components.Builtins);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ n = 10
\\ for(0:n) {
\\ sum += it
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start").get(components.Overloads).slice()[0];
try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo");
try expectEqualStrings(literalOf(start.get(components.Name).entity), "start");
try expectEqual(start.get(components.Parameters).len(), 0);
try expectEqual(start.get(components.ReturnType).entity, builtins.I32);
const body = start.get(components.Body).slice();
try expectEqual(body.len, 4);
const sum = blk: {
const define = body[0];
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const n = blk: {
const define = body[1];
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "10");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "n");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const for_ = body[2];
try expectEqual(for_.get(components.AstKind), .for_);
try expectEqual(typeOf(for_), builtins.Void);
const i = blk: {
const define = for_.get(components.LoopVariable).entity;
try expectEqual(define.get(components.AstKind), .define);
try expectEqual(typeOf(define), builtins.Void);
try expectEqualStrings(literalOf(define.get(components.Value).entity), "0");
const local = define.get(components.Local).entity;
try expectEqual(local.get(components.AstKind), .local);
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
try expectEqual(typeOf(local), builtins.I32);
break :blk local;
};
const iterator = for_.get(components.Iterator).entity;
try expectEqual(iterator.get(components.AstKind), .range);
const first = iterator.get(components.First).entity;
try expectEqual(typeOf(first), builtins.I32);
try expectEqualStrings(literalOf(first), "0");
try expectEqual(iterator.get(components.Last).entity, n);
const for_body = for_.get(components.Body).slice();
try expectEqual(for_body.len, 1);
const assign = for_body[0];
try expectEqual(assign.get(components.AstKind), .assign);
try expectEqual(typeOf(assign), builtins.Void);
try expectEqual(assign.get(components.Local).entity, sum);
const value = assign.get(components.Value).entity;
try expectEqual(value.get(components.AstKind), .intrinsic);
try expectEqual(value.get(components.Intrinsic), .add);
const arguments = value.get(components.Arguments).slice();
try expectEqual(arguments.len, 2);
try expectEqual(arguments[0], sum);
try expectEqual(arguments[1], i);
try expectEqual(body[3], sum);
}
test "codegen for loop" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ for(0:10) {
\\ sum += it
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const top_level = module.get(components.TopLevel);
const start = top_level.findString("start").get(components.Overloads).slice()[0];
const start_instructions = start.get(components.WasmInstructions).slice();
try expectEqual(start_instructions.len, 22);
{
const i32_const = start_instructions[0];
try expectEqual(i32_const.get(components.WasmInstructionKind), .i32_const);
try expectEqualStrings(literalOf(i32_const.get(components.Constant).entity), "0");
const local_set = start_instructions[1];
try expectEqual(local_set.get(components.WasmInstructionKind), .local_set);
const local = local_set.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
}
{
const i32_const = start_instructions[2];
try expectEqual(i32_const.get(components.WasmInstructionKind), .i32_const);
try expectEqualStrings(literalOf(i32_const.get(components.Constant).entity), "0");
const local_set = start_instructions[3];
try expectEqual(local_set.get(components.WasmInstructionKind), .local_set);
const local = local_set.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
}
{
const block = start_instructions[4];
try expectEqual(block.get(components.WasmInstructionKind), .block);
try expectEqual(block.get(components.Label).value, 0);
const loop = start_instructions[5];
try expectEqual(loop.get(components.WasmInstructionKind), .loop);
try expectEqual(loop.get(components.Label).value, 1);
const local_get = start_instructions[6];
try expectEqual(local_get.get(components.WasmInstructionKind), .local_get);
const local = local_get.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
const i32_const = start_instructions[7];
try expectEqual(i32_const.get(components.WasmInstructionKind), .i32_const);
try expectEqualStrings(literalOf(i32_const.get(components.Constant).entity), "10");
try expectEqual(start_instructions[8].get(components.WasmInstructionKind), .i32_ge);
const br_if = start_instructions[9];
try expectEqual(br_if.get(components.WasmInstructionKind), .br_if);
try expectEqual(br_if.get(components.Label).value, 0);
}
const sum = blk: {
const local_get = start_instructions[10];
try expectEqual(local_get.get(components.WasmInstructionKind), .local_get);
const local = local_get.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
break :blk local;
};
{
const local_get = start_instructions[11];
try expectEqual(local_get.get(components.WasmInstructionKind), .local_get);
const local = local_get.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
}
try expectEqual(start_instructions[12].get(components.WasmInstructionKind), .i32_add);
{
const local_set = start_instructions[13];
try expectEqual(local_set.get(components.WasmInstructionKind), .local_set);
try expectEqual(local_set.get(components.Local).entity, sum);
}
{
const i32_const = start_instructions[14];
try expectEqual(i32_const.get(components.WasmInstructionKind), .i32_const);
try expectEqualStrings(literalOf(i32_const.get(components.Constant).entity), "1");
}
const i = blk: {
const local_get = start_instructions[15];
try expectEqual(local_get.get(components.WasmInstructionKind), .local_get);
const local = local_get.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "it");
break :blk local;
};
try expectEqual(start_instructions[16].get(components.WasmInstructionKind), .i32_add);
{
const local_set = start_instructions[17];
try expectEqual(local_set.get(components.WasmInstructionKind), .local_set);
try expectEqual(local_set.get(components.Local).entity, i);
}
{
const br = start_instructions[18];
try expectEqual(br.get(components.WasmInstructionKind), .br);
try expectEqual(br.get(components.Label).value, 1);
}
try expectEqual(start_instructions[19].get(components.WasmInstructionKind), .end);
try expectEqual(start_instructions[20].get(components.WasmInstructionKind), .end);
const local_get = start_instructions[21];
try expectEqual(local_get.get(components.WasmInstructionKind), .local_get);
const local = local_get.get(components.Local).entity;
try expectEqualStrings(literalOf(local.get(components.Name).entity), "sum");
}
test "print wasm for loop" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i32 {
\\ sum = 0
\\ for(0:10) {
\\ sum += it
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const wasm = try printWasm(module);
try expectEqualStrings(wasm,
\\(module
\\
\\ (func $foo/start (result i32)
\\ (local $sum i32)
\\ (local $it i32)
\\ (i32.const 0)
\\ (local.set $sum)
\\ (i32.const 0)
\\ (local.set $it)
\\ block $.label.0
\\ loop $.label.1
\\ (local.get $it)
\\ (i32.const 10)
\\ i32.ge_s
\\ br_if $.label.0
\\ (local.get $sum)
\\ (local.get $it)
\\ i32.add
\\ (local.set $sum)
\\ (i32.const 1)
\\ (local.get $it)
\\ i32.add
\\ (local.set $it)
\\ br $.label.1
\\ end $.label.1
\\ end $.label.0
\\ (local.get $sum))
\\
\\ (export "_start" (func $foo/start)))
);
}
test "print wasm properly infer type for for loop" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i64 {
\\ sum = 0
\\ for(0:10) {
\\ sum += 1
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const wasm = try printWasm(module);
try expectEqualStrings(wasm,
\\(module
\\
\\ (func $foo/start (result i64)
\\ (local $sum i64)
\\ (local $it i32)
\\ (i64.const 0)
\\ (local.set $sum)
\\ (i32.const 0)
\\ (local.set $it)
\\ block $.label.0
\\ loop $.label.1
\\ (local.get $it)
\\ (i32.const 10)
\\ i32.ge_s
\\ br_if $.label.0
\\ (local.get $sum)
\\ (i64.const 1)
\\ i64.add
\\ (local.set $sum)
\\ (i32.const 1)
\\ (local.get $it)
\\ i32.add
\\ (local.set $it)
\\ br $.label.1
\\ end $.label.1
\\ end $.label.0
\\ (local.get $sum))
\\
\\ (export "_start" (func $foo/start)))
);
}
test "print wasm for loop non int literal last" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i64 {
\\ sum = 0
\\ n = 10
\\ for(0:n) {
\\ sum += 1
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const wasm = try printWasm(module);
try expectEqualStrings(wasm,
\\(module
\\
\\ (func $foo/start (result i64)
\\ (local $sum i64)
\\ (local $it i32)
\\ (i64.const 0)
\\ (local.set $sum)
\\ (i32.const 0)
\\ (local.set $it)
\\ block $.label.0
\\ loop $.label.1
\\ (local.get $it)
\\ (i32.const 10)
\\ i32.ge_s
\\ br_if $.label.0
\\ (local.get $sum)
\\ (i64.const 1)
\\ i64.add
\\ (local.set $sum)
\\ (i32.const 1)
\\ (local.get $it)
\\ i32.add
\\ (local.set $it)
\\ br $.label.1
\\ end $.label.1
\\ end $.label.0
\\ (local.get $sum))
\\
\\ (export "_start" (func $foo/start)))
);
}
test "print wasm for loop non int literal last implicit range start" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i64 {
\\ sum = 0
\\ n = 10
\\ for(:n) {
\\ sum += 1
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const wasm = try printWasm(module);
try expectEqualStrings(wasm,
\\(module
\\
\\ (func $foo/start (result i64)
\\ (local $sum i64)
\\ (local $it i32)
\\ (i64.const 0)
\\ (local.set $sum)
\\ (i32.const 0)
\\ (local.set $it)
\\ block $.label.0
\\ loop $.label.1
\\ (local.get $it)
\\ (i32.const 10)
\\ i32.ge_s
\\ br_if $.label.0
\\ (local.get $sum)
\\ (i64.const 1)
\\ i64.add
\\ (local.set $sum)
\\ (i32.const 1)
\\ (local.get $it)
\\ i32.add
\\ (local.set $it)
\\ br $.label.1
\\ end $.label.1
\\ end $.label.0
\\ (local.get $sum))
\\
\\ (export "_start" (func $foo/start)))
);
}
test "print wasm for loop non int literal first" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i64 {
\\ sum = 0
\\ n = 0
\\ for(n:10) {
\\ sum += 1
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const wasm = try printWasm(module);
try expectEqualStrings(wasm,
\\(module
\\
\\ (func $foo/start (result i64)
\\ (local $sum i64)
\\ (local $it i32)
\\ (i64.const 0)
\\ (local.set $sum)
\\ (i32.const 0)
\\ (local.set $it)
\\ block $.label.0
\\ loop $.label.1
\\ (local.get $it)
\\ (i32.const 10)
\\ i32.ge_s
\\ br_if $.label.0
\\ (local.get $sum)
\\ (i64.const 1)
\\ i64.add
\\ (local.set $sum)
\\ (i32.const 1)
\\ (local.get $it)
\\ i32.add
\\ (local.set $it)
\\ br $.label.1
\\ end $.label.1
\\ end $.label.0
\\ (local.get $sum))
\\
\\ (export "_start" (func $foo/start)))
);
}
test "print wasm for loop non int literal first and last" {
var arena = Arena.init(std.heap.page_allocator);
defer arena.deinit();
var codebase = try initCodebase(&arena);
var fs = try MockFileSystem.init(&arena);
_ = try fs.newFile("foo.yeti",
\\start() i64 {
\\ sum = 0
\\ first = 0
\\ last = 10
\\ for(first:last) {
\\ sum += 1
\\ }
\\ sum
\\}
);
const module = try analyzeSemantics(codebase, fs, "foo.yeti");
try codegen(module);
const wasm = try printWasm(module);
try expectEqualStrings(wasm,
\\(module
\\
\\ (func $foo/start (result i64)
\\ (local $sum i64)
\\ (local $it i32)
\\ (i64.const 0)
\\ (local.set $sum)
\\ (i32.const 0)
\\ (local.set $it)
\\ block $.label.0
\\ loop $.label.1
\\ (local.get $it)
\\ (i32.const 10)
\\ i32.ge_s
\\ br_if $.label.0
\\ (local.get $sum)
\\ (i64.const 1)
\\ i64.add
\\ (local.set $sum)
\\ (i32.const 1)
\\ (local.get $it)
\\ i32.add
\\ (local.set $it)
\\ br $.label.1
\\ end $.label.1
\\ end $.label.0
\\ (local.get $sum))
\\
\\ (export "_start" (func $foo/start)))
);
} | src/tests/test_for.zig |
const cmp = @import("cmp.zig");
const testing = @import("std").testing;
fn test__cmpdi2(a: i64, b: i64, expected: i64) !void {
var result = cmp.__cmpdi2(a, b);
try testing.expectEqual(expected, result);
}
test "cmpdi2" {
// minInt == -9223372036854775808
// maxInt == 9223372036854775807
// minInt/2 == -4611686018427387904
// maxInt/2 == 4611686018427387903
// 1. equality minInt, minInt+1, minInt/2, 0, maxInt/2, maxInt-1, maxInt
try test__cmpdi2(-9223372036854775808, -9223372036854775808, 1);
try test__cmpdi2(-9223372036854775807, -9223372036854775807, 1);
try test__cmpdi2(-4611686018427387904, -4611686018427387904, 1);
try test__cmpdi2(-1, -1, 1);
try test__cmpdi2(0, 0, 1);
try test__cmpdi2(1, 1, 1);
try test__cmpdi2(4611686018427387903, 4611686018427387903, 1);
try test__cmpdi2(9223372036854775806, 9223372036854775806, 1);
try test__cmpdi2(9223372036854775807, 9223372036854775807, 1);
// 2. cmp minInt, { minInt + 1, minInt/2, -1, 0, 1, maxInt/2, maxInt-1, maxInt}
try test__cmpdi2(-9223372036854775808, -9223372036854775807, 0);
try test__cmpdi2(-9223372036854775808, -4611686018427387904, 0);
try test__cmpdi2(-9223372036854775808, -1, 0);
try test__cmpdi2(-9223372036854775808, 0, 0);
try test__cmpdi2(-9223372036854775808, 1, 0);
try test__cmpdi2(-9223372036854775808, 4611686018427387903, 0);
try test__cmpdi2(-9223372036854775808, 9223372036854775806, 0);
try test__cmpdi2(-9223372036854775808, 9223372036854775807, 0);
// 3. cmp minInt+1, {minInt, minInt/2, -1,0,1, maxInt/2, maxInt-1, maxInt}
try test__cmpdi2(-9223372036854775807, -9223372036854775808, 2);
try test__cmpdi2(-9223372036854775807, -4611686018427387904, 0);
try test__cmpdi2(-9223372036854775807, -1, 0);
try test__cmpdi2(-9223372036854775807, 0, 0);
try test__cmpdi2(-9223372036854775807, 1, 0);
try test__cmpdi2(-9223372036854775807, 4611686018427387903, 0);
try test__cmpdi2(-9223372036854775807, 9223372036854775806, 0);
try test__cmpdi2(-9223372036854775807, 9223372036854775807, 0);
// 4. cmp minInt/2, {minInt, minInt + 1, -1,0,1, maxInt/2, maxInt-1, maxInt}
try test__cmpdi2(-4611686018427387904, -9223372036854775808, 2);
try test__cmpdi2(-4611686018427387904, -9223372036854775807, 2);
try test__cmpdi2(-4611686018427387904, -1, 0);
try test__cmpdi2(-4611686018427387904, 0, 0);
try test__cmpdi2(-4611686018427387904, 1, 0);
try test__cmpdi2(-4611686018427387904, 4611686018427387903, 0);
try test__cmpdi2(-4611686018427387904, 9223372036854775806, 0);
try test__cmpdi2(-4611686018427387904, 9223372036854775807, 0);
// 5. cmp -1, {minInt, minInt + 1, minInt/2, 0,1, maxInt/2, maxInt-1, maxInt}
try test__cmpdi2(-1, -9223372036854775808, 2);
try test__cmpdi2(-1, -9223372036854775807, 2);
try test__cmpdi2(-1, -4611686018427387904, 2);
try test__cmpdi2(-1, 0, 0);
try test__cmpdi2(-1, 1, 0);
try test__cmpdi2(-1, 4611686018427387903, 0);
try test__cmpdi2(-1, 9223372036854775806, 0);
try test__cmpdi2(-1, 9223372036854775807, 0);
// 6. cmp 0, {minInt, minInt + 1, minInt/2, -1, 1, maxInt/2, maxInt-1, maxInt}
try test__cmpdi2(0, -9223372036854775808, 2);
try test__cmpdi2(0, -9223372036854775807, 2);
try test__cmpdi2(0, -4611686018427387904, 2);
try test__cmpdi2(0, -1, 2);
try test__cmpdi2(0, 1, 0);
try test__cmpdi2(0, 4611686018427387903, 0);
try test__cmpdi2(0, 9223372036854775806, 0);
try test__cmpdi2(0, 9223372036854775807, 0);
// 7. cmp 1, {minInt, minInt + 1, minInt/2, -1,0, maxInt/2, maxInt-1, maxInt}
try test__cmpdi2(1, -9223372036854775808, 2);
try test__cmpdi2(1, -9223372036854775807, 2);
try test__cmpdi2(1, -4611686018427387904, 2);
try test__cmpdi2(1, -1, 2);
try test__cmpdi2(1, 0, 2);
try test__cmpdi2(1, 4611686018427387903, 0);
try test__cmpdi2(1, 9223372036854775806, 0);
try test__cmpdi2(1, 9223372036854775807, 0);
// 8. cmp maxInt/2, {minInt, minInt + 1, minInt/2, -1,0,1, maxInt-1, maxInt}
try test__cmpdi2(4611686018427387903, -9223372036854775808, 2);
try test__cmpdi2(4611686018427387903, -9223372036854775807, 2);
try test__cmpdi2(4611686018427387903, -4611686018427387904, 2);
try test__cmpdi2(4611686018427387903, -1, 2);
try test__cmpdi2(4611686018427387903, 0, 2);
try test__cmpdi2(4611686018427387903, 1, 2);
try test__cmpdi2(4611686018427387903, 9223372036854775806, 0);
try test__cmpdi2(4611686018427387903, 9223372036854775807, 0);
// 9. cmp maxInt-1, {minInt, minInt + 1, minInt/2, -1,0,1, maxInt/2, maxInt}
try test__cmpdi2(9223372036854775806, -9223372036854775808, 2);
try test__cmpdi2(9223372036854775806, -9223372036854775807, 2);
try test__cmpdi2(9223372036854775806, -4611686018427387904, 2);
try test__cmpdi2(9223372036854775806, -1, 2);
try test__cmpdi2(9223372036854775806, 0, 2);
try test__cmpdi2(9223372036854775806, 1, 2);
try test__cmpdi2(9223372036854775806, 4611686018427387903, 2);
try test__cmpdi2(9223372036854775806, 9223372036854775807, 0);
// 10.cmp maxInt, {minInt, minInt + 1, minInt/2, -1,0,1, maxInt/2, maxInt-1, }
try test__cmpdi2(9223372036854775807, -9223372036854775808, 2);
try test__cmpdi2(9223372036854775807, -9223372036854775807, 2);
try test__cmpdi2(9223372036854775807, -4611686018427387904, 2);
try test__cmpdi2(9223372036854775807, -1, 2);
try test__cmpdi2(9223372036854775807, 0, 2);
try test__cmpdi2(9223372036854775807, 1, 2);
try test__cmpdi2(9223372036854775807, 4611686018427387903, 2);
try test__cmpdi2(9223372036854775807, 9223372036854775806, 2);
} | lib/std/special/compiler_rt/cmpdi2_test.zig |
const std = @import("../../../std.zig");
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
pub const SYS = extern enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
waitpid = 7,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
time = 13,
mknod = 14,
chmod = 15,
lchown = 16,
@"break" = 17,
oldstat = 18,
lseek = 19,
getpid = 20,
mount = 21,
umount = 22,
setuid = 23,
getuid = 24,
stime = 25,
ptrace = 26,
alarm = 27,
oldfstat = 28,
pause = 29,
utime = 30,
stty = 31,
gtty = 32,
access = 33,
nice = 34,
ftime = 35,
sync = 36,
kill = 37,
rename = 38,
mkdir = 39,
rmdir = 40,
dup = 41,
pipe = 42,
times = 43,
prof = 44,
brk = 45,
setgid = 46,
getgid = 47,
signal = 48,
geteuid = 49,
getegid = 50,
acct = 51,
umount2 = 52,
lock = 53,
ioctl = 54,
fcntl = 55,
mpx = 56,
setpgid = 57,
ulimit = 58,
oldolduname = 59,
umask = 60,
chroot = 61,
ustat = 62,
dup2 = 63,
getppid = 64,
getpgrp = 65,
setsid = 66,
sigaction = 67,
sgetmask = 68,
ssetmask = 69,
setreuid = 70,
setregid = 71,
sigsuspend = 72,
sigpending = 73,
sethostname = 74,
setrlimit = 75,
getrlimit = 76,
getrusage = 77,
gettimeofday = 78,
settimeofday = 79,
getgroups = 80,
setgroups = 81,
select = 82,
symlink = 83,
oldlstat = 84,
readlink = 85,
uselib = 86,
swapon = 87,
reboot = 88,
readdir = 89,
mmap = 90,
munmap = 91,
truncate = 92,
ftruncate = 93,
fchmod = 94,
fchown = 95,
getpriority = 96,
setpriority = 97,
profil = 98,
statfs = 99,
fstatfs = 100,
ioperm = 101,
socketcall = 102,
syslog = 103,
setitimer = 104,
getitimer = 105,
stat = 106,
lstat = 107,
fstat = 108,
olduname = 109,
iopl = 110,
vhangup = 111,
idle = 112,
vm86old = 113,
wait4 = 114,
swapoff = 115,
sysinfo = 116,
ipc = 117,
fsync = 118,
sigreturn = 119,
clone = 120,
setdomainname = 121,
uname = 122,
modify_ldt = 123,
adjtimex = 124,
mprotect = 125,
sigprocmask = 126,
create_module = 127,
init_module = 128,
delete_module = 129,
get_kernel_syms = 130,
quotactl = 131,
getpgid = 132,
fchdir = 133,
bdflush = 134,
sysfs = 135,
personality = 136,
afs_syscall = 137,
setfsuid = 138,
setfsgid = 139,
_llseek = 140,
getdents = 141,
_newselect = 142,
flock = 143,
msync = 144,
readv = 145,
writev = 146,
getsid = 147,
fdatasync = 148,
_sysctl = 149,
mlock = 150,
munlock = 151,
mlockall = 152,
munlockall = 153,
sched_setparam = 154,
sched_getparam = 155,
sched_setscheduler = 156,
sched_getscheduler = 157,
sched_yield = 158,
sched_get_priority_max = 159,
sched_get_priority_min = 160,
sched_rr_get_interval = 161,
nanosleep = 162,
mremap = 163,
setresuid = 164,
getresuid = 165,
vm86 = 166,
query_module = 167,
poll = 168,
nfsservctl = 169,
setresgid = 170,
getresgid = 171,
prctl = 172,
rt_sigreturn = 173,
rt_sigaction = 174,
rt_sigprocmask = 175,
rt_sigpending = 176,
rt_sigtimedwait = 177,
rt_sigqueueinfo = 178,
rt_sigsuspend = 179,
pread64 = 180,
pwrite64 = 181,
chown = 182,
getcwd = 183,
capget = 184,
capset = 185,
sigaltstack = 186,
sendfile = 187,
getpmsg = 188,
putpmsg = 189,
vfork = 190,
ugetrlimit = 191,
mmap2 = 192,
truncate64 = 193,
ftruncate64 = 194,
stat64 = 195,
lstat64 = 196,
fstat64 = 197,
lchown32 = 198,
getuid32 = 199,
getgid32 = 200,
geteuid32 = 201,
getegid32 = 202,
setreuid32 = 203,
setregid32 = 204,
getgroups32 = 205,
setgroups32 = 206,
fchown32 = 207,
setresuid32 = 208,
getresuid32 = 209,
setresgid32 = 210,
getresgid32 = 211,
chown32 = 212,
setuid32 = 213,
setgid32 = 214,
setfsuid32 = 215,
setfsgid32 = 216,
pivot_root = 217,
mincore = 218,
madvise = 219,
getdents64 = 220,
fcntl64 = 221,
gettid = 224,
readahead = 225,
setxattr = 226,
lsetxattr = 227,
fsetxattr = 228,
getxattr = 229,
lgetxattr = 230,
fgetxattr = 231,
listxattr = 232,
llistxattr = 233,
flistxattr = 234,
removexattr = 235,
lremovexattr = 236,
fremovexattr = 237,
tkill = 238,
sendfile64 = 239,
futex = 240,
sched_setaffinity = 241,
sched_getaffinity = 242,
set_thread_area = 243,
get_thread_area = 244,
io_setup = 245,
io_destroy = 246,
io_getevents = 247,
io_submit = 248,
io_cancel = 249,
fadvise64 = 250,
exit_group = 252,
lookup_dcookie = 253,
epoll_create = 254,
epoll_ctl = 255,
epoll_wait = 256,
remap_file_pages = 257,
set_tid_address = 258,
timer_create = 259,
timer_settime, // SYS_timer_create + 1
timer_gettime, // SYS_timer_create + 2
timer_getoverrun, // SYS_timer_create + 3
timer_delete, // SYS_timer_create + 4
clock_settime, // SYS_timer_create + 5
clock_gettime, // SYS_timer_create + 6
clock_getres, // SYS_timer_create + 7
clock_nanosleep, // SYS_timer_create + 8
statfs64 = 268,
fstatfs64 = 269,
tgkill = 270,
utimes = 271,
fadvise64_64 = 272,
vserver = 273,
mbind = 274,
get_mempolicy = 275,
set_mempolicy = 276,
mq_open = 277,
mq_unlink, // SYS_mq_open + 1
mq_timedsend, // SYS_mq_open + 2
mq_timedreceive, // SYS_mq_open + 3
mq_notify, // SYS_mq_open + 4
mq_getsetattr, // SYS_mq_open + 5
kexec_load = 283,
waitid = 284,
add_key = 286,
request_key = 287,
keyctl = 288,
ioprio_set = 289,
ioprio_get = 290,
inotify_init = 291,
inotify_add_watch = 292,
inotify_rm_watch = 293,
migrate_pages = 294,
openat = 295,
mkdirat = 296,
mknodat = 297,
fchownat = 298,
futimesat = 299,
fstatat64 = 300,
unlinkat = 301,
renameat = 302,
linkat = 303,
symlinkat = 304,
readlinkat = 305,
fchmodat = 306,
faccessat = 307,
pselect6 = 308,
ppoll = 309,
unshare = 310,
set_robust_list = 311,
get_robust_list = 312,
splice = 313,
sync_file_range = 314,
tee = 315,
vmsplice = 316,
move_pages = 317,
getcpu = 318,
epoll_pwait = 319,
utimensat = 320,
signalfd = 321,
timerfd_create = 322,
eventfd = 323,
fallocate = 324,
timerfd_settime = 325,
timerfd_gettime = 326,
signalfd4 = 327,
eventfd2 = 328,
epoll_create1 = 329,
dup3 = 330,
pipe2 = 331,
inotify_init1 = 332,
preadv = 333,
pwritev = 334,
rt_tgsigqueueinfo = 335,
perf_event_open = 336,
recvmmsg = 337,
fanotify_init = 338,
fanotify_mark = 339,
prlimit64 = 340,
name_to_handle_at = 341,
open_by_handle_at = 342,
clock_adjtime = 343,
syncfs = 344,
sendmmsg = 345,
setns = 346,
process_vm_readv = 347,
process_vm_writev = 348,
kcmp = 349,
finit_module = 350,
sched_setattr = 351,
sched_getattr = 352,
renameat2 = 353,
seccomp = 354,
getrandom = 355,
memfd_create = 356,
bpf = 357,
execveat = 358,
socket = 359,
socketpair = 360,
bind = 361,
connect = 362,
listen = 363,
accept4 = 364,
getsockopt = 365,
setsockopt = 366,
getsockname = 367,
getpeername = 368,
sendto = 369,
sendmsg = 370,
recvfrom = 371,
recvmsg = 372,
shutdown = 373,
userfaultfd = 374,
membarrier = 375,
mlock2 = 376,
copy_file_range = 377,
preadv2 = 378,
pwritev2 = 379,
pkey_mprotect = 380,
pkey_alloc = 381,
pkey_free = 382,
statx = 383,
arch_prctl = 384,
io_pgetevents = 385,
rseq = 386,
semget = 393,
semctl = 394,
shmget = 395,
shmctl = 396,
shmat = 397,
shmdt = 398,
msgget = 399,
msgsnd = 400,
msgrcv = 401,
msgctl = 402,
clock_gettime64 = 403,
clock_settime64 = 404,
clock_adjtime64 = 405,
clock_getres_time64 = 406,
clock_nanosleep_time64 = 407,
timer_gettime64 = 408,
timer_settime64 = 409,
timerfd_gettime64 = 410,
timerfd_settime64 = 411,
utimensat_time64 = 412,
pselect6_time64 = 413,
ppoll_time64 = 414,
io_pgetevents_time64 = 416,
recvmmsg_time64 = 417,
mq_timedsend_time64 = 418,
mq_timedreceive_time64 = 419,
semtimedop_time64 = 420,
rt_sigtimedwait_time64 = 421,
futex_time64 = 422,
sched_rr_get_interval_time64 = 423,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
_,
};
pub const O_CREAT = 0o100;
pub const O_EXCL = 0o200;
pub const O_NOCTTY = 0o400;
pub const O_TRUNC = 0o1000;
pub const O_APPEND = 0o2000;
pub const O_NONBLOCK = 0o4000;
pub const O_DSYNC = 0o10000;
pub const O_SYNC = 0o4010000;
pub const O_RSYNC = 0o4010000;
pub const O_DIRECTORY = 0o200000;
pub const O_NOFOLLOW = 0o400000;
pub const O_CLOEXEC = 0o2000000;
pub const O_ASYNC = 0o20000;
pub const O_DIRECT = 0o40000;
pub const O_LARGEFILE = 0o100000;
pub const O_NOATIME = 0o1000000;
pub const O_PATH = 0o10000000;
pub const O_TMPFILE = 0o20200000;
pub const O_NDELAY = O_NONBLOCK;
pub const F_DUPFD = 0;
pub const F_GETFD = 1;
pub const F_SETFD = 2;
pub const F_GETFL = 3;
pub const F_SETFL = 4;
pub const F_SETOWN = 8;
pub const F_GETOWN = 9;
pub const F_SETSIG = 10;
pub const F_GETSIG = 11;
pub const F_GETLK = 12;
pub const F_SETLK = 13;
pub const F_SETLKW = 14;
pub const F_RDLCK = 0;
pub const F_WRLCK = 1;
pub const F_UNLCK = 2;
pub const LOCK_SH = 1;
pub const LOCK_EX = 2;
pub const LOCK_UN = 8;
pub const LOCK_NB = 4;
pub const F_SETOWN_EX = 15;
pub const F_GETOWN_EX = 16;
pub const F_GETOWNER_UIDS = 17;
pub const MAP_NORESERVE = 0x4000;
pub const MAP_GROWSDOWN = 0x0100;
pub const MAP_DENYWRITE = 0x0800;
pub const MAP_EXECUTABLE = 0x1000;
pub const MAP_LOCKED = 0x2000;
pub const MAP_32BIT = 0x40;
pub const MMAP2_UNIT = 4096;
pub const VDSO_CGT_SYM = "__vdso_clock_gettime";
pub const VDSO_CGT_VER = "LINUX_2.6";
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
};
pub const msghdr = extern struct {
msg_name: ?*sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec,
msg_iovlen: i32,
msg_control: ?*c_void,
msg_controllen: socklen_t,
msg_flags: i32,
};
pub const msghdr_const = extern struct {
msg_name: ?*const sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec_const,
msg_iovlen: i32,
msg_control: ?*c_void,
msg_controllen: socklen_t,
msg_flags: i32,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = isize;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const kernel_stat = extern struct {
dev: dev_t,
__dev_padding: u32,
__ino_truncated: u32,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__rdev_padding: u32,
size: off_t,
blksize: blksize_t,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
ino: ino_t,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
// The `stat64` definition used by the libc.
pub const libc_stat = kernel_stat;
pub const timespec = extern struct {
tv_sec: i32,
tv_nsec: i32,
};
pub const timeval = extern struct {
tv_sec: i32,
tv_usec: i32,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const mcontext_t = extern struct {
gregs: [19]usize,
fpregs: [*]u8,
oldmask: usize,
cr2: usize,
};
pub const REG_GS = 0;
pub const REG_FS = 1;
pub const REG_ES = 2;
pub const REG_DS = 3;
pub const REG_EDI = 4;
pub const REG_ESI = 5;
pub const REG_EBP = 6;
pub const REG_ESP = 7;
pub const REG_EBX = 8;
pub const REG_EDX = 9;
pub const REG_ECX = 10;
pub const REG_EAX = 11;
pub const REG_TRAPNO = 12;
pub const REG_ERR = 13;
pub const REG_EIP = 14;
pub const REG_CS = 15;
pub const REG_EFL = 16;
pub const REG_UESP = 17;
pub const REG_SS = 18;
pub const ucontext_t = extern struct {
flags: usize,
link: *ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
sigmask: sigset_t,
regspace: [64]u64,
};
pub const Elf_Symndx = u32;
pub const user_desc = packed struct {
entry_number: u32,
base_addr: u32,
limit: u32,
seg_32bit: u1,
contents: u2,
read_exec_only: u1,
limit_in_pages: u1,
seg_not_present: u1,
useable: u1,
};
// socketcall() call numbers
pub const SC_socket = 1;
pub const SC_bind = 2;
pub const SC_connect = 3;
pub const SC_listen = 4;
pub const SC_accept = 5;
pub const SC_getsockname = 6;
pub const SC_getpeername = 7;
pub const SC_socketpair = 8;
pub const SC_send = 9;
pub const SC_recv = 10;
pub const SC_sendto = 11;
pub const SC_recvfrom = 12;
pub const SC_shutdown = 13;
pub const SC_setsockopt = 14;
pub const SC_getsockopt = 15;
pub const SC_sendmsg = 16;
pub const SC_recvmsg = 17;
pub const SC_accept4 = 18;
pub const SC_recvmmsg = 19;
pub const SC_sendmmsg = 20; | lib/std/os/bits/linux/i386.zig |
const std = @import("std");
const print = std.debug.print;
usingnamespace @import("value.zig");
usingnamespace @import("chunk.zig");
usingnamespace @import("compiler.zig");
pub var sacnner: Scanner = undefined;
pub const TokenType = enum(u8) {
// Single-character tokens.
TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_LEFT_BRACE, TOKEN_RIGHT_BRACE, TOKEN_COMMA, TOKEN_DOT, TOKEN_MINUS, TOKEN_PLUS, TOKEN_SEMICOLON, TOKEN_SLASH, TOKEN_STAR,
// One or two character tokens.
TOKEN_BANG, TOKEN_BANG_EQUAL, TOKEN_EQUAL, TOKEN_EQUAL_EQUAL, TOKEN_GREATER, TOKEN_GREATER_EQUAL, TOKEN_LESS, TOKEN_LESS_EQUAL,
// Literals.
TOKEN_IDENTIFIER, TOKEN_STRING, TOKEN_NUMBER,
// Keywords.
TOKEN_AND, TOKEN_CLASS, TOKEN_ELSE, TOKEN_FALSE, TOKEN_FOR, TOKEN_FUN, TOKEN_IF, TOKEN_NIL, TOKEN_OR, TOKEN_PRINT, TOKEN_RETURN, TOKEN_SUPER, TOKEN_THIS, TOKEN_TRUE, TOKEN_VAR, TOKEN_WHILE, TOKEN_ERROR, TOKEN_EOF
};
pub const Token = struct {
tokenType: TokenType,
line: usize,
literal: []const u8,
pub fn equal(a: Token, b: Token) bool {
if (a.literal.len != b.literal.len) return false;
return std.mem.eql(u8, a.literal, b.literal);
}
};
pub const Scanner = struct {
start: usize,
current: usize,
line: usize,
source: []const u8,
pub fn init(source: []const u8) void {
sacnner.source = source;
sacnner.start = 0;
sacnner.current = 0;
sacnner.line = 1;
}
pub fn scanToken(self: *Scanner) Token {
self.skipWhitespace();
self.start = self.current;
if (self.isAtEnd()) {
return self.makeToken(TokenType.TOKEN_EOF);
}
const c = self.advance();
if (isDigit(c)) {
return self.number();
} else if (isAlpha(c)) {
return self.identifier();
}
return switch (c) {
'(' => self.makeToken(TokenType.TOKEN_LEFT_PAREN),
')' => self.makeToken(TokenType.TOKEN_RIGHT_PAREN),
'{' => self.makeToken(TokenType.TOKEN_LEFT_BRACE),
'}' => self.makeToken(TokenType.TOKEN_RIGHT_BRACE),
';' => self.makeToken(TokenType.TOKEN_SEMICOLON),
',' => self.makeToken(TokenType.TOKEN_COMMA),
'.' => self.makeToken(TokenType.TOKEN_DOT),
'-' => self.makeToken(TokenType.TOKEN_MINUS),
'+' => self.makeToken(TokenType.TOKEN_PLUS),
'/' => self.makeToken(TokenType.TOKEN_SLASH),
'*' => self.makeToken(TokenType.TOKEN_STAR),
'!' => self.makeToken(if (self.match('=')) TokenType.TOKEN_BANG_EQUAL else TokenType.TOKEN_BANG),
'=' => self.makeToken(if (self.match('=')) TokenType.TOKEN_EQUAL_EQUAL else TokenType.TOKEN_EQUAL),
'<' => self.makeToken(if (self.match('=')) TokenType.TOKEN_LESS_EQUAL else TokenType.TOKEN_LESS),
'>' => self.makeToken(if (self.match('=')) TokenType.TOKEN_GREATER_EQUAL else TokenType.TOKEN_GREATER),
'"' => self.string(),
else => self.errorToekn("Unexpected character."),
};
}
fn isDigit(c: u8) bool {
return c >= '0' and c <= '9';
}
fn isAlpha(c: u8) bool {
return (c >= 'a' and c <= 'z') or
(c >= 'A' and c <= 'Z') or
c == '_';
}
pub fn advance(self: *Scanner) u8 {
self.current += 1;
return self.source[self.current - 1];
}
fn match(self: *Scanner, char: u8) bool {
if (self.isAtEnd()) {
return false;
}
if (self.source[self.current] != char) {
return false;
}
self.current += 1;
return true;
}
fn skipWhitespace(self: *Scanner) void {
while (true) {
const c = self.peek();
switch (c) {
' ', '\r', '\t' => _ = self.advance(),
'\n' => {
self.line += 1;
_ = self.advance();
},
'/' => {
if (self.peekNext() == '/') {
while (self.peek() != '\n' and !self.isAtEnd()) {
_ = self.advance();
}
} else {
return;
}
},
else => return,
}
}
}
fn identifierType(self: *Scanner) Token {
return switch (self.source[self.start]) {
'a' => self.checkKeyword(1, 2, "nd", TokenType.TOKEN_AND),
'c' => self.checkKeyword(1, 4, "lass", TokenType.TOKEN_CLASS),
'e' => self.checkKeyword(1, 3, "lse", TokenType.TOKEN_ELSE),
'f' => self.checkKeywordF(),
'i' => self.checkKeyword(1, 1, "f", TokenType.TOKEN_IF),
'n' => self.checkKeyword(1, 2, "il", TokenType.TOKEN_NIL),
'o' => self.checkKeyword(1, 1, "r", TokenType.TOKEN_OR),
'p' => self.checkKeyword(1, 4, "rint", TokenType.TOKEN_PRINT),
'r' => self.checkKeyword(1, 5, "eturn", TokenType.TOKEN_RETURN),
's' => self.checkKeyword(1, 4, "uper", TokenType.TOKEN_SUPER),
't' => self.checkKeywordT(),
'v' => self.checkKeyword(1, 2, "ar", TokenType.TOKEN_VAR),
'w' => self.checkKeyword(1, 4, "hile", TokenType.TOKEN_WHILE),
else => self.getIdentifierType(),
};
}
fn checkKeywordF(self: *Scanner) Token {
return switch (self.source[self.start + 1]) {
'a' => self.checkKeyword(2, 3, "lse", TokenType.TOKEN_FALSE),
'o' => self.checkKeyword(2, 1, "r", TokenType.TOKEN_FOR),
'u' => self.checkKeyword(2, 1, "n", TokenType.TOKEN_FUN),
else => self.getIdentifierType(),
};
}
fn checkKeywordT(self: *Scanner) Token {
return switch (self.source[self.start + 1]) {
'h' => self.checkKeyword(2, 2, "is", TokenType.TOKEN_THIS),
'r' => self.checkKeyword(2, 2, "ue", TokenType.TOKEN_TRUE),
else => self.getIdentifierType(),
};
}
fn getIdentifierType(self: *Scanner) Token {
return self.makeToken(TokenType.TOKEN_IDENTIFIER);
}
fn identifier(self: *Scanner) Token {
while (isAlpha(self.peek()) or isDigit(self.peek())) {
_ = self.advance();
}
return if (self.current - self.start > 1) self.identifierType() else self.getIdentifierType();
}
fn checkKeyword(self: *Scanner, start: usize, length: usize, rest: []const u8, tokenType: TokenType) Token {
if (self.current - self.start == start + length and
std.mem.eql(u8, self.source[self.start + start .. self.current], rest))
{
return Token{
.tokenType = tokenType,
.line = self.line,
.literal = self.source[self.start..self.current],
};
}
return self.getIdentifierType();
}
fn number(self: *Scanner) Token {
while (isDigit(self.peek())) {
_ = self.advance();
}
// Look for a fraction part.
if (self.peek() == '.' and isDigit(self.peekNext())) {
_ = self.advance();
while (isDigit(self.peek())) {
_ = self.advance();
}
}
return self.makeToken(TokenType.TOKEN_NUMBER);
}
fn string(self: *Scanner) Token {
while (self.peek() != '"' and !self.isAtEnd()) {
if (self.peek() == '\n') {
self.line += 1;
}
_ = self.advance();
}
if (self.isAtEnd()) {
return self.errorToekn("Unterminated string.");
} else {
_ = self.advance();
return self.makeToken(TokenType.TOKEN_STRING);
}
}
fn peek(self: *Scanner) u8 {
return self.source[self.current];
}
fn peekNext(self: *Scanner) u8 {
if (self.isAtEnd()) {
return 0;
}
return self.source[self.current + 1];
}
fn isAtEnd(self: *Scanner) bool {
return self.source[self.current] == 0;
}
fn makeToken(self: *Scanner, tokenType: TokenType) Token {
return Token{
.tokenType = tokenType,
.line = sacnner.line,
.literal = self.source[self.start..self.current],
};
}
fn errorToekn(self: *Scanner, message: []const u8) Token {
return Token{
.tokenType = TokenType.TOKEN_ERROR,
.line = sacnner.line,
.literal = message,
};
}
}; | zvm/src/scanner.zig |
const std = @import("std");
const c = @import("c.zig").c;
const Error = @import("errors.zig").Error;
const getError = @import("errors.zig").getError;
const Window = @import("Window.zig");
const internal_debug = @import("internal_debug.zig");
/// Returns whether the Vulkan loader and an ICD have been found.
///
/// This function returns whether the Vulkan loader and any minimally functional ICD have been
/// found.
///
/// The availability of a Vulkan loader and even an ICD does not by itself guarantee that surface
/// creation or even instance creation is possible. For example, on Fermi systems Nvidia will
/// install an ICD that provides no actual Vulkan support. Call glfw.getRequiredInstanceExtensions
/// to check whether the extensions necessary for Vulkan surface creation are available and
/// glfw.getPhysicalDevicePresentationSupport to check whether a queue family of a physical device
/// supports image presentation.
///
/// @return `true` if Vulkan is minimally available, or `false` otherwise.
///
/// Possible errors include glfw.Error.NotInitialized.
///
/// @thread_safety This function may be called from any thread.
pub inline fn vulkanSupported() bool {
internal_debug.assertInitialized();
const supported = c.glfwVulkanSupported();
getError() catch unreachable; // Only error 'GLFW_NOT_INITIALIZED' is impossible
return supported == c.GLFW_TRUE;
}
/// Returns the Vulkan instance extensions required by GLFW.
///
/// This function returns an array of names of Vulkan instance extensions required by GLFW for
/// creating Vulkan surfaces for GLFW windows. If successful, the list will always contain
/// `VK_KHR_surface`, so if you don't require any additional extensions you can pass this list
/// directly to the `VkInstanceCreateInfo` struct.
///
/// If Vulkan is not available on the machine, this function returns null and generates a
/// glfw.Error.APIUnavailable error. Call glfw.vulkanSupported to check whether Vulkan is at least
/// minimally available.
///
/// If Vulkan is available but no set of extensions allowing window surface creation was found,
/// this function returns null. You may still use Vulkan for off-screen rendering and compute work.
///
/// Possible errors include glfw.Error.NotInitialized and glfw.Error.APIUnavailable.
///
/// Additional extensions may be required by future versions of GLFW. You should check if any
/// extensions you wish to enable are already in the returned array, as it is an error to specify
/// an extension more than once in the `VkInstanceCreateInfo` struct.
///
/// macos: This function currently supports either the `VK_MVK_macos_surface` extension from
/// MoltenVK or `VK_EXT_metal_surface` extension.
///
/// @pointer_lifetime The returned array is allocated and freed by GLFW. You should not free it
/// yourself. It is guaranteed to be valid only until the library is terminated.
///
/// @thread_safety This function may be called from any thread.
///
/// see also: vulkan_ext, glfwCreateWindowSurface
pub inline fn getRequiredInstanceExtensions() error{APIUnavailable}![][*:0]const u8 {
internal_debug.assertInitialized();
var count: u32 = 0;
const extensions = c.glfwGetRequiredInstanceExtensions(&count);
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.APIUnavailable => @errSetCast(error{APIUnavailable}, err),
else => unreachable,
};
return @ptrCast([*][*:0]const u8, extensions)[0..count];
}
/// Vulkan API function pointer type.
///
/// Generic function pointer used for returning Vulkan API function pointers.
///
/// see also: vulkan_proc, glfw.getInstanceProcAddress
pub const VKProc = fn () callconv(.C) void;
/// Returns the address of the specified Vulkan instance function.
///
/// This function returns the address of the specified Vulkan core or extension function for the
/// specified instance. If instance is set to null it can return any function exported from the
/// Vulkan loader, including at least the following functions:
///
/// - `vkEnumerateInstanceExtensionProperties`
/// - `vkEnumerateInstanceLayerProperties`
/// - `vkCreateInstance`
/// - `vkGetInstanceProcAddr`
///
/// If Vulkan is not available on the machine, this function returns null and generates a
/// glfw.Error.APIUnavailable error. Call glfw.vulkanSupported to check whether Vulkan is at least
/// minimally available.
///
/// This function is equivalent to calling `vkGetInstanceProcAddr` with a platform-specific query
/// of the Vulkan loader as a fallback.
///
/// @param[in] instance The Vulkan instance to query, or null to retrieve functions related to
/// instance creation.
/// @param[in] procname The ASCII encoded name of the function.
/// @return The address of the function, or null if an error occurred.
///
/// To maintain ABI compatability with the C glfwGetInstanceProcAddress, as it is commonly passed
/// into libraries expecting that exact ABI, this function does not return an error. Instead, if
/// glfw.Error.NotInitialized or glfw.Error.APIUnavailable would occur this function will panic.
/// You may check glfw.vulkanSupported prior to invoking this function.
///
/// @pointer_lifetime The returned function pointer is valid until the library is terminated.
///
/// @thread_safety This function may be called from any thread.
pub fn getInstanceProcAddress(vk_instance: ?*opaque {}, proc_name: [*:0]const u8) callconv(.C) ?VKProc {
internal_debug.assertInitialized();
const proc_address = c.glfwGetInstanceProcAddress(if (vk_instance) |v| @ptrCast(c.VkInstance, v) else null, proc_name);
getError() catch |err| @panic(@errorName(err));
if (proc_address) |addr| return addr;
return null;
}
/// Returns whether the specified queue family can present images.
///
/// This function returns whether the specified queue family of the specified physical device
/// supports presentation to the platform GLFW was built for.
///
/// If Vulkan or the required window surface creation instance extensions are not available on the
/// machine, or if the specified instance was not created with the required extensions, this
/// function returns `GLFW_FALSE` and generates a glfw.Error.APIUnavailable error. Call
/// glfw.vulkanSupported to check whether Vulkan is at least minimally available and
/// glfw.getRequiredInstanceExtensions to check what instance extensions are required.
///
/// @param[in] instance The instance that the physical device belongs to.
/// @param[in] device The physical device that the queue family belongs to.
/// @param[in] queuefamily The index of the queue family to query.
/// @return `true` if the queue family supports presentation, or `false` otherwise.
///
/// Possible errors include glfw.Error.NotInitialized, glfw.Error.APIUnavailable and glfw.Error.PlatformError.
///
/// macos: This function currently always returns `true`, as the `VK_MVK_macos_surface`
/// extension does not provide a `vkGetPhysicalDevice*PresentationSupport` type function.
///
/// @thread_safety This function may be called from any thread. For synchronization details of
/// Vulkan objects, see the Vulkan specification.
///
/// see also: vulkan_present
pub inline fn getPhysicalDevicePresentationSupport(
vk_instance: *opaque {},
vk_physical_device: *opaque {},
queue_family: u32,
) error{ APIUnavailable, PlatformError }!bool {
internal_debug.assertInitialized();
const v = c.glfwGetPhysicalDevicePresentationSupport(
@ptrCast(c.VkInstance, vk_instance),
@ptrCast(*c.VkPhysicalDevice, @alignCast(@alignOf(*c.VkPhysicalDevice), vk_physical_device)).*,
queue_family,
);
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.APIUnavailable,
Error.PlatformError,
=> @errSetCast(error{ APIUnavailable, PlatformError }, err),
else => unreachable,
};
return v == c.GLFW_TRUE;
}
/// Creates a Vulkan surface for the specified window.
///
/// This function creates a Vulkan surface for the specified window.
///
/// If the Vulkan loader or at least one minimally functional ICD were not found, this function
/// returns `VK_ERROR_INITIALIZATION_FAILED` and generates a glfw.Error.APIUnavailable error. Call
/// glfw.vulkanSupported to check whether Vulkan is at least minimally available.
///
/// If the required window surface creation instance extensions are not available or if the
/// specified instance was not created with these extensions enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT`
/// and generates a glfw.Error.APIUnavailable error. Call glfw.getRequiredInstanceExtensions to
/// check what instance extensions are required.
///
/// The window surface cannot be shared with another API so the window must have been created with
/// the client api hint set to `GLFW_NO_API` otherwise it generates a glfw.Error.InvalidValue error
/// and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
///
/// The window surface must be destroyed before the specified Vulkan instance. It is the
/// responsibility of the caller to destroy the window surface. GLFW does not destroy it for you.
/// Call `vkDestroySurfaceKHR` to destroy the surface.
///
/// @param[in] vk_instance The Vulkan instance to create the surface in.
/// @param[in] window The window to create the surface for.
/// @param[in] vk_allocation_callbacks The allocator to use, or null to use the default
/// allocator.
/// @param[out] surface Where to store the handle of the surface. This is set
/// to `VK_NULL_HANDLE` if an error occurred.
/// @return `VkResult` type, `VK_SUCCESS` if successful, or a Vulkan error code if an
/// error occurred.
///
/// Possible errors include glfw.Error.NotInitialized, glfw.Error.APIUnavailable, glfw.Error.PlatformError and glfw.Error.InvalidValue
///
/// If an error occurs before the creation call is made, GLFW returns the Vulkan error code most
/// appropriate for the error. Appropriate use of glfw.vulkanSupported and glfw.getRequiredInstanceExtensions
/// should eliminate almost all occurrences of these errors.
///
/// macos: This function currently only supports the `VK_MVK_macos_surface` extension from MoltenVK.
///
/// macos: This function creates and sets a `CAMetalLayer` instance for the window content view,
/// which is required for MoltenVK to function.
///
/// @thread_safety This function may be called from any thread. For synchronization details of
/// Vulkan objects, see the Vulkan specification.
///
/// see also: vulkan_surface, glfw.getRequiredInstanceExtensions
pub inline fn createWindowSurface(vk_instance: anytype, window: Window, vk_allocation_callbacks: anytype, vk_surface_khr: anytype) error{ APIUnavailable, PlatformError }!i32 {
internal_debug.assertInitialized();
// zig-vulkan uses enums to represent opaque pointers:
// pub const Instance = enum(usize) { null_handle = 0, _ };
const instance: c.VkInstance = switch (@typeInfo(@TypeOf(vk_instance))) {
.Enum => @intToPtr(c.VkInstance, @enumToInt(vk_instance)),
else => @ptrCast(c.VkInstance, vk_instance),
};
const v = c.glfwCreateWindowSurface(
instance,
window.handle,
if (vk_allocation_callbacks == null) null else @ptrCast(*const c.VkAllocationCallbacks, @alignCast(@alignOf(c.VkAllocationCallbacks), vk_allocation_callbacks)),
@ptrCast(*c.VkSurfaceKHR, @alignCast(@alignOf(c.VkSurfaceKHR), vk_surface_khr)),
);
getError() catch |err| return switch (err) {
Error.NotInitialized => unreachable,
Error.InvalidValue => @panic("Attempted to use window with client api to create vulkan surface."),
Error.APIUnavailable,
Error.PlatformError,
=> @errSetCast(error{ APIUnavailable, PlatformError }, err),
else => unreachable,
};
return v;
}
test "vulkanSupported" {
const glfw = @import("main.zig");
try glfw.init(.{});
defer glfw.terminate();
_ = glfw.vulkanSupported();
}
test "getRequiredInstanceExtensions" {
const glfw = @import("main.zig");
try glfw.init(.{});
defer glfw.terminate();
_ = glfw.getRequiredInstanceExtensions() catch |err| std.debug.print("failed to get vulkan instance extensions, error={}\n", .{err});
}
test "getInstanceProcAddress" {
const glfw = @import("main.zig");
try glfw.init(.{});
defer glfw.terminate();
// syntax check only, we don't have a real vulkan instance and so this function would panic.
_ = glfw.getInstanceProcAddress;
}
test "syntax" {
// Best we can do for these two functions in terms of testing in lieu of an actual Vulkan
// context.
_ = getPhysicalDevicePresentationSupport;
_ = createWindowSurface;
} | glfw/src/vulkan.zig |
// Copyright (c) 2020 <NAME>
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
const std = @import("std");
comptime {
std.debug.assert(@sizeOf(std.os.sockaddr) >= @sizeOf(std.os.sockaddr_in));
// std.debug.assert(@sizeOf(std.os.sockaddr) >= @sizeOf(std.os.sockaddr_in6));
}
const is_windows = std.builtin.os.tag == .windows;
const is_darwin = std.builtin.os.tag.isDarwin();
const is_linux = std.builtin.os.tag == .linux;
pub fn init() error{InitializationError}!void {
if (is_windows) {
_ = windows.WSAStartup(2, 2) catch return error.InitializationError;
}
}
pub fn deinit() void {
if (is_windows) {
windows.WSACleanup() catch return;
}
}
/// A network address abstraction. Contains one member for each possible type of address.
pub const Address = union(AddressFamily) {
ipv4: IPv4,
ipv6: IPv6,
pub const IPv4 = struct {
const Self = @This();
pub const any = IPv4.init(0, 0, 0, 0);
pub const broadcast = IPv4.init(255, 255, 255, 255);
pub const loopback = IPv4.init(127, 0, 0, 1);
value: [4]u8,
pub fn init(a: u8, b: u8, c: u8, d: u8) Self {
return Self{
.value = [4]u8{ a, b, c, d },
};
}
pub fn eql(lhs: Self, rhs: Self) bool {
return std.mem.eql(u8, &lhs.value, &rhs.value);
}
pub fn format(value: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
try writer.print("{}.{}.{}.{}", .{
value.value[0],
value.value[1],
value.value[2],
value.value[3],
});
}
};
pub const IPv6 = struct {
const Self = @This();
pub const any = std.mem.zeroes(Self);
pub const loopback = IPv6.init([1]u8{0} ** 15 ++ [1]u8{1}, 0);
value: [16]u8,
scope_id: u32,
pub fn init(value: [16]u8, scope_id: u32) Self {
return Self{ .value = value, .scope_id = scope_id };
}
pub fn eql(lhs: Self, rhs: Self) bool {
return std.mem.eql(u8, &lhs.value, &rhs.value) and
lhs.scope_id == rhs.scope_id;
}
pub fn format(self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
if (std.mem.eql(u8, self.value[0..12], &[_]u8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff })) {
try std.fmt.format(writer, "[::ffff:{}.{}.{}.{}]", .{
self.value[12],
self.value[13],
self.value[14],
self.value[15],
});
return;
}
const big_endian_parts = @ptrCast(*align(1) const [8]u16, &self.value);
const native_endian_parts = switch (std.builtin.endian) {
.Big => big_endian_parts.*,
.Little => blk: {
var buf: [8]u16 = undefined;
for (big_endian_parts) |part, i| {
buf[i] = std.mem.bigToNative(u16, part);
}
break :blk buf;
},
};
try writer.writeAll("[");
var i: usize = 0;
var abbrv = false;
while (i < native_endian_parts.len) : (i += 1) {
if (native_endian_parts[i] == 0) {
if (!abbrv) {
try writer.writeAll(if (i == 0) "::" else ":");
abbrv = true;
}
continue;
}
try std.fmt.format(writer, "{x}", .{native_endian_parts[i]});
if (i != native_endian_parts.len - 1) {
try writer.writeAll(":");
}
}
try writer.writeAll("]");
}
};
pub fn format(value: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
switch (value) {
.ipv4 => |a| try a.format(fmt, options, writer),
.ipv6 => |a| try a.format(fmt, options, writer),
}
}
pub fn eql(lhs: @This(), rhs: @This()) bool {
if (@as(AddressFamily, lhs) != @as(AddressFamily, rhs))
return false;
return switch (lhs) {
.ipv4 => |l| l.eql(rhs.ipv4),
.ipv6 => |l| l.eql(rhs.ipv6),
};
}
};
pub const AddressFamily = enum {
const Self = @This();
ipv4,
ipv6,
fn toNativeAddressFamily(af: Self) u32 {
return switch (af) {
.ipv4 => std.os.AF_INET,
.ipv6 => std.os.AF_INET6,
};
}
fn fromNativeAddressFamily(af: i32) !Self {
return switch (af) {
std.os.AF_INET => .ipv4,
std.os.AF_INET6 => .ipv6,
else => return error.UnsupportedAddressFamily,
};
}
};
/// Protocols supported by this library.
pub const Protocol = enum {
const Self = @This();
tcp,
udp,
fn toSocketType(proto: Self) u32 {
return switch (proto) {
.tcp => std.os.SOCK_STREAM,
.udp => std.os.SOCK_DGRAM,
};
}
};
/// A network end point. Is composed of an address and a port.
pub const EndPoint = struct {
const Self = @This();
address: Address,
port: u16,
pub fn format(value: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
try writer.print("{}:{}", .{
value.address,
value.port,
});
}
pub fn fromSocketAddress(src: *const std.os.sockaddr, size: usize) !Self {
switch (src.family) {
std.os.AF_INET => {
if (size < @sizeOf(std.os.sockaddr_in))
return error.InsufficientBytes;
const value = @ptrCast(*const std.os.sockaddr_in, @alignCast(4, src));
return EndPoint{
.port = std.mem.bigToNative(u16, value.port),
.address = .{
.ipv4 = .{
.value = @bitCast([4]u8, value.addr),
},
},
};
},
std.os.AF_INET6 => {
if (size < @sizeOf(std.os.sockaddr_in6))
return error.InsufficientBytes;
const value = @ptrCast(*const std.os.sockaddr_in6, @alignCast(4, src));
return EndPoint{
.port = std.mem.bigToNative(u16, value.port),
.address = .{
.ipv6 = .{
.value = value.addr,
.scope_id = value.scope_id,
},
},
};
},
else => {
std.debug.warn("got invalid socket address: {}\n", .{src});
return error.UnsupportedAddressFamily;
},
}
}
pub const SockAddr = union(AddressFamily) {
ipv4: std.os.sockaddr_in,
ipv6: std.os.sockaddr_in6,
};
fn toSocketAddress(self: Self) SockAddr {
var result: std.os.sockaddr align(8) = undefined;
return switch (self.address) {
.ipv4 => |addr| SockAddr{
.ipv4 = .{
.family = std.os.AF_INET,
.port = std.mem.nativeToBig(u16, self.port),
.addr = @bitCast(u32, addr.value),
.zero = [_]u8{0} ** 8,
},
},
.ipv6 => |addr| SockAddr{
.ipv6 = .{
.family = std.os.AF_INET6,
.port = std.mem.nativeToBig(u16, self.port),
.flowinfo = 0,
.addr = addr.value,
.scope_id = addr.scope_id,
},
},
};
}
};
/// A network socket, can receive and send data for TCP/UDP and accept
/// incoming connections if bound as a TCP server.
pub const Socket = struct {
pub const Reader = std.io.Reader(Socket, std.os.RecvFromError, receive);
pub const Writer = std.io.Writer(Socket, std.os.SendError, send);
const Self = @This();
const NativeSocket = if (is_windows) windows.ws2_32.SOCKET else std.os.fd_t;
family: AddressFamily,
internal: NativeSocket,
endpoint: ?EndPoint,
/// Spawns a new socket that must be freed with `close()`.
/// `family` defines the socket family, `protocol` the protocol used.
pub fn create(family: AddressFamily, protocol: Protocol) !Self {
const socket_fn = if (is_windows) windows.socket else std.os.socket;
// std provides a shim for Darwin to set SOCK_NONBLOCK.
// Socket creation will only set the flag if we provide the shim rather than the actual flag.
const socket_type = if ((is_darwin or is_linux) and std.io.is_async)
protocol.toSocketType() | std.os.SOCK_NONBLOCK | std.os.SOCK_CLOEXEC
else
protocol.toSocketType();
return Self{
.family = family,
.internal = try socket_fn(family.toNativeAddressFamily(), socket_type, 0),
.endpoint = null,
};
}
/// Closes the socket and releases its resources.
pub fn close(self: Self) void {
const close_fn = if (is_windows) windows.close else std.os.close;
close_fn(self.internal);
}
/// Binds the socket to the given end point.
pub fn bind(self: Self, ep: EndPoint) !void {
const bind_fn = if (is_windows) windows.bind else std.os.bind;
switch (ep.toSocketAddress()) {
.ipv4 => |sockaddr| try bind_fn(self.internal, @ptrCast(*const std.os.sockaddr, &sockaddr), @sizeOf(@TypeOf(sockaddr))),
.ipv6 => |sockaddr| try bind_fn(self.internal, @ptrCast(*const std.os.sockaddr, &sockaddr), @sizeOf(@TypeOf(sockaddr))),
}
}
/// Binds the socket to all supported addresses on the local device.
/// This will use the any IP (`0.0.0.0` for IPv4).
pub fn bindToPort(self: Self, port: u16) !void {
return switch (self.family) {
.ipv4 => self.bind(EndPoint{
.address = Address{ .ipv4 = Address.IPv4.any },
.port = port,
}),
.ipv6 => self.bind(EndPoint{
.address = Address{ .ipv6 = Address.IPv6.any },
.port = port,
}),
};
}
/// Connects the UDP or TCP socket to a remote server.
/// The `target` address type must fit the address type of the socket.
pub fn connect(self: *Self, target: EndPoint) !void {
if (target.address != self.family)
return error.AddressFamilyMismach;
// on darwin you set the NOSIGNAl once, rather than for each message
if (is_darwin) {
// set the options to ON
const value: u32 = 1;
const SO_NOSIGPIPE = 0x00000800;
try std.os.setsockopt(self.internal, std.os.SOL_SOCKET, SO_NOSIGPIPE, std.mem.asBytes(&value));
}
const connect_fn = if (is_windows) windows.connect else std.os.connect;
switch (target.toSocketAddress()) {
.ipv4 => |sockaddr| try connect_fn(self.internal, @ptrCast(*const std.os.sockaddr, &sockaddr), @sizeOf(@TypeOf(sockaddr))),
.ipv6 => |sockaddr| try connect_fn(self.internal, @ptrCast(*const std.os.sockaddr, &sockaddr), @sizeOf(@TypeOf(sockaddr))),
}
self.endpoint = target;
}
/// Makes this socket a TCP server and allows others to connect to
/// this socket.
/// Call `accept()` to handle incoming connections.
pub fn listen(self: Self) !void {
const listen_fn = if (is_windows) windows.listen else std.os.listen;
try listen_fn(self.internal, 0);
}
/// Waits until a new TCP client connects to this socket and accepts the incoming TCP connection.
/// This function is only allowed for a bound TCP socket. `listen()` must have been called before!
pub fn accept(self: Self) !Socket {
const accept4_fn = if (is_windows) windows.accept4 else std.os.accept;
const close_fn = if (is_windows) windows.close else std.os.close;
var addr: std.os.sockaddr_in6 = undefined;
var addr_size: std.os.socklen_t = @sizeOf(std.os.sockaddr_in6);
const flags = if (is_windows or is_darwin)
0
else if (std.io.is_async) std.os.O_NONBLOCK else 0;
var addr_ptr = @ptrCast(*std.os.sockaddr, &addr);
const fd = try accept4_fn(self.internal, addr_ptr, &addr_size, flags);
errdefer close_fn(fd);
return Socket{
.family = try AddressFamily.fromNativeAddressFamily(addr_ptr.family),
.internal = fd,
.endpoint = null,
};
}
/// Send some data to the connected peer. In UDP, this
/// will always send full packets, on TCP it will append
/// to the stream.
pub fn send(self: Self, data: []const u8) !usize {
if (self.endpoint) |ep|
return try self.sendTo(ep, data);
const send_fn = if (is_windows) windows.send else std.os.send;
const flags = if (is_windows or is_darwin) 0 else std.os.MSG_NOSIGNAL;
return try send_fn(self.internal, data, flags);
}
/// Blockingly receives some data from the connected peer.
/// Will read all available data from the TCP stream or
/// a UDP packet.
pub fn receive(self: Self, data: []u8) !usize {
const recvfrom_fn = if (is_windows) windows.recvfrom else std.os.recvfrom;
const flags = if (is_windows or is_darwin) 0 else std.os.MSG_NOSIGNAL;
return try recvfrom_fn(self.internal, data, flags, null, null);
}
const ReceiveFrom = struct { numberOfBytes: usize, sender: EndPoint };
/// Same as ´receive`, but will also return the end point from which the data
/// was received. This is only a valid operation on UDP sockets.
pub fn receiveFrom(self: Self, data: []u8) !ReceiveFrom {
const recvfrom_fn = if (is_windows) windows.recvfrom else std.os.recvfrom;
const flags = if (is_windows or is_darwin) 0 else std.os.MSG_NOSIGNAL;
// Use the ipv6 sockaddr to gurantee data will fit.
var addr: std.os.sockaddr_in6 align(4) = undefined;
var size: std.os.socklen_t = @sizeOf(std.os.sockaddr_in6);
var addr_ptr = @ptrCast(*std.os.sockaddr, &addr);
const len = try recvfrom_fn(self.internal, data, flags, addr_ptr, &size);
return ReceiveFrom{
.numberOfBytes = len,
.sender = try EndPoint.fromSocketAddress(addr_ptr, size),
};
}
/// Sends a packet to a given network end point. Behaves the same as `send()`, but will only work for
/// for UDP sockets.
pub fn sendTo(self: Self, receiver: EndPoint, data: []const u8) !usize {
const sendto_fn = if (is_windows) windows.sendto else std.os.sendto;
const flags = if (is_windows or is_darwin) 0 else std.os.MSG_NOSIGNAL;
return switch (receiver.toSocketAddress()) {
.ipv4 => |sockaddr| try sendto_fn(self.internal, data, flags, @ptrCast(*const std.os.sockaddr, &sockaddr), @sizeOf(@TypeOf(sockaddr))),
.ipv6 => |sockaddr| try sendto_fn(self.internal, data, flags, @ptrCast(*const std.os.sockaddr, &sockaddr), @sizeOf(@TypeOf(sockaddr))),
};
}
/// Sets the socket option `SO_REUSEPORT` which allows
/// multiple bindings of the same socket to the same address
/// on UDP sockets and allows quicker re-binding of TCP sockets.
pub fn enablePortReuse(self: Self, enabled: bool) !void {
const setsockopt_fn = if (is_windows) windows.setsockopt else std.os.setsockopt;
var opt: c_int = if (enabled) 1 else 0;
try setsockopt_fn(self.internal, std.os.SOL_SOCKET, std.os.SO_REUSEADDR, std.mem.asBytes(&opt));
}
/// Retrieves the end point to which the socket is bound.
pub fn getLocalEndPoint(self: Self) !EndPoint {
const getsockname_fn = if (is_windows) windows.getsockname else std.os.getsockname;
var addr: std.os.sockaddr_in6 align(4) = undefined;
var size: std.os.socklen_t = @sizeOf(std.os.sockaddr_in6);
var addr_ptr = @ptrCast(*std.os.sockaddr, &addr);
try getsockname_fn(self.internal, addr_ptr, &size);
return try EndPoint.fromSocketAddress(addr_ptr, size);
}
/// Retrieves the end point to which the socket is connected.
pub fn getRemoteEndPoint(self: Self) !EndPoint {
const getpeername_fn = if (is_windows) windows.getpeername else getpeername;
var addr: std.os.sockaddr_in6 align(4) = undefined;
var size: std.os.socklen_t = @sizeOf(std.os.sockaddr_in6);
var addr_ptr = @ptrCast(*std.os.sockaddr, &addr);
try getpeername_fn(self.internal, addr_ptr, &size);
return try EndPoint.fromSocketAddress(addr_ptr, size);
}
pub const MulticastGroup = struct {
interface: Address.IPv4,
group: Address.IPv4,
};
/// Joins the UDP socket into a multicast group.
/// Multicast enables sending packets to the group and all joined peers
/// will receive the sent data.
pub fn joinMulticastGroup(self: Self, group: MulticastGroup) !void {
const setsockopt_fn = if (is_windows) windows.setsockopt else std.os.setsockopt;
const ip_mreq = extern struct {
imr_multiaddr: u32,
imr_address: u32,
imr_ifindex: u32,
};
const request = ip_mreq{
.imr_multiaddr = @bitCast(u32, group.group.value),
.imr_address = @bitCast(u32, group.interface.value),
.imr_ifindex = 0, // this cannot be crossplatform, so we set it to zero
};
const IP_ADD_MEMBERSHIP = if (is_windows) 5 else 35;
try setsockopt_fn(self.internal, std.os.SOL_SOCKET, IP_ADD_MEMBERSHIP, std.mem.asBytes(&request));
}
/// Gets an reader that allows reading data from the socket.
pub fn reader(self: Self) Reader {
return .{
.context = self,
};
}
/// Gets a writer that allows writing data to the socket.
pub fn writer(self: Self) Writer {
return .{
.context = self,
};
}
};
/// A socket event that can be waited for.
pub const SocketEvent = struct {
/// Wait for data ready to be read.
read: bool,
/// Wait for all pending data to be sent and the socket accepting
/// non-blocking writes.
write: bool,
};
/// A set of sockets that can be used to query socket readiness.
/// This is similar to `select()´ or `poll()` and provides a way to
/// create non-blocking socket I/O.
/// This is intented to be used with `waitForSocketEvents()`.
pub const SocketSet = struct {
const Self = @This();
internal: OSLogic,
/// Initialize a new socket set. This can be reused for
/// multiple queries without having to reset the set every time.
/// Call `deinit()` to free the socket set.
pub fn init(allocator: *std.mem.Allocator) !Self {
return Self{
.internal = try OSLogic.init(allocator),
};
}
/// Frees the contained resources.
pub fn deinit(self: *Self) void {
self.internal.deinit();
}
/// Removes all sockets from the set.
pub fn clear(self: *Self) void {
self.internal.clear();
}
/// Adds a socket to the set and enables waiting for any of the events
/// in `events`.
pub fn add(self: *Self, sock: Socket, events: SocketEvent) !void {
try self.internal.add(sock, events);
}
/// Removes the socket from the set.
pub fn remove(self: *Self, sock: Socket) void {
self.internal.remove(sock);
}
/// Checks if the socket is ready to be read.
/// Only valid after the first call to `waitForSocketEvent()`.
pub fn isReadyRead(self: Self, sock: Socket) bool {
return self.internal.isReadyRead(sock);
}
/// Checks if the socket is ready to be written.
/// Only valid after the first call to `waitForSocketEvent()`.
pub fn isReadyWrite(self: Self, sock: Socket) bool {
return self.internal.isReadyWrite(sock);
}
/// Checks if the socket is faulty and cannot be used anymore.
/// Only valid after the first call to `waitForSocketEvent()`.
pub fn isFaulted(self: Self, sock: Socket) bool {
return self.internal.isFaulted(sock);
}
};
/// Implementation of SocketSet for each platform,
/// keeps the thing above nice and clean, all functions get inlined.
const OSLogic = switch (std.builtin.os.tag) {
.windows => WindowsOSLogic,
.linux => LinuxOSLogic,
.macosx, .ios, .watchos, .tvos => DarwinOsLogic,
else => @compileError("unsupported os " ++ @tagName(std.builtin.os.tag) ++ " for SocketSet!"),
};
// Linux uses `poll()` syscall to wait for socket events.
// This allows an arbitrary number of sockets to be handled.
const LinuxOSLogic = struct {
const Self = @This();
// use poll on linux
fds: std.ArrayList(std.os.pollfd),
inline fn init(allocator: *std.mem.Allocator) !Self {
return Self{
.fds = std.ArrayList(std.os.pollfd).init(allocator),
};
}
inline fn deinit(self: Self) void {
self.fds.deinit();
}
inline fn clear(self: *Self) void {
self.fds.shrink(0);
}
inline fn add(self: *Self, sock: Socket, events: SocketEvent) !void {
// Always poll for errors as this is done anyways
var mask: i16 = std.os.POLLERR;
if (events.read)
mask |= std.os.POLLIN;
if (events.write)
mask |= std.os.POLLOUT;
for (self.fds.items) |*pfd| {
if (pfd.fd == sock.internal) {
pfd.events |= mask;
return;
}
}
try self.fds.append(std.os.pollfd{
.fd = sock.internal,
.events = mask,
.revents = 0,
});
}
inline fn remove(self: *Self, sock: Socket) void {
const index = for (self.fds.items) |item, i| {
if (item.fd == sock.internal)
break i;
} else null;
if (index) |idx| {
_ = self.fds.swapRemove(idx);
}
}
inline fn checkMaskAnyBit(self: Self, sock: Socket, mask: i16) bool {
for (self.fds.items) |item| {
if (item.fd != sock.internal)
continue;
if ((item.revents & mask) != 0) {
return true;
}
return false;
}
return false;
}
inline fn isReadyRead(self: Self, sock: Socket) bool {
return self.checkMaskAnyBit(sock, std.os.POLLIN);
}
inline fn isReadyWrite(self: Self, sock: Socket) bool {
return self.checkMaskAnyBit(sock, std.os.POLLOUT);
}
inline fn isFaulted(self: Self, sock: Socket) bool {
return self.checkMaskAnyBit(sock, std.os.POLLERR);
}
};
/// Alias to LinuxOSLogic as the logic between the two are shared and both support poll()
const DarwinOsLogic = LinuxOSLogic;
// On windows, we use select()
const WindowsOSLogic = struct {
// The windows struct fd_set uses a statically size array of 64 sockets by default.
// However, it is documented that one can create bigger sets and pass them into the functions that use them.
// Instead, we dynamically allocate the sets and reallocate them as needed.
// See https://docs.microsoft.com/en-us/windows/win32/winsock/maximum-number-of-sockets-supported-2
const FdSet = extern struct {
padding1: c_uint = 0, // This is added to guarantee &size is 8 byte aligned
capacity: c_uint,
size: c_uint,
padding2: c_uint = 0, // This is added to gurantee &fds is 8 byte aligned
// fds: SOCKET[size]
fn fdSlice(self: *align(8) FdSet) []windows.ws2_32.SOCKET {
return @ptrCast([*]windows.ws2_32.SOCKET, @ptrCast([*]u8, self) + 4 * @sizeOf(c_uint))[0..self.size];
}
fn make(allocator: *std.mem.Allocator) !*align(8) FdSet {
// Initialize with enough space for 8 sockets.
var mem = try allocator.alignedAlloc(u8, 8, 4 * @sizeOf(c_uint) + 8 * @sizeOf(windows.ws2_32.SOCKET));
var fd_set = @ptrCast(*align(8) FdSet, mem);
fd_set.* = .{ .capacity = 8, .size = 0 };
return fd_set;
}
fn clear(self: *align(8) FdSet) void {
self.size = 0;
}
fn memSlice(self: *align(8) FdSet) []u8 {
return @ptrCast([*]u8, self)[0..(4 * @sizeOf(c_uint) + self.capacity * @sizeOf(windows.ws2_32.SOCKET))];
}
fn deinit(self: *align(8) FdSet, allocator: *std.mem.Allocator) void {
allocator.free(self.memSlice());
}
fn containsFd(self: *align(8) FdSet, fd: windows.ws2_32.SOCKET) bool {
for (self.fdSlice()) |ex_fd| {
if (ex_fd == fd) return true;
}
return false;
}
fn addFd(fd_set: **align(8) FdSet, allocator: *std.mem.Allocator, new_fd: windows.ws2_32.SOCKET) !void {
if (fd_set.*.size == fd_set.*.capacity) {
// Double our capacity.
const new_mem_size = 4 * @sizeOf(c_uint) + 2 * fd_set.*.capacity * @sizeOf(windows.ws2_32.SOCKET);
fd_set.* = @ptrCast(*align(8) FdSet, (try allocator.reallocAdvanced(fd_set.*.memSlice(), 8, new_mem_size, .exact)).ptr);
fd_set.*.capacity *= 2;
}
fd_set.*.size += 1;
fd_set.*.fdSlice()[fd_set.*.size - 1] = new_fd;
}
fn getSelectPointer(self: *align(8) FdSet) ?[*]u8 {
if (self.size == 0) return null;
return @ptrCast([*]u8, self) + 2 * @sizeOf(c_uint);
}
};
const Self = @This();
allocator: *std.mem.Allocator,
read_fds: std.ArrayListUnmanaged(windows.ws2_32.SOCKET),
write_fds: std.ArrayListUnmanaged(windows.ws2_32.SOCKET),
read_fd_set: *align(8) FdSet,
write_fd_set: *align(8) FdSet,
except_fd_set: *align(8) FdSet,
inline fn init(allocator: *std.mem.Allocator) !Self {
// TODO: https://github.com/ziglang/zig/issues/5391
var read_fds = std.ArrayListUnmanaged(windows.ws2_32.SOCKET){};
var write_fds = std.ArrayListUnmanaged(windows.ws2_32.SOCKET){};
try read_fds.ensureCapacity(allocator, 8);
try write_fds.ensureCapacity(allocator, 8);
return Self{
.allocator = allocator,
.read_fds = read_fds,
.write_fds = write_fds,
.read_fd_set = try FdSet.make(allocator),
.write_fd_set = try FdSet.make(allocator),
.except_fd_set = try FdSet.make(allocator),
};
}
inline fn deinit(self: *Self) void {
self.read_fds.deinit(self.allocator);
self.write_fds.deinit(self.allocator);
self.read_fd_set.deinit(self.allocator);
self.write_fd_set.deinit(self.allocator);
self.except_fd_set.deinit(self.allocator);
}
inline fn clear(self: *Self) void {
self.read_fds.shrink(0);
self.write_fds.shrink(0);
self.read_fd_set.clear();
self.write_fd_set.clear();
self.except_fd_set.clear();
}
inline fn add(self: *Self, sock: Socket, events: SocketEvent) !void {
if (events.read) read_block: {
for (self.read_fds.items) |fd| {
if (fd == sock.internal) break :read_block;
}
try self.read_fds.append(self.allocator, sock.internal);
}
if (events.write) {
for (self.write_fds.items) |fd| {
if (fd == sock.internal) return;
}
try self.write_fds.append(self.allocator, sock.internal);
}
}
inline fn remove(self: *Self, sock: Socket) void {
for (self.read_fds.items) |fd, idx| {
if (fd == sock.internal) {
_ = self.read_fds.swapRemove(idx);
break;
}
}
for (self.write_fds.items) |fd, idx| {
if (fd == sock.internal) {
_ = self.write_fds.swapRemove(idx);
break;
}
}
}
const Set = enum {
read,
write,
except,
};
inline fn getFdSet(self: *Self, comptime set_selection: Set) !?[*]u8 {
const set_ptr = switch (set_selection) {
.read => &self.read_fd_set,
.write => &self.write_fd_set,
.except => &self.except_fd_set,
};
set_ptr.*.clear();
if (set_selection == .read or set_selection == .except) {
for (self.read_fds.items) |fd| {
try FdSet.addFd(set_ptr, self.allocator, fd);
}
}
if (set_selection == .write) {
for (self.write_fds.items) |fd| {
try FdSet.addFd(set_ptr, self.allocator, fd);
}
} else if (set_selection == .except) {
for (self.write_fds.items) |fd| {
if (set_ptr.*.containsFd(fd)) continue;
try FdSet.addFd(set_ptr, self.allocator, fd);
}
}
return set_ptr.*.getSelectPointer();
}
inline fn isReadyRead(self: Self, sock: Socket) bool {
if (self.read_fd_set.getSelectPointer()) |ptr| {
return windows.funcs.__WSAFDIsSet(sock.internal, ptr) != 0;
}
return false;
}
inline fn isReadyWrite(self: Self, sock: Socket) bool {
if (self.write_fd_set.getSelectPointer()) |ptr| {
return windows.funcs.__WSAFDIsSet(sock.internal, ptr) != 0;
}
return false;
}
inline fn isFaulted(self: Self, sock: Socket) bool {
if (self.except_fd_set.getSelectPointer()) |ptr| {
return windows.funcs.__WSAFDIsSet(sock.internal, ptr) != 0;
}
return false;
}
};
/// Waits until sockets in SocketSet are ready to read/write or have a fault condition.
/// If `timeout` is not `null`, it describes a timeout in nanoseconds until the function
/// should return.
/// Note that `timeout` granularity may not be available in nanoseconds and larger
/// granularities are used.
/// If the requested timeout interval requires a finer granularity than the implementation supports, the
/// actual timeout interval shall be rounded up to the next supported value.
pub fn waitForSocketEvent(set: *SocketSet, timeout: ?u64) !usize {
switch (std.builtin.os.tag) {
.windows => {
const read_set = try set.internal.getFdSet(.read);
const write_set = try set.internal.getFdSet(.write);
const except_set = try set.internal.getFdSet(.except);
if (read_set == null and write_set == null and except_set == null) return 0;
const tm: windows.timeval = if (timeout) |tout| block: {
const secs = @divFloor(tout, std.time.ns_per_s);
const usecs = @divFloor(tout - secs * std.time.ns_per_s, 1000);
break :block .{ .tv_sec = @intCast(c_long, secs), .tv_usec = @intCast(c_long, usecs) };
} else .{ .tv_sec = 0, .tv_usec = 0 };
// Windows ignores first argument.
return try windows.select(0, read_set, write_set, except_set, if (timeout != null) &tm else null);
},
.linux, .macosx, .ios, .watchos, .tvos => return try std.os.poll(
set.internal.fds.items,
if (timeout) |val| @intCast(i32, (val + std.time.ns_per_s - 1) / std.time.ns_per_s) else -1,
),
else => @compileError("unsupported os " ++ @tagName(std.builtin.os.tag) ++ " for SocketSet!"),
}
}
const GetPeerNameError = error{
/// Insufficient resources were available in the system to perform the operation.
SystemResources,
NotConnected,
} || std.os.UnexpectedError;
fn getpeername(sockfd: std.os.fd_t, addr: *std.os.sockaddr, addrlen: *std.os.socklen_t) GetPeerNameError!void {
switch (std.os.errno(std.os.system.getpeername(sockfd, addr, addrlen))) {
0 => return,
else => |err| return std.os.unexpectedErrno(err),
std.os.EBADF => unreachable, // always a race condition
std.os.EFAULT => unreachable,
std.os.EINVAL => unreachable, // invalid parameters
std.os.ENOTSOCK => unreachable,
std.os.ENOBUFS => return error.SystemResources,
std.os.ENOTCONN => return error.NotConnected,
}
}
pub fn connectToHost(
allocator: *std.mem.Allocator,
name: []const u8,
port: u16,
protocol: Protocol,
) !Socket {
const endpoint_list = try getEndpointList(allocator, name, port);
defer endpoint_list.deinit();
for (endpoint_list.endpoints) |endpt| {
var sock = try Socket.create(@as(AddressFamily, endpt.address), protocol);
sock.connect(endpt) catch {
sock.close();
continue;
};
return sock;
}
return error.CouldNotConnect;
}
pub const EndpointList = struct {
arena: std.heap.ArenaAllocator,
endpoints: []EndPoint,
canon_name: ?[]u8,
pub fn deinit(self: *EndpointList) void {
var arena = self.arena;
arena.deinit();
}
};
// Code adapted from std.net
/// Call `EndpointList.deinit` on the result.
pub fn getEndpointList(allocator: *std.mem.Allocator, name: []const u8, port: u16) !*EndpointList {
const result = blk: {
var arena = std.heap.ArenaAllocator.init(allocator);
errdefer arena.deinit();
const result = try arena.allocator.create(EndpointList);
result.* = EndpointList{
.arena = arena,
.endpoints = undefined,
.canon_name = null,
};
break :blk result;
};
const arena = &result.arena.allocator;
errdefer result.arena.deinit();
if (std.builtin.link_libc or is_windows) {
const getaddrinfo_fn = if (is_windows) windows.getaddrinfo else libc_getaddrinfo;
const freeaddrinfo_fn = if (is_windows) windows.funcs.freeaddrinfo else std.os.system.freeaddrinfo;
const addrinfo = if (is_windows) windows.addrinfo else std.os.addrinfo;
const AI_NUMERICSERV = if (is_windows) 0x00000008 else std.c.AI_NUMERICSERV;
const name_c = try std.cstr.addNullByte(allocator, name);
defer allocator.free(name_c);
const port_c = try std.fmt.allocPrint(allocator, "{}\x00", .{port});
defer allocator.free(port_c);
const hints = addrinfo{
.flags = AI_NUMERICSERV,
.family = std.os.AF_UNSPEC,
.socktype = std.os.SOCK_STREAM,
.protocol = std.os.IPPROTO_TCP,
.canonname = null,
.addr = null,
.addrlen = 0,
.next = null,
};
var res: *addrinfo = undefined;
try getaddrinfo_fn(name_c.ptr, @ptrCast([*:0]const u8, port_c.ptr), &hints, &res);
defer freeaddrinfo_fn(res);
const addr_count = blk: {
var count: usize = 0;
var it: ?*addrinfo = res;
while (it) |info| : (it = info.next) {
if (info.addr != null) {
count += 1;
}
}
break :blk count;
};
result.endpoints = try arena.alloc(EndPoint, addr_count);
var it: ?*addrinfo = res;
var i: usize = 0;
while (it) |info| : (it = info.next) {
const sockaddr = info.addr orelse continue;
const addr: Address = switch (sockaddr.family) {
std.os.AF_INET => block: {
const bytes = @ptrCast(*const [4]u8, sockaddr.data[2..]);
break :block .{ .ipv4 = Address.IPv4.init(bytes[0], bytes[1], bytes[2], bytes[3]) };
},
std.os.AF_INET6 => block: {
const sockaddr_in6 = @ptrCast(*align(1) const std.os.sockaddr_in6, sockaddr);
break :block .{ .ipv6 = Address.IPv6.init(sockaddr_in6.addr, sockaddr_in6.scope_id) };
},
else => unreachable,
};
result.endpoints[i] = .{
.address = addr,
.port = port,
};
if (info.canonname) |n| {
if (result.canon_name == null) {
result.canon_name = try std.mem.dupe(arena, u8, std.mem.spanZ(n));
}
}
i += 1;
}
return result;
}
if (std.builtin.os.tag == .linux) {
// Fall back to std.net
const address_list = try std.net.getAddressList(allocator, name, port);
defer address_list.deinit();
if (address_list.canon_name) |cname| {
result.canon_name = try std.mem.dupe(arena, u8, cname);
}
var count: usize = 0;
for (address_list.addrs) |net_addr| {
count += 1;
}
result.endpoints = try arena.alloc(EndPoint, count);
var idx: usize = 0;
for (address_list.addrs) |net_addr| {
const addr: Address = switch (net_addr.any.family) {
std.os.AF_INET => block: {
const bytes = @ptrCast(*const [4]u8, &net_addr.in.sa.addr);
break :block .{ .ipv4 = Address.IPv4.init(bytes[0], bytes[1], bytes[2], bytes[3]) };
},
std.os.AF_INET6 => .{ .ipv6 = Address.IPv6.init(net_addr.in6.sa.addr, net_addr.in6.sa.scope_id) },
else => unreachable,
};
result.endpoints[idx] = EndPoint{
.address = addr,
.port = port,
};
idx += 1;
}
return result;
}
@compileError("unsupported os " ++ @tagName(std.builtin.os.tag) ++ " for getEndpointList!");
}
const GetAddrInfoError = error{
HostLacksNetworkAddresses,
TemporaryNameServerFailure,
NameServerFailure,
AddressFamilyNotSupported,
OutOfMemory,
UnknownHostName,
ServiceUnavailable,
} || std.os.UnexpectedError;
fn libc_getaddrinfo(
name: [*:0]const u8,
port: [*:0]const u8,
hints: *const std.os.addrinfo,
result: **std.os.addrinfo,
) GetAddrInfoError!void {
const rc = std.os.system.getaddrinfo(name, port, hints, result);
if (rc != @intToEnum(std.os.system.EAI, 0))
return switch (rc) {
.ADDRFAMILY => return error.HostLacksNetworkAddresses,
.AGAIN => return error.TemporaryNameServerFailure,
.BADFLAGS => unreachable, // Invalid hints
.FAIL => return error.NameServerFailure,
.FAMILY => return error.AddressFamilyNotSupported,
.MEMORY => return error.OutOfMemory,
.NODATA => return error.HostLacksNetworkAddresses,
.NONAME => return error.UnknownHostName,
.SERVICE => return error.ServiceUnavailable,
.SOCKTYPE => unreachable, // Invalid socket type requested in hints
.SYSTEM => switch (std.os.errno(-1)) {
else => |e| return std.os.unexpectedErrno(e),
},
else => unreachable,
};
}
const windows = struct {
usingnamespace std.os.windows;
const timeval = extern struct {
tv_sec: c_long,
tv_usec: c_long,
};
const addrinfo = extern struct {
flags: i32,
family: i32,
socktype: i32,
protocol: i32,
addrlen: std.os.socklen_t,
canonname: ?[*:0]u8,
addr: ?*std.os.sockaddr,
next: ?*addrinfo,
};
const funcs = struct {
extern "ws2_32" fn sendto(s: ws2_32.SOCKET, buf: [*c]const u8, len: c_int, flags: c_int, to: [*c]const std.os.sockaddr, tolen: std.os.socklen_t) callconv(.Stdcall) c_int;
extern "ws2_32" fn send(s: ws2_32.SOCKET, buf: [*c]const u8, len: c_int, flags: c_int) callconv(.Stdcall) c_int;
extern "ws2_32" fn recvfrom(s: ws2_32.SOCKET, buf: [*c]u8, len: c_int, flags: c_int, from: [*c]std.os.sockaddr, fromlen: [*c]std.os.socklen_t) callconv(.Stdcall) c_int;
extern "ws2_32" fn listen(s: ws2_32.SOCKET, backlog: c_int) callconv(.Stdcall) c_int;
extern "ws2_32" fn accept(s: ws2_32.SOCKET, addr: [*c]std.os.sockaddr, addrlen: [*c]std.os.socklen_t) callconv(.Stdcall) ws2_32.SOCKET;
extern "ws2_32" fn setsockopt(s: ws2_32.SOCKET, level: c_int, optname: c_int, optval: [*c]const u8, optlen: c_int) callconv(.Stdcall) c_int;
extern "ws2_32" fn getsockname(s: ws2_32.SOCKET, name: [*c]std.os.sockaddr, namelen: [*c]std.os.socklen_t) callconv(.Stdcall) c_int;
extern "ws2_32" fn getpeername(s: ws2_32.SOCKET, name: [*c]std.os.sockaddr, namelen: [*c]std.os.socklen_t) callconv(.Stdcall) c_int;
extern "ws2_32" fn select(nfds: c_int, readfds: ?*c_void, writefds: ?*c_void, exceptfds: ?*c_void, timeout: [*c]const timeval) callconv(.Stdcall) c_int;
extern "ws2_32" fn __WSAFDIsSet(arg0: ws2_32.SOCKET, arg1: [*]u8) c_int;
extern "ws2_32" fn bind(s: ws2_32.SOCKET, addr: [*c]const std.os.sockaddr, namelen: std.os.socklen_t) callconv(.Stdcall) c_int;
extern "ws2_32" fn getaddrinfo(nodename: [*:0]const u8, servicename: [*:0]const u8, hints: *const addrinfo, result: **addrinfo) callconv(.Stdcall) c_int;
extern "ws2_32" fn freeaddrinfo(res: *addrinfo) callconv(.Stdcall) void;
};
fn socket(addr_family: u32, socket_type: u32, protocol: u32) std.os.SocketError!ws2_32.SOCKET {
const sock = try WSASocketW(
@intCast(i32, addr_family),
@intCast(i32, socket_type),
@intCast(i32, protocol),
null,
0,
ws2_32.WSA_FLAG_OVERLAPPED,
);
if (std.io.is_async and std.event.Loop.instance != null) {
const loop = std.event.Loop.instance.?;
_ = try CreateIoCompletionPort(sock, loop.os_data.io_port, undefined, undefined);
}
return sock;
}
// @TODO Make this, listen, accept, bind etc (all but recv and sendto) asynchronous
fn connect(sock: ws2_32.SOCKET, sock_addr: *const std.os.sockaddr, len: std.os.socklen_t) std.os.ConnectError!void {
while (true) if (ws2_32.connect(sock, sock_addr, len) != 0) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEACCES => error.PermissionDenied,
.WSAEADDRINUSE => error.AddressInUse,
.WSAEINPROGRESS => error.WouldBlock,
.WSAEALREADY => unreachable,
.WSAEAFNOSUPPORT => error.AddressFamilyNotSupported,
.WSAECONNREFUSED => error.ConnectionRefused,
.WSAEFAULT => unreachable,
.WSAEINTR => continue,
.WSAEISCONN => unreachable,
.WSAENETUNREACH => error.NetworkUnreachable,
.WSAEHOSTUNREACH => error.NetworkUnreachable,
.WSAENOTSOCK => unreachable,
.WSAETIMEDOUT => error.ConnectionTimedOut,
.WSAEWOULDBLOCK => error.WouldBlock,
else => |err| return unexpectedWSAError(err),
};
} else return;
}
fn close(sock: ws2_32.SOCKET) void {
if (ws2_32.closesocket(sock) != 0) {
switch (ws2_32.WSAGetLastError()) {
.WSAENOTSOCK => unreachable,
.WSAEINPROGRESS => unreachable,
else => return,
}
}
}
fn sendto(
sock: ws2_32.SOCKET,
buf: []const u8,
flags: u32,
dest_addr: ?*const std.os.sockaddr,
addrlen: std.os.socklen_t,
) std.os.SendError!usize {
if (std.io.is_async and std.event.Loop.instance != null) {
const loop = std.event.Loop.instance.?;
const Const_WSABUF = extern struct {
len: ULONG,
buf: [*]const u8,
};
var wsa_buf = Const_WSABUF{
.len = @intCast(ULONG, buf.len),
.buf = buf.ptr,
};
var resume_node = std.event.Loop.ResumeNode.Basic{
.base = .{
.id = .Basic,
.handle = @frame(),
.overlapped = std.event.Loop.ResumeNode.overlapped_init,
},
};
loop.beginOneEvent();
suspend {
_ = ws2_32.WSASendTo(
sock,
@ptrCast([*]ws2_32.WSABUF, &wsa_buf),
1,
null,
@intCast(DWORD, flags),
dest_addr,
addrlen,
@ptrCast(*ws2_32.WSAOVERLAPPED, &resume_node.base.overlapped),
null,
);
}
var bytes_transferred: DWORD = undefined;
if (kernel32.GetOverlappedResult(sock, &resume_node.base.overlapped, &bytes_transferred, FALSE) == 0) {
switch (kernel32.GetLastError()) {
.IO_PENDING => unreachable,
// TODO Handle more errors
else => |err| return unexpectedError(err),
}
}
return bytes_transferred;
}
while (true) {
const result = funcs.sendto(sock, buf.ptr, @intCast(c_int, buf.len), @intCast(c_int, flags), dest_addr, addrlen);
if (result == ws2_32.SOCKET_ERROR) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEACCES => error.AccessDenied,
.WSAECONNRESET => error.ConnectionResetByPeer,
.WSAEDESTADDRREQ => unreachable,
.WSAEFAULT => unreachable,
.WSAEINTR => continue,
.WSAEINVAL => unreachable,
.WSAEMSGSIZE => error.MessageTooBig,
.WSAENOBUFS => error.SystemResources,
.WSAENOTCONN => unreachable,
.WSAENOTSOCK => unreachable,
.WSAEOPNOTSUPP => unreachable,
else => |err| return unexpectedWSAError(err),
};
}
return @intCast(usize, result);
}
}
fn send(
sock: ws2_32.SOCKET,
buf: []const u8,
flags: u32,
) std.os.SendError!usize {
return sendto(sock, buf, flags, null, 0);
}
fn recvfrom(
sock: ws2_32.SOCKET,
buf: []u8,
flags: u32,
src_addr: ?*std.os.sockaddr,
addrlen: ?*std.os.socklen_t,
) std.os.RecvFromError!usize {
if (std.io.is_async and std.event.Loop.instance != null) {
const loop = std.event.Loop.instance.?;
const wsa_buf = ws2_32.WSABUF{
.len = @intCast(ULONG, buf.len),
.buf = buf.ptr,
};
var lpFlags = @intCast(DWORD, flags);
var resume_node = std.event.Loop.ResumeNode.Basic{
.base = .{
.id = .Basic,
.handle = @frame(),
.overlapped = std.event.Loop.ResumeNode.overlapped_init,
},
};
loop.beginOneEvent();
suspend {
_ = ws2_32.WSARecvFrom(
sock,
@ptrCast([*]const ws2_32.WSABUF, &wsa_buf),
1,
null,
&lpFlags,
src_addr,
addrlen,
@ptrCast(*ws2_32.WSAOVERLAPPED, &resume_node.base.overlapped),
null,
);
}
var bytes_transferred: DWORD = undefined;
if (kernel32.GetOverlappedResult(sock, &resume_node.base.overlapped, &bytes_transferred, FALSE) == 0) {
switch (kernel32.GetLastError()) {
.IO_PENDING => unreachable,
// TODO Handle more errors here
.HANDLE_EOF => return @as(usize, bytes_transferred),
else => |err| return unexpectedError(err),
}
}
return @as(usize, bytes_transferred);
}
while (true) {
const result = funcs.recvfrom(sock, buf.ptr, @intCast(c_int, buf.len), @intCast(c_int, flags), src_addr, addrlen);
if (result == ws2_32.SOCKET_ERROR) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEFAULT => unreachable,
.WSAEINVAL => unreachable,
.WSAEISCONN => unreachable,
.WSAENOTSOCK => unreachable,
.WSAESHUTDOWN => unreachable,
.WSAEOPNOTSUPP => unreachable,
.WSAEWOULDBLOCK => error.WouldBlock,
.WSAEINTR => continue,
else => |err| return unexpectedWSAError(err),
};
}
return @intCast(usize, result);
}
}
// TODO: std.os.ListenError is not pub.
const ListenError = error{
AddressInUse,
FileDescriptorNotASocket,
OperationNotSupported,
} || std.os.UnexpectedError;
fn listen(sock: ws2_32.SOCKET, backlog: u32) ListenError!void {
const rc = funcs.listen(sock, @intCast(c_int, backlog));
if (rc != 0) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEADDRINUSE => error.AddressInUse,
.WSAENOTSOCK => error.FileDescriptorNotASocket,
.WSAEOPNOTSUPP => error.OperationNotSupported,
else => |err| return unexpectedWSAError(err),
};
}
}
/// Ignores flags
fn accept4(
sock: ws2_32.SOCKET,
addr: ?*std.os.sockaddr,
addr_size: *std.os.socklen_t,
flags: u32,
) std.os.AcceptError!ws2_32.SOCKET {
while (true) {
const result = funcs.accept(sock, addr, addr_size);
if (result == ws2_32.INVALID_SOCKET) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEINTR => continue,
.WSAEWOULDBLOCK => error.WouldBlock,
.WSAECONNRESET => error.ConnectionAborted,
.WSAEFAULT => unreachable,
.WSAEINVAL => unreachable,
.WSAENOTSOCK => unreachable,
.WSAEMFILE => error.ProcessFdQuotaExceeded,
.WSAENOBUFS => error.SystemResources,
.WSAEOPNOTSUPP => unreachable,
else => |err| return unexpectedWSAError(err),
};
}
if (std.io.is_async and std.event.Loop.instance != null) {
const loop = std.event.Loop.instance.?;
_ = try CreateIoCompletionPort(result, loop.os_data.io_port, undefined, undefined);
}
return result;
}
}
fn setsockopt(sock: ws2_32.SOCKET, level: u32, optname: u32, opt: []const u8) std.os.SetSockOptError!void {
if (funcs.setsockopt(sock, @intCast(c_int, level), @intCast(c_int, optname), opt.ptr, @intCast(c_int, opt.len)) != 0) {
return switch (ws2_32.WSAGetLastError()) {
.WSAENOTSOCK => unreachable,
.WSAEINVAL => unreachable,
.WSAEFAULT => unreachable,
.WSAENOPROTOOPT => error.InvalidProtocolOption,
else => |err| return unexpectedWSAError(err),
};
}
}
fn getsockname(sock: ws2_32.SOCKET, addr: *std.os.sockaddr, addrlen: *std.os.socklen_t) std.os.GetSockNameError!void {
if (funcs.getsockname(sock, addr, addrlen) != 0) {
return unexpectedWSAError(ws2_32.WSAGetLastError());
}
}
fn getpeername(sock: ws2_32.SOCKET, addr: *std.os.sockaddr, addrlen: *std.os.socklen_t) GetPeerNameError!void {
if (funcs.getpeername(sock, addr, addrlen) != 0) {
return switch (ws2_32.WSAGetLastError()) {
.WSAENOTCONN => error.NotConnected,
else => |err| return unexpectedWSAError(err),
};
}
}
pub const SelectError = error{FileDescriptorNotASocket} || std.os.UnexpectedError;
fn select(nfds: usize, read_fds: ?[*]u8, write_fds: ?[*]u8, except_fds: ?[*]u8, timeout: ?*const timeval) SelectError!usize {
while (true) {
// Windows ignores nfds so we just pass zero here.
const result = funcs.select(0, read_fds, write_fds, except_fds, timeout);
if (result == ws2_32.SOCKET_ERROR) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEFAULT => unreachable,
.WSAEINVAL => unreachable,
.WSAEINTR => continue,
.WSAENOTSOCK => error.FileDescriptorNotASocket,
else => |err| return unexpectedWSAError(err),
};
}
return @intCast(usize, result);
}
}
fn bind(sock: ws2_32.SOCKET, addr: *const std.os.sockaddr, namelen: std.os.socklen_t) std.os.BindError!void {
if (funcs.bind(sock, addr, namelen) != 0) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEACCES => error.AccessDenied,
.WSAEADDRINUSE => error.AddressInUse,
.WSAEINVAL => unreachable,
.WSAENOTSOCK => unreachable,
.WSAEADDRNOTAVAIL => error.AddressNotAvailable,
.WSAEFAULT => unreachable,
else => |err| return unexpectedWSAError(err),
};
}
}
fn getaddrinfo(
name: [*:0]const u8,
port: [*:0]const u8,
hints: *const addrinfo,
result: **addrinfo,
) GetAddrInfoError!void {
const rc = funcs.getaddrinfo(name, port, hints, result);
if (rc != 0)
return switch (ws2_32.WSAGetLastError()) {
.WSATRY_AGAIN => error.TemporaryNameServerFailure,
.WSAEINVAL => unreachable,
.WSANO_RECOVERY => error.NameServerFailure,
.WSAEAFNOSUPPORT => error.AddressFamilyNotSupported,
.WSA_NOT_ENOUGH_MEMORY => error.OutOfMemory,
.WSAHOST_NOT_FOUND => error.UnknownHostName,
.WSATYPE_NOT_FOUND => error.ServiceUnavailable,
.WSAESOCKTNOSUPPORT => unreachable,
else => |err| return unexpectedWSAError(err),
};
}
}; | net_demo/io_uring/net_blocking_network.zig |
pub const WCN_E_PEER_NOT_FOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206143));
pub const WCN_E_AUTHENTICATION_FAILED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206142));
pub const WCN_E_CONNECTION_REJECTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206141));
pub const WCN_E_SESSION_TIMEDOUT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206140));
pub const WCN_E_PROTOCOL_ERROR = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147206139));
pub const WCN_VALUE_DT_CATEGORY_COMPUTER = @as(u32, 1);
pub const WCN_VALUE_DT_CATEGORY_INPUT_DEVICE = @as(u32, 2);
pub const WCN_VALUE_DT_CATEGORY_PRINTER = @as(u32, 3);
pub const WCN_VALUE_DT_CATEGORY_CAMERA = @as(u32, 4);
pub const WCN_VALUE_DT_CATEGORY_STORAGE = @as(u32, 5);
pub const WCN_VALUE_DT_CATEGORY_NETWORK_INFRASTRUCTURE = @as(u32, 6);
pub const WCN_VALUE_DT_CATEGORY_DISPLAY = @as(u32, 7);
pub const WCN_VALUE_DT_CATEGORY_MULTIMEDIA_DEVICE = @as(u32, 8);
pub const WCN_VALUE_DT_CATEGORY_GAMING_DEVICE = @as(u32, 9);
pub const WCN_VALUE_DT_CATEGORY_TELEPHONE = @as(u32, 10);
pub const WCN_VALUE_DT_CATEGORY_AUDIO_DEVICE = @as(u32, 11);
pub const WCN_VALUE_DT_CATEGORY_OTHER = @as(u32, 255);
pub const WCN_VALUE_DT_SUBTYPE_WIFI_OUI = @as(u32, 5304836);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__PC = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__SERVER = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__MEDIACENTER = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__ULTRAMOBILEPC = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__NOTEBOOK = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__DESKTOP = @as(u32, 6);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__MID = @as(u32, 7);
pub const WCN_VALUE_DT_SUBTYPE_COMPUTER__NETBOOK = @as(u32, 8);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__KEYBOARD = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__MOUSE = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__JOYSTICK = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__TRACKBALL = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__GAMECONTROLLER = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__REMOTE = @as(u32, 6);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__TOUCHSCREEN = @as(u32, 7);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__BIOMETRICREADER = @as(u32, 8);
pub const WCN_VALUE_DT_SUBTYPE_INPUT_DEVICE__BARCODEREADER = @as(u32, 9);
pub const WCN_VALUE_DT_SUBTYPE_PRINTER__PRINTER = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_PRINTER__SCANNER = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_PRINTER__FAX = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_PRINTER__COPIER = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_PRINTER__ALLINONE = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_CAMERA__STILL_CAMERA = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_CAMERA__VIDEO_CAMERA = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_CAMERA__WEB_CAMERA = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_CAMERA__SECURITY_CAMERA = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_STORAGE__NAS = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__AP = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__ROUTER = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__SWITCH = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__GATEWAY = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_NETWORK_INFRASTRUCUTURE__BRIDGE = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__TELEVISION = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__PICTURE_FRAME = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__PROJECTOR = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_DISPLAY__MONITOR = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__DAR = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__PVR = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__MCX = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__SETTOPBOX = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__MEDIA_SERVER_ADAPT_EXT = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_MULTIMEDIA_DEVICE__PVP = @as(u32, 6);
pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__XBOX = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__XBOX360 = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__PLAYSTATION = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__CONSOLE_ADAPT = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_GAMING_DEVICE__PORTABLE = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__WINDOWS_MOBILE = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__PHONE_SINGLEMODE = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__PHONE_DUALMODE = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__SMARTPHONE_SINGLEMODE = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_TELEPHONE__SMARTPHONE_DUALMODE = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__TUNER_RECEIVER = @as(u32, 1);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__SPEAKERS = @as(u32, 2);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__PMP = @as(u32, 3);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__HEADSET = @as(u32, 4);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__HEADPHONES = @as(u32, 5);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__MICROPHONE = @as(u32, 6);
pub const WCN_VALUE_DT_SUBTYPE_AUDIO_DEVICE__HOMETHEATER = @as(u32, 7);
pub const WCN_API_MAX_BUFFER_SIZE = @as(u32, 2096);
pub const WCN_MICROSOFT_VENDOR_ID = @as(u32, 311);
pub const WCN_NO_SUBTYPE = @as(u32, 4294967294);
pub const WCN_FLAG_DISCOVERY_VE = @as(u32, 1);
pub const WCN_FLAG_AUTHENTICATED_VE = @as(u32, 2);
pub const WCN_FLAG_ENCRYPTED_VE = @as(u32, 4);
pub const SID_WcnProvider = Guid.initString("c100beca-d33a-4a4b-bf23-bbef4663d017");
//--------------------------------------------------------------------------------
// Section: Types (22)
//--------------------------------------------------------------------------------
pub const WCN_ATTRIBUTE_TYPE = enum(i32) {
TYPE_AP_CHANNEL = 0,
TYPE_ASSOCIATION_STATE = 1,
TYPE_AUTHENTICATION_TYPE = 2,
TYPE_AUTHENTICATION_TYPE_FLAGS = 3,
TYPE_AUTHENTICATOR = 4,
TYPE_CONFIG_METHODS = 5,
TYPE_CONFIGURATION_ERROR = 6,
TYPE_CONFIRMATION_URL4 = 7,
TYPE_CONFIRMATION_URL6 = 8,
TYPE_CONNECTION_TYPE = 9,
TYPE_CONNECTION_TYPE_FLAGS = 10,
TYPE_CREDENTIAL = 11,
TYPE_DEVICE_NAME = 12,
TYPE_DEVICE_PASSWORD_ID = 13,
TYPE_E_HASH1 = 14,
TYPE_E_HASH2 = 15,
TYPE_E_SNONCE1 = 16,
TYPE_E_SNONCE2 = 17,
TYPE_ENCRYPTED_SETTINGS = 18,
TYPE_ENCRYPTION_TYPE = 19,
TYPE_ENCRYPTION_TYPE_FLAGS = 20,
TYPE_ENROLLEE_NONCE = 21,
TYPE_FEATURE_ID = 22,
TYPE_IDENTITY = 23,
TYPE_IDENTITY_PROOF = 24,
TYPE_KEY_WRAP_AUTHENTICATOR = 25,
TYPE_KEY_IDENTIFIER = 26,
TYPE_MAC_ADDRESS = 27,
TYPE_MANUFACTURER = 28,
TYPE_MESSAGE_TYPE = 29,
TYPE_MODEL_NAME = 30,
TYPE_MODEL_NUMBER = 31,
TYPE_NETWORK_INDEX = 32,
TYPE_NETWORK_KEY = 33,
TYPE_NETWORK_KEY_INDEX = 34,
TYPE_NEW_DEVICE_NAME = 35,
TYPE_NEW_PASSWORD = 36,
TYPE_OOB_DEVICE_PASSWORD = 37,
TYPE_OS_VERSION = 38,
TYPE_POWER_LEVEL = 39,
TYPE_PSK_CURRENT = 40,
TYPE_PSK_MAX = 41,
TYPE_PUBLIC_KEY = 42,
TYPE_RADIO_ENABLED = 43,
TYPE_REBOOT = 44,
TYPE_REGISTRAR_CURRENT = 45,
TYPE_REGISTRAR_ESTABLISHED = 46,
TYPE_REGISTRAR_LIST = 47,
TYPE_REGISTRAR_MAX = 48,
TYPE_REGISTRAR_NONCE = 49,
TYPE_REQUEST_TYPE = 50,
TYPE_RESPONSE_TYPE = 51,
TYPE_RF_BANDS = 52,
TYPE_R_HASH1 = 53,
TYPE_R_HASH2 = 54,
TYPE_R_SNONCE1 = 55,
TYPE_R_SNONCE2 = 56,
TYPE_SELECTED_REGISTRAR = 57,
TYPE_SERIAL_NUMBER = 58,
TYPE_WI_FI_PROTECTED_SETUP_STATE = 59,
TYPE_SSID = 60,
TYPE_TOTAL_NETWORKS = 61,
TYPE_UUID_E = 62,
TYPE_UUID_R = 63,
TYPE_VENDOR_EXTENSION = 64,
TYPE_VERSION = 65,
TYPE_X_509_CERTIFICATE_REQUEST = 66,
TYPE_X_509_CERTIFICATE = 67,
TYPE_EAP_IDENTITY = 68,
TYPE_MESSAGE_COUNTER = 69,
TYPE_PUBLIC_KEY_HASH = 70,
TYPE_REKEY_KEY = 71,
TYPE_KEY_LIFETIME = 72,
TYPE_PERMITTED_CONFIG_METHODS = 73,
TYPE_SELECTED_REGISTRAR_CONFIG_METHODS = 74,
TYPE_PRIMARY_DEVICE_TYPE = 75,
TYPE_SECONDARY_DEVICE_TYPE_LIST = 76,
TYPE_PORTABLE_DEVICE = 77,
TYPE_AP_SETUP_LOCKED = 78,
TYPE_APPLICATION_EXTENSION = 79,
TYPE_EAP_TYPE = 80,
TYPE_INITIALIZATION_VECTOR = 81,
TYPE_KEY_PROVIDED_AUTOMATICALLY = 82,
TYPE_802_1X_ENABLED = 83,
TYPE_APPSESSIONKEY = 84,
TYPE_WEPTRANSMITKEY = 85,
TYPE_UUID = 86,
TYPE_PRIMARY_DEVICE_TYPE_CATEGORY = 87,
TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI = 88,
TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY = 89,
TYPE_CURRENT_SSID = 90,
TYPE_BSSID = 91,
TYPE_DOT11_MAC_ADDRESS = 92,
TYPE_AUTHORIZED_MACS = 93,
TYPE_NETWORK_KEY_SHAREABLE = 94,
TYPE_REQUEST_TO_ENROLL = 95,
TYPE_REQUESTED_DEVICE_TYPE = 96,
TYPE_SETTINGS_DELAY_TIME = 97,
TYPE_VERSION2 = 98,
TYPE_VENDOR_EXTENSION_WFA = 99,
NUM_ATTRIBUTE_TYPES = 100,
};
pub const WCN_TYPE_AP_CHANNEL = WCN_ATTRIBUTE_TYPE.TYPE_AP_CHANNEL;
pub const WCN_TYPE_ASSOCIATION_STATE = WCN_ATTRIBUTE_TYPE.TYPE_ASSOCIATION_STATE;
pub const WCN_TYPE_AUTHENTICATION_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_AUTHENTICATION_TYPE;
pub const WCN_TYPE_AUTHENTICATION_TYPE_FLAGS = WCN_ATTRIBUTE_TYPE.TYPE_AUTHENTICATION_TYPE_FLAGS;
pub const WCN_TYPE_AUTHENTICATOR = WCN_ATTRIBUTE_TYPE.TYPE_AUTHENTICATOR;
pub const WCN_TYPE_CONFIG_METHODS = WCN_ATTRIBUTE_TYPE.TYPE_CONFIG_METHODS;
pub const WCN_TYPE_CONFIGURATION_ERROR = WCN_ATTRIBUTE_TYPE.TYPE_CONFIGURATION_ERROR;
pub const WCN_TYPE_CONFIRMATION_URL4 = WCN_ATTRIBUTE_TYPE.TYPE_CONFIRMATION_URL4;
pub const WCN_TYPE_CONFIRMATION_URL6 = WCN_ATTRIBUTE_TYPE.TYPE_CONFIRMATION_URL6;
pub const WCN_TYPE_CONNECTION_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_CONNECTION_TYPE;
pub const WCN_TYPE_CONNECTION_TYPE_FLAGS = WCN_ATTRIBUTE_TYPE.TYPE_CONNECTION_TYPE_FLAGS;
pub const WCN_TYPE_CREDENTIAL = WCN_ATTRIBUTE_TYPE.TYPE_CREDENTIAL;
pub const WCN_TYPE_DEVICE_NAME = WCN_ATTRIBUTE_TYPE.TYPE_DEVICE_NAME;
pub const WCN_TYPE_DEVICE_PASSWORD_ID = WCN_ATTRIBUTE_TYPE.TYPE_DEVICE_PASSWORD_ID;
pub const WCN_TYPE_E_HASH1 = WCN_ATTRIBUTE_TYPE.TYPE_E_HASH1;
pub const WCN_TYPE_E_HASH2 = WCN_ATTRIBUTE_TYPE.TYPE_E_HASH2;
pub const WCN_TYPE_E_SNONCE1 = WCN_ATTRIBUTE_TYPE.TYPE_E_SNONCE1;
pub const WCN_TYPE_E_SNONCE2 = WCN_ATTRIBUTE_TYPE.TYPE_E_SNONCE2;
pub const WCN_TYPE_ENCRYPTED_SETTINGS = WCN_ATTRIBUTE_TYPE.TYPE_ENCRYPTED_SETTINGS;
pub const WCN_TYPE_ENCRYPTION_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_ENCRYPTION_TYPE;
pub const WCN_TYPE_ENCRYPTION_TYPE_FLAGS = WCN_ATTRIBUTE_TYPE.TYPE_ENCRYPTION_TYPE_FLAGS;
pub const WCN_TYPE_ENROLLEE_NONCE = WCN_ATTRIBUTE_TYPE.TYPE_ENROLLEE_NONCE;
pub const WCN_TYPE_FEATURE_ID = WCN_ATTRIBUTE_TYPE.TYPE_FEATURE_ID;
pub const WCN_TYPE_IDENTITY = WCN_ATTRIBUTE_TYPE.TYPE_IDENTITY;
pub const WCN_TYPE_IDENTITY_PROOF = WCN_ATTRIBUTE_TYPE.TYPE_IDENTITY_PROOF;
pub const WCN_TYPE_KEY_WRAP_AUTHENTICATOR = WCN_ATTRIBUTE_TYPE.TYPE_KEY_WRAP_AUTHENTICATOR;
pub const WCN_TYPE_KEY_IDENTIFIER = WCN_ATTRIBUTE_TYPE.TYPE_KEY_IDENTIFIER;
pub const WCN_TYPE_MAC_ADDRESS = WCN_ATTRIBUTE_TYPE.TYPE_MAC_ADDRESS;
pub const WCN_TYPE_MANUFACTURER = WCN_ATTRIBUTE_TYPE.TYPE_MANUFACTURER;
pub const WCN_TYPE_MESSAGE_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_MESSAGE_TYPE;
pub const WCN_TYPE_MODEL_NAME = WCN_ATTRIBUTE_TYPE.TYPE_MODEL_NAME;
pub const WCN_TYPE_MODEL_NUMBER = WCN_ATTRIBUTE_TYPE.TYPE_MODEL_NUMBER;
pub const WCN_TYPE_NETWORK_INDEX = WCN_ATTRIBUTE_TYPE.TYPE_NETWORK_INDEX;
pub const WCN_TYPE_NETWORK_KEY = WCN_ATTRIBUTE_TYPE.TYPE_NETWORK_KEY;
pub const WCN_TYPE_NETWORK_KEY_INDEX = WCN_ATTRIBUTE_TYPE.TYPE_NETWORK_KEY_INDEX;
pub const WCN_TYPE_NEW_DEVICE_NAME = WCN_ATTRIBUTE_TYPE.TYPE_NEW_DEVICE_NAME;
pub const WCN_TYPE_NEW_PASSWORD = WCN_ATTRIBUTE_TYPE.TYPE_NEW_PASSWORD;
pub const WCN_TYPE_OOB_DEVICE_PASSWORD = WCN_ATTRIBUTE_TYPE.TYPE_OOB_DEVICE_PASSWORD;
pub const WCN_TYPE_OS_VERSION = WCN_ATTRIBUTE_TYPE.TYPE_OS_VERSION;
pub const WCN_TYPE_POWER_LEVEL = WCN_ATTRIBUTE_TYPE.TYPE_POWER_LEVEL;
pub const WCN_TYPE_PSK_CURRENT = WCN_ATTRIBUTE_TYPE.TYPE_PSK_CURRENT;
pub const WCN_TYPE_PSK_MAX = WCN_ATTRIBUTE_TYPE.TYPE_PSK_MAX;
pub const WCN_TYPE_PUBLIC_KEY = WCN_ATTRIBUTE_TYPE.TYPE_PUBLIC_KEY;
pub const WCN_TYPE_RADIO_ENABLED = WCN_ATTRIBUTE_TYPE.TYPE_RADIO_ENABLED;
pub const WCN_TYPE_REBOOT = WCN_ATTRIBUTE_TYPE.TYPE_REBOOT;
pub const WCN_TYPE_REGISTRAR_CURRENT = WCN_ATTRIBUTE_TYPE.TYPE_REGISTRAR_CURRENT;
pub const WCN_TYPE_REGISTRAR_ESTABLISHED = WCN_ATTRIBUTE_TYPE.TYPE_REGISTRAR_ESTABLISHED;
pub const WCN_TYPE_REGISTRAR_LIST = WCN_ATTRIBUTE_TYPE.TYPE_REGISTRAR_LIST;
pub const WCN_TYPE_REGISTRAR_MAX = WCN_ATTRIBUTE_TYPE.TYPE_REGISTRAR_MAX;
pub const WCN_TYPE_REGISTRAR_NONCE = WCN_ATTRIBUTE_TYPE.TYPE_REGISTRAR_NONCE;
pub const WCN_TYPE_REQUEST_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_REQUEST_TYPE;
pub const WCN_TYPE_RESPONSE_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_RESPONSE_TYPE;
pub const WCN_TYPE_RF_BANDS = WCN_ATTRIBUTE_TYPE.TYPE_RF_BANDS;
pub const WCN_TYPE_R_HASH1 = WCN_ATTRIBUTE_TYPE.TYPE_R_HASH1;
pub const WCN_TYPE_R_HASH2 = WCN_ATTRIBUTE_TYPE.TYPE_R_HASH2;
pub const WCN_TYPE_R_SNONCE1 = WCN_ATTRIBUTE_TYPE.TYPE_R_SNONCE1;
pub const WCN_TYPE_R_SNONCE2 = WCN_ATTRIBUTE_TYPE.TYPE_R_SNONCE2;
pub const WCN_TYPE_SELECTED_REGISTRAR = WCN_ATTRIBUTE_TYPE.TYPE_SELECTED_REGISTRAR;
pub const WCN_TYPE_SERIAL_NUMBER = WCN_ATTRIBUTE_TYPE.TYPE_SERIAL_NUMBER;
pub const WCN_TYPE_WI_FI_PROTECTED_SETUP_STATE = WCN_ATTRIBUTE_TYPE.TYPE_WI_FI_PROTECTED_SETUP_STATE;
pub const WCN_TYPE_SSID = WCN_ATTRIBUTE_TYPE.TYPE_SSID;
pub const WCN_TYPE_TOTAL_NETWORKS = WCN_ATTRIBUTE_TYPE.TYPE_TOTAL_NETWORKS;
pub const WCN_TYPE_UUID_E = WCN_ATTRIBUTE_TYPE.TYPE_UUID_E;
pub const WCN_TYPE_UUID_R = WCN_ATTRIBUTE_TYPE.TYPE_UUID_R;
pub const WCN_TYPE_VENDOR_EXTENSION = WCN_ATTRIBUTE_TYPE.TYPE_VENDOR_EXTENSION;
pub const WCN_TYPE_VERSION = WCN_ATTRIBUTE_TYPE.TYPE_VERSION;
pub const WCN_TYPE_X_509_CERTIFICATE_REQUEST = WCN_ATTRIBUTE_TYPE.TYPE_X_509_CERTIFICATE_REQUEST;
pub const WCN_TYPE_X_509_CERTIFICATE = WCN_ATTRIBUTE_TYPE.TYPE_X_509_CERTIFICATE;
pub const WCN_TYPE_EAP_IDENTITY = WCN_ATTRIBUTE_TYPE.TYPE_EAP_IDENTITY;
pub const WCN_TYPE_MESSAGE_COUNTER = WCN_ATTRIBUTE_TYPE.TYPE_MESSAGE_COUNTER;
pub const WCN_TYPE_PUBLIC_KEY_HASH = WCN_ATTRIBUTE_TYPE.TYPE_PUBLIC_KEY_HASH;
pub const WCN_TYPE_REKEY_KEY = WCN_ATTRIBUTE_TYPE.TYPE_REKEY_KEY;
pub const WCN_TYPE_KEY_LIFETIME = WCN_ATTRIBUTE_TYPE.TYPE_KEY_LIFETIME;
pub const WCN_TYPE_PERMITTED_CONFIG_METHODS = WCN_ATTRIBUTE_TYPE.TYPE_PERMITTED_CONFIG_METHODS;
pub const WCN_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS = WCN_ATTRIBUTE_TYPE.TYPE_SELECTED_REGISTRAR_CONFIG_METHODS;
pub const WCN_TYPE_PRIMARY_DEVICE_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_PRIMARY_DEVICE_TYPE;
pub const WCN_TYPE_SECONDARY_DEVICE_TYPE_LIST = WCN_ATTRIBUTE_TYPE.TYPE_SECONDARY_DEVICE_TYPE_LIST;
pub const WCN_TYPE_PORTABLE_DEVICE = WCN_ATTRIBUTE_TYPE.TYPE_PORTABLE_DEVICE;
pub const WCN_TYPE_AP_SETUP_LOCKED = WCN_ATTRIBUTE_TYPE.TYPE_AP_SETUP_LOCKED;
pub const WCN_TYPE_APPLICATION_EXTENSION = WCN_ATTRIBUTE_TYPE.TYPE_APPLICATION_EXTENSION;
pub const WCN_TYPE_EAP_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_EAP_TYPE;
pub const WCN_TYPE_INITIALIZATION_VECTOR = WCN_ATTRIBUTE_TYPE.TYPE_INITIALIZATION_VECTOR;
pub const WCN_TYPE_KEY_PROVIDED_AUTOMATICALLY = WCN_ATTRIBUTE_TYPE.TYPE_KEY_PROVIDED_AUTOMATICALLY;
pub const WCN_TYPE_802_1X_ENABLED = WCN_ATTRIBUTE_TYPE.TYPE_802_1X_ENABLED;
pub const WCN_TYPE_APPSESSIONKEY = WCN_ATTRIBUTE_TYPE.TYPE_APPSESSIONKEY;
pub const WCN_TYPE_WEPTRANSMITKEY = WCN_ATTRIBUTE_TYPE.TYPE_WEPTRANSMITKEY;
pub const WCN_TYPE_UUID = WCN_ATTRIBUTE_TYPE.TYPE_UUID;
pub const WCN_TYPE_PRIMARY_DEVICE_TYPE_CATEGORY = WCN_ATTRIBUTE_TYPE.TYPE_PRIMARY_DEVICE_TYPE_CATEGORY;
pub const WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI = WCN_ATTRIBUTE_TYPE.TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY_OUI;
pub const WCN_TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY = WCN_ATTRIBUTE_TYPE.TYPE_PRIMARY_DEVICE_TYPE_SUBCATEGORY;
pub const WCN_TYPE_CURRENT_SSID = WCN_ATTRIBUTE_TYPE.TYPE_CURRENT_SSID;
pub const WCN_TYPE_BSSID = WCN_ATTRIBUTE_TYPE.TYPE_BSSID;
pub const WCN_TYPE_DOT11_MAC_ADDRESS = WCN_ATTRIBUTE_TYPE.TYPE_DOT11_MAC_ADDRESS;
pub const WCN_TYPE_AUTHORIZED_MACS = WCN_ATTRIBUTE_TYPE.TYPE_AUTHORIZED_MACS;
pub const WCN_TYPE_NETWORK_KEY_SHAREABLE = WCN_ATTRIBUTE_TYPE.TYPE_NETWORK_KEY_SHAREABLE;
pub const WCN_TYPE_REQUEST_TO_ENROLL = WCN_ATTRIBUTE_TYPE.TYPE_REQUEST_TO_ENROLL;
pub const WCN_TYPE_REQUESTED_DEVICE_TYPE = WCN_ATTRIBUTE_TYPE.TYPE_REQUESTED_DEVICE_TYPE;
pub const WCN_TYPE_SETTINGS_DELAY_TIME = WCN_ATTRIBUTE_TYPE.TYPE_SETTINGS_DELAY_TIME;
pub const WCN_TYPE_VERSION2 = WCN_ATTRIBUTE_TYPE.TYPE_VERSION2;
pub const WCN_TYPE_VENDOR_EXTENSION_WFA = WCN_ATTRIBUTE_TYPE.TYPE_VENDOR_EXTENSION_WFA;
pub const WCN_NUM_ATTRIBUTE_TYPES = WCN_ATTRIBUTE_TYPE.NUM_ATTRIBUTE_TYPES;
pub const WCN_VALUE_TYPE_VERSION = enum(i32) {
@"1_0" = 16,
@"2_0" = 32,
};
pub const WCN_VALUE_VERSION_1_0 = WCN_VALUE_TYPE_VERSION.@"1_0";
pub const WCN_VALUE_VERSION_2_0 = WCN_VALUE_TYPE_VERSION.@"2_0";
pub const WCN_VALUE_TYPE_BOOLEAN = enum(i32) {
FALSE = 0,
TRUE = 1,
};
pub const WCN_VALUE_FALSE = WCN_VALUE_TYPE_BOOLEAN.FALSE;
pub const WCN_VALUE_TRUE = WCN_VALUE_TYPE_BOOLEAN.TRUE;
pub const WCN_VALUE_TYPE_ASSOCIATION_STATE = enum(i32) {
NOT_ASSOCIATED = 0,
CONNECTION_SUCCESS = 1,
CONFIGURATION_FAILURE = 2,
ASSOCIATION_FAILURE = 3,
IP_FAILURE = 4,
};
pub const WCN_VALUE_AS_NOT_ASSOCIATED = WCN_VALUE_TYPE_ASSOCIATION_STATE.NOT_ASSOCIATED;
pub const WCN_VALUE_AS_CONNECTION_SUCCESS = WCN_VALUE_TYPE_ASSOCIATION_STATE.CONNECTION_SUCCESS;
pub const WCN_VALUE_AS_CONFIGURATION_FAILURE = WCN_VALUE_TYPE_ASSOCIATION_STATE.CONFIGURATION_FAILURE;
pub const WCN_VALUE_AS_ASSOCIATION_FAILURE = WCN_VALUE_TYPE_ASSOCIATION_STATE.ASSOCIATION_FAILURE;
pub const WCN_VALUE_AS_IP_FAILURE = WCN_VALUE_TYPE_ASSOCIATION_STATE.IP_FAILURE;
pub const WCN_VALUE_TYPE_AUTHENTICATION_TYPE = enum(i32) {
OPEN = 1,
WPAPSK = 2,
SHARED = 4,
WPA = 8,
WPA2 = 16,
WPA2PSK = 32,
WPAWPA2PSK_MIXED = 34,
};
pub const WCN_VALUE_AT_OPEN = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.OPEN;
pub const WCN_VALUE_AT_WPAPSK = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.WPAPSK;
pub const WCN_VALUE_AT_SHARED = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.SHARED;
pub const WCN_VALUE_AT_WPA = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.WPA;
pub const WCN_VALUE_AT_WPA2 = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.WPA2;
pub const WCN_VALUE_AT_WPA2PSK = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.WPA2PSK;
pub const WCN_VALUE_AT_WPAWPA2PSK_MIXED = WCN_VALUE_TYPE_AUTHENTICATION_TYPE.WPAWPA2PSK_MIXED;
pub const WCN_VALUE_TYPE_CONFIG_METHODS = enum(i32) {
USBA = 1,
ETHERNET = 2,
LABEL = 4,
DISPLAY = 8,
EXTERNAL_NFC = 16,
INTEGRATED_NFC = 32,
NFC_INTERFACE = 64,
PUSHBUTTON = 128,
KEYPAD = 256,
VIRT_PUSHBUTTON = 640,
PHYS_PUSHBUTTON = 1152,
VIRT_DISPLAY = 8200,
PHYS_DISPLAY = 16392,
};
pub const WCN_VALUE_CM_USBA = WCN_VALUE_TYPE_CONFIG_METHODS.USBA;
pub const WCN_VALUE_CM_ETHERNET = WCN_VALUE_TYPE_CONFIG_METHODS.ETHERNET;
pub const WCN_VALUE_CM_LABEL = WCN_VALUE_TYPE_CONFIG_METHODS.LABEL;
pub const WCN_VALUE_CM_DISPLAY = WCN_VALUE_TYPE_CONFIG_METHODS.DISPLAY;
pub const WCN_VALUE_CM_EXTERNAL_NFC = WCN_VALUE_TYPE_CONFIG_METHODS.EXTERNAL_NFC;
pub const WCN_VALUE_CM_INTEGRATED_NFC = WCN_VALUE_TYPE_CONFIG_METHODS.INTEGRATED_NFC;
pub const WCN_VALUE_CM_NFC_INTERFACE = WCN_VALUE_TYPE_CONFIG_METHODS.NFC_INTERFACE;
pub const WCN_VALUE_CM_PUSHBUTTON = WCN_VALUE_TYPE_CONFIG_METHODS.PUSHBUTTON;
pub const WCN_VALUE_CM_KEYPAD = WCN_VALUE_TYPE_CONFIG_METHODS.KEYPAD;
pub const WCN_VALUE_CM_VIRT_PUSHBUTTON = WCN_VALUE_TYPE_CONFIG_METHODS.VIRT_PUSHBUTTON;
pub const WCN_VALUE_CM_PHYS_PUSHBUTTON = WCN_VALUE_TYPE_CONFIG_METHODS.PHYS_PUSHBUTTON;
pub const WCN_VALUE_CM_VIRT_DISPLAY = WCN_VALUE_TYPE_CONFIG_METHODS.VIRT_DISPLAY;
pub const WCN_VALUE_CM_PHYS_DISPLAY = WCN_VALUE_TYPE_CONFIG_METHODS.PHYS_DISPLAY;
pub const WCN_VALUE_TYPE_CONFIGURATION_ERROR = enum(i32) {
NO_ERROR = 0,
OOB_INTERFACE_READ_ERROR = 1,
DECRYPTION_CRC_FAILURE = 2,
@"2_4_CHANNEL_NOT_SUPPORTED" = 3,
@"5_0_CHANNEL_NOT_SUPPORTED" = 4,
SIGNAL_TOO_WEAK = 5,
NETWORK_AUTHENTICATION_FAILURE = 6,
NETWORK_ASSOCIATION_FAILURE = 7,
NO_DHCP_RESPONSE = 8,
FAILED_DHCP_CONFIG = 9,
IP_ADDRESS_CONFLICT = 10,
COULD_NOT_CONNECT_TO_REGISTRAR = 11,
MULTIPLE_PBC_SESSIONS_DETECTED = 12,
ROGUE_ACTIVITY_SUSPECTED = 13,
DEVICE_BUSY = 14,
SETUP_LOCKED = 15,
MESSAGE_TIMEOUT = 16,
REGISTRATION_SESSION_TIMEOUT = 17,
DEVICE_PASSWORD_AUTH_FAILURE = 18,
};
pub const WCN_VALUE_CE_NO_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR.NO_ERROR;
pub const WCN_VALUE_CE_OOB_INTERFACE_READ_ERROR = WCN_VALUE_TYPE_CONFIGURATION_ERROR.OOB_INTERFACE_READ_ERROR;
pub const WCN_VALUE_CE_DECRYPTION_CRC_FAILURE = WCN_VALUE_TYPE_CONFIGURATION_ERROR.DECRYPTION_CRC_FAILURE;
pub const WCN_VALUE_CE_2_4_CHANNEL_NOT_SUPPORTED = WCN_VALUE_TYPE_CONFIGURATION_ERROR.@"2_4_CHANNEL_NOT_SUPPORTED";
pub const WCN_VALUE_CE_5_0_CHANNEL_NOT_SUPPORTED = WCN_VALUE_TYPE_CONFIGURATION_ERROR.@"5_0_CHANNEL_NOT_SUPPORTED";
pub const WCN_VALUE_CE_SIGNAL_TOO_WEAK = WCN_VALUE_TYPE_CONFIGURATION_ERROR.SIGNAL_TOO_WEAK;
pub const WCN_VALUE_CE_NETWORK_AUTHENTICATION_FAILURE = WCN_VALUE_TYPE_CONFIGURATION_ERROR.NETWORK_AUTHENTICATION_FAILURE;
pub const WCN_VALUE_CE_NETWORK_ASSOCIATION_FAILURE = WCN_VALUE_TYPE_CONFIGURATION_ERROR.NETWORK_ASSOCIATION_FAILURE;
pub const WCN_VALUE_CE_NO_DHCP_RESPONSE = WCN_VALUE_TYPE_CONFIGURATION_ERROR.NO_DHCP_RESPONSE;
pub const WCN_VALUE_CE_FAILED_DHCP_CONFIG = WCN_VALUE_TYPE_CONFIGURATION_ERROR.FAILED_DHCP_CONFIG;
pub const WCN_VALUE_CE_IP_ADDRESS_CONFLICT = WCN_VALUE_TYPE_CONFIGURATION_ERROR.IP_ADDRESS_CONFLICT;
pub const WCN_VALUE_CE_COULD_NOT_CONNECT_TO_REGISTRAR = WCN_VALUE_TYPE_CONFIGURATION_ERROR.COULD_NOT_CONNECT_TO_REGISTRAR;
pub const WCN_VALUE_CE_MULTIPLE_PBC_SESSIONS_DETECTED = WCN_VALUE_TYPE_CONFIGURATION_ERROR.MULTIPLE_PBC_SESSIONS_DETECTED;
pub const WCN_VALUE_CE_ROGUE_ACTIVITY_SUSPECTED = WCN_VALUE_TYPE_CONFIGURATION_ERROR.ROGUE_ACTIVITY_SUSPECTED;
pub const WCN_VALUE_CE_DEVICE_BUSY = WCN_VALUE_TYPE_CONFIGURATION_ERROR.DEVICE_BUSY;
pub const WCN_VALUE_CE_SETUP_LOCKED = WCN_VALUE_TYPE_CONFIGURATION_ERROR.SETUP_LOCKED;
pub const WCN_VALUE_CE_MESSAGE_TIMEOUT = WCN_VALUE_TYPE_CONFIGURATION_ERROR.MESSAGE_TIMEOUT;
pub const WCN_VALUE_CE_REGISTRATION_SESSION_TIMEOUT = WCN_VALUE_TYPE_CONFIGURATION_ERROR.REGISTRATION_SESSION_TIMEOUT;
pub const WCN_VALUE_CE_DEVICE_PASSWORD_AUTH_FAILURE = WCN_VALUE_TYPE_CONFIGURATION_ERROR.DEVICE_PASSWORD_AUTH_FAILURE;
pub const WCN_VALUE_TYPE_CONNECTION_TYPE = enum(i32) {
ESS = 1,
IBSS = 2,
};
pub const WCN_VALUE_CT_ESS = WCN_VALUE_TYPE_CONNECTION_TYPE.ESS;
pub const WCN_VALUE_CT_IBSS = WCN_VALUE_TYPE_CONNECTION_TYPE.IBSS;
pub const WCN_VALUE_TYPE_DEVICE_PASSWORD_ID = enum(i32) {
DEFAULT = 0,
USER_SPECIFIED = 1,
MACHINE_SPECIFIED = 2,
REKEY = 3,
PUSHBUTTON = 4,
REGISTRAR_SPECIFIED = 5,
NFC_CONNECTION_HANDOVER = 7,
WFD_SERVICES = 8,
OUTOFBAND_MIN = 16,
OUTOFBAND_MAX = 65535,
};
pub const WCN_VALUE_DP_DEFAULT = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.DEFAULT;
pub const WCN_VALUE_DP_USER_SPECIFIED = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.USER_SPECIFIED;
pub const WCN_VALUE_DP_MACHINE_SPECIFIED = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.MACHINE_SPECIFIED;
pub const WCN_VALUE_DP_REKEY = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.REKEY;
pub const WCN_VALUE_DP_PUSHBUTTON = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.PUSHBUTTON;
pub const WCN_VALUE_DP_REGISTRAR_SPECIFIED = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.REGISTRAR_SPECIFIED;
pub const WCN_VALUE_DP_NFC_CONNECTION_HANDOVER = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.NFC_CONNECTION_HANDOVER;
pub const WCN_VALUE_DP_WFD_SERVICES = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.WFD_SERVICES;
pub const WCN_VALUE_DP_OUTOFBAND_MIN = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.OUTOFBAND_MIN;
pub const WCN_VALUE_DP_OUTOFBAND_MAX = WCN_VALUE_TYPE_DEVICE_PASSWORD_ID.OUTOFBAND_MAX;
pub const WCN_VALUE_TYPE_ENCRYPTION_TYPE = enum(i32) {
NONE = 1,
WEP = 2,
TKIP = 4,
AES = 8,
TKIP_AES_MIXED = 12,
};
pub const WCN_VALUE_ET_NONE = WCN_VALUE_TYPE_ENCRYPTION_TYPE.NONE;
pub const WCN_VALUE_ET_WEP = WCN_VALUE_TYPE_ENCRYPTION_TYPE.WEP;
pub const WCN_VALUE_ET_TKIP = WCN_VALUE_TYPE_ENCRYPTION_TYPE.TKIP;
pub const WCN_VALUE_ET_AES = WCN_VALUE_TYPE_ENCRYPTION_TYPE.AES;
pub const WCN_VALUE_ET_TKIP_AES_MIXED = WCN_VALUE_TYPE_ENCRYPTION_TYPE.TKIP_AES_MIXED;
pub const WCN_VALUE_TYPE_MESSAGE_TYPE = enum(i32) {
BEACON = 1,
PROBE_REQUEST = 2,
PROBE_RESPONSE = 3,
M1 = 4,
M2 = 5,
M2D = 6,
M3 = 7,
M4 = 8,
M5 = 9,
M6 = 10,
M7 = 11,
M8 = 12,
ACK = 13,
NACK = 14,
DONE = 15,
};
pub const WCN_VALUE_MT_BEACON = WCN_VALUE_TYPE_MESSAGE_TYPE.BEACON;
pub const WCN_VALUE_MT_PROBE_REQUEST = WCN_VALUE_TYPE_MESSAGE_TYPE.PROBE_REQUEST;
pub const WCN_VALUE_MT_PROBE_RESPONSE = WCN_VALUE_TYPE_MESSAGE_TYPE.PROBE_RESPONSE;
pub const WCN_VALUE_MT_M1 = WCN_VALUE_TYPE_MESSAGE_TYPE.M1;
pub const WCN_VALUE_MT_M2 = WCN_VALUE_TYPE_MESSAGE_TYPE.M2;
pub const WCN_VALUE_MT_M2D = WCN_VALUE_TYPE_MESSAGE_TYPE.M2D;
pub const WCN_VALUE_MT_M3 = WCN_VALUE_TYPE_MESSAGE_TYPE.M3;
pub const WCN_VALUE_MT_M4 = WCN_VALUE_TYPE_MESSAGE_TYPE.M4;
pub const WCN_VALUE_MT_M5 = WCN_VALUE_TYPE_MESSAGE_TYPE.M5;
pub const WCN_VALUE_MT_M6 = WCN_VALUE_TYPE_MESSAGE_TYPE.M6;
pub const WCN_VALUE_MT_M7 = WCN_VALUE_TYPE_MESSAGE_TYPE.M7;
pub const WCN_VALUE_MT_M8 = WCN_VALUE_TYPE_MESSAGE_TYPE.M8;
pub const WCN_VALUE_MT_ACK = WCN_VALUE_TYPE_MESSAGE_TYPE.ACK;
pub const WCN_VALUE_MT_NACK = WCN_VALUE_TYPE_MESSAGE_TYPE.NACK;
pub const WCN_VALUE_MT_DONE = WCN_VALUE_TYPE_MESSAGE_TYPE.DONE;
pub const WCN_VALUE_TYPE_REQUEST_TYPE = enum(i32) {
ENROLLEE_INFO = 0,
ENROLLEE_OPEN_1X = 1,
REGISTRAR = 2,
MANAGER_REGISTRAR = 3,
};
pub const WCN_VALUE_ReqT_ENROLLEE_INFO = WCN_VALUE_TYPE_REQUEST_TYPE.ENROLLEE_INFO;
pub const WCN_VALUE_ReqT_ENROLLEE_OPEN_1X = WCN_VALUE_TYPE_REQUEST_TYPE.ENROLLEE_OPEN_1X;
pub const WCN_VALUE_ReqT_REGISTRAR = WCN_VALUE_TYPE_REQUEST_TYPE.REGISTRAR;
pub const WCN_VALUE_ReqT_MANAGER_REGISTRAR = WCN_VALUE_TYPE_REQUEST_TYPE.MANAGER_REGISTRAR;
pub const WCN_VALUE_TYPE_RESPONSE_TYPE = enum(i32) {
ENROLLEE_INFO = 0,
ENROLLEE_OPEN_1X = 1,
REGISTRAR = 2,
AP = 3,
};
pub const WCN_VALUE_RspT_ENROLLEE_INFO = WCN_VALUE_TYPE_RESPONSE_TYPE.ENROLLEE_INFO;
pub const WCN_VALUE_RspT_ENROLLEE_OPEN_1X = WCN_VALUE_TYPE_RESPONSE_TYPE.ENROLLEE_OPEN_1X;
pub const WCN_VALUE_RspT_REGISTRAR = WCN_VALUE_TYPE_RESPONSE_TYPE.REGISTRAR;
pub const WCN_VALUE_RspT_AP = WCN_VALUE_TYPE_RESPONSE_TYPE.AP;
pub const WCN_VALUE_TYPE_RF_BANDS = enum(i32) {
@"24GHZ" = 1,
@"50GHZ" = 2,
};
pub const WCN_VALUE_RB_24GHZ = WCN_VALUE_TYPE_RF_BANDS.@"24GHZ";
pub const WCN_VALUE_RB_50GHZ = WCN_VALUE_TYPE_RF_BANDS.@"50GHZ";
pub const WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE = enum(i32) {
RESERVED00 = 0,
NOT_CONFIGURED = 1,
CONFIGURED = 2,
};
pub const WCN_VALUE_SS_RESERVED00 = WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE.RESERVED00;
pub const WCN_VALUE_SS_NOT_CONFIGURED = WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE.NOT_CONFIGURED;
pub const WCN_VALUE_SS_CONFIGURED = WCN_VALUE_TYPE_WI_FI_PROTECTED_SETUP_STATE.CONFIGURED;
pub const WCN_VALUE_TYPE_PRIMARY_DEVICE_TYPE = packed struct {
Category: u16,
SubCategoryOUI: u32,
SubCategory: u16,
};
const CLSID_WCNDeviceObject_Value = @import("../zig.zig").Guid.initString("c100bea7-d33a-4a4b-bf23-bbef4663d017");
pub const CLSID_WCNDeviceObject = &CLSID_WCNDeviceObject_Value;
pub const WCN_PASSWORD_TYPE = enum(i32) {
PUSH_BUTTON = 0,
PIN = 1,
PIN_REGISTRAR_SPECIFIED = 2,
OOB_SPECIFIED = 3,
WFDS = 4,
};
pub const WCN_PASSWORD_TYPE_PUSH_BUTTON = WCN_PASSWORD_TYPE.PUSH_BUTTON;
pub const WCN_PASSWORD_TYPE_PIN = WCN_PASSWORD_TYPE.PIN;
pub const WCN_PASSWORD_TYPE_PIN_REGISTRAR_SPECIFIED = WCN_PASSWORD_TYPE.PIN_REGISTRAR_SPECIFIED;
pub const WCN_PASSWORD_TYPE_OOB_SPECIFIED = WCN_PASSWORD_TYPE.OOB_SPECIFIED;
pub const WCN_PASSWORD_TYPE_WFDS = WCN_PASSWORD_TYPE.WFDS;
pub const WCN_SESSION_STATUS = enum(i32) {
SUCCESS = 0,
FAILURE_GENERIC = 1,
FAILURE_TIMEOUT = 2,
};
pub const WCN_SESSION_STATUS_SUCCESS = WCN_SESSION_STATUS.SUCCESS;
pub const WCN_SESSION_STATUS_FAILURE_GENERIC = WCN_SESSION_STATUS.FAILURE_GENERIC;
pub const WCN_SESSION_STATUS_FAILURE_TIMEOUT = WCN_SESSION_STATUS.FAILURE_TIMEOUT;
pub const WCN_VENDOR_EXTENSION_SPEC = extern struct {
VendorId: u32,
SubType: u32,
Index: u32,
Flags: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_IWCNDevice_Value = @import("../zig.zig").Guid.initString("c100be9c-d33a-4a4b-bf23-bbef4663d017");
pub const IID_IWCNDevice = &IID_IWCNDevice_Value;
pub const IWCNDevice = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetPassword: fn(
self: *const IWCNDevice,
Type: WCN_PASSWORD_TYPE,
dwPasswordLength: u32,
pbPassword: [*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Connect: fn(
self: *const IWCNDevice,
pNotify: ?*IWCNConnectNotify,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetAttribute: fn(
self: *const IWCNDevice,
AttributeType: WCN_ATTRIBUTE_TYPE,
dwMaxBufferSize: u32,
pbBuffer: [*:0]u8,
pdwBufferUsed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetIntegerAttribute: fn(
self: *const IWCNDevice,
AttributeType: WCN_ATTRIBUTE_TYPE,
puInteger: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStringAttribute: fn(
self: *const IWCNDevice,
AttributeType: WCN_ATTRIBUTE_TYPE,
cchMaxString: u32,
wszString: [*:0]u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNetworkProfile: fn(
self: *const IWCNDevice,
cchMaxStringLength: u32,
wszProfile: [*:0]u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNetworkProfile: fn(
self: *const IWCNDevice,
pszProfileXml: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVendorExtension: fn(
self: *const IWCNDevice,
pVendorExtSpec: ?*const WCN_VENDOR_EXTENSION_SPEC,
dwMaxBufferSize: u32,
pbBuffer: [*:0]u8,
pdwBufferUsed: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVendorExtension: fn(
self: *const IWCNDevice,
pVendorExtSpec: ?*const WCN_VENDOR_EXTENSION_SPEC,
cbBuffer: u32,
pbBuffer: [*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unadvise: fn(
self: *const IWCNDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNFCPasswordParams: fn(
self: *const IWCNDevice,
Type: WCN_PASSWORD_TYPE,
dwOOBPasswordID: u32,
dwPasswordLength: u32,
pbPassword: ?[*:0]const u8,
dwRemotePublicKeyHashLength: u32,
pbRemotePublicKeyHash: ?[*:0]const u8,
dwDHKeyBlobLength: u32,
pbDHKeyBlob: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_SetPassword(self: *const T, Type: WCN_PASSWORD_TYPE, dwPasswordLength: u32, pbPassword: [*:0]const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).SetPassword(@ptrCast(*const IWCNDevice, self), Type, dwPasswordLength, pbPassword);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_Connect(self: *const T, pNotify: ?*IWCNConnectNotify) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).Connect(@ptrCast(*const IWCNDevice, self), pNotify);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_GetAttribute(self: *const T, AttributeType: WCN_ATTRIBUTE_TYPE, dwMaxBufferSize: u32, pbBuffer: [*:0]u8, pdwBufferUsed: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).GetAttribute(@ptrCast(*const IWCNDevice, self), AttributeType, dwMaxBufferSize, pbBuffer, pdwBufferUsed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_GetIntegerAttribute(self: *const T, AttributeType: WCN_ATTRIBUTE_TYPE, puInteger: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).GetIntegerAttribute(@ptrCast(*const IWCNDevice, self), AttributeType, puInteger);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_GetStringAttribute(self: *const T, AttributeType: WCN_ATTRIBUTE_TYPE, cchMaxString: u32, wszString: [*:0]u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).GetStringAttribute(@ptrCast(*const IWCNDevice, self), AttributeType, cchMaxString, wszString);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_GetNetworkProfile(self: *const T, cchMaxStringLength: u32, wszProfile: [*:0]u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).GetNetworkProfile(@ptrCast(*const IWCNDevice, self), cchMaxStringLength, wszProfile);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_SetNetworkProfile(self: *const T, pszProfileXml: ?[*:0]const u16) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).SetNetworkProfile(@ptrCast(*const IWCNDevice, self), pszProfileXml);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_GetVendorExtension(self: *const T, pVendorExtSpec: ?*const WCN_VENDOR_EXTENSION_SPEC, dwMaxBufferSize: u32, pbBuffer: [*:0]u8, pdwBufferUsed: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).GetVendorExtension(@ptrCast(*const IWCNDevice, self), pVendorExtSpec, dwMaxBufferSize, pbBuffer, pdwBufferUsed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_SetVendorExtension(self: *const T, pVendorExtSpec: ?*const WCN_VENDOR_EXTENSION_SPEC, cbBuffer: u32, pbBuffer: [*:0]const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).SetVendorExtension(@ptrCast(*const IWCNDevice, self), pVendorExtSpec, cbBuffer, pbBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_Unadvise(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).Unadvise(@ptrCast(*const IWCNDevice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNDevice_SetNFCPasswordParams(self: *const T, Type: WCN_PASSWORD_TYPE, dwOOBPasswordID: u32, dwPasswordLength: u32, pbPassword: ?[*:0]const u8, dwRemotePublicKeyHashLength: u32, pbRemotePublicKeyHash: ?[*:0]const u8, dwDHKeyBlobLength: u32, pbDHKeyBlob: ?[*:0]const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNDevice.VTable, self.vtable).SetNFCPasswordParams(@ptrCast(*const IWCNDevice, self), Type, dwOOBPasswordID, dwPasswordLength, pbPassword, dwRemotePublicKeyHashLength, pbRemotePublicKeyHash, dwDHKeyBlobLength, pbDHKeyBlob);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_IWCNConnectNotify_Value = @import("../zig.zig").Guid.initString("c100be9f-d33a-4a4b-bf23-bbef4663d017");
pub const IID_IWCNConnectNotify = &IID_IWCNConnectNotify_Value;
pub const IWCNConnectNotify = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
ConnectSucceeded: fn(
self: *const IWCNConnectNotify,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ConnectFailed: fn(
self: *const IWCNConnectNotify,
hrFailure: HRESULT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNConnectNotify_ConnectSucceeded(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNConnectNotify.VTable, self.vtable).ConnectSucceeded(@ptrCast(*const IWCNConnectNotify, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IWCNConnectNotify_ConnectFailed(self: *const T, hrFailure: HRESULT) callconv(.Inline) HRESULT {
return @ptrCast(*const IWCNConnectNotify.VTable, self.vtable).ConnectFailed(@ptrCast(*const IWCNConnectNotify, self), hrFailure);
}
};}
pub usingnamespace MethodMixin(@This());
};
//--------------------------------------------------------------------------------
// Section: Functions (0)
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (0)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
},
.wide => struct {
},
.unspecified => if (@import("builtin").is_test) struct {
} else struct {
},
};
//--------------------------------------------------------------------------------
// Section: Imports (4)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const HRESULT = @import("../foundation.zig").HRESULT;
const IUnknown = @import("../system/com.zig").IUnknown;
const PWSTR = @import("../foundation.zig").PWSTR;
test {
@setEvalBranchQuota(
@import("std").meta.declarations(@This()).len * 3
);
// reference all the pub declarations
if (!@import("builtin").is_test) return;
inline for (@import("std").meta.declarations(@This())) |decl| {
if (decl.is_pub) {
_ = decl;
}
}
} | win32/network_management/windows_connect_now.zig |
const std = @import("std");
const math = std.math;
const solar_mass = 4.0 * math.pi * math.pi;
const year = 365.24;
const vec3 = std.meta.Vector(3, f64);
fn dot(a: vec3, b: vec3) f64 {
return @reduce(.Add, a * b);
}
fn scale(v: vec3, f: f64) vec3 {
return v * @splat(3, f);
}
fn length_sq(v: vec3) f64 {
return dot(v, v);
}
fn length(v: vec3) f64 {
return math.sqrt(length_sq(v));
}
fn range(len: usize) []void {
var res: []void = &.{};
res.len = len;
return res;
}
const Body = struct {
pos: vec3,
vel: vec3,
mass: f64,
};
fn offset_momentum(bodies: []Body) void {
@setFloatMode(.Optimized);
var pos = vec3{ 0, 0, 0 };
for (bodies) |b| pos += scale(b.vel, b.mass);
var sun = &bodies[0];
sun.vel = -scale(pos, 1 / solar_mass);
}
fn advance(bodies: []Body, dt: f64) void {
@setFloatMode(.Optimized);
for (bodies[0..]) |*bi, i| for (bodies[i + 1 ..]) |*bj| {
const d = bi.pos - bj.pos;
const dsq = length_sq(d);
const dst = math.sqrt(dsq);
const mag = dt / (dsq * dst);
bi.vel -= scale(d, bj.mass * mag);
bj.vel += scale(d, bi.mass * mag);
};
for (bodies) |*bi| bi.pos += scale(bi.vel, dt);
}
fn energy(bodies: []const Body) f64 {
@setFloatMode(.Optimized);
var e: f64 = 0.0;
for (bodies) |bi, i| {
e += 0.5 * length_sq(bi.vel) * bi.mass;
for (bodies[i + 1 ..]) |bj| {
e -= bi.mass * bj.mass / length(bi.pos - bj.pos);
}
}
return e;
}
var solar_bodies = [_]Body{
// Sun
Body{
.pos = vec3{ 0, 0, 0 },
.vel = vec3{ 0, 0, 0 },
.mass = solar_mass,
},
// Jupiter
Body{
.pos = vec3{ 4.84143144246472090, -1.16032004402742839, -0.103622044471123109 },
.vel = scale(vec3{ 1.66007664274403694e-03, 7.69901118419740425e-03, -6.90460016972063023e-05 }, year),
.mass = 9.54791938424326609e-04 * solar_mass,
},
// Saturn
Body{
.pos = vec3{ 8.34336671824457987, 4.12479856412430479, -0.403523417114321381 },
.vel = scale(vec3{ -2.76742510726862411e-03, 4.99852801234917238e-03, 2.30417297573763929e-05 }, year),
.mass = 2.85885980666130812e-04 * solar_mass,
},
// Uranus
Body{
.pos = vec3{ 12.8943695621391310, -15.1111514016986312, -0.223307578892655734 },
.vel = scale(vec3{ 2.96460137564761618e-03, 2.37847173959480950e-03, -2.96589568540237556e-05 }, year),
.mass = 4.36624404335156298e-05 * solar_mass,
},
// Neptune
Body{
.pos = vec3{ 15.3796971148509165, -25.9193146099879641, 0.179258772950371181 },
.vel = scale(vec3{ 2.68067772490389322e-03, 1.62824170038242295e-03, -9.51592254519715870e-05 }, year),
.mass = 5.15138902046611451e-05 * solar_mass,
},
};
pub fn main() !void {
const steps = try get_steps();
offset_momentum(&solar_bodies);
const initial_energy = energy(&solar_bodies);
for (range(steps)) |_| advance(&solar_bodies, 0.01);
const final_energy = energy(&solar_bodies);
const stdout = std.io.getStdOut().writer();
try stdout.print("{d:.9}\n{d:.9}\n", .{ initial_energy, final_energy });
}
fn get_steps() !usize {
var arg_it = std.process.args();
_ = arg_it.skip();
const arg = arg_it.next() orelse return 10;
return try std.fmt.parseInt(usize, arg, 10);
} | bench/algorithm/nbody/2.zig |
const std = @import("std");
const math = std.math;
const expect = std.testing.expect;
pub fn __exph(a: f16) callconv(.C) f16 {
// TODO: more efficient implementation
return @floatCast(f16, expf(a));
}
pub fn expf(x_: f32) callconv(.C) f32 {
const half = [_]f32{ 0.5, -0.5 };
const ln2hi = 6.9314575195e-1;
const ln2lo = 1.4286067653e-6;
const invln2 = 1.4426950216e+0;
const P1 = 1.6666625440e-1;
const P2 = -2.7667332906e-3;
var x = x_;
var hx = @bitCast(u32, x);
const sign = @intCast(i32, hx >> 31);
hx &= 0x7FFFFFFF;
if (math.isNan(x)) {
return x;
}
// |x| >= -87.33655 or nan
if (hx >= 0x42AEAC50) {
// nan
if (hx > 0x7F800000) {
return x;
}
// x >= 88.722839
if (hx >= 0x42b17218 and sign == 0) {
return x * 0x1.0p127;
}
if (sign != 0) {
math.doNotOptimizeAway(-0x1.0p-149 / x); // overflow
// x <= -103.972084
if (hx >= 0x42CFF1B5) {
return 0;
}
}
}
var k: i32 = undefined;
var hi: f32 = undefined;
var lo: f32 = undefined;
// |x| > 0.5 * ln2
if (hx > 0x3EB17218) {
// |x| > 1.5 * ln2
if (hx > 0x3F851592) {
k = @floatToInt(i32, invln2 * x + half[@intCast(usize, sign)]);
} else {
k = 1 - sign - sign;
}
const fk = @intToFloat(f32, k);
hi = x - fk * ln2hi;
lo = fk * ln2lo;
x = hi - lo;
}
// |x| > 2^(-14)
else if (hx > 0x39000000) {
k = 0;
hi = x;
lo = 0;
} else {
math.doNotOptimizeAway(0x1.0p127 + x); // inexact
return 1 + x;
}
const xx = x * x;
const c = x - xx * (P1 + xx * P2);
const y = 1 + (x * c / (2 - c) - lo + hi);
if (k == 0) {
return y;
} else {
return math.scalbn(y, k);
}
}
pub fn exp(x_: f64) callconv(.C) f64 {
const half = [_]f64{ 0.5, -0.5 };
const ln2hi: f64 = 6.93147180369123816490e-01;
const ln2lo: f64 = 1.90821492927058770002e-10;
const invln2: f64 = 1.44269504088896338700e+00;
const P1: f64 = 1.66666666666666019037e-01;
const P2: f64 = -2.77777777770155933842e-03;
const P3: f64 = 6.61375632143793436117e-05;
const P4: f64 = -1.65339022054652515390e-06;
const P5: f64 = 4.13813679705723846039e-08;
var x = x_;
var ux = @bitCast(u64, x);
var hx = ux >> 32;
const sign = @intCast(i32, hx >> 31);
hx &= 0x7FFFFFFF;
if (math.isNan(x)) {
return x;
}
// |x| >= 708.39 or nan
if (hx >= 0x4086232B) {
// nan
if (hx > 0x7FF00000) {
return x;
}
if (x > 709.782712893383973096) {
// overflow if x != inf
if (!math.isInf(x)) {
math.raiseOverflow();
}
return math.inf(f64);
}
if (x < -708.39641853226410622) {
// underflow if x != -inf
// math.doNotOptimizeAway(@as(f32, -0x1.0p-149 / x));
if (x < -745.13321910194110842) {
return 0;
}
}
}
// argument reduction
var k: i32 = undefined;
var hi: f64 = undefined;
var lo: f64 = undefined;
// |x| > 0.5 * ln2
if (hx > 0x3FD62E42) {
// |x| >= 1.5 * ln2
if (hx > 0x3FF0A2B2) {
k = @floatToInt(i32, invln2 * x + half[@intCast(usize, sign)]);
} else {
k = 1 - sign - sign;
}
const dk = @intToFloat(f64, k);
hi = x - dk * ln2hi;
lo = dk * ln2lo;
x = hi - lo;
}
// |x| > 2^(-28)
else if (hx > 0x3E300000) {
k = 0;
hi = x;
lo = 0;
} else {
// inexact if x != 0
// math.doNotOptimizeAway(0x1.0p1023 + x);
return 1 + x;
}
const xx = x * x;
const c = x - xx * (P1 + xx * (P2 + xx * (P3 + xx * (P4 + xx * P5))));
const y = 1 + (x * c / (2 - c) - lo + hi);
if (k == 0) {
return y;
} else {
return math.scalbn(y, k);
}
}
pub fn __expx(a: f80) callconv(.C) f80 {
// TODO: more efficient implementation
return @floatCast(f80, expq(a));
}
pub fn expq(a: f128) callconv(.C) f128 {
// TODO: more correct implementation
return exp(@floatCast(f64, a));
}
pub fn expl(x: c_longdouble) callconv(.C) c_longdouble {
switch (@typeInfo(c_longdouble).Float.bits) {
16 => return __exph(x),
32 => return expf(x),
64 => return exp(x),
80 => return __expx(x),
128 => return expq(x),
else => @compileError("unreachable"),
}
}
test "exp32" {
const epsilon = 0.000001;
try expect(expf(0.0) == 1.0);
try expect(math.approxEqAbs(f32, expf(0.0), 1.0, epsilon));
try expect(math.approxEqAbs(f32, expf(0.2), 1.221403, epsilon));
try expect(math.approxEqAbs(f32, expf(0.8923), 2.440737, epsilon));
try expect(math.approxEqAbs(f32, expf(1.5), 4.481689, epsilon));
}
test "exp64" {
const epsilon = 0.000001;
try expect(exp(0.0) == 1.0);
try expect(math.approxEqAbs(f64, exp(0.0), 1.0, epsilon));
try expect(math.approxEqAbs(f64, exp(0.2), 1.221403, epsilon));
try expect(math.approxEqAbs(f64, exp(0.8923), 2.440737, epsilon));
try expect(math.approxEqAbs(f64, exp(1.5), 4.481689, epsilon));
}
test "exp32.special" {
try expect(math.isPositiveInf(expf(math.inf(f32))));
try expect(math.isNan(expf(math.nan(f32))));
}
test "exp64.special" {
try expect(math.isPositiveInf(exp(math.inf(f64))));
try expect(math.isNan(exp(math.nan(f64))));
} | lib/compiler_rt/exp.zig |
const std = @import("std");
const assert = std.debug.assert;
pub fn RangeTo(n: usize) type {
return struct {
idx: usize,
pub fn new() RangeTo(n) {
return .{ .idx = 0 };
}
pub fn next(self: *RangeTo(n)) ?usize {
if (self.idx >= n) {
return null;
}
var r = self.idx;
self.idx += 1;
return r;
}
};
}
pub const Relu1 = struct {
pub const Param = struct {};
pub const Input = f32;
pub const Output = f32;
fn initializeParams(param: *Param, rng: *std.rand.Random) void {
// nothing
}
fn updateGradient(gradient: *Param, scale: f32, update: *Param) void {
// nothing
}
fn run(input: *Input, param: Param, output: *Output) void {
if (input > 0) {
output.* = input;
}
}
fn reverse(
input: Input,
param: Param,
delta: Output,
backprop: *Input,
gradient: *Param,
) void {
if (input > 0) {
backprop.* = delta;
}
}
};
pub fn Lin(size: usize) type {
return struct {
pub const Param = struct { weights: [size]f32, bias: f32 };
pub const Input = [size]f32;
pub const Output = f32;
fn initializeParams(param: *Param, rng: *std.rand.Random) void {
var iter = RangeTo(size).new();
while (iter.next()) |i| {
param.weights[i] = rng.float(f32) * 2 - 1;
}
param.bias = rng.float(f32) * 4 - 2;
}
fn updateGradient(gradient: *Param, scale: f32, update: *Param) void {
var iter = RangeTo(size).new();
while (iter.next()) |i| {
gradient.weights[i] += scale * update.weights[i];
}
gradient.bias += scale * update.bias;
}
fn run(input: Input, param: Param, output: *Output) void {
for (input) |x, i| {
output.* += x * param.weights[i];
}
output.* += param.bias;
}
fn reverse(
input: Input,
param: Param,
delta: Output,
backprop: *Input, // add
gradient: *Param, // add
) void {
gradient.bias = delta;
for (input) |x, i| {
backprop.*[i] += delta * param.weights[i];
gradient.weights[i] += delta * x;
}
}
};
}
pub fn zeroed(comptime T: type) T {
var x: T = undefined;
@memset(@ptrCast([*]u8, &x), 0, @sizeOf(T));
return x;
}
fn Seq2(comptime Net1: type, comptime Net2: type) type {
assert(Net1.Output == Net2.Input);
return struct {
pub const Param = struct {
first: Net1.Param,
second: Net2.Param,
};
pub const Input = Net1.Input;
pub const Output = Net2.Output;
pub fn initializeParams(param: *Param, rng: *std.rand.Random) void {
Net1.initializeParams(¶m.first, rng);
Net2.initializeParams(¶m.second, rng);
}
pub fn updateGradient(gradient: *Param, scale: f32, update: *Param) void {
Net1.updateGradient(&gradient.first, scale, &update.first);
Net2.updateGradient(&gradient.second, scale, &update.second);
}
pub fn run(input: Input, param: Param, output: *Output) void {
var scratch: Net1.Output = zeroed(Net1.Output);
Net1.run(input, ¶m.first, &scratch);
Net2.run(scratch, ¶m.second, output);
}
pub fn reverse(
input: Input,
param: Param,
delta: Output,
backprop: *Input, // add
gradient: *Param, // add
) void {
var scratch: Net1.Output = zeroed(Net1.Output);
Net1.run(input, ¶m.first, &scratch);
var middleDelta: Net1.Output = zeroed(Net1.Output);
Net2.reverse(scratch, ¶m.second, delta, &middleDelta, &gradient.second);
Net1.reverse(input, ¶m.first, middleDelta, backprop, &gradient.first);
}
};
}
fn SeqFrom(comptime Nets: var, index: usize) type {
if (index == Nets.len - 1) {
return Nets[index];
}
return Seq2(Nets[index], SeqFrom(Nets, index + 1));
}
pub fn Seq(comptime Nets: var) type {
assert(Nets.len > 0);
return SeqFrom(Nets, 0);
}
pub fn Fan(comptime by: usize, Net: type) type {
return struct {
pub const Input = Net.Input;
pub const Output = [by]Net.Output;
pub const Param = [by]Net.Param;
pub fn initializeParams(param: *Param, rng: *std.rand.Random) void {
var iter = RangeTo(by).new();
while (iter.next()) |i| {
Net.initializeParams(¶m[i], rng);
}
}
pub fn updateGradient(gradient: *Param, scale: f32, update: *Param) void {
var iter = RangeTo(by).new();
while (iter.next()) |i| {
Net.updateGradient(&gradient.*[i], scale, &update.*[i]);
}
}
pub fn run(input: Input, param: Param, output: *Output) void {
var iter = RangeTo(by).new();
while (iter.next()) |i| {
Net.run(input, param[i], &output[i]);
}
}
pub fn reverse(
input: Input,
param: Param,
delta: Output,
backprop: *Input, // add
gradient: *Param, // add
) void {
var iter = RangeTo(by).new();
while (iter.next()) |i| {
Net.reverse(input, param[i], delta[i], backprop, &gradient[i]);
}
}
};
}
pub fn Relu(comptime in: usize, comptime out: usize) type {
return Fan(out, Seq(.{ Lin(in), Relu1 }));
}
pub fn LossSum(comptime LossNet: type) type {
assert(LossNet.Output == f32);
return struct {
pub const Input = []LossNet.Input;
pub const Output = f32;
pub const Param = LossNet.Param;
pub fn initializeParams(param: *Param, rng: *std.rand.Random) void {
LossNet.initializeParams(param, rng);
}
pub fn updateGradient(gradient: *Param, scale: f32, update: *Param) void {
LossNet.updateGradient(gradient, scale, update);
}
pub fn run(input: Input, param: Param, output: *Output) void {
var loss: f32 = 0.0;
for (input) |item, index| {
var lossAdd: f32 = 0.0;
LossNet.run(input[index], param, &lossAdd);
loss += lossAdd;
}
output.* += loss;
}
pub fn reverse(
input: Input,
param: Param,
delta: Output,
backprop: *Input, // add
gradient: *Param, // add
) void {
// TODO: backprop is not set; should we have non-differentiable inputs?
for (input) |_, index| {
var discardInputDelta = zeroed(LossNet.Input);
// here we rely on gradients being added, instead of set:
LossNet.reverse(input[index], param, delta, &discardInputDelta, gradient);
}
}
};
}
pub fn TrainingExample(comptime T: type, comptime G: type) type {
return struct {
input: T,
target: G,
};
}
pub fn LossL2(comptime Net: type) type {
return struct {
pub const Input = TrainingExample(Net.Input, f32);
pub const Output = f32;
pub const Param = Net.Param;
pub fn initializeParams(param: *Param, rng: *std.rand.Random) void {
Net.initializeParams(param, rng);
}
pub fn updateGradient(gradient: *Param, scale: f32, update: *Param) void {
Net.updateGradient(gradient, scale, update);
}
pub fn run(input: Input, param: Param, output: *Output) void {
var predicted = [1]f32{0};
Net.run(input.input, param, &predicted);
var loss = (predicted[0] - input.target) * (predicted[0] - input.target);
output.* += loss;
}
pub fn reverse(
input: Input,
param: Param,
delta: Output,
backprop: *Input, // add
gradient: *Param, // add
) void {
// 'delta' indicates how much being wrong counts.
// the amount we pass back into the previous layer is therefore based
// on how far off the current estimate is.
// So we first need to run forward to obtain a prediction:
var predicted = [1]f32{0};
Net.run(input.input, param, &predicted);
// We have: L = (pred - target)^2
// and we know dE / dL
// we want to find dpred / dL
// dE/dA = dE/dL dL/dA
// so take d/dpred of both sides:
// dL/dpred = 2(pred-target)
// so dE/dpred = dE/dL 2 (pred - target).
var adjustedDelta: Net.Output = [1]f32{2 * delta * (predicted[0] - input.target)};
var discardInputBackprop = zeroed(Net.Input);
Net.reverse(
input.input,
param,
adjustedDelta,
&discardInputBackprop,
gradient,
);
}
};
} | net.zig |
const std = @import("std");
const cpp_options = &[_][]const u8{
"-std=c++17",
"-fno-sanitize=undefined",
};
const c_options = &[_][]const u8{
"-fno-sanitize=undefined",
};
pub fn build(b: *std.build.Builder) !void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const static_sdl = b.option(bool, "static-sdl", "Link SDL statically") orelse true;
const strip_executables = b.option(bool, "strip", "Strips all executables") orelse false;
const nfd = b.addStaticLibrary("nfd", null);
{
nfd.strip = strip_executables;
nfd.linkLibC();
nfd.setTarget(target);
nfd.setBuildMode(mode);
nfd.addCSourceFile("./ext/nativefiledialog/src/nfd_common.c", c_options);
nfd.addIncludeDir("./ext/nativefiledialog/src/include");
switch (target.getOsTag()) {
.linux => {
nfd.addCSourceFile("./ext/nativefiledialog/src/nfd_gtk.c", c_options);
nfd.linkSystemLibrary("gtk+-3.0");
},
.windows => nfd.addCSourceFile("./ext/nativefiledialog/src/nfd_win.cpp", c_options),
.macos => nfd.addCSourceFile("./ext/nativefiledialog/src/nfd_cocoa.m", c_options),
else => return error.UnsupportedOS,
}
}
const workbench = b.addExecutable("cg-workbench", "workbench/main.zig");
{
workbench.strip = strip_executables;
workbench.linkLibC();
workbench.linkSystemLibrary("c++");
workbench.setTarget(target);
workbench.setBuildMode(mode);
workbench.linkLibrary(nfd);
workbench.defineCMacro("GLM_ENABLE_EXPERIMENTAL");
workbench.defineCMacro("IMGUI_DISABLE_OBSOLETE_FUNCTIONS");
workbench.defineCMacro("STB_VORBIS_HEADER_ONLY");
if (mode == .Debug)
workbench.defineCMacro("DEBUG_BUILD");
if (target.getOsTag() == .windows) {
workbench.defineCMacro("NOMINMAX");
workbench.defineCMacro("WIN32_LEAN_AND_MEAN");
workbench.defineCMacro("CGPLAT_WINDOWS");
workbench.defineCMacro("WIN32");
// Remove warnings for using non-portable libc functions
workbench.defineCMacro("_CRT_SECURE_NO_WARNINGS");
workbench.linkSystemLibrary("gdi32");
workbench.linkSystemLibrary("kernel32");
workbench.linkSystemLibrary("ole32");
workbench.linkSystemLibrary("oleaut32");
workbench.linkSystemLibrary("opengl32");
workbench.linkSystemLibrary("shell32");
workbench.linkSystemLibrary("shlwapi");
workbench.linkSystemLibrary("user32");
if (target.getCpuArch() == .i386) {
// https://github.com/MasterQ32/cg-workbench/issues/1
workbench.defineCMacro("IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS");
}
if (target.getAbi() == .msvc) {
workbench.addIncludeDir("lib/SDL2-2.0.12/include");
if (target.getCpuArch() == .i386) {
workbench.addLibPath("lib/SDL2-2.0.12/lib/x86");
} else {
workbench.addLibPath("lib/SDL2-2.0.12/lib/x64");
}
workbench.linkSystemLibraryName("SDL2");
workbench.linkSystemLibraryName("SDL2main");
} else {
workbench.defineCMacro("DECLSPEC=");
if (target.getCpuArch() == .i386) {
workbench.addIncludeDir("lib/SDL2-2.0.12.mingw/i686-w64-mingw32/include/SDL2");
} else {
workbench.addIncludeDir("lib/SDL2-2.0.12.mingw/x86_64-w64-mingw32/include/SDL2");
}
// TODO: https://github.com/MasterQ32/cg-workbench/issues/4
if (static_sdl) {
workbench.linkSystemLibrary("winmm");
workbench.linkSystemLibrary("imm32");
workbench.linkSystemLibrary("version");
workbench.linkSystemLibrary("setupapi");
if (target.getCpuArch() == .i386) {
workbench.addObjectFile("lib/SDL2-2.0.12.mingw/i686-w64-mingw32/lib/libSDL2.a");
} else {
workbench.addObjectFile("lib/SDL2-2.0.12.mingw/x86_64-w64-mingw32/lib/libSDL2.a");
}
} else {
if (target.getCpuArch() == .i386) {
workbench.addLibPath("lib/SDL2-2.0.12.mingw/i686-w64-mingw32/lib");
} else {
workbench.addLibPath("lib/SDL2-2.0.12.mingw/x86_64-w64-mingw32/lib");
}
workbench.linkSystemLibraryName("SDL2.dll");
workbench.linkSystemLibraryName("SDL2main");
}
}
} else {
workbench.defineCMacro("CGPLAT_LINUX");
workbench.linkSystemLibrary("m");
workbench.linkSystemLibrary("dl");
workbench.linkSystemLibrary("gl");
workbench.linkSystemLibrary("sdl2");
workbench.linkSystemLibrary("gtk+-3.0");
}
for (workbench_sources) |src| {
workbench.addCSourceFile(
src,
if (std.mem.endsWith(u8, src, ".cpp")) cpp_options else c_options,
);
}
for (include_dirs) |dir| {
workbench.addIncludeDir(dir);
}
}
workbench.install();
}
const include_dirs = [_][]const u8{
"./workbench/src",
"./ext/gl3w",
"./ext/stb",
"./ext/imgui",
"./ext/json",
"./ext/nativefiledialog/src/include",
"./ext/tinyobjloader",
"./ext/tinydir",
"./ext/webcam-v4l2",
"./ext/kiss_fft",
"./ext/kiss_fft/tools",
"./ext/rtmidi",
"./ext/glm-0.9.9.8/",
};
const workbench_sources = [_][]const u8{
"./ext/gl3w/gl3w.c",
"./ext/imgui/imgui.cpp",
"./ext/imgui/imgui_demo.cpp",
"./ext/imgui/imgui_draw.cpp",
"./ext/tinyobjloader/tiny_obj_loader.cpp",
"./ext/imgui/imgui_widgets.cpp",
"./workbench/src/cgdatatype.cpp",
"./workbench/src/imgui_impl.cpp",
"./workbench/src/audiostream.cpp",
"./workbench/src/event.cpp",
"./workbench/src/fileio.cpp",
"./workbench/src/geometry.cpp",
"./workbench/src/imageloader.cpp",
"./workbench/src/resources.cpp",
"./workbench/src/shaderprogram.cpp",
"./workbench/src/sink.cpp",
"./workbench/src/slot.cpp",
"./workbench/src/source.cpp",
"./workbench/src/textureeditor.cpp",
"./workbench/src/time.cpp",
"./workbench/src/window.cpp",
"./workbench/src/windowregistry.cpp",
"./workbench/src/windows/event/bpmnode.cpp",
"./workbench/src/windows/event/eventdelay.cpp",
"./workbench/src/windows/event/trackernode.cpp",
"./workbench/src/windows/event/trigger.cpp",
"./workbench/src/windows/graphic/shadereditor.cpp",
"./workbench/src/windows/graphic/gpuerrorlog.cpp",
"./workbench/src/windows/generic/linearnoisenode.cpp",
"./workbench/src/windows/generic/notewindow.cpp",
"./workbench/src/windows/graphic/geometrywindow.cpp",
"./workbench/src/windows/graphic/imagebuffer.cpp",
"./workbench/src/windows/graphic/imagesource.cpp",
"./workbench/src/windows/graphic/renderwindow.cpp",
"./workbench/src/windows/numeric/arithmeticwindow.cpp",
"./workbench/src/windows/numeric/bufferwindow.cpp",
"./workbench/src/windows/numeric/colorwindow.cpp",
"./workbench/src/windows/numeric/graphwindow.cpp",
"./workbench/src/windows/numeric/matrixtransforms.cpp",
"./workbench/src/windows/numeric/timerwindow.cpp",
"./workbench/src/windows/numeric/uniformwindow.cpp",
"./workbench/src/windows/numeric/vectoradapter.cpp",
"./workbench/src/main.cpp",
"./workbench/src/windows/graphic/renderpassnode.cpp",
"./workbench/src/renderpass.cpp",
"./workbench/src/utils.cpp",
"./workbench/src/windows/event/eventcounter.cpp",
"./workbench/src/windows/event/edgedetector.cpp",
"./workbench/src/windows/event/pulsenode.cpp",
"./workbench/src/windows/graphic/noisetexture.cpp",
"./workbench/src/audionode.cpp",
}; | build.zig |
pub const D3D_COMPILER_VERSION = @as(u32, 47);
pub const D3DCOMPILE_DEBUG = @as(u32, 1);
pub const D3DCOMPILE_SKIP_VALIDATION = @as(u32, 2);
pub const D3DCOMPILE_SKIP_OPTIMIZATION = @as(u32, 4);
pub const D3DCOMPILE_PACK_MATRIX_ROW_MAJOR = @as(u32, 8);
pub const D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR = @as(u32, 16);
pub const D3DCOMPILE_PARTIAL_PRECISION = @as(u32, 32);
pub const D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT = @as(u32, 64);
pub const D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT = @as(u32, 128);
pub const D3DCOMPILE_NO_PRESHADER = @as(u32, 256);
pub const D3DCOMPILE_AVOID_FLOW_CONTROL = @as(u32, 512);
pub const D3DCOMPILE_PREFER_FLOW_CONTROL = @as(u32, 1024);
pub const D3DCOMPILE_ENABLE_STRICTNESS = @as(u32, 2048);
pub const D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY = @as(u32, 4096);
pub const D3DCOMPILE_IEEE_STRICTNESS = @as(u32, 8192);
pub const D3DCOMPILE_OPTIMIZATION_LEVEL0 = @as(u32, 16384);
pub const D3DCOMPILE_OPTIMIZATION_LEVEL1 = @as(u32, 0);
pub const D3DCOMPILE_OPTIMIZATION_LEVEL3 = @as(u32, 32768);
pub const D3DCOMPILE_RESERVED16 = @as(u32, 65536);
pub const D3DCOMPILE_RESERVED17 = @as(u32, 131072);
pub const D3DCOMPILE_WARNINGS_ARE_ERRORS = @as(u32, 262144);
pub const D3DCOMPILE_RESOURCES_MAY_ALIAS = @as(u32, 524288);
pub const D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES = @as(u32, 1048576);
pub const D3DCOMPILE_ALL_RESOURCES_BOUND = @as(u32, 2097152);
pub const D3DCOMPILE_DEBUG_NAME_FOR_SOURCE = @as(u32, 4194304);
pub const D3DCOMPILE_DEBUG_NAME_FOR_BINARY = @as(u32, 8388608);
pub const D3DCOMPILE_EFFECT_CHILD_EFFECT = @as(u32, 1);
pub const D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS = @as(u32, 2);
pub const D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST = @as(u32, 0);
pub const D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 = @as(u32, 16);
pub const D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 = @as(u32, 32);
pub const D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS = @as(u32, 1);
pub const D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS = @as(u32, 2);
pub const D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH = @as(u32, 4);
pub const D3D_DISASM_ENABLE_COLOR_CODE = @as(u32, 1);
pub const D3D_DISASM_ENABLE_DEFAULT_VALUE_PRINTS = @as(u32, 2);
pub const D3D_DISASM_ENABLE_INSTRUCTION_NUMBERING = @as(u32, 4);
pub const D3D_DISASM_ENABLE_INSTRUCTION_CYCLE = @as(u32, 8);
pub const D3D_DISASM_DISABLE_DEBUG_INFO = @as(u32, 16);
pub const D3D_DISASM_ENABLE_INSTRUCTION_OFFSET = @as(u32, 32);
pub const D3D_DISASM_INSTRUCTION_ONLY = @as(u32, 64);
pub const D3D_DISASM_PRINT_HEX_LITERALS = @as(u32, 128);
pub const D3D_GET_INST_OFFSETS_INCLUDE_NON_EXECUTABLE = @as(u32, 1);
pub const D3D_COMPRESS_SHADER_KEEP_ALL_PARTS = @as(u32, 1);
//--------------------------------------------------------------------------------
// Section: Types (6)
//--------------------------------------------------------------------------------
pub const pD3DCompile = fn(
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pFileName: ?[*:0]const u8,
pDefines: ?*const D3D_SHADER_MACRO,
pInclude: ?*ID3DInclude,
pEntrypoint: ?[*:0]const u8,
pTarget: ?[*:0]const u8,
Flags1: u32,
Flags2: u32,
ppCode: ?*?*ID3DBlob,
ppErrorMsgs: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub const pD3DPreprocess = fn(
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pFileName: ?[*:0]const u8,
pDefines: ?*const D3D_SHADER_MACRO,
pInclude: ?*ID3DInclude,
ppCodeText: ?*?*ID3DBlob,
ppErrorMsgs: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub const pD3DDisassemble = fn(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
Flags: u32,
szComments: ?[*:0]const u8,
ppDisassembly: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub const D3DCOMPILER_STRIP_FLAGS = enum(i32) {
REFLECTION_DATA = 1,
DEBUG_INFO = 2,
TEST_BLOBS = 4,
PRIVATE_DATA = 8,
ROOT_SIGNATURE = 16,
FORCE_DWORD = 2147483647,
};
pub const D3DCOMPILER_STRIP_REFLECTION_DATA = D3DCOMPILER_STRIP_FLAGS.REFLECTION_DATA;
pub const D3DCOMPILER_STRIP_DEBUG_INFO = D3DCOMPILER_STRIP_FLAGS.DEBUG_INFO;
pub const D3DCOMPILER_STRIP_TEST_BLOBS = D3DCOMPILER_STRIP_FLAGS.TEST_BLOBS;
pub const D3DCOMPILER_STRIP_PRIVATE_DATA = D3DCOMPILER_STRIP_FLAGS.PRIVATE_DATA;
pub const D3DCOMPILER_STRIP_ROOT_SIGNATURE = D3DCOMPILER_STRIP_FLAGS.ROOT_SIGNATURE;
pub const D3DCOMPILER_STRIP_FORCE_DWORD = D3DCOMPILER_STRIP_FLAGS.FORCE_DWORD;
pub const D3D_BLOB_PART = enum(i32) {
INPUT_SIGNATURE_BLOB = 0,
OUTPUT_SIGNATURE_BLOB = 1,
INPUT_AND_OUTPUT_SIGNATURE_BLOB = 2,
PATCH_CONSTANT_SIGNATURE_BLOB = 3,
ALL_SIGNATURE_BLOB = 4,
DEBUG_INFO = 5,
LEGACY_SHADER = 6,
XNA_PREPASS_SHADER = 7,
XNA_SHADER = 8,
PDB = 9,
PRIVATE_DATA = 10,
ROOT_SIGNATURE = 11,
DEBUG_NAME = 12,
TEST_ALTERNATE_SHADER = 32768,
TEST_COMPILE_DETAILS = 32769,
TEST_COMPILE_PERF = 32770,
TEST_COMPILE_REPORT = 32771,
};
pub const D3D_BLOB_INPUT_SIGNATURE_BLOB = D3D_BLOB_PART.INPUT_SIGNATURE_BLOB;
pub const D3D_BLOB_OUTPUT_SIGNATURE_BLOB = D3D_BLOB_PART.OUTPUT_SIGNATURE_BLOB;
pub const D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB = D3D_BLOB_PART.INPUT_AND_OUTPUT_SIGNATURE_BLOB;
pub const D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB = D3D_BLOB_PART.PATCH_CONSTANT_SIGNATURE_BLOB;
pub const D3D_BLOB_ALL_SIGNATURE_BLOB = D3D_BLOB_PART.ALL_SIGNATURE_BLOB;
pub const D3D_BLOB_DEBUG_INFO = D3D_BLOB_PART.DEBUG_INFO;
pub const D3D_BLOB_LEGACY_SHADER = D3D_BLOB_PART.LEGACY_SHADER;
pub const D3D_BLOB_XNA_PREPASS_SHADER = D3D_BLOB_PART.XNA_PREPASS_SHADER;
pub const D3D_BLOB_XNA_SHADER = D3D_BLOB_PART.XNA_SHADER;
pub const D3D_BLOB_PDB = D3D_BLOB_PART.PDB;
pub const D3D_BLOB_PRIVATE_DATA = D3D_BLOB_PART.PRIVATE_DATA;
pub const D3D_BLOB_ROOT_SIGNATURE = D3D_BLOB_PART.ROOT_SIGNATURE;
pub const D3D_BLOB_DEBUG_NAME = D3D_BLOB_PART.DEBUG_NAME;
pub const D3D_BLOB_TEST_ALTERNATE_SHADER = D3D_BLOB_PART.TEST_ALTERNATE_SHADER;
pub const D3D_BLOB_TEST_COMPILE_DETAILS = D3D_BLOB_PART.TEST_COMPILE_DETAILS;
pub const D3D_BLOB_TEST_COMPILE_PERF = D3D_BLOB_PART.TEST_COMPILE_PERF;
pub const D3D_BLOB_TEST_COMPILE_REPORT = D3D_BLOB_PART.TEST_COMPILE_REPORT;
pub const D3D_SHADER_DATA = extern struct {
pBytecode: ?*const anyopaque,
BytecodeLength: usize,
};
//--------------------------------------------------------------------------------
// Section: Functions (25)
//--------------------------------------------------------------------------------
pub extern "D3DCOMPILER_47" fn D3DReadFileToBlob(
pFileName: ?[*:0]const u16,
ppContents: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DWriteBlobToFile(
pBlob: ?*ID3DBlob,
pFileName: ?[*:0]const u16,
bOverwrite: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCompile(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pSourceName: ?[*:0]const u8,
pDefines: ?*const D3D_SHADER_MACRO,
pInclude: ?*ID3DInclude,
pEntrypoint: ?[*:0]const u8,
pTarget: ?[*:0]const u8,
Flags1: u32,
Flags2: u32,
ppCode: ?*?*ID3DBlob,
ppErrorMsgs: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCompile2(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pSourceName: ?[*:0]const u8,
pDefines: ?*const D3D_SHADER_MACRO,
pInclude: ?*ID3DInclude,
pEntrypoint: ?[*:0]const u8,
pTarget: ?[*:0]const u8,
Flags1: u32,
Flags2: u32,
SecondaryDataFlags: u32,
// TODO: what to do with BytesParamIndex 11?
pSecondaryData: ?*const anyopaque,
SecondaryDataSize: usize,
ppCode: ?*?*ID3DBlob,
ppErrorMsgs: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCompileFromFile(
pFileName: ?[*:0]const u16,
pDefines: ?*const D3D_SHADER_MACRO,
pInclude: ?*ID3DInclude,
pEntrypoint: ?[*:0]const u8,
pTarget: ?[*:0]const u8,
Flags1: u32,
Flags2: u32,
ppCode: ?*?*ID3DBlob,
ppErrorMsgs: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DPreprocess(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pSourceName: ?[*:0]const u8,
pDefines: ?*const D3D_SHADER_MACRO,
pInclude: ?*ID3DInclude,
ppCodeText: ?*?*ID3DBlob,
ppErrorMsgs: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DGetDebugInfo(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
ppDebugInfo: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DReflect(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pInterface: ?*const Guid,
ppReflector: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DReflectLibrary(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
riid: ?*const Guid,
ppReflector: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DDisassemble(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
Flags: u32,
szComments: ?[*:0]const u8,
ppDisassembly: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DDisassembleRegion(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
Flags: u32,
szComments: ?[*:0]const u8,
StartByteOffset: usize,
NumInsts: usize,
pFinishByteOffset: ?*usize,
ppDisassembly: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCreateLinker(
ppLinker: ?*?*ID3D11Linker,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DLoadModule(
pSrcData: ?*const anyopaque,
cbSrcDataSize: usize,
ppModule: ?*?*ID3D11Module,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCreateFunctionLinkingGraph(
uFlags: u32,
ppFunctionLinkingGraph: ?*?*ID3D11FunctionLinkingGraph,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DGetTraceInstructionOffsets(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
Flags: u32,
StartInstIndex: usize,
NumInsts: usize,
pOffsets: ?[*]usize,
pTotalInsts: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DGetInputSignatureBlob(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
ppSignatureBlob: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DGetOutputSignatureBlob(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
ppSignatureBlob: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DGetInputAndOutputSignatureBlob(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
ppSignatureBlob: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DStripShader(
// TODO: what to do with BytesParamIndex 1?
pShaderBytecode: ?*const anyopaque,
BytecodeLength: usize,
uStripFlags: u32,
ppStrippedBlob: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DGetBlobPart(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
Part: D3D_BLOB_PART,
Flags: u32,
ppPart: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DSetBlobPart(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
Part: D3D_BLOB_PART,
Flags: u32,
// TODO: what to do with BytesParamIndex 5?
pPart: ?*const anyopaque,
PartSize: usize,
ppNewShader: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCreateBlob(
Size: usize,
ppBlob: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DCompressShaders(
uNumShaders: u32,
pShaderData: [*]D3D_SHADER_DATA,
uFlags: u32,
ppCompressedData: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DDecompressShaders(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
uNumShaders: u32,
uStartIndex: u32,
pIndices: ?[*]u32,
uFlags: u32,
ppShaders: [*]?*ID3DBlob,
pTotalShaders: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "D3DCOMPILER_47" fn D3DDisassemble10Effect(
pEffect: ?*ID3D10Effect,
Flags: u32,
ppDisassembly: ?*?*ID3DBlob,
) 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 (12)
//--------------------------------------------------------------------------------
const Guid = @import("../../zig.zig").Guid;
const BOOL = @import("../../foundation.zig").BOOL;
const D3D_SHADER_MACRO = @import("../../graphics/direct3d.zig").D3D_SHADER_MACRO;
const HRESULT = @import("../../foundation.zig").HRESULT;
const ID3D10Effect = @import("../../graphics/direct3d10.zig").ID3D10Effect;
const ID3D11FunctionLinkingGraph = @import("../../graphics/direct3d11.zig").ID3D11FunctionLinkingGraph;
const ID3D11Linker = @import("../../graphics/direct3d11.zig").ID3D11Linker;
const ID3D11Module = @import("../../graphics/direct3d11.zig").ID3D11Module;
const ID3DBlob = @import("../../graphics/direct3d.zig").ID3DBlob;
const ID3DInclude = @import("../../graphics/direct3d.zig").ID3DInclude;
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(), "pD3DCompile")) { _ = pD3DCompile; }
if (@hasDecl(@This(), "pD3DPreprocess")) { _ = pD3DPreprocess; }
if (@hasDecl(@This(), "pD3DDisassemble")) { _ = pD3DDisassemble; }
@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/fxc.zig |
const ImageReader = zigimg.ImageReader;
const ImageSeekStream = zigimg.ImageSeekStream;
const PixelFormat = zigimg.PixelFormat;
const assert = std.debug.assert;
const tga = zigimg.tga;
const color = zigimg.color;
const errors = zigimg.errors;
const std = @import("std");
const testing = std.testing;
const zigimg = @import("zigimg");
const helpers = @import("../helpers.zig");
test "Should error on non TGA images" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/bmp/simple_v4.bmp");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
const invalidFile = tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectError(invalidFile, errors.ImageError.InvalidMagicHeader);
}
test "Read ubw8 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/ubw8.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Grayscale8);
const expected_strip = [_]u8{ 76, 149, 178, 0, 76, 149, 178, 254, 76, 149, 178, 0, 76, 149, 178, 254 };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Grayscale8);
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Grayscale8[stride + x].value, expected_strip[strip_index]);
}
}
}
}
test "Read ucm8 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/ucm8.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Bpp8);
const expected_strip = [_]u8{ 64, 128, 192, 0, 64, 128, 192, 255, 64, 128, 192, 0, 64, 128, 192, 255 };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Bpp8);
try helpers.expectEq(pixels.Bpp8.indices.len, 128 * 128);
try helpers.expectEq(pixels.Bpp8.palette[0].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0x000000));
try helpers.expectEq(pixels.Bpp8.palette[64].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0xff0000));
try helpers.expectEq(pixels.Bpp8.palette[128].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0x00ff00));
try helpers.expectEq(pixels.Bpp8.palette[192].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0x0000ff));
try helpers.expectEq(pixels.Bpp8.palette[255].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0xffffff));
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Bpp8.indices[stride + x], expected_strip[strip_index]);
}
}
}
}
test "Read utc16 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/utc16.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Rgb555);
const expected_strip = [_]u32{ 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff, 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Rgb555);
try helpers.expectEq(pixels.Rgb555.len, 128 * 128);
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Rgb555[stride + x].toColor().toIntegerColor8(), color.IntegerColor8.fromHtmlHex(expected_strip[strip_index]));
}
}
}
}
test "Read utc24 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/utc24.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Rgb24);
const expected_strip = [_]u32{ 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff, 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Rgb24);
try helpers.expectEq(pixels.Rgb24.len, 128 * 128);
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Rgb24[stride + x].toColor().toIntegerColor8(), color.IntegerColor8.fromHtmlHex(expected_strip[strip_index]));
}
}
}
}
test "Read utc32 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/utc32.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Rgba32);
const expected_strip = [_]u32{ 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff, 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Rgba32);
try helpers.expectEq(pixels.Rgba32.len, 128 * 128);
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Rgba32[stride + x].toColor().toIntegerColor8(), color.IntegerColor8.fromHtmlHex(expected_strip[strip_index]));
}
}
}
}
test "Read cbw8 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/cbw8.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Grayscale8);
const expected_strip = [_]u8{ 76, 149, 178, 0, 76, 149, 178, 254, 76, 149, 178, 0, 76, 149, 178, 254 };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Grayscale8);
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Grayscale8[stride + x].value, expected_strip[strip_index]);
}
}
}
}
test "Read ccm8 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/ccm8.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Bpp8);
const expected_strip = [_]u8{ 64, 128, 192, 0, 64, 128, 192, 255, 64, 128, 192, 0, 64, 128, 192, 255 };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Bpp8);
try helpers.expectEq(pixels.Bpp8.indices.len, 128 * 128);
try helpers.expectEq(pixels.Bpp8.palette[0].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0x000000));
try helpers.expectEq(pixels.Bpp8.palette[64].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0xff0000));
try helpers.expectEq(pixels.Bpp8.palette[128].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0x00ff00));
try helpers.expectEq(pixels.Bpp8.palette[192].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0x0000ff));
try helpers.expectEq(pixels.Bpp8.palette[255].toIntegerColor8(), color.IntegerColor8.fromHtmlHex(0xffffff));
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Bpp8.indices[stride + x], expected_strip[strip_index]);
}
}
}
}
test "Read ctc24 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/ctc24.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 128);
try helpers.expectEq(tga_file.height(), 128);
try helpers.expectEq(try tga_file.pixelFormat(), .Rgb24);
const expected_strip = [_]u32{ 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff, 0xff0000, 0x00ff00, 0x0000ff, 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff };
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Rgb24);
try helpers.expectEq(pixels.Rgb24.len, 128 * 128);
const width = tga_file.width();
const height = tga_file.height();
var y: usize = 0;
while (y < height) : (y += 1) {
var x: usize = 0;
const stride = y * width;
while (x < width) : (x += 1) {
const strip_index = x / 8;
try helpers.expectEq(pixels.Rgb24[stride + x].toColor().toIntegerColor8(), color.IntegerColor8.fromHtmlHex(expected_strip[strip_index]));
}
}
}
}
test "Read matte-01 TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/matte-01.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 1280);
try helpers.expectEq(tga_file.height(), 720);
try helpers.expectEq(try tga_file.pixelFormat(), .Rgba32);
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Rgba32);
try helpers.expectEq(pixels.Rgba32.len, 1280 * 720);
const test_inputs = [_]helpers.TestInput{
.{
.x = 0,
.y = 0,
.hex = 0x3b5f38,
},
.{
.x = 608,
.y = 357,
.hex = 0x8e6c57,
},
.{
.x = 972,
.y = 679,
.hex = 0xa46c41,
},
};
for (test_inputs) |input| {
const expected_color = color.IntegerColor8.fromHtmlHex(input.hex);
const index = tga_file.header.width * input.y + input.x;
try helpers.expectEq(pixels.Rgba32[index].toColor().toIntegerColor8(), expected_color);
}
}
}
test "Read font TGA file" {
const file = try helpers.testOpenFile(helpers.zigimg_test_allocator, "tests/fixtures/tga/font.tga");
defer file.close();
var stream_source = std.io.StreamSource{ .file = file };
var tga_file = tga.TGA{};
var pixelsOpt: ?color.ColorStorage = null;
try tga_file.read(helpers.zigimg_test_allocator, stream_source.reader(), stream_source.seekableStream(), &pixelsOpt);
defer {
if (pixelsOpt) |pixels| {
pixels.deinit(helpers.zigimg_test_allocator);
}
}
try helpers.expectEq(tga_file.width(), 192);
try helpers.expectEq(tga_file.height(), 256);
try helpers.expectEq(try tga_file.pixelFormat(), .Rgba32);
try testing.expect(pixelsOpt != null);
if (pixelsOpt) |pixels| {
try testing.expect(pixels == .Rgba32);
try helpers.expectEq(pixels.Rgba32.len, 192 * 256);
const width = tga_file.width();
try helpers.expectEq(pixels.Rgba32[64 * width + 16].toColor().toIntegerColor8(), color.IntegerColor8.initRGBA(0, 0, 0, 0));
try helpers.expectEq(pixels.Rgba32[64 * width + 17].toColor().toIntegerColor8(), color.IntegerColor8.initRGBA(209, 209, 209, 255));
try helpers.expectEq(pixels.Rgba32[65 * width + 17].toColor().toIntegerColor8(), color.IntegerColor8.initRGBA(255, 255, 255, 255));
}
} | tests/formats/tga_test.zig |
const std = @import("std");
const string = @import("String.zig");
const Allocator = std.mem.Allocator;
const tags = @import("Tags.zig");
const ANSIEscCode = @import("ANSITerminal.zig").ANSIEscCode;
pub fn parseHTML(allocator: Allocator, html_: []const u8, output_ansi_codes: bool) ![]u8 {
var html = html_;
// 1 is added when a relevant tag is entered and subtracted when the tag is closed
var in_link: i32 = 0;
var in_bold: i32 = 0;
var in_italics: i32 = 0;
var in_underline: i32 = 0;
var in_strikethrough: i32 = 0;
var in_h1: i32 = 0;
var in_h2_h3: i32 = 0;
var in_list: i32 = 0;
var in_code: i32 = 0;
var tag_stack = std.ArrayList([]const u8).init(allocator);
defer tag_stack.deinit();
html = string.skip(html, string.isWhitespace, true);
var output_string = std.ArrayList(u8).init(allocator);
var ansi_state = ANSIEscCode{};
var ansi_str: [15]u8 = undefined;
// For merging whitespace together
// Cannot check output_string directly as it might end in a ANSI control code
var last_char_was_whitespace = false;
var last_char_was_newline = false;
while (html.len > 0) {
if (html[0] == '<') {
html = html[1..];
if (html.len == 0) {
break;
}
var is_closing_tag = false;
if (html[0] == '!') {
if (html.len < 3) {
break;
}
if (html[1] == '-' and html[2] == '-') {
// Comment
html = string.findAndSkip(html, "-->");
continue;
} else {
html = html[1..];
}
} else if (html[0] == '/') {
// Closing tag
is_closing_tag = true;
html = html[1..];
}
const tag_start = string.getStart(html, string.isASCIIAlphabet, true);
const tag_number_suffix = string.getStart(html[tag_start.len..], string.isDigit, true);
const tag = html[0 .. tag_start.len + tag_number_suffix.len];
html = html[tag.len..];
if (html.len == 0) {
break;
}
var in_vars_add: i32 = if (is_closing_tag) -1 else 1;
if (std.ascii.eqlIgnoreCase(tag, "ul") or std.ascii.eqlIgnoreCase(tag, "ol")) {
in_list += in_vars_add;
}
// Update colours
if (output_ansi_codes) {
if (std.ascii.eqlIgnoreCase(tag, "a")) {
in_link += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "strong") or std.ascii.eqlIgnoreCase(tag, "b")) {
in_bold += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "h1")) {
in_h1 += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "h2") or std.ascii.eqlIgnoreCase(tag, "h3")) {
in_h2_h3 += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "em") or std.ascii.eqlIgnoreCase(tag, "i")) {
in_italics += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "u")) {
in_underline += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "strike") or std.ascii.eqlIgnoreCase(tag, "s") or
std.ascii.eqlIgnoreCase(tag, "del"))
{
in_strikethrough += in_vars_add;
} else if (std.ascii.eqlIgnoreCase(tag, "code")) {
in_code += in_vars_add;
}
var new_ansi_state = ANSIEscCode{
.bold = in_bold > 0 or in_h1 > 0,
.underline = in_underline > 0,
.italics = in_italics > 0,
.strikethrough = in_strikethrough > 0,
};
if (in_link > 0) {
new_ansi_state.fg_colour = 6; // bright blue
} else if (in_h1 > 0 or in_h2_h3 > 0) {
new_ansi_state.fg_colour = 8 | 1; // bright red
} else if (in_code > 0) {
new_ansi_state.fg_colour = 7; // grey
} else {
new_ansi_state.fg_colour = 0; // default
}
if (!ansi_state.eq(new_ansi_state)) {
ansi_state = new_ansi_state;
try output_string.appendSlice(ansi_state.get(&ansi_str));
}
}
// Tag stack
if (!tags.singleton_tags.has(tag)) {
if (is_closing_tag) {
// Find last occurence of this tag and move stack back to tag before that
var i: isize = @intCast(isize, tag_stack.items.len) - 1;
while (i >= 0) : (i -= 1) {
if (std.ascii.eqlIgnoreCase(tag_stack.items[@intCast(usize, i)], tag)) {
tag_stack.items.len = @intCast(usize, i);
break;
}
}
} else {
try tag_stack.append(tag);
}
if (!tags.inline_tags.has(tag)) {
if (!last_char_was_newline) {
try output_string.appendNTimes('\n', 2);
last_char_was_whitespace = true;
last_char_was_newline = true;
}
}
// bullet point for lists
// TODO ordered lists
if (!is_closing_tag and std.ascii.eqlIgnoreCase(tag, "li")) {
if (in_list >= 0) {
try output_string.appendNTimes('\t', @intCast(usize, in_list));
}
try output_string.appendSlice("• ");
last_char_was_whitespace = true;
last_char_was_newline = true; // Next non-inline element won't start new line
}
} else if (std.ascii.eqlIgnoreCase(tag, "br")) {
try output_string.append('\n');
}
// Skip to end of tag (attributes are ignored)
html = string.skipToCharacterNotInQuotes(html, '>');
if (html.len > 0) {
html = html[1..];
}
if (tags.no_display_tags.has(tag)) {
// Skip contents (find closing tag)
while (html.len > 0) {
html = string.skipToCharacterNotInQuotes(html, '<');
if (html.len < 2 + tag.len + 1) {
html = &[_]u8{};
break;
}
html = html[1..];
if (html[0] != '/') {
continue;
}
if (!std.ascii.eqlIgnoreCase(tag, string.getStart(html[1..], string.isASCIIAlphabet, true))) {
continue;
}
html = string.skipToCharacterNotInQuotes(html, '>');
if (html.len >= 2) {
html = html[1..];
}
break;
}
}
} else {
// Output contents of tag
// Combine whitespace at start
if (string.isWhitespace(html[0]) and !last_char_was_whitespace) {
try output_string.append(' ');
last_char_was_whitespace = true;
last_char_was_newline = false;
html = html[1..];
}
while (html.len > 0 and html[0] != '<') {
if (html[0] == '&' and html.len >= 3 and
(html[1] == '#' or string.isASCIIAlphabet(html[1])))
{
// Character reference
const codepoint_maybe = try parse_char_ref(&html, &output_string);
if (codepoint_maybe) |codepoint| {
last_char_was_whitespace = codepoint <= 255 and
string.isWhitespace(@intCast(u8, codepoint));
last_char_was_newline = codepoint == '\n';
} else {
try output_string.append('&');
html = html[1..];
}
} else if (string.isWhitespace(html[0])) {
if (!last_char_was_whitespace) {
try output_string.append(' ');
last_char_was_whitespace = true;
last_char_was_newline = false;
}
html = html[1..];
} else if (html.len >= 2 and (string.startsWith(html, "¶") or string.startsWith(html, "§"))) {
// Skip over pilcrows and section signs
html = html[2..];
} else if (html[0] < 32 or html[0] == 127) {
// Skip over control codes
html = html[1..];
} else {
last_char_was_whitespace = false;
last_char_was_newline = false;
try output_string.append(html[0]);
html = html[1..];
}
}
}
}
// Clear formatting
if (!ansi_state.eq(.{})) {
try output_string.appendSlice("\x1b[0m");
}
return output_string.items;
}
// If character reference is valid then unicode character is added to output_string
// and html slice is updated
fn parse_char_ref(html: *[]const u8, output_string: *std.ArrayList(u8)) !?u21 {
std.debug.assert(html.*.len >= 3 and html.*[0] == '&');
const old_html_slice = html.*;
html.* = html.*[1..];
const codepoint_maybe = get_char_ref_codepoint(html) catch null;
if (codepoint_maybe) |codepoint| {
var utf8: [4]u8 = undefined;
const utf8_bytes = std.unicode.utf8Encode(codepoint, utf8[0..]) catch unreachable;
try output_string.*.appendSlice(utf8[0..utf8_bytes]);
} else {
html.* = old_html_slice;
}
return codepoint_maybe;
}
// Returns UTF8 codepoint and skips html slice past character reference
fn get_char_ref_codepoint(html: *[]const u8) !u21 {
std.debug.assert(html.*.len >= 2);
if (html.*[0] == '#') {
// Codepoint
html.* = html.*[1..];
if (html.*[0] == 'x' or html.*[0] == 'X') {
// Hex
html.* = html.*[1..];
if (html.*.len < 2) {
return error.FormatError;
}
const s = string.getStart(html.*, string.isHexDigit, true);
if (s.len == html.*.len or html.*[s.len] != ';') {
return error.FormatError;
}
html.* = html.*[s.len + 1 ..];
const u = try std.fmt.parseUnsigned(u21, s, 16);
if (u >= 0x110000) {
return error.TooLarge;
}
if (u < 32) { // ASCII control codes
return 0xfffd; // replacement character
}
return u;
} else if (string.isDigit(html.*[0])) {
// Dec
const s = string.getStart(html.*, string.isDigit, true);
if (s.len == html.*.len or html.*[s.len] != ';') {
return error.FormatError;
}
html.* = html.*[s.len + 1 ..];
const u = try std.fmt.parseUnsigned(u21, s, 10);
if (u >= 0x110000) {
return error.TooLarge;
}
if (u < 32) { // ASCII control codes
return 0xfffd; // replacement character
}
return u;
}
} else if (string.isASCIIAlphabet(html.*[0])) {
// Name
const s = string.getStart(html.*, string.isASCIIAlphabet, true);
if (s.len == html.*.len or html.*[s.len] != ';') {
return error.FormatError;
}
html.* = html.*[s.len + 1 ..];
if (std.ascii.eqlIgnoreCase(s, "lt")) {
return '<';
} else if (std.ascii.eqlIgnoreCase(s, "gt")) {
return '>';
} else if (std.ascii.eqlIgnoreCase(s, "quot")) {
return '"';
} else if (std.ascii.eqlIgnoreCase(s, "amp")) {
return '&';
} else if (std.ascii.eqlIgnoreCase(s, "nbsp")) {
return ' ';
} else if (std.ascii.eqlIgnoreCase(s, "raquo")) {
return '»';
}
// TODO There are hundreds of other unicode character names which are all valid in HTML.
}
return error.FormatError;
}
fn getFilePath(allocator: Allocator) ?[]const u8 {
var args = std.process.args();
defer args.deinit();
// Skip application path
const skipped = args.skip();
if (!skipped) {
return null;
}
// Get file path
const path_maybe = args.next(allocator);
if (path_maybe) |path| {
return path catch null;
} else {
return null;
}
}
fn loadHTML(allocator: Allocator, path_maybe: ?[]const u8) ![]const u8 {
if (path_maybe) |path| {
return try std.fs.cwd().readFileAlloc(allocator, path, 8 * 1024 * 1024);
} else {
// Read file from stdin
const f = std.io.getStdIn();
var a = std.ArrayList(u8).init(allocator);
var offset: usize = 0;
var size: usize = 0;
while (true) {
try a.resize(a.items.len + 64 * 1024);
const n = try f.read(a.items[offset..]);
if (n < 64 * 1024) {
size += n;
return a.items[0..size];
} else {
size += n;
offset += n;
}
}
return try f.readToEndAlloc(allocator, 8 * 1024 * 1024);
}
}
pub fn main() anyerror!void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
const path_maybe = getFilePath(allocator);
defer {
if (path_maybe) |path| {
allocator.free(path);
}
}
const html = try loadHTML(allocator, path_maybe);
defer allocator.free(html);
const s = try parseHTML(allocator, html, true);
defer allocator.free(s);
try std.io.getStdOut().writer().print("{s}\n", .{s});
}
test "" {
_ = @import("String.zig");
}
test "HTML" {
const allocator = std.testing.allocator;
const s = try parseHTML(allocator, "<b>hello <i>123</i></b>", true);
defer allocator.free(s);
std.debug.print("s [{s}]\n", .{s});
try std.testing.expectEqualSlices(u8, s, "\x1b[0;1mhello \x1b[0;1;3m123\x1b[0;1m\x1b[0m");
} | src/main.zig |
const vmem = @import("vmem.zig");
const x86 = @import("x86.zig");
// Description of an ELF executable.
const ELFHeader = packed struct {
e_ident: [16]u8,
e_type: u16,
e_machine: u16,
e_version: u32,
e_entry: u32,
e_phoff: u32,
e_shoff: u32,
e_flags: u32,
e_ehsize: u16,
e_phentsize: u16,
e_phnum: u16,
e_shentsize: u16,
e_shnum: u16,
e_shstrndx: u16,
};
// Type of a segment.
const PT_NULL = 0;
const PT_LOAD = 1;
const PT_DYNAMIC = 2;
const PT_INTERP = 3;
const PT_NOTE = 4;
const PT_SHLIB = 5;
const PT_PHDR = 6;
const PT_TLS = 7;
// Segment permission flags.
const PF_X = 0x1;
const PF_W = 0x2;
const PF_R = 0x4;
// Description of an ELF program segment.
const ELFProgHeader = packed struct {
p_type: u32,
p_offset: u32,
p_vaddr: u32,
p_paddr: u32,
p_filesz: u32,
p_memsz: u32,
p_flags: u32,
p_align: u32,
};
////
// Load an ELF file.
//
// Arguments:
// elf_addr: Pointer to the beginning of the ELF.
//
// Returns:
// Pointer to the entry point of the ELF.
//
pub fn load(elf_addr: usize) usize {
// Get the ELF structures.
const elf = @intToPtr(&ELFHeader, elf_addr);
const ph_tbl = @intToPtr(&ELFProgHeader, elf_addr + elf.e_phoff)[0..elf.e_phnum];
// Iterate over the Program Header Table.
for (ph_tbl) |ph| {
// Load this segment if needed.
if (ph.p_type == PT_LOAD) {
var flags = u16(vmem.PAGE_USER);
if (ph.p_flags & PF_W != 0) {
flags |= vmem.PAGE_WRITE;
}
// Map the requested pages.
var addr: usize = ph.p_vaddr;
while (addr < (ph.p_vaddr + ph.p_memsz)) : (addr += x86.PAGE_SIZE) {
vmem.map(addr, null, flags);
}
// Copy the segment data, and fill the rest with zeroes.
const dest = @intToPtr(&u8, ph.p_vaddr);
const src = @intToPtr(&u8, elf_addr + ph.p_offset);
@memcpy(dest, src, ph.p_filesz);
@memset(&dest[ph.p_filesz], 0, ph.p_memsz - ph.p_filesz);
}
}
return elf.e_entry;
} | kernel/elf.zig |
const std = @import("std");
const clap = @import("clap");
usingnamespace @import("common.zig");
usingnamespace @import("lexer.zig");
usingnamespace @import("parser.zig");
usingnamespace @import("error_handler.zig");
usingnamespace @import("code_formatter.zig");
usingnamespace @import("dot_printer.zig");
usingnamespace @import("compiler.zig");
usingnamespace @import("job.zig");
pub const log = @import("logger.zig").log;
pub const log_level: std.log.Level = .info;
pub fn main() anyerror!void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var allocator = &gpa.allocator;
std.debug.print("Orbit 0.0.1\n", .{});
const params = comptime [_]clap.Param(clap.Help){
clap.parseParam("-c, --compile Compile input files.") catch unreachable,
clap.parseParam("-l, --lex Only lex input files.") catch unreachable,
clap.parseParam("-p, --parse Only parse input files.") catch unreachable,
clap.parseParam("-g, --graph Print ast as graph.") catch unreachable,
clap.parseParam("<POS>...") catch unreachable,
};
var diag = clap.Diagnostic{};
var args = clap.parse(clap.Help, ¶ms, .{.allocator = allocator, .diagnostic = &diag}) catch |err| {
diag.report(std.io.getStdErr().writer(), err) catch {};
return err;
};
defer args.deinit();
var files = std.ArrayList([]const u8).init(allocator);
defer files.deinit();
for (args.positionals()) |pos| {
std.log.info("{s}", .{pos});
try files.append(pos);
}
if (args.flag("--lex")) {
try lexFiles(files.items, allocator);
return;
}
if (args.flag("--parse")) {
try parseFiles(files.items, allocator);
return;
}
if (args.flag("--graph")) {
try printGraph(files.items, allocator);
return;
}
if (args.flag("--compile")) {
try compileFiles(files.items, allocator);
return;
}
}
pub fn compileFiles(files: [][]const u8, allocator: *std.mem.Allocator) anyerror!void {
var errorReporter = ConsoleErrorReporter.init(std.io.getStdErr().writer());
var compiler = try Compiler.init(allocator, &errorReporter.reporter);
defer compiler.deinit();
if (files.len == 0) {
_ = try compiler.allocateAndAddJob(LoadFileJob{ .fileName = "./examples/test.orb" });
} else {
for (files) |file| {
_ = try compiler.allocateAndAddJob(LoadFileJob{ .fileName = file });
}
}
compiler.run() catch |err| switch (err) {
error.CompilationFailed => std.os.exit(69),
else => return err,
};
}
pub fn parseFiles(files: [][]const u8, _allocator: *std.mem.Allocator) anyerror!void {
const T = struct {
pub fn parseFile(file: []const u8, allocator: *std.mem.Allocator) anyerror!void {
const fileContent = try std.fs.cwd().readFileAlloc(allocator, file, std.math.maxInt(usize));
defer allocator.free(fileContent);
var lexer = try Lexer.init(file, fileContent);
var errorReporter = ConsoleErrorReporter.init(std.io.getStdErr().writer());
var parser = Parser.init(lexer, allocator, &errorReporter.reporter);
defer parser.deinit();
var astFormatter = AstFormatter.init();
while (try parser.parseTopLevelExpression()) |expr| {
try astFormatter.format(std.io.getStdOut().writer(), expr, 0);
try std.io.getStdOut().writer().writeAll("\n");
}
std.debug.print("\n", .{});
}
};
if (files.len == 0) {
T.parseFile("./examples/test.orb", _allocator) catch |err| {
std.log.err("Failed to parse file {s}: {any}", .{ "./examples/test.orb", err });
};
} else {
for (files) |file| {
T.parseFile(file, _allocator) catch |err| {
std.log.err("Failed to parse file {s}: {any}", .{ file, err });
};
}
}
}
pub fn printGraph(files: [][]const u8, _allocator: *std.mem.Allocator) anyerror!void {
const T = struct {
pub fn parseFile(file: []const u8, allocator: *std.mem.Allocator) anyerror!void {
const fileContent = try std.fs.cwd().readFileAlloc(allocator, file, std.math.maxInt(usize));
defer allocator.free(fileContent);
var lexer = try Lexer.init(file, fileContent);
var errorReporter = ConsoleErrorReporter.init(std.io.getStdErr().writer());
var parser = Parser.init(lexer, allocator, &errorReporter.reporter);
defer parser.deinit();
var newFileName = StringBuf.init(allocator);
try std.fmt.format(newFileName.writer(), "{s}.gv", .{file});
defer newFileName.deinit();
var graphFile = try std.fs.cwd().createFile(newFileName.items, .{});
defer graphFile.close();
var dotPrinter = try DotPrinter.init(graphFile.writer(), false);
defer dotPrinter.deinit(graphFile.writer());
while (try parser.parseTopLevelExpression()) |expr| {
try dotPrinter.printGraph(graphFile.writer(), expr);
}
std.debug.print("\n", .{});
}
};
if (files.len == 0) {
T.parseFile("./examples/test.orb", _allocator) catch |err| {
std.log.err("Failed to parse file {s}: {any}", .{ "./examples/test.orb", err });
};
} else {
for (files) |file| {
T.parseFile(file, _allocator) catch |err| {
std.log.err("Failed to parse file {s}: {any}", .{ file, err });
};
}
}
}
pub fn lexFiles(files: [][]const u8, _allocator: *std.mem.Allocator) anyerror!void {
const T = struct {
pub fn lexFile(file: []const u8, allocator: *std.mem.Allocator) anyerror!void {
const fileContent = try std.fs.cwd().readFileAlloc(allocator, file, std.math.maxInt(usize));
defer allocator.free(fileContent);
var lexer = try Lexer.init(file, fileContent);
while (lexer.read()) |token| {
switch (token.kind) {
.Identifier => {
std.log.info("{s}", .{token.data.text});
},
.String => {
std.log.info("\"{s}\"", .{token.data.text});
},
.Char => {
var buff: [4]u8 = undefined;
const bytes = try std.unicode.utf8Encode(token.data.char, buff[0..buff.len]);
std.log.info("'{s}'", .{buff[0..bytes]});
},
else => {
std.log.info("{any}", .{token});
},
}
}
std.debug.print("\n", .{});
}
};
if (files.len == 0) {
T.lexFile("./examples/test.orb", _allocator) catch |err| {
std.log.err("Failed to lex file {s}: {any}", .{ "./examples/test.orb", err });
};
} else {
for (files) |file| {
T.lexFile(file, _allocator) catch |err| {
std.log.err("Failed to lex file {s}: {any}", .{ file, err });
};
}
}
} | src/main.zig |
usingnamespace @import("c.zig");
// Types
pub const Bool32 = VkBool32;
pub const DebugUtilsMessageTypeFlags = VkDebugUtilsMessageTypeFlagsEXT;
pub const PipelineStageFlags = VkPipelineStageFlags;
// Constants
pub const debug_utils_extension_name = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
pub const layer_khronos_validation = "VK_LAYER_KHRONOS_validation"; // XXX
pub const subpass_external = VK_SUBPASS_EXTERNAL;
pub const swapchain_extension_name = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
// Flags
pub const access_color_attachment_write_bit = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
pub const color_component_a_bit = VK_COLOR_COMPONENT_A_BIT;
pub const color_component_b_bit = VK_COLOR_COMPONENT_B_BIT;
pub const color_component_g_bit = VK_COLOR_COMPONENT_G_BIT;
pub const color_component_r_bit = VK_COLOR_COMPONENT_R_BIT;
pub const cull_mode_back_bit = VK_CULL_MODE_BACK_BIT;
pub const debug_utils_message_severity_error_bit = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
pub const debug_utils_message_severity_verbose_bit = VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
pub const debug_utils_message_severity_warning_bit = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT;
pub const debug_utils_message_type_general_bit = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT;
pub const debug_utils_message_type_performance_bit = VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
pub const debug_utils_message_type_validation_bit = VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT;
pub const fence_create_signaled_bit = VK_FENCE_CREATE_SIGNALED_BIT;
pub const image_aspect_color_bit = VK_IMAGE_ASPECT_COLOR_BIT;
pub const image_usage_color_attachment_bit = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
pub const pipeline_stage_color_attachment_output_bit = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
pub const queue_graphics_bit = VK_QUEUE_GRAPHICS_BIT;
// Enumerations
pub const DebugUtilsMessageSeverityFlagBits = VkDebugUtilsMessageSeverityFlagBitsEXT;
pub const Format = VkFormat;
pub const PresentMode = VkPresentModeKHR;
// Unions
pub const ClearColorValue = VkClearColorValue;
pub const ClearValue = VkClearValue;
// Structures
const AllocationCallbacks = VkAllocationCallbacks;
pub const ApplicationInfo = VkApplicationInfo;
pub const AttachmentDescription = VkAttachmentDescription;
pub const AttachmentReference = VkAttachmentReference;
pub const CommandBufferAllocateInfo = VkCommandBufferAllocateInfo;
pub const CommandBufferBeginInfo = VkCommandBufferBeginInfo;
pub const CommandPoolCreateInfo = VkCommandPoolCreateInfo;
pub const ComponentMapping = VkComponentMapping;
pub const DebugUtilsMessengerCallbackData = VkDebugUtilsMessengerCallbackDataEXT;
pub const DebugUtilsMessengerCreateInfo = VkDebugUtilsMessengerCreateInfoEXT;
pub const DeviceCreateInfo = VkDeviceCreateInfo;
pub const DeviceQueueCreateInfo = VkDeviceQueueCreateInfo;
pub const ExtensionProperties = VkExtensionProperties;
pub const Extent2D = VkExtent2D;
pub const FenceCreateInfo = VkFenceCreateInfo;
pub const FramebufferCreateInfo = VkFramebufferCreateInfo;
pub const GraphicsPipelineCreateInfo = VkGraphicsPipelineCreateInfo;
pub const ImageSubresourceRange = VkImageSubresourceRange;
pub const ImageViewCreateInfo = VkImageViewCreateInfo;
pub const InstanceCreateInfo = VkInstanceCreateInfo;
pub const LayerProperties = VkLayerProperties;
pub const Offset2D = VkOffset2D;
pub const PhysicalDeviceFeatures = VkPhysicalDeviceFeatures;
pub const PipelineColorBlendAttachmentState = VkPipelineColorBlendAttachmentState;
pub const PipelineColorBlendStateCreateInfo = VkPipelineColorBlendStateCreateInfo;
pub const PipelineInputAssemblyStateCreateInfo = VkPipelineInputAssemblyStateCreateInfo;
pub const PipelineLayoutCreateInfo = VkPipelineLayoutCreateInfo;
pub const PipelineMultisampleStateCreateInfo = VkPipelineMultisampleStateCreateInfo;
pub const PipelineRasterizationStateCreateInfo = VkPipelineRasterizationStateCreateInfo;
pub const PipelineShaderStageCreateInfo = VkPipelineShaderStageCreateInfo;
pub const PipelineVertexInputStateCreateInfo = VkPipelineVertexInputStateCreateInfo;
pub const PipelineViewportStateCreateInfo = VkPipelineViewportStateCreateInfo;
pub const PresentInfo = VkPresentInfoKHR;
pub const QueueFamilyProperties = VkQueueFamilyProperties;
pub const Rect2D = VkRect2D;
pub const RenderPassBeginInfo = VkRenderPassBeginInfo;
pub const RenderPassCreateInfo = VkRenderPassCreateInfo;
pub const SemaphoreCreateInfo = VkSemaphoreCreateInfo;
pub const ShaderModuleCreateInfo = VkShaderModuleCreateInfo;
pub const SubmitInfo = VkSubmitInfo;
pub const SubpassDependency = VkSubpassDependency;
pub const SubpassDescription = VkSubpassDescription;
pub const SurfaceCapabilities = VkSurfaceCapabilitiesKHR;
pub const SurfaceFormat = VkSurfaceFormatKHR;
pub const SwapchainCreateInfo = VkSwapchainCreateInfoKHR;
pub const Viewport = VkViewport;
// Opaque Handles
const PipelineCache = VkPipelineCache;
pub const CommandBuffer = VkCommandBuffer;
pub const CommandPool = VkCommandPool;
pub const DebugUtilsMessenger = VkDebugUtilsMessengerEXT;
pub const Device = VkDevice;
pub const Fence = VkFence;
pub const Framebuffer = VkFramebuffer;
pub const Image = VkImage;
pub const ImageView = VkImageView;
pub const Instance = VkInstance;
pub const PhysicalDevice = VkPhysicalDevice;
pub const Pipeline = VkPipeline;
pub const PipelineLayout = VkPipelineLayout;
pub const Queue = VkQueue;
pub const RenderPass = VkRenderPass;
pub const Semaphore = VkSemaphore;
pub const ShaderModule = VkShaderModule;
pub const Surface = VkSurfaceKHR;
pub const Swapchain = VkSwapchainKHR;
// Functions
pub const cmdBeginRenderPass = vkCmdBeginRenderPass;
pub const cmdBindPipeline = vkCmdBindPipeline;
pub const cmdDraw = vkCmdDraw;
pub const cmdEndRenderPass = vkCmdEndRenderPass;
pub const destroyCommandPool = vkDestroyCommandPool;
pub const destroyDevice = vkDestroyDevice;
pub const destroyFence = vkDestroyFence;
pub const destroyFramebuffer = vkDestroyFramebuffer;
pub const destroyImageView = vkDestroyImageView;
pub const destroyInstance = vkDestroyInstance;
pub const destroyPipeline = vkDestroyPipeline;
pub const destroyPipelineLayout = vkDestroyPipelineLayout;
pub const destroyRenderPass = vkDestroyRenderPass;
pub const destroySemaphore = vkDestroySemaphore;
pub const destroyShaderModule = vkDestroyShaderModule;
pub const destroySurface = vkDestroySurfaceKHR;
pub const destroySwapchain = vkDestroySwapchainKHR;
pub const getDeviceQueue = vkGetDeviceQueue;
pub inline fn freeCommandBuffers(
device: Device,
command_pool: CommandPool,
command_buffers: []const CommandBuffer,
) void {
vkFreeCommandBuffers(device, command_pool, @intCast(u32, command_buffers.len), command_buffers.ptr);
}
pub inline fn getPhysicalDeviceQueueFamilyProperties(
physical_device: PhysicalDevice,
queue_family_property_count: *u32,
queue_family_properties: ?[]QueueFamilyProperties,
) void {
vkGetPhysicalDeviceQueueFamilyProperties(physical_device, queue_family_property_count, if (queue_family_properties) |props| props.ptr else null);
}
pub inline fn acquireNextImage(
device: Device,
swapchain: Swapchain,
timeout: u64,
semaphore: Semaphore,
fence: Fence,
image_index: *u32,
) !Success {
return switch (vkAcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, image_index)) {
.VK_SUCCESS => .Success,
.VK_TIMEOUT => .Timeout,
.VK_NOT_READY => .NotReady,
.VK_SUBOPTIMAL_KHR => .Suboptimal,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
.VK_ERROR_OUT_OF_DATE_KHR => Error.OutOfDate,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
.VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT => Error.FullScreenExclusiveModeLost,
else => unreachable,
};
}
pub inline fn allocateCommandBuffers(
device: Device,
allocate_info: *const CommandBufferAllocateInfo,
command_buffers: []CommandBuffer,
) !void {
return switch (vkAllocateCommandBuffers(device, allocate_info, command_buffers.ptr)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn beginCommandBuffer(
command_buffer: CommandBuffer,
begin_info: *const CommandBufferBeginInfo,
) !void {
return switch (vkBeginCommandBuffer(command_buffer, begin_info)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createCommandPool(
device: Device,
create_info: *const CommandPoolCreateInfo,
allocator: ?*const AllocationCallbacks,
command_pool: *CommandPool,
) !void {
return switch (vkCreateCommandPool(device, create_info, allocator, command_pool)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createDevice(
physical_device: PhysicalDevice,
create_info: *const DeviceCreateInfo,
allocator: ?*const AllocationCallbacks,
device: *Device,
) !void {
return switch (vkCreateDevice(physical_device, create_info, allocator, device)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_INITIALIZATION_FAILED => Error.InitializationFailed,
.VK_ERROR_EXTENSION_NOT_PRESENT => Error.ExtensionNotPresent,
.VK_ERROR_FEATURE_NOT_PRESENT => Error.FeatureNotPresent,
.VK_ERROR_TOO_MANY_OBJECTS => Error.TooManyObjects,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
else => unreachable,
};
}
pub inline fn createFence(
device: Device,
create_info: *const FenceCreateInfo,
allocator: ?*const AllocationCallbacks,
fence: *Fence,
) !void {
return switch (vkCreateFence(device, create_info, allocator, fence)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createFramebuffer(
device: Device,
create_info: *const FramebufferCreateInfo,
allocator: ?*const AllocationCallbacks,
framebuffer: *Framebuffer,
) !void {
return switch (vkCreateFramebuffer(device, create_info, allocator, framebuffer)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createGraphicsPipelines(
device: Device,
pipeline_cache: PipelineCache,
create_infos: []const GraphicsPipelineCreateInfo,
allocator: ?*const AllocationCallbacks,
pipelines: []Pipeline,
) !Success {
return switch (vkCreateGraphicsPipelines(device, pipeline_cache, @intCast(u32, create_infos.len), create_infos.ptr, allocator, pipelines.ptr)) {
.VK_SUCCESS => .Success,
.VK_PIPELINE_COMPILE_REQUIRED_EXT => .PipelineCompileRequired,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_INVALID_SHADER_NV => Error.InvalidShader,
else => unreachable,
};
}
pub inline fn createImageView(
device: Device,
create_info: *const ImageViewCreateInfo,
allocator: ?*const AllocationCallbacks,
view: *ImageView,
) !void {
return switch (vkCreateImageView(device, create_info, allocator, view)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createInstance(
create_info: *const InstanceCreateInfo,
allocator: ?*const AllocationCallbacks,
instance: *Instance,
) !void {
return switch (vkCreateInstance(create_info, allocator, instance)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_INITIALIZATION_FAILED => Error.InitializationFailed,
.VK_ERROR_LAYER_NOT_PRESENT => Error.LayerNotPresent,
.VK_ERROR_EXTENSION_NOT_PRESENT => Error.ExtensionNotPresent,
.VK_ERROR_INCOMPATIBLE_DRIVER => Error.IncompatibleDriver,
else => unreachable,
};
}
pub inline fn createPipelineLayout(
device: Device,
create_info: *const PipelineLayoutCreateInfo,
allocator: ?*const AllocationCallbacks,
pipeline_layout: *PipelineLayout,
) !void {
return switch (vkCreatePipelineLayout(device, create_info, allocator, pipeline_layout)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createRenderPass(
device: Device,
create_info: *const RenderPassCreateInfo,
allocator: ?*const AllocationCallbacks,
render_pass: *RenderPass,
) !void {
return switch (vkCreateRenderPass(device, create_info, allocator, render_pass)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createSemaphore(
device: Device,
create_info: *const SemaphoreCreateInfo,
allocator: ?*const AllocationCallbacks,
semaphore: *Semaphore,
) !void {
return switch (vkCreateSemaphore(device, create_info, allocator, semaphore)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn createShaderModule(
device: Device,
create_info: *const ShaderModuleCreateInfo,
allocator: ?*const AllocationCallbacks,
shader_module: *ShaderModule,
) !void {
return switch (vkCreateShaderModule(device, create_info, allocator, shader_module)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_INVALID_SHADER_NV => Error.InvalidShader,
else => unreachable,
};
}
pub inline fn createSwapchain(
device: Device,
create_info: *const SwapchainCreateInfo,
allocator: ?*const AllocationCallbacks,
swapchain: *Swapchain,
) !void {
return switch (vkCreateSwapchainKHR(device, create_info, allocator, swapchain)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
.VK_ERROR_NATIVE_WINDOW_IN_USE_KHR => Error.NativeWindowInUse,
.VK_ERROR_INITIALIZATION_FAILED => Error.InitializationFailed,
else => unreachable,
};
}
pub inline fn deviceWaitIdle(
device: Device,
) !void {
return switch (vkDeviceWaitIdle(device)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
else => unreachable,
};
}
pub inline fn endCommandBuffer(
command_buffer: CommandBuffer,
) !void {
return switch (vkEndCommandBuffer(command_buffer)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn enumerateDeviceExtensionProperties(
physical_device: PhysicalDevice,
layer_name: ?*const u8,
property_count: *u32,
properties: ?[]ExtensionProperties,
) !Success {
return switch (vkEnumerateDeviceExtensionProperties(physical_device, layer_name, property_count, if (properties) |props| props.ptr else null)) {
.VK_SUCCESS => .Success,
.VK_INCOMPLETE => .Incomplete,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_LAYER_NOT_PRESENT => Error.LayerNotPresent,
else => unreachable,
};
}
pub inline fn enumerateInstanceLayerProperties(
property_count: *u32,
properties: ?[]LayerProperties,
) !Success {
return switch (vkEnumerateInstanceLayerProperties(property_count, if (properties) |props| props.ptr else null)) {
.VK_SUCCESS => .Success,
.VK_INCOMPLETE => .Incomplete,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn enumeratePhysicalDevices(
instance: Instance,
physical_device_count: *u32,
physical_devices: ?[]PhysicalDevice,
) !Success {
return switch (vkEnumeratePhysicalDevices(instance, physical_device_count, if (physical_devices) |devs| devs.ptr else null)) {
.VK_SUCCESS => .Success,
.VK_INCOMPLETE => .Incomplete,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_INITIALIZATION_FAILED => Error.InitializationFailed,
else => unreachable,
};
}
pub inline fn getPhysicalDeviceSurfaceCapabilities(
physical_device: PhysicalDevice,
surface: Surface,
surface_capabilities: *SurfaceCapabilities,
) !void {
return switch (vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_device, surface, surface_capabilities)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
else => unreachable,
};
}
pub inline fn getPhysicalDeviceSurfaceFormats(
physical_device: PhysicalDevice,
surface: Surface,
surface_format_count: *u32,
surface_formats: ?[]SurfaceFormat,
) !Success {
return switch (vkGetPhysicalDeviceSurfaceFormatsKHR(physical_device, surface, surface_format_count, if (surface_formats) |fmts| fmts.ptr else null)) {
.VK_SUCCESS => .Success,
.VK_INCOMPLETE => .Incomplete,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
else => unreachable,
};
}
pub inline fn getPhysicalDeviceSurfacePresentModes(
physical_device: PhysicalDevice,
surface: Surface,
present_mode_count: *u32,
present_modes: ?[]PresentMode,
) !Success {
return switch (vkGetPhysicalDeviceSurfacePresentModesKHR(physical_device, surface, present_mode_count, if (present_modes) |modes| modes.ptr else null)) {
.VK_SUCCESS => .Success,
.VK_INCOMPLETE => .Incomplete,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
else => unreachable,
};
}
pub inline fn getPhysicalDeviceSurfaceSupport(
physical_device: PhysicalDevice,
queue_family_index: usize,
surface: Surface,
supported: *align(@sizeOf(Bool32)) bool,
) !void {
return switch (vkGetPhysicalDeviceSurfaceSupportKHR(physical_device, @intCast(u32, queue_family_index), surface, @ptrCast(*Bool32, supported))) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
else => unreachable,
};
}
pub inline fn getSwapchainImages(
device: Device,
swapchain: Swapchain,
swapchain_image_count: *u32,
swapchain_images: ?[]Image,
) !Success {
return switch (vkGetSwapchainImagesKHR(device, swapchain, swapchain_image_count, if (swapchain_images) |imgs| imgs.ptr else null)) {
.VK_SUCCESS => .Success,
.VK_INCOMPLETE => .Incomplete,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn queuePresent(
queue: Queue,
present_info: *const PresentInfo,
) !Success {
return switch (vkQueuePresentKHR(queue, present_info)) {
.VK_SUCCESS => .Success,
.VK_SUBOPTIMAL_KHR => .Suboptimal,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
.VK_ERROR_OUT_OF_DATE_KHR => Error.OutOfDate,
.VK_ERROR_SURFACE_LOST_KHR => Error.SurfaceLost,
.VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT => Error.FullScreenExclusiveModeLost,
else => unreachable,
};
}
pub inline fn queueSubmit(
queue: Queue,
submits: []const SubmitInfo,
fence: Fence,
) !void {
return switch (vkQueueSubmit(queue, @intCast(u32, submits.len), submits.ptr, fence)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
else => unreachable,
};
}
pub inline fn resetFences(
device: Device,
fences: []const Fence,
) !void {
return switch (vkResetFences(device, @intCast(u32, fences.len), fences.ptr)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
else => unreachable,
};
}
pub inline fn waitForFences(
device: Device,
fences: []const Fence,
wait_all: bool,
timeout: u64,
) !Success {
return switch (vkWaitForFences(device, @intCast(u32, fences.len), fences.ptr, @boolToInt(wait_all), timeout)) {
.VK_SUCCESS => .Success,
.VK_TIMEOUT => .Timeout,
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
.VK_ERROR_OUT_OF_DEVICE_MEMORY => Error.OutOfDeviceMemory,
.VK_ERROR_DEVICE_LOST => Error.DeviceLost,
else => unreachable,
};
}
pub inline fn createDebugUtilsMessenger(
instance: Instance,
create_info: *const DebugUtilsMessengerCreateInfo,
allocator: ?*const AllocationCallbacks,
messenger: *DebugUtilsMessenger,
) !void {
const vkCreateDebugUtilsMessenger = @ptrCast(
PFN_vkCreateDebugUtilsMessengerEXT,
vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT"),
) orelse return Error.ExtensionNotPresent;
return switch (vkCreateDebugUtilsMessenger(instance, create_info, allocator, messenger)) {
.VK_SUCCESS => {},
.VK_ERROR_OUT_OF_HOST_MEMORY => Error.OutOfHostMemory,
else => unreachable,
};
}
pub inline fn destroyDebugUtilsMessenger(
instance: Instance,
messenger: DebugUtilsMessenger,
allocator: ?*const AllocationCallbacks,
) void {
const vkDestroyDebugUtilsMessenger = @ptrCast(
PFN_vkDestroyDebugUtilsMessengerEXT,
vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT"),
) orelse return;
vkDestroyDebugUtilsMessenger(instance, messenger, allocator);
}
/// Constructs an API version number with major, minor and patch version numbers.
pub inline fn makeVersion(major: u10, minor: u10, patch: u12) u32 {
return @as(u32, major) << 22 | @as(u22, minor) << 12 | patch;
}
/// Status of commands reported via VkResult return values and represented by
/// successful completion codes.
const Success = enum {
Success,
NotReady,
Timeout,
EventSet,
EventReset,
Incomplete,
Suboptimal,
ThreadIdle,
ThreadDone,
OperationDeferred,
OperationNotDeferred,
PipelineCompileRequired,
};
/// Status of commands reported via VkResult return values and represented by
/// run time error codes.
const Error = error{
OutOfHostMemory,
OutOfDeviceMemory,
InitializationFailed,
DeviceLost,
MemoryMapFailed,
LayerNotPresent,
ExtensionNotPresent,
FeatureNotPresent,
IncompatibleDriver,
TooManyObjects,
FormatNotSupported,
FragmentedPool,
Unknown,
OutOfPoolMemory,
InvalidExternalHandle,
Fragmentation,
InvalidOpaqueCaptureAddress,
SurfaceLost,
NativeWindowInUse,
OutOfDate,
IncompatibleDisplay,
ValidationFailed,
InvalidShader,
IncompatibleVersion,
InvalidDRMFormatModifierPlaneLayout,
NotPermitted,
FullScreenExclusiveModeLost,
}; | src/vulkan.zig |
const std = @import("std");
usingnamespace @import("kiragine").kira.log;
const engine = @import("kiragine");
const windowWidth = 1024;
const windowHeight = 768;
const title = "Pong";
const targetfps = 60;
const aabb = engine.kira.math.aabb;
var input: *engine.Input = undefined;
var ballpos = engine.Vec2f{
.x = 1024 / 2 - 50,
.y = 768 / 2,
};
var ballmotion = engine.Vec2f{
.y = 1,
.x = 0,
};
const ballspeed: f32 = 400;
const ballsize = 10;
const ballcolour = engine.Colour.rgba(240, 240, 240, 255);
var paddle = engine.Rectangle{
.x = 1024 / 2 - 100,
.y = 700,
.width = 100,
.height = 20,
};
var paddlemotion: f32 = 0;
const paddlespeed: f32 = 300;
const paddlecolour = engine.Colour.rgba(30, 70, 200, 255);
fn update(dt: f32) !void {
const keyA: engine.Input.State = try input.keyState('A');
const keyD: engine.Input.State = try input.keyState('D');
if (keyA == .down) {
paddlemotion = -paddlespeed;
} else if (keyD == .down) {
paddlemotion = paddlespeed;
} else paddlemotion = 0;
if (paddle.x > 1024 - paddle.width) {
paddlemotion = -paddlespeed;
} else if (paddle.x <= 0) {
paddlemotion = paddlespeed;
}
if (ballpos.x > 1024 - 20) {
ballmotion.x = -ballspeed;
} else if (ballpos.x < 100) {
ballmotion.x = ballspeed;
}
if (aabb(paddle.x, paddle.y, paddle.width, paddle.height, ballpos.x, ballpos.y, ballsize, ballsize)) {
ballmotion.y = -ballspeed;
if (ballmotion.x == 0) {
ballmotion.x = 1 * ballspeed;
}
ballmotion.x *= -1;
}
if (ballpos.y <= 20) {
ballmotion.y = ballspeed;
} else if (ballpos.y > 800) {
ballpos.y = 20;
}
}
fn fixedupdate(fixedtime: f32) !void {
paddle.x += paddlemotion * fixedtime;
ballpos.x += ballmotion.x * fixedtime;
ballpos.y += ballmotion.y * fixedtime;
}
fn draw() !void {
engine.clearScreen(0.1, 0.1, 0.1, 1.0);
// Push the triangle batch, it can be mixed with quad batch
try engine.pushBatch2D(engine.Renderer2DBatchTag.triangles);
// or
// try engine.pushBatch2D(engine.Renderer2DBatchTag.quads);
try engine.drawRectangle(paddle, paddlecolour);
try engine.drawCircle(ballpos, ballsize, ballcolour);
// Pops the current batch
try engine.popBatch2D();
}
pub fn main() !void {
const callbacks = engine.Callbacks{
.draw = draw,
.fixed = fixedupdate,
.update = update,
};
try engine.init(callbacks, windowWidth, windowHeight, title, targetfps, std.heap.page_allocator);
input = engine.getInput();
try input.bindKey('A');
try input.bindKey('D');
ballmotion.y = ballspeed;
try engine.open();
try engine.update();
try engine.deinit();
} | examples/pong.zig |
const std = @import("std");
const warn = std.debug.warn;
pub fn Message(comptime BodyType: type) type {
return packed struct {
const Self = @This();
pub header: MessageHeader,
pub body: BodyType,
pub fn init(cmd: u64) Self {
var self: Self = undefined;
self.header.init(cmd, &self);
BodyType.init(&self.body);
return self;
}
/// Return a pointer to the Message this MessageHeader is a member of.
pub fn getMessagePtr(header: *MessageHeader) *Self {
return @fieldParentPtr(Self, "header", header);
}
pub fn format(
self: *const Self,
comptime fmt: []const u8,
context: var,
comptime FmtError: type,
output: fn (@typeOf(context), []const u8) FmtError!void
) FmtError!void {
try std.fmt.format(context, FmtError, output, "{{");
try self.header.format("", context, FmtError, output);
try std.fmt.format(context, FmtError, output, "body={{");
try BodyType.format(&self.body, fmt, context, FmtError, output);
try std.fmt.format(context, FmtError, output, "}},");
try std.fmt.format(context, FmtError, output, "}}");
}
};
}
pub const MessageHeader = packed struct {
const Self = @This();
pub cmd: u64,
pub fn init(self: *Self, cmd: u64, message_ptr: var) void {
self.cmd = cmd;
}
pub fn format(
self: *const Self,
comptime fmt: []const u8,
context: var,
comptime FmtError: type,
output: fn (@typeOf(context), []const u8) FmtError!void
) FmtError!void {
try std.fmt.format(context, FmtError, output, "cmd={}, ", self.cmd);
}
};
/// Tests
const Allocator = std.mem.Allocator;
const bufPrint = std.fmt.bufPrint;
const assert = std.debug.assert;
const mem = std.mem;
const Queue = std.atomic.Queue;
const MyMsgBody = packed struct {
const Self = @This();
data: [3]u8,
fn init(self: *Self) void {
mem.set(u8, self.data[0..], 'Z');
}
pub fn format(m: *const MyMsgBody,
comptime fmt: []const u8,
context: var,
comptime FmtError: type,
output: fn (@typeOf(context), []const u8) FmtError!void
) FmtError!void {
try std.fmt.format(context, FmtError, output, "data={{");
for (m.data) |v| {
if ((v >= ' ') and (v <= 0x7f)) {
try std.fmt.format(context, FmtError, output, "{c}," , v);
} else {
try std.fmt.format(context, FmtError, output, "{x},", v);
}
}
try std.fmt.format(context, FmtError, output, "}},");
}
};
test "Message" {
// Create a message
const MyMsg = Message(MyMsgBody);
var myMsg = MyMsg.init(123);
warn("\nmyMsg={}\n", &myMsg);
assert(myMsg.header.cmd == 123);
assert(mem.eql(u8, myMsg.body.data[0..], "ZZZ"));
// Get the MessagePtr as *MyMsg
var pMsg = MyMsg.getMessagePtr(&myMsg.header);
assert(@ptrToInt(pMsg) == @ptrToInt(&myMsg));
assert(mem.eql(u8, pMsg.body.data[0..], "ZZZ"));
var buf1: [256]u8 = undefined;
var buf2: [256]u8 = undefined;
try testExpectedActual(
"pMsg={cmd=123, body={data={Z,Z,Z,},},}",
try bufPrint(buf2[0..], "pMsg={}", pMsg));
pMsg.body.data[0] = 'a';
try testExpectedActual(
"pMsg={cmd=123, body={data={a,Z,Z,},},}",
try bufPrint(buf2[0..], "pMsg={}", pMsg));
// Create a queue of MessageHeader pointers
const MyQueue = Queue(*MessageHeader);
var q = MyQueue.init();
// Create a node with a pointer to a message header
var node_0 = MyQueue.Node {
.data = &myMsg.header,
.next = undefined,
};
// Add and remove it from the queue and verify
q.put(&node_0);
var n = q.get() orelse { return error.QGetFailed; };
pMsg = MyMsg.getMessagePtr(n.data);
assert(pMsg.header.cmd == 123);
assert(mem.eql(u8, pMsg.body.data[0..], "aZZ"));
warn(" pMsg={}\n", pMsg);
try testExpectedActual(
"pMsg={cmd=123, body={data={a,Z,Z,},},}",
try bufPrint(buf2[0..], "pMsg={}", pMsg));
}
fn testExpectedActual(expected: []const u8, actual: []const u8) !void {
if (mem.eql(u8, expected, actual)) return;
warn("\n====== expected this output: =========\n");
warn("{}", expected);
warn("\n======== instead found this: =========\n");
warn("{}", actual);
warn("\n======================================\n");
return error.TestFailed;
} | message/message.zig |
const std = @import("std");
const Barr = std.BoundedArray;
const fmt = std.fmt;
const log = std.log;
const mem = std.mem;
const os = std.os;
const process = std.process;
const stdout = std.io.getStdOut();
const usage: []const u8 =
\\ path
;
fn fatal(comptime format: []const u8, args: anytype) noreturn {
log.err(format, args);
std.process.exit(2);
}
fn ensureDir(path: []const u8) !void {
//std.debug.print("path: {s}\n", .{path});
std.fs.cwd().makeDir(path) catch |err| switch (err) {
error.PathAlreadyExists => {},
else => {
fatal("unable to create test directory '{s}': {s}", .{
path, @errorName(err),
});
},
};
}
// -------------- move above parts into testhelper.zig --------------
// assume: nesting < 10
fn addEnsurePathDir(path_buf: []u8, n_pbuf: *u64, nr: u8, nesting: *u8) !void {
const slash: u8 = '/';
// workaround: comptime-connect strings with start and end offset
// "continuous enum" => number*2 => (start,end) into static buffer for entries
const str_nr: []const u8 = &[2]u8{ slash, nr };
mem.copy(u8, path_buf[n_pbuf.*..], str_nr);
n_pbuf.* += str_nr.len;
try ensureDir(path_buf[0..n_pbuf.*]);
//std.debug.print("addEnsurePathDir\n", .{});
//std.debug.print("path_buf: {s}\n", .{path_buf[0..n_pbuf.*]});
//std.debug.print("write insert_nr: {d}\n", .{nr});
nesting.* += 1;
}
// does not remove direcories, only removes `/number` of the path
fn rmPathDir(n_pbuf: *u64, nesting: *u8) void {
n_pbuf.* -= 2;
nesting.* -= 1;
//std.debug.print("rm dir\n", .{});
}
fn digitsToChars(buf: []u8, case: fmt.Case) void {
var char: u8 = undefined;
for (buf) |digit, i| {
char = fmt.digitToChar(digit, case);
buf[i] = char;
}
}
pub fn charsToDigits(buf: []u8, radix: u8) (error{InvalidCharacter}!void) {
var digit: u8 = undefined;
for (buf) |char, i| {
digit = try fmt.charToDigit(char, radix);
buf[i] = digit;
}
}
// on successfull addition return true, otherwise false
fn add(comptime UT: type, cust_nr: []UT, base: UT, path_buf: []u8, n_pbuf: *u64, nesting: *u8) bool {
//std.debug.print("cust_nr: {d} {d} {d}", .{ cust_nr.len, base, nesting.* });
//return true;
_ = nesting;
//std.debug.print("nesting: {d}\n", .{nesting.*});
var carry = false;
var index: u64 = cust_nr.len - 1;
// get first index from right-hand side that can be updated
while (index > 0) : (index -= 1) {
var added_val = cust_nr[index] + 1;
if (added_val == base) {
carry = true;
} else {
break; // defer updating number until overflow check
}
}
// prevent index overflow
if (index == 0 and carry == true and cust_nr[index] + 1 == base) {
return false; // could not increase anymore
}
cust_nr[index] += 1; // update value
// logic for directories
{
var dir_index: u64 = cust_nr.len - 1;
std.debug.assert(dir_index >= index);
std.debug.assert(nesting.* == cust_nr.len);
// remove directories from path string from end to index
while (dir_index > index) : (dir_index -= 1)
rmPathDir(n_pbuf, nesting);
rmPathDir(n_pbuf, nesting); // also remove dir from index to replace it
std.debug.assert(dir_index == index);
//std.debug.print("path_buf before ensureDir: {s}\n", .{path_buf[0..n_pbuf.*]});
// replacement of dir at index
const char_of_dig = fmt.digitToChar(cust_nr[index], fmt.Case.lower);
try addEnsurePathDir(path_buf, n_pbuf, char_of_dig, nesting);
dir_index += 1; // update index after appending dir to point to new dir
//std.debug.print("nesting after addEnsurePathDir : {d}\n", .{nesting.*});
//std.debug.print("dir_index : {d}\n", .{dir_index});
// ensure zero dirs until nesting = cust_nr.len
while (dir_index < cust_nr.len) : (dir_index += 1) {
const char0 = fmt.digitToChar(0, fmt.Case.lower);
try addEnsurePathDir(path_buf, n_pbuf, char0, nesting); // add 0 dirs
}
std.debug.assert(nesting.* == cust_nr.len);
}
// zero out numbers right of the index
if (carry == true) {
std.debug.assert(index < cust_nr.len - 1);
index += 1;
while (index < cust_nr.len) : (index += 1) {
cust_nr[index] = 0;
}
}
return true;
}
fn printCustomNr(comptime UT: type, cust_nr: []UT) !void {
try stdout.writeAll("created ");
const case = fmt.Case.lower;
digitsToChars(cust_nr, case);
try stdout.writeAll(cust_nr);
try charsToDigits(cust_nr, 11); // invalidate digits > 10
try stdout.writeAll(" +1 direcories\n");
}
pub fn main() !void {
var path_buffer: [1000]u8 = undefined;
var n_pbuf: u64 = 0; // next free position
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena_instance.deinit();
const arena = arena_instance.allocator();
const args: [][:0]u8 = try process.argsAlloc(arena);
defer process.argsFree(arena, args);
for (args) |arg| {
std.debug.print("{s}\n", .{arg});
}
if (args.len != 2) {
try stdout.writer().print("To create folders for perf benchmark at path, run in shell: {s} {s}\n", .{ args[0], usage });
std.process.exit(1);
}
// 1. folders for perf benchmarks
try ensureDir(args[1]);
var test_dir = try std.fs.cwd().openDir(args[1], .{
.no_follow = true,
});
defer test_dir.close();
mem.copy(u8, path_buffer[n_pbuf..], args[1]);
n_pbuf += args[1].len;
// 1.1 base_perf
// because we need to store where what number overlfowed
{
const path1: []const u8 = "/base_perf";
mem.copy(u8, path_buffer[n_pbuf..], path1);
n_pbuf += path1.len;
try ensureDir(path_buffer[0..n_pbuf]);
defer n_pbuf -= path1.len;
{
// custom number system backed by buffer
//var cust_nr = [_]u8{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; 10^{10} == too big
var cust_nr = [_]u8{ 0, 0, 0, 0, 0 }; // 10^{5} == 100_000
//var cust_nr = [_]u8{ 0, 0, 0 }; // 10^{3} == 1_000
//var cust_nr = [_]u8{ 0, 0 }; // 10^{2} == 100 (+10)
const base: u32 = 10;
var nesting: u8 = 0;
var i: u64 = 0;
while (i < cust_nr.len) : (i += 1) {
const char_of_dig = fmt.digitToChar(0, fmt.Case.lower);
try addEnsurePathDir(&path_buffer, &n_pbuf, char_of_dig, &nesting);
}
// cust_nr now represents the ensured path structure
i = 0;
while (add(u8, &cust_nr, base, &path_buffer, &n_pbuf, &nesting)) {
//std.debug.print("i: {d}\n", .{i});
//printCustomNr(u8, &cust_nr);
i += 1;
std.debug.assert(i < 1_000_000);
}
try printCustomNr(u8, &cust_nr);
i = 0;
while (i < cust_nr.len) : (i += 1) {
rmPathDir(&n_pbuf, &nesting);
}
std.debug.assert(n_pbuf == args[1].len + path1.len);
std.debug.assert(nesting == 0);
}
}
} | src/perffolder_gen.zig |
pub const IOCTL_SCSI_BASE = @as(u32, 4);
pub const ScsiRawInterfaceGuid = Guid.initString("53f56309-b6bf-11d0-94f2-00a0c91efb8b");
pub const WmiScsiAddressGuid = Guid.initString("53f5630f-b6bf-11d0-94f2-00a0c91efb8b");
pub const FILE_DEVICE_SCSI = @as(u32, 27);
pub const IOCTL_SCSI_PASS_THROUGH = @as(u32, 315396);
pub const IOCTL_SCSI_MINIPORT = @as(u32, 315400);
pub const IOCTL_SCSI_GET_INQUIRY_DATA = @as(u32, 266252);
pub const IOCTL_SCSI_GET_CAPABILITIES = @as(u32, 266256);
pub const IOCTL_SCSI_PASS_THROUGH_DIRECT = @as(u32, 315412);
pub const IOCTL_SCSI_GET_ADDRESS = @as(u32, 266264);
pub const IOCTL_SCSI_RESCAN_BUS = @as(u32, 266268);
pub const IOCTL_SCSI_GET_DUMP_POINTERS = @as(u32, 266272);
pub const IOCTL_SCSI_FREE_DUMP_POINTERS = @as(u32, 266276);
pub const IOCTL_IDE_PASS_THROUGH = @as(u32, 315432);
pub const IOCTL_ATA_PASS_THROUGH = @as(u32, 315436);
pub const IOCTL_ATA_PASS_THROUGH_DIRECT = @as(u32, 315440);
pub const IOCTL_ATA_MINIPORT = @as(u32, 315444);
pub const IOCTL_MINIPORT_PROCESS_SERVICE_IRP = @as(u32, 315448);
pub const IOCTL_MPIO_PASS_THROUGH_PATH = @as(u32, 315452);
pub const IOCTL_MPIO_PASS_THROUGH_PATH_DIRECT = @as(u32, 315456);
pub const IOCTL_SCSI_PASS_THROUGH_EX = @as(u32, 315460);
pub const IOCTL_SCSI_PASS_THROUGH_DIRECT_EX = @as(u32, 315464);
pub const IOCTL_MPIO_PASS_THROUGH_PATH_EX = @as(u32, 315468);
pub const IOCTL_MPIO_PASS_THROUGH_PATH_DIRECT_EX = @as(u32, 315472);
pub const ATA_FLAGS_DRDY_REQUIRED = @as(u32, 1);
pub const ATA_FLAGS_DATA_IN = @as(u32, 2);
pub const ATA_FLAGS_DATA_OUT = @as(u32, 4);
pub const ATA_FLAGS_48BIT_COMMAND = @as(u32, 8);
pub const ATA_FLAGS_USE_DMA = @as(u32, 16);
pub const ATA_FLAGS_NO_MULTIPLE = @as(u32, 32);
pub const NRB_FUNCTION_NVCACHE_INFO = @as(u32, 236);
pub const NRB_FUNCTION_SPINDLE_STATUS = @as(u32, 229);
pub const NRB_FUNCTION_NVCACHE_POWER_MODE_SET = @as(u32, 0);
pub const NRB_FUNCTION_NVCACHE_POWER_MODE_RETURN = @as(u32, 1);
pub const NRB_FUNCTION_FLUSH_NVCACHE = @as(u32, 20);
pub const NRB_FUNCTION_QUERY_PINNED_SET = @as(u32, 18);
pub const NRB_FUNCTION_QUERY_CACHE_MISS = @as(u32, 19);
pub const NRB_FUNCTION_ADD_LBAS_PINNED_SET = @as(u32, 16);
pub const NRB_FUNCTION_REMOVE_LBAS_PINNED_SET = @as(u32, 17);
pub const NRB_FUNCTION_QUERY_ASCENDER_STATUS = @as(u32, 208);
pub const NRB_FUNCTION_QUERY_HYBRID_DISK_STATUS = @as(u32, 209);
pub const NRB_FUNCTION_PASS_HINT_PAYLOAD = @as(u32, 224);
pub const NRB_FUNCTION_NVSEPARATED_INFO = @as(u32, 192);
pub const NRB_FUNCTION_NVSEPARATED_FLUSH = @as(u32, 193);
pub const NRB_FUNCTION_NVSEPARATED_WB_DISABLE = @as(u32, 194);
pub const NRB_FUNCTION_NVSEPARATED_WB_REVERT_DEFAULT = @as(u32, 195);
pub const NRB_SUCCESS = @as(u32, 0);
pub const NRB_ILLEGAL_REQUEST = @as(u32, 1);
pub const NRB_INVALID_PARAMETER = @as(u32, 2);
pub const NRB_INPUT_DATA_OVERRUN = @as(u32, 3);
pub const NRB_INPUT_DATA_UNDERRUN = @as(u32, 4);
pub const NRB_OUTPUT_DATA_OVERRUN = @as(u32, 5);
pub const NRB_OUTPUT_DATA_UNDERRUN = @as(u32, 6);
pub const NV_SEP_CACHE_PARAMETER_VERSION_1 = @as(u32, 1);
pub const STORAGE_DIAGNOSTIC_STATUS_SUCCESS = @as(u32, 0);
pub const STORAGE_DIAGNOSTIC_STATUS_BUFFER_TOO_SMALL = @as(u32, 1);
pub const STORAGE_DIAGNOSTIC_STATUS_UNSUPPORTED_VERSION = @as(u32, 2);
pub const STORAGE_DIAGNOSTIC_STATUS_INVALID_PARAMETER = @as(u32, 3);
pub const STORAGE_DIAGNOSTIC_STATUS_INVALID_SIGNATURE = @as(u32, 4);
pub const STORAGE_DIAGNOSTIC_STATUS_INVALID_TARGET_TYPE = @as(u32, 5);
pub const STORAGE_DIAGNOSTIC_STATUS_MORE_DATA = @as(u32, 6);
pub const MINIPORT_DSM_NOTIFICATION_VERSION_1 = @as(u32, 1);
pub const MINIPORT_DSM_PROFILE_UNKNOWN = @as(u32, 0);
pub const MINIPORT_DSM_PROFILE_PAGE_FILE = @as(u32, 1);
pub const MINIPORT_DSM_PROFILE_HIBERNATION_FILE = @as(u32, 2);
pub const MINIPORT_DSM_PROFILE_CRASHDUMP_FILE = @as(u32, 3);
pub const MINIPORT_DSM_NOTIFY_FLAG_BEGIN = @as(u32, 1);
pub const MINIPORT_DSM_NOTIFY_FLAG_END = @as(u32, 2);
pub const HYBRID_FUNCTION_GET_INFO = @as(u32, 1);
pub const HYBRID_FUNCTION_DISABLE_CACHING_MEDIUM = @as(u32, 16);
pub const HYBRID_FUNCTION_ENABLE_CACHING_MEDIUM = @as(u32, 17);
pub const HYBRID_FUNCTION_SET_DIRTY_THRESHOLD = @as(u32, 18);
pub const HYBRID_FUNCTION_DEMOTE_BY_SIZE = @as(u32, 19);
pub const HYBRID_STATUS_SUCCESS = @as(u32, 0);
pub const HYBRID_STATUS_ILLEGAL_REQUEST = @as(u32, 1);
pub const HYBRID_STATUS_INVALID_PARAMETER = @as(u32, 2);
pub const HYBRID_STATUS_OUTPUT_BUFFER_TOO_SMALL = @as(u32, 3);
pub const HYBRID_STATUS_ENABLE_REFCOUNT_HOLD = @as(u32, 16);
pub const HYBRID_REQUEST_BLOCK_STRUCTURE_VERSION = @as(u32, 1);
pub const HYBRID_REQUEST_INFO_STRUCTURE_VERSION = @as(u32, 1);
pub const FIRMWARE_FUNCTION_GET_INFO = @as(u32, 1);
pub const FIRMWARE_FUNCTION_DOWNLOAD = @as(u32, 2);
pub const FIRMWARE_FUNCTION_ACTIVATE = @as(u32, 3);
pub const FIRMWARE_STATUS_SUCCESS = @as(u32, 0);
pub const FIRMWARE_STATUS_ERROR = @as(u32, 1);
pub const FIRMWARE_STATUS_ILLEGAL_REQUEST = @as(u32, 2);
pub const FIRMWARE_STATUS_INVALID_PARAMETER = @as(u32, 3);
pub const FIRMWARE_STATUS_INPUT_BUFFER_TOO_BIG = @as(u32, 4);
pub const FIRMWARE_STATUS_OUTPUT_BUFFER_TOO_SMALL = @as(u32, 5);
pub const FIRMWARE_STATUS_INVALID_SLOT = @as(u32, 6);
pub const FIRMWARE_STATUS_INVALID_IMAGE = @as(u32, 7);
pub const FIRMWARE_STATUS_CONTROLLER_ERROR = @as(u32, 16);
pub const FIRMWARE_STATUS_POWER_CYCLE_REQUIRED = @as(u32, 32);
pub const FIRMWARE_STATUS_DEVICE_ERROR = @as(u32, 64);
pub const FIRMWARE_STATUS_INTERFACE_CRC_ERROR = @as(u32, 128);
pub const FIRMWARE_STATUS_UNCORRECTABLE_DATA_ERROR = @as(u32, 129);
pub const FIRMWARE_STATUS_MEDIA_CHANGE = @as(u32, 130);
pub const FIRMWARE_STATUS_ID_NOT_FOUND = @as(u32, 131);
pub const FIRMWARE_STATUS_MEDIA_CHANGE_REQUEST = @as(u32, 132);
pub const FIRMWARE_STATUS_COMMAND_ABORT = @as(u32, 133);
pub const FIRMWARE_STATUS_END_OF_MEDIA = @as(u32, 134);
pub const FIRMWARE_STATUS_ILLEGAL_LENGTH = @as(u32, 135);
pub const FIRMWARE_REQUEST_BLOCK_STRUCTURE_VERSION = @as(u32, 1);
pub const FIRMWARE_REQUEST_FLAG_CONTROLLER = @as(u32, 1);
pub const FIRMWARE_REQUEST_FLAG_LAST_SEGMENT = @as(u32, 2);
pub const FIRMWARE_REQUEST_FLAG_FIRST_SEGMENT = @as(u32, 4);
pub const FIRMWARE_REQUEST_FLAG_SWITCH_TO_EXISTING_FIRMWARE = @as(u32, 2147483648);
pub const STORAGE_FIRMWARE_INFO_STRUCTURE_VERSION = @as(u32, 1);
pub const STORAGE_FIRMWARE_INFO_STRUCTURE_VERSION_V2 = @as(u32, 2);
pub const STORAGE_FIRMWARE_INFO_INVALID_SLOT = @as(u32, 255);
pub const STORAGE_FIRMWARE_SLOT_INFO_V2_REVISION_LENGTH = @as(u32, 16);
pub const STORAGE_FIRMWARE_DOWNLOAD_STRUCTURE_VERSION = @as(u32, 1);
pub const STORAGE_FIRMWARE_DOWNLOAD_STRUCTURE_VERSION_V2 = @as(u32, 2);
pub const STORAGE_FIRMWARE_ACTIVATE_STRUCTURE_VERSION = @as(u32, 1);
pub const DUMP_POINTERS_VERSION_1 = @as(u32, 1);
pub const DUMP_POINTERS_VERSION_2 = @as(u32, 2);
pub const DUMP_POINTERS_VERSION_3 = @as(u32, 3);
pub const DUMP_POINTERS_VERSION_4 = @as(u32, 4);
pub const DUMP_DRIVER_NAME_LENGTH = @as(u32, 15);
pub const DUMP_EX_FLAG_SUPPORT_64BITMEMORY = @as(u32, 1);
pub const DUMP_EX_FLAG_SUPPORT_DD_TELEMETRY = @as(u32, 2);
pub const DUMP_EX_FLAG_RESUME_SUPPORT = @as(u32, 4);
pub const DUMP_EX_FLAG_DRIVER_FULL_PATH_SUPPORT = @as(u32, 8);
pub const SCSI_IOCTL_DATA_OUT = @as(u32, 0);
pub const SCSI_IOCTL_DATA_IN = @as(u32, 1);
pub const SCSI_IOCTL_DATA_UNSPECIFIED = @as(u32, 2);
pub const SCSI_IOCTL_DATA_BIDIRECTIONAL = @as(u32, 3);
pub const MPIO_IOCTL_FLAG_USE_PATHID = @as(u32, 1);
pub const MPIO_IOCTL_FLAG_USE_SCSIADDRESS = @as(u32, 2);
pub const MPIO_IOCTL_FLAG_INVOLVE_DSM = @as(u32, 4);
pub const MAX_ISCSI_HBANAME_LEN = @as(u32, 256);
pub const MAX_ISCSI_NAME_LEN = @as(u32, 223);
pub const MAX_ISCSI_ALIAS_LEN = @as(u32, 255);
pub const MAX_ISCSI_PORTAL_NAME_LEN = @as(u32, 256);
pub const MAX_ISCSI_PORTAL_ALIAS_LEN = @as(u32, 256);
pub const MAX_ISCSI_TEXT_ADDRESS_LEN = @as(u32, 256);
pub const MAX_ISCSI_DISCOVERY_DOMAIN_LEN = @as(u32, 256);
pub const MAX_RADIUS_ADDRESS_LEN = @as(u32, 41);
pub const ISCSI_SECURITY_FLAG_TUNNEL_MODE_PREFERRED = @as(u32, 64);
pub const ISCSI_SECURITY_FLAG_TRANSPORT_MODE_PREFERRED = @as(u32, 32);
pub const ISCSI_SECURITY_FLAG_PFS_ENABLED = @as(u32, 16);
pub const ISCSI_SECURITY_FLAG_AGGRESSIVE_MODE_ENABLED = @as(u32, 8);
pub const ISCSI_SECURITY_FLAG_MAIN_MODE_ENABLED = @as(u32, 4);
pub const ISCSI_SECURITY_FLAG_IKE_IPSEC_ENABLED = @as(u32, 2);
pub const ISCSI_SECURITY_FLAG_VALID = @as(u32, 1);
pub const ISCSI_LOGIN_FLAG_REQUIRE_IPSEC = @as(u32, 1);
pub const ISCSI_LOGIN_FLAG_MULTIPATH_ENABLED = @as(u32, 2);
pub const ISCSI_LOGIN_FLAG_RESERVED1 = @as(u32, 4);
pub const ISCSI_LOGIN_FLAG_ALLOW_PORTAL_HOPPING = @as(u32, 8);
pub const ISCSI_LOGIN_FLAG_USE_RADIUS_RESPONSE = @as(u32, 16);
pub const ISCSI_LOGIN_FLAG_USE_RADIUS_VERIFICATION = @as(u32, 32);
pub const ISCSI_LOGIN_OPTIONS_HEADER_DIGEST = @as(u32, 1);
pub const ISCSI_LOGIN_OPTIONS_DATA_DIGEST = @as(u32, 2);
pub const ISCSI_LOGIN_OPTIONS_MAXIMUM_CONNECTIONS = @as(u32, 4);
pub const ISCSI_LOGIN_OPTIONS_DEFAULT_TIME_2_WAIT = @as(u32, 8);
pub const ISCSI_LOGIN_OPTIONS_DEFAULT_TIME_2_RETAIN = @as(u32, 16);
pub const ISCSI_LOGIN_OPTIONS_USERNAME = @as(u32, 32);
pub const ISCSI_LOGIN_OPTIONS_PASSWORD = @as(u32, 64);
pub const ISCSI_LOGIN_OPTIONS_AUTH_TYPE = @as(u32, 128);
pub const ISCSI_LOGIN_OPTIONS_VERSION = @as(u32, 0);
pub const ISCSI_TARGET_FLAG_HIDE_STATIC_TARGET = @as(u32, 2);
pub const ISCSI_TARGET_FLAG_MERGE_TARGET_INFORMATION = @as(u32, 4);
pub const ID_IPV4_ADDR = @as(u32, 1);
pub const ID_FQDN = @as(u32, 2);
pub const ID_USER_FQDN = @as(u32, 3);
pub const ID_IPV6_ADDR = @as(u32, 5);
//--------------------------------------------------------------------------------
// Section: Types (94)
//--------------------------------------------------------------------------------
pub const _ADAPTER_OBJECT = extern struct {
placeholder: usize, // TODO: why is this type empty?
};
pub const SCSI_PASS_THROUGH = extern struct {
Length: u16,
ScsiStatus: u8,
PathId: u8,
TargetId: u8,
Lun: u8,
CdbLength: u8,
SenseInfoLength: u8,
DataIn: u8,
DataTransferLength: u32,
TimeOutValue: u32,
DataBufferOffset: usize,
SenseInfoOffset: u32,
Cdb: [16]u8,
};
pub const SCSI_PASS_THROUGH_DIRECT = extern struct {
Length: u16,
ScsiStatus: u8,
PathId: u8,
TargetId: u8,
Lun: u8,
CdbLength: u8,
SenseInfoLength: u8,
DataIn: u8,
DataTransferLength: u32,
TimeOutValue: u32,
DataBuffer: ?*c_void,
SenseInfoOffset: u32,
Cdb: [16]u8,
};
pub const SCSI_PASS_THROUGH_EX = extern struct {
Version: u32,
Length: u32,
CdbLength: u32,
StorAddressLength: u32,
ScsiStatus: u8,
SenseInfoLength: u8,
DataDirection: u8,
Reserved: u8,
TimeOutValue: u32,
StorAddressOffset: u32,
SenseInfoOffset: u32,
DataOutTransferLength: u32,
DataInTransferLength: u32,
DataOutBufferOffset: usize,
DataInBufferOffset: usize,
Cdb: [1]u8,
};
pub const SCSI_PASS_THROUGH_DIRECT_EX = extern struct {
Version: u32,
Length: u32,
CdbLength: u32,
StorAddressLength: u32,
ScsiStatus: u8,
SenseInfoLength: u8,
DataDirection: u8,
Reserved: u8,
TimeOutValue: u32,
StorAddressOffset: u32,
SenseInfoOffset: u32,
DataOutTransferLength: u32,
DataInTransferLength: u32,
DataOutBuffer: ?*c_void,
DataInBuffer: ?*c_void,
Cdb: [1]u8,
};
pub const ATA_PASS_THROUGH_EX = extern struct {
Length: u16,
AtaFlags: u16,
PathId: u8,
TargetId: u8,
Lun: u8,
ReservedAsUchar: u8,
DataTransferLength: u32,
TimeOutValue: u32,
ReservedAsUlong: u32,
DataBufferOffset: usize,
PreviousTaskFile: [8]u8,
CurrentTaskFile: [8]u8,
};
pub const ATA_PASS_THROUGH_DIRECT = extern struct {
Length: u16,
AtaFlags: u16,
PathId: u8,
TargetId: u8,
Lun: u8,
ReservedAsUchar: u8,
DataTransferLength: u32,
TimeOutValue: u32,
ReservedAsUlong: u32,
DataBuffer: ?*c_void,
PreviousTaskFile: [8]u8,
CurrentTaskFile: [8]u8,
};
pub const IDE_IO_CONTROL = extern struct {
HeaderLength: u32,
Signature: [8]u8,
Timeout: u32,
ControlCode: u32,
ReturnStatus: u32,
DataLength: u32,
};
pub const MPIO_PASS_THROUGH_PATH = extern struct {
PassThrough: SCSI_PASS_THROUGH,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
};
pub const MPIO_PASS_THROUGH_PATH_DIRECT = extern struct {
PassThrough: SCSI_PASS_THROUGH_DIRECT,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
};
pub const MPIO_PASS_THROUGH_PATH_EX = extern struct {
PassThroughOffset: u32,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
};
pub const MPIO_PASS_THROUGH_PATH_DIRECT_EX = extern struct {
PassThroughOffset: u32,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
};
pub const SCSI_BUS_DATA = extern struct {
NumberOfLogicalUnits: u8,
InitiatorBusId: u8,
InquiryDataOffset: u32,
};
pub const SCSI_ADAPTER_BUS_INFO = extern struct {
NumberOfBuses: u8,
BusData: [1]SCSI_BUS_DATA,
};
pub const SCSI_INQUIRY_DATA = extern struct {
PathId: u8,
TargetId: u8,
Lun: u8,
DeviceClaimed: BOOLEAN,
InquiryDataLength: u32,
NextInquiryDataOffset: u32,
InquiryData: [1]u8,
};
pub const SRB_IO_CONTROL = extern struct {
HeaderLength: u32,
Signature: [8]u8,
Timeout: u32,
ControlCode: u32,
ReturnCode: u32,
Length: u32,
};
pub const NVCACHE_REQUEST_BLOCK = extern struct {
NRBSize: u32,
Function: u16,
NRBFlags: u32,
NRBStatus: u32,
Count: u32,
LBA: u64,
DataBufSize: u32,
NVCacheStatus: u32,
NVCacheSubStatus: u32,
};
pub const NV_FEATURE_PARAMETER = extern struct {
NVPowerModeEnabled: u16,
NVParameterReserv1: u16,
NVCmdEnabled: u16,
NVParameterReserv2: u16,
NVPowerModeVer: u16,
NVCmdVer: u16,
NVSize: u32,
NVReadSpeed: u16,
NVWrtSpeed: u16,
DeviceSpinUpTime: u32,
};
pub const NVCACHE_HINT_PAYLOAD = extern struct {
Command: u8,
Feature7_0: u8,
Feature15_8: u8,
Count15_8: u8,
LBA7_0: u8,
LBA15_8: u8,
LBA23_16: u8,
LBA31_24: u8,
LBA39_32: u8,
LBA47_40: u8,
Auxiliary7_0: u8,
Auxiliary23_16: u8,
Reserved: [4]u8,
};
pub const NV_SEP_CACHE_PARAMETER = extern struct {
Version: u32,
Size: u32,
Flags: extern union {
CacheFlags: extern struct {
_bitfield: u8,
},
CacheFlagsSet: u8,
},
WriteCacheType: u8,
WriteCacheTypeEffective: u8,
ParameterReserve1: [3]u8,
};
pub const NV_SEP_WRITE_CACHE_TYPE = enum(i32) {
Unknown = 0,
None = 1,
WriteBack = 2,
WriteThrough = 3,
};
pub const NVSEPWriteCacheTypeUnknown = NV_SEP_WRITE_CACHE_TYPE.Unknown;
pub const NVSEPWriteCacheTypeNone = NV_SEP_WRITE_CACHE_TYPE.None;
pub const NVSEPWriteCacheTypeWriteBack = NV_SEP_WRITE_CACHE_TYPE.WriteBack;
pub const NVSEPWriteCacheTypeWriteThrough = NV_SEP_WRITE_CACHE_TYPE.WriteThrough;
pub const MP_STORAGE_DIAGNOSTIC_LEVEL = enum(i32) {
Default = 0,
Max = 1,
};
pub const MpStorageDiagnosticLevelDefault = MP_STORAGE_DIAGNOSTIC_LEVEL.Default;
pub const MpStorageDiagnosticLevelMax = MP_STORAGE_DIAGNOSTIC_LEVEL.Max;
pub const MP_STORAGE_DIAGNOSTIC_TARGET_TYPE = enum(i32) {
Undefined = 0,
Miniport = 2,
HbaFirmware = 3,
Max = 4,
};
pub const MpStorageDiagnosticTargetTypeUndefined = MP_STORAGE_DIAGNOSTIC_TARGET_TYPE.Undefined;
pub const MpStorageDiagnosticTargetTypeMiniport = MP_STORAGE_DIAGNOSTIC_TARGET_TYPE.Miniport;
pub const MpStorageDiagnosticTargetTypeHbaFirmware = MP_STORAGE_DIAGNOSTIC_TARGET_TYPE.HbaFirmware;
pub const MpStorageDiagnosticTargetTypeMax = MP_STORAGE_DIAGNOSTIC_TARGET_TYPE.Max;
pub const STORAGE_DIAGNOSTIC_MP_REQUEST = extern struct {
Version: u32,
Size: u32,
TargetType: MP_STORAGE_DIAGNOSTIC_TARGET_TYPE,
Level: MP_STORAGE_DIAGNOSTIC_LEVEL,
ProviderId: Guid,
BufferSize: u32,
Reserved: u32,
DataBuffer: [1]u8,
};
pub const MP_DEVICE_DATA_SET_RANGE = extern struct {
StartingOffset: i64,
LengthInBytes: u64,
};
pub const DSM_NOTIFICATION_REQUEST_BLOCK = extern struct {
Size: u32,
Version: u32,
NotifyFlags: u32,
DataSetProfile: u32,
Reserved: [3]u32,
DataSetRangesCount: u32,
DataSetRanges: [1]MP_DEVICE_DATA_SET_RANGE,
};
pub const HYBRID_REQUEST_BLOCK = extern struct {
Version: u32,
Size: u32,
Function: u32,
Flags: u32,
DataBufferOffset: u32,
DataBufferLength: u32,
};
pub const NVCACHE_TYPE = enum(i32) {
Unknown = 0,
None = 1,
WriteBack = 2,
WriteThrough = 3,
};
pub const NvCacheTypeUnknown = NVCACHE_TYPE.Unknown;
pub const NvCacheTypeNone = NVCACHE_TYPE.None;
pub const NvCacheTypeWriteBack = NVCACHE_TYPE.WriteBack;
pub const NvCacheTypeWriteThrough = NVCACHE_TYPE.WriteThrough;
pub const NVCACHE_STATUS = enum(i32) {
Unknown = 0,
Disabling = 1,
Disabled = 2,
Enabled = 3,
};
pub const NvCacheStatusUnknown = NVCACHE_STATUS.Unknown;
pub const NvCacheStatusDisabling = NVCACHE_STATUS.Disabling;
pub const NvCacheStatusDisabled = NVCACHE_STATUS.Disabled;
pub const NvCacheStatusEnabled = NVCACHE_STATUS.Enabled;
pub const NVCACHE_PRIORITY_LEVEL_DESCRIPTOR = extern struct {
PriorityLevel: u8,
Reserved0: [3]u8,
ConsumedNVMSizeFraction: u32,
ConsumedMappingResourcesFraction: u32,
ConsumedNVMSizeForDirtyDataFraction: u32,
ConsumedMappingResourcesForDirtyDataFraction: u32,
Reserved1: u32,
};
pub const HYBRID_INFORMATION = extern struct {
Version: u32,
Size: u32,
HybridSupported: BOOLEAN,
Status: NVCACHE_STATUS,
CacheTypeEffective: NVCACHE_TYPE,
CacheTypeDefault: NVCACHE_TYPE,
FractionBase: u32,
CacheSize: u64,
Attributes: extern struct {
_bitfield: u32,
},
Priorities: extern struct {
PriorityLevelCount: u8,
MaxPriorityBehavior: BOOLEAN,
OptimalWriteGranularity: u8,
Reserved: u8,
DirtyThresholdLow: u32,
DirtyThresholdHigh: u32,
SupportedCommands: extern struct {
_bitfield: u32,
MaxEvictCommands: u32,
MaxLbaRangeCountForEvict: u32,
MaxLbaRangeCountForChangeLba: u32,
},
Priority: [1]NVCACHE_PRIORITY_LEVEL_DESCRIPTOR,
},
};
pub const HYBRID_DIRTY_THRESHOLDS = extern struct {
Version: u32,
Size: u32,
DirtyLowThreshold: u32,
DirtyHighThreshold: u32,
};
pub const HYBRID_DEMOTE_BY_SIZE = extern struct {
Version: u32,
Size: u32,
SourcePriority: u8,
TargetPriority: u8,
Reserved0: u16,
Reserved1: u32,
LbaCount: u64,
};
pub const FIRMWARE_REQUEST_BLOCK = extern struct {
Version: u32,
Size: u32,
Function: u32,
Flags: u32,
DataBufferOffset: u32,
DataBufferLength: u32,
};
pub const STORAGE_FIRMWARE_SLOT_INFO = extern struct {
SlotNumber: u8,
ReadOnly: BOOLEAN,
Reserved: [6]u8,
Revision: extern union {
Info: [8]u8,
AsUlonglong: u64,
},
};
pub const STORAGE_FIRMWARE_SLOT_INFO_V2 = extern struct {
SlotNumber: u8,
ReadOnly: BOOLEAN,
Reserved: [6]u8,
Revision: [16]u8,
};
pub const STORAGE_FIRMWARE_INFO = extern struct {
Version: u32,
Size: u32,
UpgradeSupport: BOOLEAN,
SlotCount: u8,
ActiveSlot: u8,
PendingActivateSlot: u8,
Reserved: u32,
Slot: [1]STORAGE_FIRMWARE_SLOT_INFO,
};
pub const STORAGE_FIRMWARE_INFO_V2 = extern struct {
Version: u32,
Size: u32,
UpgradeSupport: BOOLEAN,
SlotCount: u8,
ActiveSlot: u8,
PendingActivateSlot: u8,
FirmwareShared: BOOLEAN,
Reserved: [3]u8,
ImagePayloadAlignment: u32,
ImagePayloadMaxSize: u32,
Slot: [1]STORAGE_FIRMWARE_SLOT_INFO_V2,
};
pub const STORAGE_FIRMWARE_DOWNLOAD = extern struct {
Version: u32,
Size: u32,
Offset: u64,
BufferSize: u64,
ImageBuffer: [1]u8,
};
pub const STORAGE_FIRMWARE_DOWNLOAD_V2 = extern struct {
Version: u32,
Size: u32,
Offset: u64,
BufferSize: u64,
Slot: u8,
Reserved: [3]u8,
ImageSize: u32,
ImageBuffer: [1]u8,
};
pub const STORAGE_FIRMWARE_ACTIVATE = extern struct {
Version: u32,
Size: u32,
SlotToActivate: u8,
Reserved0: [3]u8,
};
pub const IO_SCSI_CAPABILITIES = extern struct {
Length: u32,
MaximumTransferLength: u32,
MaximumPhysicalPages: u32,
SupportedAsynchronousEvents: u32,
AlignmentMask: u32,
TaggedQueuing: BOOLEAN,
AdapterScansDown: BOOLEAN,
AdapterUsesPio: BOOLEAN,
};
pub const SCSI_ADDRESS = extern struct {
Length: u32,
PortNumber: u8,
PathId: u8,
TargetId: u8,
Lun: u8,
};
pub const DUMP_DEVICE_POWERON_ROUTINE = fn(
Context: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) i32;
pub const PDUMP_DEVICE_POWERON_ROUTINE = fn(
) callconv(@import("std").os.windows.WINAPI) i32;
pub const DUMP_POINTERS_VERSION = extern struct {
Version: u32,
Size: u32,
};
pub const DUMP_POINTERS = extern struct {
AdapterObject: ?*_ADAPTER_OBJECT,
MappedRegisterBase: ?*c_void,
DumpData: ?*c_void,
CommonBufferVa: ?*c_void,
CommonBufferPa: LARGE_INTEGER,
CommonBufferSize: u32,
AllocateCommonBuffers: BOOLEAN,
UseDiskDump: BOOLEAN,
Spare1: [2]u8,
DeviceObject: ?*c_void,
};
pub const DUMP_POINTERS_EX = extern struct {
Header: DUMP_POINTERS_VERSION,
DumpData: ?*c_void,
CommonBufferVa: ?*c_void,
CommonBufferSize: u32,
AllocateCommonBuffers: BOOLEAN,
DeviceObject: ?*c_void,
DriverList: ?*c_void,
dwPortFlags: u32,
MaxDeviceDumpSectionSize: u32,
MaxDeviceDumpLevel: u32,
MaxTransferSize: u32,
AdapterObject: ?*c_void,
MappedRegisterBase: ?*c_void,
DeviceReady: ?*BOOLEAN,
DumpDevicePowerOn: ?PDUMP_DEVICE_POWERON_ROUTINE,
DumpDevicePowerOnContext: ?*c_void,
};
pub const DUMP_DRIVER = extern struct {
DumpDriverList: ?*c_void,
DriverName: [15]u16,
BaseName: [15]u16,
};
pub const NTSCSI_UNICODE_STRING = extern struct {
Length: u16,
MaximumLength: u16,
Buffer: ?[*]u16,
};
pub const DUMP_DRIVER_EX = extern struct {
DumpDriverList: ?*c_void,
DriverName: [15]u16,
BaseName: [15]u16,
DriverFullPath: NTSCSI_UNICODE_STRING,
};
pub const STORAGE_ENDURANCE_INFO = extern struct {
ValidFields: u32,
GroupId: u32,
Flags: extern struct {
_bitfield: u32,
},
LifePercentage: u32,
BytesReadCount: [16]u8,
ByteWriteCount: [16]u8,
};
pub const STORAGE_ENDURANCE_DATA_DESCRIPTOR = extern struct {
Version: u32,
Size: u32,
EnduranceInfo: STORAGE_ENDURANCE_INFO,
};
pub const ISCSI_DIGEST_TYPES = enum(i32) {
NONE = 0,
CRC32C = 1,
};
pub const ISCSI_DIGEST_TYPE_NONE = ISCSI_DIGEST_TYPES.NONE;
pub const ISCSI_DIGEST_TYPE_CRC32C = ISCSI_DIGEST_TYPES.CRC32C;
pub const ISCSI_AUTH_TYPES = enum(i32) {
NO_AUTH_TYPE = 0,
CHAP_AUTH_TYPE = 1,
MUTUAL_CHAP_AUTH_TYPE = 2,
};
pub const ISCSI_NO_AUTH_TYPE = ISCSI_AUTH_TYPES.NO_AUTH_TYPE;
pub const ISCSI_CHAP_AUTH_TYPE = ISCSI_AUTH_TYPES.CHAP_AUTH_TYPE;
pub const ISCSI_MUTUAL_CHAP_AUTH_TYPE = ISCSI_AUTH_TYPES.MUTUAL_CHAP_AUTH_TYPE;
pub const ISCSI_LOGIN_OPTIONS = extern struct {
Version: u32,
InformationSpecified: u32,
LoginFlags: u32,
AuthType: ISCSI_AUTH_TYPES,
HeaderDigest: ISCSI_DIGEST_TYPES,
DataDigest: ISCSI_DIGEST_TYPES,
MaximumConnections: u32,
DefaultTime2Wait: u32,
DefaultTime2Retain: u32,
UsernameLength: u32,
PasswordLength: u32,
Username: ?*u8,
Password: <PASSWORD>,
};
pub const IKE_AUTHENTICATION_METHOD = enum(i32) {
D = 1,
};
pub const IKE_AUTHENTICATION_PRESHARED_KEY_METHOD = IKE_AUTHENTICATION_METHOD.D;
pub const IKE_AUTHENTICATION_PRESHARED_KEY = extern struct {
SecurityFlags: u64,
IdType: u8,
IdLengthInBytes: u32,
Id: ?*u8,
KeyLengthInBytes: u32,
Key: ?*u8,
};
pub const IKE_AUTHENTICATION_INFORMATION = extern struct {
AuthMethod: IKE_AUTHENTICATION_METHOD,
Anonymous: extern union {
PsKey: IKE_AUTHENTICATION_PRESHARED_KEY,
},
};
pub const ISCSI_UNIQUE_SESSION_ID = extern struct {
AdapterUnique: u64,
AdapterSpecific: u64,
};
pub const SCSI_LUN_LIST = extern struct {
OSLUN: u32,
TargetLUN: u64,
};
pub const ISCSI_TARGET_MAPPINGW = extern struct {
InitiatorName: [256]u16,
TargetName: [224]u16,
OSDeviceName: [260]u16,
SessionId: ISCSI_UNIQUE_SESSION_ID,
OSBusNumber: u32,
OSTargetNumber: u32,
LUNCount: u32,
LUNList: ?*SCSI_LUN_LIST,
};
pub const ISCSI_TARGET_MAPPINGA = extern struct {
InitiatorName: [256]CHAR,
TargetName: [224]CHAR,
OSDeviceName: [260]CHAR,
SessionId: ISCSI_UNIQUE_SESSION_ID,
OSBusNumber: u32,
OSTargetNumber: u32,
LUNCount: u32,
LUNList: ?*SCSI_LUN_LIST,
};
pub const ISCSI_TARGET_PORTALW = extern struct {
SymbolicName: [256]u16,
Address: [256]u16,
Socket: u16,
};
pub const ISCSI_TARGET_PORTALA = extern struct {
SymbolicName: [256]CHAR,
Address: [256]CHAR,
Socket: u16,
};
pub const ISCSI_TARGET_PORTAL_INFOW = extern struct {
InitiatorName: [256]u16,
InitiatorPortNumber: u32,
SymbolicName: [256]u16,
Address: [256]u16,
Socket: u16,
};
pub const ISCSI_TARGET_PORTAL_INFOA = extern struct {
InitiatorName: [256]CHAR,
InitiatorPortNumber: u32,
SymbolicName: [256]CHAR,
Address: [256]CHAR,
Socket: u16,
};
pub const ISCSI_TARGET_PORTAL_INFO_EXW = extern struct {
InitiatorName: [256]u16,
InitiatorPortNumber: u32,
SymbolicName: [256]u16,
Address: [256]u16,
Socket: u16,
SecurityFlags: u64,
LoginOptions: ISCSI_LOGIN_OPTIONS,
};
pub const ISCSI_TARGET_PORTAL_INFO_EXA = extern struct {
InitiatorName: [256]CHAR,
InitiatorPortNumber: u32,
SymbolicName: [256]CHAR,
Address: [256]CHAR,
Socket: u16,
SecurityFlags: u64,
LoginOptions: ISCSI_LOGIN_OPTIONS,
};
pub const ISCSI_TARGET_PORTAL_GROUPW = extern struct {
Count: u32,
Portals: [1]ISCSI_TARGET_PORTALW,
};
pub const ISCSI_TARGET_PORTAL_GROUPA = extern struct {
Count: u32,
Portals: [1]ISCSI_TARGET_PORTALA,
};
pub const ISCSI_CONNECTION_INFOW = extern struct {
ConnectionId: ISCSI_UNIQUE_SESSION_ID,
InitiatorAddress: ?[*]u16,
TargetAddress: ?[*]u16,
InitiatorSocket: u16,
TargetSocket: u16,
CID: [2]u8,
};
pub const ISCSI_SESSION_INFOW = extern struct {
SessionId: ISCSI_UNIQUE_SESSION_ID,
InitiatorName: ?[*]u16,
TargetNodeName: ?[*]u16,
TargetName: ?[*]u16,
ISID: [6]u8,
TSID: [2]u8,
ConnectionCount: u32,
Connections: ?*ISCSI_CONNECTION_INFOW,
};
pub const ISCSI_CONNECTION_INFOA = extern struct {
ConnectionId: ISCSI_UNIQUE_SESSION_ID,
InitiatorAddress: ?[*]u8,
TargetAddress: ?[*]u8,
InitiatorSocket: u16,
TargetSocket: u16,
CID: [2]u8,
};
pub const ISCSI_SESSION_INFOA = extern struct {
SessionId: ISCSI_UNIQUE_SESSION_ID,
InitiatorName: ?[*]u8,
TargetNodeName: ?[*]u8,
TargetName: ?[*]u8,
ISID: [6]u8,
TSID: [2]u8,
ConnectionCount: u32,
Connections: ?*ISCSI_CONNECTION_INFOA,
};
pub const ISCSI_CONNECTION_INFO_EX = extern struct {
ConnectionId: ISCSI_UNIQUE_SESSION_ID,
State: u8,
Protocol: u8,
HeaderDigest: u8,
DataDigest: u8,
MaxRecvDataSegmentLength: u32,
AuthType: ISCSI_AUTH_TYPES,
EstimatedThroughput: u64,
MaxDatagramSize: u32,
};
pub const ISCSI_SESSION_INFO_EX = extern struct {
SessionId: ISCSI_UNIQUE_SESSION_ID,
InitialR2t: BOOLEAN,
ImmediateData: BOOLEAN,
Type: u8,
DataSequenceInOrder: BOOLEAN,
DataPduInOrder: BOOLEAN,
ErrorRecoveryLevel: u8,
MaxOutstandingR2t: u32,
FirstBurstLength: u32,
MaxBurstLength: u32,
MaximumConnections: u32,
ConnectionCount: u32,
Connections: ?*ISCSI_CONNECTION_INFO_EX,
};
pub const ISCSI_DEVICE_ON_SESSIONW = extern struct {
InitiatorName: [256]u16,
TargetName: [224]u16,
ScsiAddress: SCSI_ADDRESS,
DeviceInterfaceType: Guid,
DeviceInterfaceName: [260]u16,
LegacyName: [260]u16,
StorageDeviceNumber: STORAGE_DEVICE_NUMBER,
DeviceInstance: u32,
};
pub const ISCSI_DEVICE_ON_SESSIONA = extern struct {
InitiatorName: [256]CHAR,
TargetName: [224]CHAR,
ScsiAddress: SCSI_ADDRESS,
DeviceInterfaceType: Guid,
DeviceInterfaceName: [260]CHAR,
LegacyName: [260]CHAR,
StorageDeviceNumber: STORAGE_DEVICE_NUMBER,
DeviceInstance: u32,
};
pub const PERSISTENT_ISCSI_LOGIN_INFOW = extern struct {
TargetName: [224]u16,
IsInformationalSession: BOOLEAN,
InitiatorInstance: [256]u16,
InitiatorPortNumber: u32,
TargetPortal: ISCSI_TARGET_PORTALW,
SecurityFlags: u64,
Mappings: ?*ISCSI_TARGET_MAPPINGW,
LoginOptions: ISCSI_LOGIN_OPTIONS,
};
pub const PERSISTENT_ISCSI_LOGIN_INFOA = extern struct {
TargetName: [224]CHAR,
IsInformationalSession: BOOLEAN,
InitiatorInstance: [256]CHAR,
InitiatorPortNumber: u32,
TargetPortal: ISCSI_TARGET_PORTALA,
SecurityFlags: u64,
Mappings: ?*ISCSI_TARGET_MAPPINGA,
LoginOptions: ISCSI_LOGIN_OPTIONS,
};
pub const TARGETPROTOCOLTYPE = enum(i32) {
E = 0,
};
pub const ISCSI_TCP_PROTOCOL_TYPE = TARGETPROTOCOLTYPE.E;
pub const TARGET_INFORMATION_CLASS = enum(i32) {
ProtocolType = 0,
TargetAlias = 1,
DiscoveryMechanisms = 2,
PortalGroups = 3,
PersistentTargetMappings = 4,
InitiatorName = 5,
TargetFlags = 6,
LoginOptions = 7,
};
pub const ProtocolType = TARGET_INFORMATION_CLASS.ProtocolType;
pub const TargetAlias = TARGET_INFORMATION_CLASS.TargetAlias;
pub const DiscoveryMechanisms = TARGET_INFORMATION_CLASS.DiscoveryMechanisms;
pub const PortalGroups = TARGET_INFORMATION_CLASS.PortalGroups;
pub const PersistentTargetMappings = TARGET_INFORMATION_CLASS.PersistentTargetMappings;
pub const InitiatorName = TARGET_INFORMATION_CLASS.InitiatorName;
pub const TargetFlags = TARGET_INFORMATION_CLASS.TargetFlags;
pub const LoginOptions = TARGET_INFORMATION_CLASS.LoginOptions;
pub const ISCSI_VERSION_INFO = extern struct {
MajorVersion: u32,
MinorVersion: u32,
BuildNumber: u32,
};
pub const SCSI_PASS_THROUGH32 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
Length: u16,
ScsiStatus: u8,
PathId: u8,
TargetId: u8,
Lun: u8,
CdbLength: u8,
SenseInfoLength: u8,
DataIn: u8,
DataTransferLength: u32,
TimeOutValue: u32,
DataBufferOffset: u32,
SenseInfoOffset: u32,
Cdb: [16]u8,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const SCSI_PASS_THROUGH_DIRECT32 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
Length: u16,
ScsiStatus: u8,
PathId: u8,
TargetId: u8,
Lun: u8,
CdbLength: u8,
SenseInfoLength: u8,
DataIn: u8,
DataTransferLength: u32,
TimeOutValue: u32,
DataBuffer: ?*c_void,
SenseInfoOffset: u32,
Cdb: [16]u8,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const SCSI_PASS_THROUGH32_EX = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
Version: u32,
Length: u32,
CdbLength: u32,
StorAddressLength: u32,
ScsiStatus: u8,
SenseInfoLength: u8,
DataDirection: u8,
Reserved: u8,
TimeOutValue: u32,
StorAddressOffset: u32,
SenseInfoOffset: u32,
DataOutTransferLength: u32,
DataInTransferLength: u32,
DataOutBufferOffset: u32,
DataInBufferOffset: u32,
Cdb: [1]u8,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const SCSI_PASS_THROUGH_DIRECT32_EX = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
Version: u32,
Length: u32,
CdbLength: u32,
StorAddressLength: u32,
ScsiStatus: u8,
SenseInfoLength: u8,
DataDirection: u8,
Reserved: u8,
TimeOutValue: u32,
StorAddressOffset: u32,
SenseInfoOffset: u32,
DataOutTransferLength: u32,
DataInTransferLength: u32,
DataOutBuffer: ?*c_void,
DataInBuffer: ?*c_void,
Cdb: [1]u8,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const ATA_PASS_THROUGH_EX32 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
Length: u16,
AtaFlags: u16,
PathId: u8,
TargetId: u8,
Lun: u8,
ReservedAsUchar: u8,
DataTransferLength: u32,
TimeOutValue: u32,
ReservedAsUlong: u32,
DataBufferOffset: u32,
PreviousTaskFile: [8]u8,
CurrentTaskFile: [8]u8,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const ATA_PASS_THROUGH_DIRECT32 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
Length: u16,
AtaFlags: u16,
PathId: u8,
TargetId: u8,
Lun: u8,
ReservedAsUchar: u8,
DataTransferLength: u32,
TimeOutValue: u32,
ReservedAsUlong: u32,
DataBuffer: ?*c_void,
PreviousTaskFile: [8]u8,
CurrentTaskFile: [8]u8,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const MPIO_PASS_THROUGH_PATH32 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
PassThrough: SCSI_PASS_THROUGH32,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const MPIO_PASS_THROUGH_PATH_DIRECT32 = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
PassThrough: SCSI_PASS_THROUGH_DIRECT32,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const MPIO_PASS_THROUGH_PATH32_EX = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
PassThroughOffset: u32,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
pub const MPIO_PASS_THROUGH_PATH_DIRECT32_EX = switch(@import("../zig.zig").arch) {
.X64, .Arm64 => extern struct {
PassThroughOffset: u32,
Version: u32,
Length: u16,
Flags: u8,
PortNumber: u8,
MpioPathId: u64,
},
else => usize, // NOTE: this should be a @compileError but can't because of https://github.com/ziglang/zig/issues/9682
};
//--------------------------------------------------------------------------------
// Section: Functions (79)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiVersionInformation(
VersionInfo: ?*ISCSI_VERSION_INFO,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiTargetInformationW(
TargetName: ?PWSTR,
DiscoveryMechanism: ?PWSTR,
InfoClass: TARGET_INFORMATION_CLASS,
BufferSize: ?*u32,
Buffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiTargetInformationA(
TargetName: ?PSTR,
DiscoveryMechanism: ?PSTR,
InfoClass: TARGET_INFORMATION_CLASS,
BufferSize: ?*u32,
Buffer: ?*c_void,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddIScsiConnectionW(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
Reserved: ?*c_void,
InitiatorPortNumber: u32,
TargetPortal: ?*ISCSI_TARGET_PORTALW,
SecurityFlags: u64,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
KeySize: u32,
Key: ?[*]u8,
ConnectionId: ?*ISCSI_UNIQUE_SESSION_ID,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddIScsiConnectionA(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
Reserved: ?*c_void,
InitiatorPortNumber: u32,
TargetPortal: ?*ISCSI_TARGET_PORTALA,
SecurityFlags: u64,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
KeySize: u32,
Key: ?[*]u8,
ConnectionId: ?*ISCSI_UNIQUE_SESSION_ID,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiConnection(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
ConnectionId: ?*ISCSI_UNIQUE_SESSION_ID,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiTargetsW(
ForceUpdate: BOOLEAN,
BufferSize: ?*u32,
Buffer: ?[*]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiTargetsA(
ForceUpdate: BOOLEAN,
BufferSize: ?*u32,
Buffer: ?[*]u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddIScsiStaticTargetW(
TargetName: ?PWSTR,
TargetAlias: ?PWSTR,
TargetFlags: u32,
Persist: BOOLEAN,
Mappings: ?*ISCSI_TARGET_MAPPINGW,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
PortalGroup: ?*ISCSI_TARGET_PORTAL_GROUPW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddIScsiStaticTargetA(
TargetName: ?PSTR,
TargetAlias: ?PSTR,
TargetFlags: u32,
Persist: BOOLEAN,
Mappings: ?*ISCSI_TARGET_MAPPINGA,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
PortalGroup: ?*ISCSI_TARGET_PORTAL_GROUPA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiStaticTargetW(
TargetName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiStaticTargetA(
TargetName: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddIScsiSendTargetPortalW(
InitiatorInstance: ?PWSTR,
InitiatorPortNumber: u32,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
SecurityFlags: u64,
Portal: ?*ISCSI_TARGET_PORTALW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddIScsiSendTargetPortalA(
InitiatorInstance: ?PSTR,
InitiatorPortNumber: u32,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
SecurityFlags: u64,
Portal: ?*ISCSI_TARGET_PORTALA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiSendTargetPortalW(
InitiatorInstance: ?PWSTR,
InitiatorPortNumber: u32,
Portal: ?*ISCSI_TARGET_PORTALW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiSendTargetPortalA(
InitiatorInstance: ?PSTR,
InitiatorPortNumber: u32,
Portal: ?*ISCSI_TARGET_PORTALA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RefreshIScsiSendTargetPortalW(
InitiatorInstance: ?PWSTR,
InitiatorPortNumber: u32,
Portal: ?*ISCSI_TARGET_PORTALW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RefreshIScsiSendTargetPortalA(
InitiatorInstance: ?PSTR,
InitiatorPortNumber: u32,
Portal: ?*ISCSI_TARGET_PORTALA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiSendTargetPortalsW(
PortalCount: ?*u32,
PortalInfo: ?*ISCSI_TARGET_PORTAL_INFOW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiSendTargetPortalsA(
PortalCount: ?*u32,
PortalInfo: ?*ISCSI_TARGET_PORTAL_INFOA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiSendTargetPortalsExW(
PortalCount: ?*u32,
PortalInfoSize: ?*u32,
PortalInfo: ?*ISCSI_TARGET_PORTAL_INFO_EXW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiSendTargetPortalsExA(
PortalCount: ?*u32,
PortalInfoSize: ?*u32,
PortalInfo: ?*ISCSI_TARGET_PORTAL_INFO_EXA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn LoginIScsiTargetW(
TargetName: ?PWSTR,
IsInformationalSession: BOOLEAN,
InitiatorInstance: ?PWSTR,
InitiatorPortNumber: u32,
TargetPortal: ?*ISCSI_TARGET_PORTALW,
SecurityFlags: u64,
Mappings: ?*ISCSI_TARGET_MAPPINGW,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
KeySize: u32,
Key: ?[*]u8,
IsPersistent: BOOLEAN,
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
UniqueConnectionId: ?*ISCSI_UNIQUE_SESSION_ID,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn LoginIScsiTargetA(
TargetName: ?PSTR,
IsInformationalSession: BOOLEAN,
InitiatorInstance: ?PSTR,
InitiatorPortNumber: u32,
TargetPortal: ?*ISCSI_TARGET_PORTALA,
SecurityFlags: u64,
Mappings: ?*ISCSI_TARGET_MAPPINGA,
LoginOptions: ?*ISCSI_LOGIN_OPTIONS,
KeySize: u32,
Key: ?[*]u8,
IsPersistent: BOOLEAN,
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
UniqueConnectionId: ?*ISCSI_UNIQUE_SESSION_ID,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiPersistentLoginsW(
Count: ?*u32,
PersistentLoginInfo: ?*PERSISTENT_ISCSI_LOGIN_INFOW,
BufferSizeInBytes: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiPersistentLoginsA(
Count: ?*u32,
PersistentLoginInfo: ?*PERSISTENT_ISCSI_LOGIN_INFOA,
BufferSizeInBytes: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn LogoutIScsiTarget(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiPersistentTargetW(
InitiatorInstance: ?PWSTR,
InitiatorPortNumber: u32,
TargetName: ?PWSTR,
Portal: ?*ISCSI_TARGET_PORTALW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveIScsiPersistentTargetA(
InitiatorInstance: ?PSTR,
InitiatorPortNumber: u32,
TargetName: ?PSTR,
Portal: ?*ISCSI_TARGET_PORTALA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SendScsiInquiry(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
Lun: u64,
EvpdCmddt: u8,
PageCode: u8,
ScsiStatus: ?*u8,
ResponseSize: ?*u32,
ResponseBuffer: ?*u8,
SenseSize: ?*u32,
SenseBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SendScsiReadCapacity(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
Lun: u64,
ScsiStatus: ?*u8,
ResponseSize: ?*u32,
ResponseBuffer: ?*u8,
SenseSize: ?*u32,
SenseBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SendScsiReportLuns(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
ScsiStatus: ?*u8,
ResponseSize: ?*u32,
ResponseBuffer: ?*u8,
SenseSize: ?*u32,
SenseBuffer: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiInitiatorListW(
BufferSize: ?*u32,
Buffer: ?[*]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiInitiatorListA(
BufferSize: ?*u32,
Buffer: ?[*]u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportActiveIScsiTargetMappingsW(
BufferSize: ?*u32,
MappingCount: ?*u32,
Mappings: ?*ISCSI_TARGET_MAPPINGW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportActiveIScsiTargetMappingsA(
BufferSize: ?*u32,
MappingCount: ?*u32,
Mappings: ?*ISCSI_TARGET_MAPPINGA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiTunnelModeOuterAddressW(
InitiatorName: ?PWSTR,
InitiatorPortNumber: u32,
DestinationAddress: ?PWSTR,
OuterModeAddress: ?PWSTR,
Persist: BOOLEAN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiTunnelModeOuterAddressA(
InitiatorName: ?PSTR,
InitiatorPortNumber: u32,
DestinationAddress: ?PSTR,
OuterModeAddress: ?PSTR,
Persist: BOOLEAN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiIKEInfoW(
InitiatorName: ?PWSTR,
InitiatorPortNumber: u32,
AuthInfo: ?*IKE_AUTHENTICATION_INFORMATION,
Persist: BOOLEAN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiIKEInfoA(
InitiatorName: ?PSTR,
InitiatorPortNumber: u32,
AuthInfo: ?*IKE_AUTHENTICATION_INFORMATION,
Persist: BOOLEAN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiIKEInfoW(
InitiatorName: ?PWSTR,
InitiatorPortNumber: u32,
Reserved: ?*u32,
AuthInfo: ?*IKE_AUTHENTICATION_INFORMATION,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiIKEInfoA(
InitiatorName: ?PSTR,
InitiatorPortNumber: u32,
Reserved: ?*u32,
AuthInfo: ?*IKE_AUTHENTICATION_INFORMATION,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiGroupPresharedKey(
KeyLength: u32,
Key: ?*u8,
Persist: BOOLEAN,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiInitiatorCHAPSharedSecret(
SharedSecretLength: u32,
SharedSecret: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiInitiatorRADIUSSharedSecret(
SharedSecretLength: u32,
SharedSecret: ?*u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiInitiatorNodeNameW(
InitiatorNodeName: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetIScsiInitiatorNodeNameA(
InitiatorNodeName: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiInitiatorNodeNameW(
InitiatorNodeName: ?[*]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiInitiatorNodeNameA(
InitiatorNodeName: ?[*]u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddISNSServerW(
Address: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddISNSServerA(
Address: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveISNSServerW(
Address: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveISNSServerA(
Address: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RefreshISNSServerW(
Address: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RefreshISNSServerA(
Address: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportISNSServerListW(
BufferSizeInChar: ?*u32,
Buffer: ?[*]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportISNSServerListA(
BufferSizeInChar: ?*u32,
Buffer: ?[*]u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiSessionListW(
BufferSize: ?*u32,
SessionCount: ?*u32,
SessionInfo: ?*ISCSI_SESSION_INFOW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetIScsiSessionListA(
BufferSize: ?*u32,
SessionCount: ?*u32,
SessionInfo: ?*ISCSI_SESSION_INFOA,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "ISCSIDSC" fn GetIScsiSessionListEx(
BufferSize: ?*u32,
SessionCountPtr: ?*u32,
SessionInfo: ?*ISCSI_SESSION_INFO_EX,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetDevicesForIScsiSessionW(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
DeviceCount: ?*u32,
Devices: ?*ISCSI_DEVICE_ON_SESSIONW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn GetDevicesForIScsiSessionA(
UniqueSessionId: ?*ISCSI_UNIQUE_SESSION_ID,
DeviceCount: ?*u32,
Devices: ?*ISCSI_DEVICE_ON_SESSIONA,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "ISCSIDSC" fn SetupPersistentIScsiVolumes(
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn SetupPersistentIScsiDevices(
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddPersistentIScsiDeviceW(
DevicePath: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddPersistentIScsiDeviceA(
DevicePath: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemovePersistentIScsiDeviceW(
DevicePath: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemovePersistentIScsiDeviceA(
DevicePath: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ClearPersistentIScsiDevices(
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportPersistentIScsiDevicesW(
BufferSizeInChar: ?*u32,
Buffer: ?[*]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportPersistentIScsiDevicesA(
BufferSizeInChar: ?*u32,
Buffer: ?[*]u8,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiTargetPortalsW(
InitiatorName: ?PWSTR,
TargetName: ?PWSTR,
TargetPortalTag: ?*u16,
ElementCount: ?*u32,
Portals: ?*ISCSI_TARGET_PORTALW,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportIScsiTargetPortalsA(
InitiatorName: ?PSTR,
TargetName: ?PSTR,
TargetPortalTag: ?*u16,
ElementCount: ?*u32,
Portals: ?*ISCSI_TARGET_PORTALA,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddRadiusServerW(
Address: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn AddRadiusServerA(
Address: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveRadiusServerW(
Address: ?PWSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn RemoveRadiusServerA(
Address: ?PSTR,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportRadiusServerListW(
BufferSizeInChar: ?*u32,
Buffer: ?[*]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
// TODO: this type is limited to platform 'windows6.0.6000'
pub extern "ISCSIDSC" fn ReportRadiusServerListA(
BufferSizeInChar: ?*u32,
Buffer: ?[*]u8,
) callconv(@import("std").os.windows.WINAPI) u32;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (42)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
pub const ISCSI_TARGET_MAPPING = thismodule.ISCSI_TARGET_MAPPINGA;
pub const ISCSI_TARGET_PORTAL = thismodule.ISCSI_TARGET_PORTALA;
pub const ISCSI_TARGET_PORTAL_INFO = thismodule.ISCSI_TARGET_PORTAL_INFOA;
pub const ISCSI_TARGET_PORTAL_INFO_EX = thismodule.ISCSI_TARGET_PORTAL_INFO_EXA;
pub const ISCSI_TARGET_PORTAL_GROUP = thismodule.ISCSI_TARGET_PORTAL_GROUPA;
pub const ISCSI_CONNECTION_INFO = thismodule.ISCSI_CONNECTION_INFOA;
pub const ISCSI_SESSION_INFO = thismodule.ISCSI_SESSION_INFOA;
pub const ISCSI_DEVICE_ON_SESSION = thismodule.ISCSI_DEVICE_ON_SESSIONA;
pub const PERSISTENT_ISCSI_LOGIN_INFO = thismodule.PERSISTENT_ISCSI_LOGIN_INFOA;
pub const GetIScsiTargetInformation = thismodule.GetIScsiTargetInformationA;
pub const AddIScsiConnection = thismodule.AddIScsiConnectionA;
pub const ReportIScsiTargets = thismodule.ReportIScsiTargetsA;
pub const AddIScsiStaticTarget = thismodule.AddIScsiStaticTargetA;
pub const RemoveIScsiStaticTarget = thismodule.RemoveIScsiStaticTargetA;
pub const AddIScsiSendTargetPortal = thismodule.AddIScsiSendTargetPortalA;
pub const RemoveIScsiSendTargetPortal = thismodule.RemoveIScsiSendTargetPortalA;
pub const RefreshIScsiSendTargetPortal = thismodule.RefreshIScsiSendTargetPortalA;
pub const ReportIScsiSendTargetPortals = thismodule.ReportIScsiSendTargetPortalsA;
pub const ReportIScsiSendTargetPortalsEx = thismodule.ReportIScsiSendTargetPortalsExA;
pub const LoginIScsiTarget = thismodule.LoginIScsiTargetA;
pub const ReportIScsiPersistentLogins = thismodule.ReportIScsiPersistentLoginsA;
pub const RemoveIScsiPersistentTarget = thismodule.RemoveIScsiPersistentTargetA;
pub const ReportIScsiInitiatorList = thismodule.ReportIScsiInitiatorListA;
pub const ReportActiveIScsiTargetMappings = thismodule.ReportActiveIScsiTargetMappingsA;
pub const SetIScsiTunnelModeOuterAddress = thismodule.SetIScsiTunnelModeOuterAddressA;
pub const SetIScsiIKEInfo = thismodule.SetIScsiIKEInfoA;
pub const GetIScsiIKEInfo = thismodule.GetIScsiIKEInfoA;
pub const SetIScsiInitiatorNodeName = thismodule.SetIScsiInitiatorNodeNameA;
pub const GetIScsiInitiatorNodeName = thismodule.GetIScsiInitiatorNodeNameA;
pub const AddISNSServer = thismodule.AddISNSServerA;
pub const RemoveISNSServer = thismodule.RemoveISNSServerA;
pub const RefreshISNSServer = thismodule.RefreshISNSServerA;
pub const ReportISNSServerList = thismodule.ReportISNSServerListA;
pub const GetIScsiSessionList = thismodule.GetIScsiSessionListA;
pub const GetDevicesForIScsiSession = thismodule.GetDevicesForIScsiSessionA;
pub const AddPersistentIScsiDevice = thismodule.AddPersistentIScsiDeviceA;
pub const RemovePersistentIScsiDevice = thismodule.RemovePersistentIScsiDeviceA;
pub const ReportPersistentIScsiDevices = thismodule.ReportPersistentIScsiDevicesA;
pub const ReportIScsiTargetPortals = thismodule.ReportIScsiTargetPortalsA;
pub const AddRadiusServer = thismodule.AddRadiusServerA;
pub const RemoveRadiusServer = thismodule.RemoveRadiusServerA;
pub const ReportRadiusServerList = thismodule.ReportRadiusServerListA;
},
.wide => struct {
pub const ISCSI_TARGET_MAPPING = thismodule.ISCSI_TARGET_MAPPINGW;
pub const ISCSI_TARGET_PORTAL = thismodule.ISCSI_TARGET_PORTALW;
pub const ISCSI_TARGET_PORTAL_INFO = thismodule.ISCSI_TARGET_PORTAL_INFOW;
pub const ISCSI_TARGET_PORTAL_INFO_EX = thismodule.ISCSI_TARGET_PORTAL_INFO_EXW;
pub const ISCSI_TARGET_PORTAL_GROUP = thismodule.ISCSI_TARGET_PORTAL_GROUPW;
pub const ISCSI_CONNECTION_INFO = thismodule.ISCSI_CONNECTION_INFOW;
pub const ISCSI_SESSION_INFO = thismodule.ISCSI_SESSION_INFOW;
pub const ISCSI_DEVICE_ON_SESSION = thismodule.ISCSI_DEVICE_ON_SESSIONW;
pub const PERSISTENT_ISCSI_LOGIN_INFO = thismodule.PERSISTENT_ISCSI_LOGIN_INFOW;
pub const GetIScsiTargetInformation = thismodule.GetIScsiTargetInformationW;
pub const AddIScsiConnection = thismodule.AddIScsiConnectionW;
pub const ReportIScsiTargets = thismodule.ReportIScsiTargetsW;
pub const AddIScsiStaticTarget = thismodule.AddIScsiStaticTargetW;
pub const RemoveIScsiStaticTarget = thismodule.RemoveIScsiStaticTargetW;
pub const AddIScsiSendTargetPortal = thismodule.AddIScsiSendTargetPortalW;
pub const RemoveIScsiSendTargetPortal = thismodule.RemoveIScsiSendTargetPortalW;
pub const RefreshIScsiSendTargetPortal = thismodule.RefreshIScsiSendTargetPortalW;
pub const ReportIScsiSendTargetPortals = thismodule.ReportIScsiSendTargetPortalsW;
pub const ReportIScsiSendTargetPortalsEx = thismodule.ReportIScsiSendTargetPortalsExW;
pub const LoginIScsiTarget = thismodule.LoginIScsiTargetW;
pub const ReportIScsiPersistentLogins = thismodule.ReportIScsiPersistentLoginsW;
pub const RemoveIScsiPersistentTarget = thismodule.RemoveIScsiPersistentTargetW;
pub const ReportIScsiInitiatorList = thismodule.ReportIScsiInitiatorListW;
pub const ReportActiveIScsiTargetMappings = thismodule.ReportActiveIScsiTargetMappingsW;
pub const SetIScsiTunnelModeOuterAddress = thismodule.SetIScsiTunnelModeOuterAddressW;
pub const SetIScsiIKEInfo = thismodule.SetIScsiIKEInfoW;
pub const GetIScsiIKEInfo = thismodule.GetIScsiIKEInfoW;
pub const SetIScsiInitiatorNodeName = thismodule.SetIScsiInitiatorNodeNameW;
pub const GetIScsiInitiatorNodeName = thismodule.GetIScsiInitiatorNodeNameW;
pub const AddISNSServer = thismodule.AddISNSServerW;
pub const RemoveISNSServer = thismodule.RemoveISNSServerW;
pub const RefreshISNSServer = thismodule.RefreshISNSServerW;
pub const ReportISNSServerList = thismodule.ReportISNSServerListW;
pub const GetIScsiSessionList = thismodule.GetIScsiSessionListW;
pub const GetDevicesForIScsiSession = thismodule.GetDevicesForIScsiSessionW;
pub const AddPersistentIScsiDevice = thismodule.AddPersistentIScsiDeviceW;
pub const RemovePersistentIScsiDevice = thismodule.RemovePersistentIScsiDeviceW;
pub const ReportPersistentIScsiDevices = thismodule.ReportPersistentIScsiDevicesW;
pub const ReportIScsiTargetPortals = thismodule.ReportIScsiTargetPortalsW;
pub const AddRadiusServer = thismodule.AddRadiusServerW;
pub const RemoveRadiusServer = thismodule.RemoveRadiusServerW;
pub const ReportRadiusServerList = thismodule.ReportRadiusServerListW;
},
.unspecified => if (@import("builtin").is_test) struct {
pub const ISCSI_TARGET_MAPPING = *opaque{};
pub const ISCSI_TARGET_PORTAL = *opaque{};
pub const ISCSI_TARGET_PORTAL_INFO = *opaque{};
pub const ISCSI_TARGET_PORTAL_INFO_EX = *opaque{};
pub const ISCSI_TARGET_PORTAL_GROUP = *opaque{};
pub const ISCSI_CONNECTION_INFO = *opaque{};
pub const ISCSI_SESSION_INFO = *opaque{};
pub const ISCSI_DEVICE_ON_SESSION = *opaque{};
pub const PERSISTENT_ISCSI_LOGIN_INFO = *opaque{};
pub const GetIScsiTargetInformation = *opaque{};
pub const AddIScsiConnection = *opaque{};
pub const ReportIScsiTargets = *opaque{};
pub const AddIScsiStaticTarget = *opaque{};
pub const RemoveIScsiStaticTarget = *opaque{};
pub const AddIScsiSendTargetPortal = *opaque{};
pub const RemoveIScsiSendTargetPortal = *opaque{};
pub const RefreshIScsiSendTargetPortal = *opaque{};
pub const ReportIScsiSendTargetPortals = *opaque{};
pub const ReportIScsiSendTargetPortalsEx = *opaque{};
pub const LoginIScsiTarget = *opaque{};
pub const ReportIScsiPersistentLogins = *opaque{};
pub const RemoveIScsiPersistentTarget = *opaque{};
pub const ReportIScsiInitiatorList = *opaque{};
pub const ReportActiveIScsiTargetMappings = *opaque{};
pub const SetIScsiTunnelModeOuterAddress = *opaque{};
pub const SetIScsiIKEInfo = *opaque{};
pub const GetIScsiIKEInfo = *opaque{};
pub const SetIScsiInitiatorNodeName = *opaque{};
pub const GetIScsiInitiatorNodeName = *opaque{};
pub const AddISNSServer = *opaque{};
pub const RemoveISNSServer = *opaque{};
pub const RefreshISNSServer = *opaque{};
pub const ReportISNSServerList = *opaque{};
pub const GetIScsiSessionList = *opaque{};
pub const GetDevicesForIScsiSession = *opaque{};
pub const AddPersistentIScsiDevice = *opaque{};
pub const RemovePersistentIScsiDevice = *opaque{};
pub const ReportPersistentIScsiDevices = *opaque{};
pub const ReportIScsiTargetPortals = *opaque{};
pub const AddRadiusServer = *opaque{};
pub const RemoveRadiusServer = *opaque{};
pub const ReportRadiusServerList = *opaque{};
} else struct {
pub const ISCSI_TARGET_MAPPING = @compileError("'ISCSI_TARGET_MAPPING' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_TARGET_PORTAL = @compileError("'ISCSI_TARGET_PORTAL' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_TARGET_PORTAL_INFO = @compileError("'ISCSI_TARGET_PORTAL_INFO' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_TARGET_PORTAL_INFO_EX = @compileError("'ISCSI_TARGET_PORTAL_INFO_EX' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_TARGET_PORTAL_GROUP = @compileError("'ISCSI_TARGET_PORTAL_GROUP' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_CONNECTION_INFO = @compileError("'ISCSI_CONNECTION_INFO' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_SESSION_INFO = @compileError("'ISCSI_SESSION_INFO' requires that UNICODE be set to true or false in the root module");
pub const ISCSI_DEVICE_ON_SESSION = @compileError("'ISCSI_DEVICE_ON_SESSION' requires that UNICODE be set to true or false in the root module");
pub const PERSISTENT_ISCSI_LOGIN_INFO = @compileError("'PERSISTENT_ISCSI_LOGIN_INFO' requires that UNICODE be set to true or false in the root module");
pub const GetIScsiTargetInformation = @compileError("'GetIScsiTargetInformation' requires that UNICODE be set to true or false in the root module");
pub const AddIScsiConnection = @compileError("'AddIScsiConnection' requires that UNICODE be set to true or false in the root module");
pub const ReportIScsiTargets = @compileError("'ReportIScsiTargets' requires that UNICODE be set to true or false in the root module");
pub const AddIScsiStaticTarget = @compileError("'AddIScsiStaticTarget' requires that UNICODE be set to true or false in the root module");
pub const RemoveIScsiStaticTarget = @compileError("'RemoveIScsiStaticTarget' requires that UNICODE be set to true or false in the root module");
pub const AddIScsiSendTargetPortal = @compileError("'AddIScsiSendTargetPortal' requires that UNICODE be set to true or false in the root module");
pub const RemoveIScsiSendTargetPortal = @compileError("'RemoveIScsiSendTargetPortal' requires that UNICODE be set to true or false in the root module");
pub const RefreshIScsiSendTargetPortal = @compileError("'RefreshIScsiSendTargetPortal' requires that UNICODE be set to true or false in the root module");
pub const ReportIScsiSendTargetPortals = @compileError("'ReportIScsiSendTargetPortals' requires that UNICODE be set to true or false in the root module");
pub const ReportIScsiSendTargetPortalsEx = @compileError("'ReportIScsiSendTargetPortalsEx' requires that UNICODE be set to true or false in the root module");
pub const LoginIScsiTarget = @compileError("'LoginIScsiTarget' requires that UNICODE be set to true or false in the root module");
pub const ReportIScsiPersistentLogins = @compileError("'ReportIScsiPersistentLogins' requires that UNICODE be set to true or false in the root module");
pub const RemoveIScsiPersistentTarget = @compileError("'RemoveIScsiPersistentTarget' requires that UNICODE be set to true or false in the root module");
pub const ReportIScsiInitiatorList = @compileError("'ReportIScsiInitiatorList' requires that UNICODE be set to true or false in the root module");
pub const ReportActiveIScsiTargetMappings = @compileError("'ReportActiveIScsiTargetMappings' requires that UNICODE be set to true or false in the root module");
pub const SetIScsiTunnelModeOuterAddress = @compileError("'SetIScsiTunnelModeOuterAddress' requires that UNICODE be set to true or false in the root module");
pub const SetIScsiIKEInfo = @compileError("'SetIScsiIKEInfo' requires that UNICODE be set to true or false in the root module");
pub const GetIScsiIKEInfo = @compileError("'GetIScsiIKEInfo' requires that UNICODE be set to true or false in the root module");
pub const SetIScsiInitiatorNodeName = @compileError("'SetIScsiInitiatorNodeName' requires that UNICODE be set to true or false in the root module");
pub const GetIScsiInitiatorNodeName = @compileError("'GetIScsiInitiatorNodeName' requires that UNICODE be set to true or false in the root module");
pub const AddISNSServer = @compileError("'AddISNSServer' requires that UNICODE be set to true or false in the root module");
pub const RemoveISNSServer = @compileError("'RemoveISNSServer' requires that UNICODE be set to true or false in the root module");
pub const RefreshISNSServer = @compileError("'RefreshISNSServer' requires that UNICODE be set to true or false in the root module");
pub const ReportISNSServerList = @compileError("'ReportISNSServerList' requires that UNICODE be set to true or false in the root module");
pub const GetIScsiSessionList = @compileError("'GetIScsiSessionList' requires that UNICODE be set to true or false in the root module");
pub const GetDevicesForIScsiSession = @compileError("'GetDevicesForIScsiSession' requires that UNICODE be set to true or false in the root module");
pub const AddPersistentIScsiDevice = @compileError("'AddPersistentIScsiDevice' requires that UNICODE be set to true or false in the root module");
pub const RemovePersistentIScsiDevice = @compileError("'RemovePersistentIScsiDevice' requires that UNICODE be set to true or false in the root module");
pub const ReportPersistentIScsiDevices = @compileError("'ReportPersistentIScsiDevices' requires that UNICODE be set to true or false in the root module");
pub const ReportIScsiTargetPortals = @compileError("'ReportIScsiTargetPortals' requires that UNICODE be set to true or false in the root module");
pub const AddRadiusServer = @compileError("'AddRadiusServer' requires that UNICODE be set to true or false in the root module");
pub const RemoveRadiusServer = @compileError("'RemoveRadiusServer' requires that UNICODE be set to true or false in the root module");
pub const ReportRadiusServerList = @compileError("'ReportRadiusServerList' requires that UNICODE be set to true or false in the root module");
},
};
//--------------------------------------------------------------------------------
// Section: Imports (7)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BOOLEAN = @import("../foundation.zig").BOOLEAN;
const CHAR = @import("../system/system_services.zig").CHAR;
const LARGE_INTEGER = @import("../system/system_services.zig").LARGE_INTEGER;
const PSTR = @import("../foundation.zig").PSTR;
const PWSTR = @import("../foundation.zig").PWSTR;
const STORAGE_DEVICE_NUMBER = @import("../system/system_services.zig").STORAGE_DEVICE_NUMBER;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "DUMP_DEVICE_POWERON_ROUTINE")) { _ = DUMP_DEVICE_POWERON_ROUTINE; }
if (@hasDecl(@This(), "PDUMP_DEVICE_POWERON_ROUTINE")) { _ = PDUMP_DEVICE_POWERON_ROUTINE; }
@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/storage/iscsi_disc.zig |
const std = @import("std");
pub const Hitbox = struct
{
top: i32 = 0,
left: i32 = 0,
bottom: i32 = 0,
right: i32 = 0,
};
pub const HitboxGroup = struct
{
StartFrame: i32 = 0,
Duration: i32 = 1,
Hitboxes: std.ArrayList(Hitbox),
pub fn init(allocator: std.mem.Allocator) !HitboxGroup {
return HitboxGroup {
.Hitboxes = std.ArrayList(Hitbox).init(allocator),
};
}
pub fn IsActiveOnFrame(self: HitboxGroup, frame: i32) bool
{
return (frame >= self.StartFrame) and (frame < (self.StartFrame + self.Duration));
}
};
pub const ActionProperties = struct
{
Duration: i32 = 0,
VulnerableHitboxGroups: std.ArrayList(HitboxGroup),
AttackHitboxGroups: std.ArrayList(HitboxGroup),
pub fn init(allocator: std.mem.Allocator) !ActionProperties {
return ActionProperties {
.VulnerableHitboxGroups = std.ArrayList(HitboxGroup).init(allocator),
.AttackHitboxGroups = std.ArrayList(HitboxGroup).init(allocator),
};
}
};
pub const CharacterProperties = struct
{
MaxHealth : i32 = 10000,
Actions: std.ArrayList(ActionProperties),
// Deinitialize with `deinit`
pub fn init(allocator: std.mem.Allocator) !CharacterProperties {
return CharacterProperties {
.Actions = std.ArrayList(ActionProperties).init(allocator),
};
}
};
test "Test HitboxGroup.IsActiveOnFrame()"
{
var ArenaAllocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var hitboxGroup = HitboxGroup
{
.StartFrame = 2,
.Duration = 5,
.Hitboxes = std.ArrayList(Hitbox).init(ArenaAllocator.allocator())
};
try std.testing.expect(hitboxGroup.IsActiveOnFrame(2));
try std.testing.expect(!hitboxGroup.IsActiveOnFrame(7));
try std.testing.expect(!hitboxGroup.IsActiveOnFrame(1));
}
test "Testing resizable array."
{
{
var CharacterArenaAllocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
var group = HitboxGroup
{
.Hitboxes = std.ArrayList(Hitbox).init(CharacterArenaAllocator.allocator())
};
try group.Hitboxes.append(Hitbox{.left = 0, .top = 0, .bottom = 200, .right = 400});
try std.testing.expect(group.Hitboxes.items.len == 1);
try std.testing.expect(group.Hitboxes.items[0].right == 400);
try std.testing.expect(group.Hitboxes.items[0].bottom == 200);
}
} | src/CharacterData.zig |
const std = @import("std");
const version = @import("version");
const zfetch = @import("zfetch");
const http = @import("hzzp");
const tar = @import("tar");
const zzz = @import("zzz");
const uri = @import("uri");
const Dependency = @import("Dependency.zig");
usingnamespace @import("common.zig");
const Allocator = std.mem.Allocator;
pub const default_repo = "astrolabe.pm";
// TODO: clean up duplicated code in this file
pub fn getLatest(
allocator: *Allocator,
repository: []const u8,
user: []const u8,
package: []const u8,
range: ?version.Range,
) !version.Semver {
const url = if (range) |r|
try std.fmt.allocPrint(allocator, "https://{s}/pkgs/{s}/{s}/latest?v={}", .{
repository,
user,
package,
r,
})
else
try std.fmt.allocPrint(allocator, "https://{s}/pkgs/{s}/{s}/latest", .{
repository,
user,
package,
});
defer allocator.free(url);
var headers = http.Headers.init(allocator);
defer headers.deinit();
const link = try uri.parse(url);
var ip_buf: [80]u8 = undefined;
var stream = std.io.fixedBufferStream(&ip_buf);
try headers.set("Accept", "*/*");
try headers.set("User-Agent", "gyro");
try headers.set("Host", link.host orelse return error.NoHost);
var req = try zfetch.Request.init(allocator, url);
defer req.deinit();
try req.commit(.GET, headers, null);
try req.fulfill();
switch (req.status.code) {
200 => {},
404 => {
if (range) |r| {
std.log.err("failed to find {} for {s}/{s} on {s}", .{
r,
user,
package,
repository,
});
} else {
std.log.err("failed to find latest for {s}/{s} on {s}", .{
user,
package,
repository,
});
}
return error.Explained;
},
else => |code| {
std.log.err("got http status code {} for {s}", .{ code, url });
return error.FailedRequest;
},
}
var buf: [10]u8 = undefined;
return version.Semver.parse(buf[0..try req.reader().readAll(&buf)]);
}
pub fn getHeadCommit(
allocator: *Allocator,
user: []const u8,
repo: []const u8,
ref: []const u8,
) ![]const u8 {
const url = try std.fmt.allocPrint(
allocator,
// TODO: fix api call once Http redirects are handled
//"https://api.github.com/repos/{s}/{s}/tarball/{s}",
"https://codeload.github.com/{s}/{s}/legacy.tar.gz/{s}",
.{
user,
repo,
ref,
},
);
defer allocator.free(url);
var headers = http.Headers.init(allocator);
defer headers.deinit();
var req = try zfetch.Request.init(allocator, url);
defer req.deinit();
try headers.set("Host", "codeload.github.com");
try headers.set("Accept", "*/*");
try headers.set("User-Agent", "gyro");
try req.commit(.GET, headers, null);
try req.fulfill();
if (req.status.code != 200) {
std.log.err("got http status code for {s}: {}", .{ url, req.status.code });
return error.FailedRequest;
}
var gzip = try std.compress.gzip.gzipStream(allocator, req.reader());
defer gzip.deinit();
var pax_header = try tar.PaxHeaderMap.init(allocator, gzip.reader());
defer pax_header.deinit();
return allocator.dupe(u8, pax_header.get("comment") orelse return error.MissingCommitKey);
}
pub fn getPkg(
allocator: *Allocator,
repository: []const u8,
user: []const u8,
package: []const u8,
semver: version.Semver,
dir: std.fs.Dir,
) !void {
const url = try std.fmt.allocPrint(
allocator,
"https://{s}/archive/{s}/{s}/{}",
.{
repository,
user,
package,
semver,
},
);
defer allocator.free(url);
try getTarGz(allocator, url, dir);
}
fn getTarGzImpl(
allocator: *Allocator,
url: []const u8,
dir: std.fs.Dir,
skip_depth: usize,
) !void {
var headers = http.Headers.init(allocator);
defer headers.deinit();
std.log.info("fetching tarball: {s}", .{url});
var req = try zfetch.Request.init(allocator, url);
defer req.deinit();
const link = try uri.parse(url);
try headers.set("Host", link.host orelse return error.NoHost);
try headers.set("Accept", "*/*");
try headers.set("User-Agent", "gyro");
try req.commit(.GET, headers, null);
try req.fulfill();
if (req.status.code != 200) {
std.log.err("got http status code for {s}: {}", .{ url, req.status.code });
return error.FailedRequest;
}
var gzip = try std.compress.gzip.gzipStream(allocator, req.reader());
defer gzip.deinit();
try tar.instantiate(allocator, dir, gzip.reader(), skip_depth);
}
pub fn getTarGz(
allocator: *Allocator,
url: []const u8,
dir: std.fs.Dir,
) !void {
try getTarGzImpl(allocator, url, dir, 0);
}
pub fn getGithubTarGz(
allocator: *Allocator,
user: []const u8,
repo: []const u8,
commit: []const u8,
dir: std.fs.Dir,
) !void {
const url = try std.fmt.allocPrint(
allocator,
// TODO: fix api call once Http redirects are handled
//"https://api.github.com/repos/{s}/{s}/tarball/{s}",
"https://codeload.github.com/{s}/{s}/legacy.tar.gz/{s}",
.{
user,
repo,
commit,
},
);
defer allocator.free(url);
try getTarGzImpl(allocator, url, dir, 1);
}
pub fn getGithubRepo(
allocator: *Allocator,
user: []const u8,
repo: []const u8,
) !std.json.ValueTree {
const url = try std.fmt.allocPrint(
allocator,
"https://api.github.com/repos/{s}/{s}",
.{ user, repo },
);
defer allocator.free(url);
var headers = http.Headers.init(allocator);
defer headers.deinit();
var req = try zfetch.Request.init(allocator, url);
defer req.deinit();
try headers.set("Host", "api.github.com");
try headers.set("Accept", "application/vnd.github.v3+json");
try headers.set("User-Agent", "gyro");
try req.commit(.GET, headers, null);
try req.fulfill();
var text = try req.reader().readAllAlloc(allocator, std.math.maxInt(usize));
defer allocator.free(text);
if (req.status.code != 200) {
std.log.err("got http status code: {}\n{s}", .{ req.status.code, text });
return error.Explained;
}
var parser = std.json.Parser.init(allocator, true);
defer parser.deinit();
return try parser.parse(text);
}
pub fn getGithubTopics(
allocator: *Allocator,
user: []const u8,
repo: []const u8,
) !std.json.ValueTree {
const url = try std.fmt.allocPrint(allocator, "https://api.github.com/repos/{s}/{s}/topics", .{ user, repo });
defer allocator.free(url);
var headers = http.Headers.init(allocator);
defer headers.deinit();
var req = try zfetch.Request.init(allocator, url);
defer req.deinit();
try headers.set("Host", "api.github.com");
try headers.set("Accept", "application/vnd.github.mercy-preview+json");
try headers.set("User-Agent", "gyro");
try req.commit(.GET, headers, null);
try req.fulfill();
if (req.status.code != 200) {
std.log.err("got http status code {s}: {}", .{ url, req.status.code });
return error.Explained;
}
var text = try req.reader().readAllAlloc(allocator, std.math.maxInt(usize));
defer allocator.free(text);
var parser = std.json.Parser.init(allocator, true);
defer parser.deinit();
return try parser.parse(text);
}
pub fn getGithubGyroFile(
allocator: *Allocator,
user: []const u8,
repo: []const u8,
commit: []const u8,
) !?[]const u8 {
const url = try std.fmt.allocPrint(
allocator,
// TODO: fix api call once Http redirects are handled
//"https://api.github.com/repos/{s}/{s}/tarball/{s}",
"https://codeload.github.com/{s}/{s}/legacy.tar.gz/{s}",
.{
user,
repo,
commit,
},
);
defer allocator.free(url);
var headers = http.Headers.init(allocator);
defer headers.deinit();
std.log.info("fetching tarball: {s}", .{url});
var req = try zfetch.Request.init(allocator, url);
defer req.deinit();
const link = try uri.parse(url);
try headers.set("Host", link.host orelse return error.NoHost);
try headers.set("Accept", "*/*");
try headers.set("User-Agent", "gyro");
try req.commit(.GET, headers, null);
try req.fulfill();
if (req.status.code != 200) {
std.log.err("got http status code for {s}: {}", .{ url, req.status.code });
return error.FailedRequest;
}
const subpath = try std.fmt.allocPrint(allocator, "{s}-{s}-{s}/gyro.zzz", .{user, repo, commit[0..7]});
defer allocator.free(subpath);
var gzip = try std.compress.gzip.gzipStream(allocator, req.reader());
defer gzip.deinit();
var extractor = tar.fileExtractor(subpath, gzip.reader());
return extractor.reader().readAllAlloc(allocator, std.math.maxInt(usize)) catch |err|
return if (err == error.FileNotFound) null else err;
} | src/api.zig |
const std = @import("std");
const formatIntBuf = std.fmt.formatIntBuf;
const FormatOptions = std.fmt.FormatOptions;
// ----------------------------------------------------------------------------
const arm_cmse = @import("../drivers/arm_cmse.zig");
// ----------------------------------------------------------------------------
const log = @import("debug.zig").log;
pub const ACTIVE: bool = @import("options.zig").ENABLE_PROFILER;
// ----------------------------------------------------------------------------
pub const Event = enum(u8) {
EnterInterrupt = 0,
LeaveInterrupt,
ShadowPush,
ShadowAssert,
ShadowAssertReturn,
Count,
};
const num_event_types = @enumToInt(Event.Count);
const event_short_names = [_][]const u8{
"EntInt",
"LeaInt",
"ShPush",
"ShAsrt",
"ShAsrtRet",
};
var event_count = [1]usize{0} ** num_event_types;
var profile_running: u8 = 0;
pub inline fn markEvent(e: Event) void {
if (@atomicLoad(u8, &profile_running, .Monotonic) != 0) {
_ = @atomicRmw(usize, &event_count[@enumToInt(e)], .Add, 1, .Monotonic);
}
}
// Non-Secure application interface
// ----------------------------------------------------------------------------
fn TCDebugStartProfiler(_1: usize, _2: usize, _3: usize, _4: usize) callconv(.C) usize {
if (!ACTIVE) {
// work-around function merging (which causes `sg` to disappear)
return 0x3df2417d;
}
for (event_count) |*count| {
_ = @atomicRmw(usize, count, .Xchg, 0, .Monotonic);
}
_ = @atomicRmw(u8, &profile_running, .Xchg, 1, .Monotonic);
return 0;
}
fn TCDebugStopProfiler(_1: usize, _2: usize, _3: usize, _4: usize) callconv(.C) usize {
if (!ACTIVE) {
// work-around function merging (which causes `sg` to disappear)
return 0xd87589d4;
}
_ = @atomicRmw(u8, &profile_running, .Xchg, 0, .Monotonic);
return 0;
}
fn TCDebugDumpProfile(_1: usize, _2: usize, _3: usize, _4: usize) callconv(.C) usize {
if (!ACTIVE) {
// work-around function merging (which causes `sg` to disappear)
return 0x767e7180;
}
log(.Critical, "# TCDebugDumpProfile\r\n", .{});
var buf: [10]u8 = undefined;
comptime var line: u32 = 1;
inline while (line <= 3) : (line += 1) {
log(.Critical, " | ", .{});
var i: usize = 0;
while (i < event_short_names.len) : (i += 1) {
const width = event_short_names[i].len;
if (line == 1) {
log(.Critical, "{}", .{event_short_names[i]});
} else if (line == 2) {
log(.Critical, "{}:", .{("-" ** 10)[0 .. width - 1]});
} else if (line == 3) {
const len = formatIntBuf(&buf, event_count[i], 10, false, FormatOptions{});
log(.Critical, "{}", .{(" " ** 10)[0 .. width - len]});
log(.Critical, "{}", .{buf[0..len]});
}
log(.Critical, " | ", .{});
}
log(.Critical, "\r\n", .{});
}
return 0;
}
comptime {
arm_cmse.exportNonSecureCallable("TCDebugStartProfiler", TCDebugStartProfiler);
arm_cmse.exportNonSecureCallable("TCDebugStopProfiler", TCDebugStopProfiler);
arm_cmse.exportNonSecureCallable("TCDebugDumpProfile", TCDebugDumpProfile);
} | src/monitor/profiler.zig |
const std = @import("std");
const TailQueue = std.TailQueue;
const print = std.debug.print;
const expect = std.testing.expect;
threadlocal var qsbr_local = Qsbr.QsbrNode{.data=1};
fn getState(self: *Qsbr) *Qsbr.QsbrNode {
return &qsbr_local;
}
pub const Qsbr = struct {
pub const Queue = TailQueue(EpochType);
pub const QsbrNode = Queue.Node;
const Self = @This();
pub const EpochType = usize;
queue: Queue = Queue{},
mutex: std.Mutex = std.Mutex{},
epoch: EpochType = 1,
getStateFn: fn(qsbr: *Qsbr) *QsbrNode = getState,
pub fn getLocalState(self: *Self) *QsbrNode {
return self.getStateFn(self);
}
pub fn init(getstatefunc: ?fn(self: *Qsbr) *QsbrNode) Self {
if(getstatefunc) |f|{
return Self{.getStateFn=f};
} else {
return Self{};
}
}
pub fn deinit(self: *Self) void {
}
pub fn register(self: *Self) void {
const lock = self.mutex.acquire();
defer lock.release();
self.queue.append(self.getLocalState());
}
pub fn unregister(self: *Self) void {
const lock = self.mutex.acquire();
defer lock.release();
var node = self.getLocalState();
self.queue.remove(node);
node.next = null;
node.prev = null;
}
pub fn quiescent(self: *Self) void {
@fence(.SeqCst);
const state = self.getLocalState();
state.data = self.epoch;
}
pub fn online(self: *Self) void {
const state = self.getLocalState();
state.data = self.epoch;
@fence(.SeqCst);
}
pub fn offline(self: *Self) void {
@fence(.SeqCst);
const state = self.getLocalState();
state.data = 0;
}
pub fn barrier(self: *Self) EpochType {
var epoch = self.epoch;
while(true){
var new_val:EpochType = undefined;
if(epoch == std.math.maxInt(EpochType)){ // skip 0
new_val = 1;
} else {
new_val = epoch + 1;
}
if(@cmpxchgWeak(EpochType, &self.epoch, epoch, new_val, .SeqCst, .Monotonic)) |v|{
epoch = v;
continue;
}
return new_val;
}
}
pub fn sync(self: *Self, target: EpochType) bool {
const lock = self.mutex.acquire();
defer lock.release();
self.quiescent();
var p = self.queue.first;
while(p) |ptr| :({p = ptr.next;}){ // traverse per-thread Nodes
if(ptr.data == 0){
continue;
}
if(ptr.data < target){
return false;
}
}
return true;
}
};
const Param = struct {
qsbr: *Qsbr,
id: usize,
};
pub fn qsbr_test(param: Param) void {
param.qsbr.register();
defer param.qsbr.unregister();
param.qsbr.quiescent();
print("{}\n", .{param.qsbr.getLocalState()});
}
test "usage" {
var qs = Qsbr.init(null);
_ = qs.barrier();
var param = Param{.qsbr=&qs, .id=0};
var a:[10]*std.Thread = undefined;
for(a) |*item|{
item.* = std.Thread.spawn(param, qsbr_test) catch unreachable;
param.id+=1;
}
for(a)|item, idx|{
item.wait();
}
print("{*}\n", .{qs.getLocalState()});
print("{}\n", .{&qs});
print("{}\n", .{qs.sync(2)});
return;
} | Qsbr.zig |
const std = @import("std");
const assert = std.debug.assert;
const tools = @import("tools");
const Vec2 = tools.Vec2;
const Map = tools.Map(u16, 1000, 1000, true);
fn tileToChar(t: u16) u8 {
if (t < 10) return '0' + @intCast(u8, t);
if (t < 36) return @intCast(u8, t - 10) + 'A';
if (t == 65535) return '.';
return '?';
}
const Avancement = struct { steps: u16, pos: Vec2 };
fn drawAlt(regex: []const u8, cur: Avancement, i: *u32, map: *Map) Avancement {
var most = cur;
assert(regex[i.*] == '(');
var start = i.* + 1;
i.* += 1;
var parens: u32 = 1;
while (true) : (i.* += 1) {
const it = regex[i.*];
if (parens == 1 and (it == '|' or it == ')')) {
const res = draw(regex[start..i.*], cur, map);
start = i.* + 1;
if (res.steps > most.steps) {
most = res;
}
}
if (it == '(') {
parens += 1;
} else if (it == ')') {
parens -= 1;
if (parens == 0)
break;
}
}
assert(regex[i.*] == ')');
return most;
}
fn draw(regex: []const u8, cur: Avancement, map: *Map) Avancement {
if (regex.len == 0) return cur;
var p = cur.pos;
var s = cur.steps;
var i: u32 = 0;
while (i < regex.len) : (i += 1) {
const it = regex[i];
switch (it) {
'N' => {
p = p.add(Vec2.cardinal_dirs[0]);
s += 1;
},
'W' => {
p = p.add(Vec2.cardinal_dirs[1]);
s += 1;
},
'E' => {
p = p.add(Vec2.cardinal_dirs[2]);
s += 1;
},
'S' => {
p = p.add(Vec2.cardinal_dirs[3]);
s += 1;
},
'(' => {
const r = drawAlt(regex, .{ .steps = s, .pos = p }, &i, map);
p = r.pos;
s = r.steps;
},
else => unreachable,
}
if (map.get(p)) |cursteps| {
if (cursteps < s) s = cursteps;
}
// std.debug.print("{c} => {},{}\n", .{ it, p, s });
map.set(p, s);
}
//std.debug.print("{}+{} => {}\n", .{ regex, cur, s });
return Avancement{ .steps = s, .pos = p };
}
pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
var arena = std.heap.ArenaAllocator.init(allocator);
defer arena.deinit();
const regex = blk: {
const begin = if (std.mem.indexOfScalar(u8, input_text, '^')) |idx| idx else return error.UnsupportedInput;
const end = if (std.mem.indexOfScalar(u8, input_text, '$')) |idx| idx else return error.UnsupportedInput;
break :blk input_text[begin + 1 .. end];
};
const map = try allocator.create(Map);
defer allocator.destroy(map);
map.bbox = tools.BBox.empty;
map.default_tile = 65535;
map.fill(65535, null);
const ans1 = ans: {
map.set(Vec2{ .x = 0, .y = 0 }, 0);
var result = Avancement{ .pos = Vec2{ .x = 0, .y = 0 }, .steps = 65535 };
while (true) {
const r = draw(regex, .{ .pos = Vec2{ .x = 0, .y = 0 }, .steps = 0 }, map);
if (r.steps == result.steps) break;
assert(r.steps < result.steps);
result = r;
}
//var buf: [1000]u8 = undefined;
//std.debug.print("{}\n", .{map.printToBuf(result.pos, null, tileToChar, &buf)});
break :ans result.steps;
};
const ans2 = ans: {
var it = map.iter(null);
var count: usize = 0;
while (it.next()) |d| {
if (d >= 1000 and d != 65535)
count += 1;
}
break :ans count;
};
return [_][]const u8{
try std.fmt.allocPrint(allocator, "{}", .{ans1}),
try std.fmt.allocPrint(allocator, "{}", .{ans2}),
};
}
pub const main = tools.defaultMain("2018/input_day20.txt", run); | 2018/day20.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const String = std.ArrayList(u8);
const nearby = fn (a: []u8, b: isize, c: isize, d: usize, e: usize) usize;
fn index(i: isize, j: isize, y: usize, x: usize) ?usize {
if (i >= 0 and j >= 0 and i < y and j < x) {
return @intCast(usize, i) * x + @intCast(usize, j);
} else {
return null;
}
}
fn adjacent(seating: []u8, i: isize, j: isize, y: usize, x: usize) usize {
var n: usize = 0;
var ii = i - 1;
while (ii <= i + 1) : (ii += 1) {
var jj = j - 1;
while (jj <= j + 1) : (jj += 1) {
if (ii == i and jj == j) {
continue;
}
if (index(ii, jj, y, x)) |p| {
if (seating[p] == '#') {
n += 1;
}
}
}
}
return n;
}
const ydir = [8]isize{ 0, 1, 1, 1, 0, -1, -1, -1 };
const xdir = [8]isize{ 1, 1, 0, -1, -1, -1, 0, 1 };
fn lineOfSight(seating: []u8, i: isize, j: isize, y: usize, x: usize) usize {
var n: usize = 0;
var k: usize = 0;
while (k < 8) : (k += 1) {
var ii: isize = i + ydir[k];
var jj: isize = j + xdir[k];
while (index(ii, jj, y, x)) |p| {
if (seating[p] == '#') {
n += 1;
break;
} else if (seating[p] == 'L') {
break;
}
ii += ydir[k];
jj += xdir[k];
}
}
return n;
}
fn evolve(prev: []u8, next: []u8, y: usize, x: usize, f: nearby, adj: usize) bool {
std.mem.copy(u8, prev, next);
var i: isize = 0;
while (i < y) : (i += 1) {
var j: isize = 0;
while (j < x) : (j += 1) {
const p = index(i, j, y, x).?;
if (prev[p] != '.') {
const n = f(prev, i, j, y, x);
if (prev[p] == 'L' and n == 0) {
next[p] = '#';
} else if (prev[p] == '#' and n >= adj) {
next[p] = 'L';
}
}
}
}
return !std.mem.eql(u8, prev, next);
}
pub fn main() anyerror!void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = &arena.allocator;
var seating = String.init(allocator);
var stdin = std.io.getStdIn().reader();
var in = std.io.bufferedReader(stdin).reader();
var buf: [256]u8 = undefined;
var x: usize = 0;
var y: usize = 0;
while (try in.readUntilDelimiterOrEof(&buf, '\n')) |line| {
try seating.appendSlice(line);
y += 1;
x += line.len;
}
x /= y;
var previous = String.init(allocator);
try previous.appendSlice(seating.items);
// Part A
while (evolve(previous.items, seating.items, y, x, adjacent, 4)) {}
const na = std.mem.count(u8, seating.items, "#");
std.debug.print("A) {d} seats occupied\n", .{na});
// Reset input
for (seating.items) |*seat| {
if (seat.* == '#') {
seat.* = 'L';
}
}
// Part B
while (evolve(previous.items, seating.items, y, x, lineOfSight, 5)) {}
const nb = std.mem.count(u8, seating.items, "#");
std.debug.print("B) {d} seats occupied\n", .{nb});
} | 2020/zig/src/11.zig |
const std = @import("std");
/// A span of time that is started but might not have an end yet.
pub const TimeSpan = struct {
/// The instant at which the span started.
start: u128,
/// The instant at which the span stopped, if any.
stop: ?u128 = null,
pub fn elapsed(self: *const @This()) u64 {
if (self.stop) |s| {
return @intCast(u64, s - self.start);
}
return 0;
}
};
/// A stopwatch used to calculate time differences.
pub const Stopwatch = struct {
/// All the time spans that this stopwatch has been or is still running.
/// Only the last timespan is allowed to have no stop value, which means it
/// is still active.
spans: std.ArrayList(TimeSpan),
pub fn init(alloc: *std.mem.Allocator) @This() {
return @This(){
.spans = std.ArrayList(TimeSpan).init(alloc),
};
}
pub fn deinit(self: *@This()) void {
self.spans.deinit();
}
/// Starts the stopwatch.
///
/// If it is already started, it will create a new split.
/// This means it will stop and start the stopwatch, creating a new TimeSpan
/// in the process.
pub fn start(self: *@This(), current_time: u128) !?TimeSpan {
// if no split or last split is stopped, create new one.
const ret = try self.stop(current_time);
try self.spans.append(TimeSpan{
.start = current_time,
.stop = null,
});
return ret;
}
/// Stops the stopwatch without resetting it.
pub fn stop(self: *@This(), current_time: u128) !?TimeSpan {
var ret: ?TimeSpan = null;
if (self.is_running() and self.spans.items.len > 0) {
self.spans.items[self.spans.items.len - 1].stop = current_time;
ret = self.spans.items[self.spans.items.len - 1];
}
return ret;
}
/// Returns whether the stopwatch is running.
pub fn is_running(self: *const @This()) bool {
// if no spans or last span has an end, we are not running.
// equiv: if we have splits and the last one has no stop
return self.spans.items.len > 0 and self.spans.items[self.spans.items.len - 1].stop == null;
}
/// Returns the total elapsed time accumulated inside of this stopwatch.
pub fn elapsed(self: *const @This()) u64 {
var sum: u64 = 0;
for (self.spans.items) |span| {
sum += span.elapsed();
}
return sum;
}
};
const TEST_DELAY = 5;
test "Repeated stops" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
var count = @as(u32, 0);
while (count < 10000) {
_ = try sw.start(0);
count += 1;
}
_ = try sw.stop(0);
try std.testing.expectEqual(sw.spans.items.len, 10000);
try std.testing.expect(sw.spans.items[sw.spans.items.len - 1].stop != null);
}
test "Elapsed none" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
_ = try sw.stop(5);
_ = try sw.stop(20);
try std.testing.expectEqual(sw.elapsed(), 0);
}
test "elapsed_ms" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
_ = try sw.start(0);
_ = try sw.stop(TEST_DELAY);
try std.testing.expectEqual(sw.elapsed(), TEST_DELAY);
}
test "stop" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
_ = try sw.start(0);
_ = try sw.stop(TEST_DELAY);
try std.testing.expectEqual(sw.elapsed(), TEST_DELAY);
_ = try sw.stop(TEST_DELAY);
try std.testing.expectEqual(sw.elapsed(), TEST_DELAY);
}
test "resume_once" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
try std.testing.expectEqual(sw.spans.items.len, 0);
_ = try sw.start(0);
try std.testing.expectEqual(sw.spans.items.len, 1);
_ = try sw.stop(TEST_DELAY);
try std.testing.expectEqual(sw.spans.items.len, 1);
try std.testing.expectEqual(sw.elapsed(), TEST_DELAY);
_ = try sw.start(TEST_DELAY);
try std.testing.expectEqual(sw.spans.items.len, 2);
_ = try sw.stop(TEST_DELAY * 2);
try std.testing.expectEqual(sw.elapsed(), 2 * TEST_DELAY);
}
test "resume_twice" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
try std.testing.expectEqual(sw.spans.items.len, 0);
_ = try sw.start(0);
_ = try sw.stop(TEST_DELAY);
try std.testing.expectEqual(sw.spans.items.len, 1);
try std.testing.expectEqual(sw.elapsed(), TEST_DELAY);
_ = try sw.start(TEST_DELAY);
try std.testing.expectEqual(sw.spans.items.len, 2);
_ = try sw.start(TEST_DELAY);
_ = try sw.stop(TEST_DELAY * 2);
try std.testing.expectEqual(sw.spans.items.len, 3);
try std.testing.expectEqual(sw.elapsed(), 2 * TEST_DELAY);
_ = try sw.start(TEST_DELAY * 2);
try std.testing.expectEqual(sw.spans.items.len, 4);
_ = try sw.stop(TEST_DELAY * 3);
try std.testing.expectEqual(sw.elapsed(), 3 * TEST_DELAY);
}
test "is_running" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
try std.testing.expect(!sw.is_running());
_ = try sw.start(0);
try std.testing.expect(sw.is_running());
_ = try sw.stop(0);
try std.testing.expect(!sw.is_running());
}
test "reset" {
var sw = Stopwatch.init(std.testing.allocator);
defer sw.deinit();
_ = try sw.start(0);
sw.spans.clearRetainingCapacity();
try std.testing.expect(!sw.is_running());
_ = try sw.start(5);
_ = try sw.stop(TEST_DELAY + 5);
try std.testing.expectEqual(sw.elapsed(), TEST_DELAY);
} | src/stopwatch.zig |
const std = @import("std");
const fmt = std.fmt;
const platform = @import("arch/x86/platform.zig");
const graphics = @import("graphics.zig");
const psf2 = @import("fonts/psf2.zig");
const Dimensions = graphics.Dimensions;
const Position = graphics.Position;
const Color = @import("color.zig");
const serial = @import("debug/serial.zig");
const TtyState = struct {
screen: Dimensions,
fontSize: Dimensions,
nbRows: u32,
nbCols: u32,
};
var state: TtyState = undefined;
const TAB_SIZE = 8;
pub fn initialize(allocator: *std.mem.Allocator) void {
var font = psf2.asFont(psf2.defaultFont);
var screen = graphics.getDimensions();
state = TtyState{
.screen = screen,
.fontSize = .{
.height = font.height,
.width = font.width,
},
.nbRows = screen.height / font.height,
.nbCols = screen.width / font.width,
};
graphics.clear(Color.Black);
graphics.setCursorCoords(0, 0);
}
fn isCharControl(char: u8) bool {
return char < 32 or char > 126;
}
const Errors = error{};
fn getCursorCharRow() i32 {
return @divTrunc(graphics.getCursorPos().y, @intCast(i32, state.fontSize.height));
}
fn getCursorCharCol() i32 {
return @divTrunc(graphics.getCursorPos().x, @intCast(i32, state.fontSize.width));
}
fn newLine() void {
var cursor = graphics.getCursorPos();
if (getCursorCharRow() >= state.nbRows) {
graphics.scroll(state.fontSize.height);
graphics.setCursorCoords(0, cursor.y);
} else {
graphics.setCursorCoords(0, cursor.y + @intCast(i32, state.fontSize.height));
}
}
const ScreenWritter = struct {
pub const Error = Errors;
pub const Writer = std.io.Writer(*ScreenWritter, Error, write);
pub fn writer(self: *ScreenWritter) Writer {
return .{ .context = self };
}
pub fn write(self: *ScreenWritter, string: []const u8) Error!usize {
if (isCharControl(string[0])) {
var cursor = graphics.getCursorPos();
switch (string[0]) {
'\n' => {
newLine();
},
'\x08' => { // backspace
var cur_w = @intCast(i32, state.fontSize.width);
if (cursor.x >= cur_w) {
graphics.setCursorCoords(cursor.x - cur_w, cursor.y);
graphics.drawText(" ");
graphics.setCursorCoords(cursor.x - cur_w, cursor.y);
}
},
'\t' => { // Tabulation
var tab_w = @intCast(i32, state.fontSize.width) * TAB_SIZE;
var x = @divTrunc(cursor.x, tab_w) * tab_w;
if (x + tab_w >= @intCast(i32, state.screen.width)) {
newLine();
cursor.y = graphics.getCursorPos().y;
x = 0;
}
graphics.setCursorCoords(x + tab_w, cursor.y);
},
'\r' => { // Cariage return
graphics.setCursorCoords(0, cursor.y);
},
else => {
serial.printf("Unknown control char {}\n", .{@intCast(u32, string[0])});
},
}
return 1;
} else {
var len = string.len;
var remainingOnLine = @intCast(i32, state.nbCols) - getCursorCharCol();
if (remainingOnLine <= 0) {
newLine();
remainingOnLine = @intCast(i32, state.nbCols);
}
if (remainingOnLine < len) {
len = @intCast(u32, remainingOnLine);
}
var realLen: usize = 0;
while (realLen < len) : (realLen += 1) {
if (isCharControl(string[realLen])) {
break;
}
}
graphics.drawText(string[0..realLen]);
return realLen;
}
}
};
var screenWritter = ScreenWritter{};
pub fn print(comptime format: []const u8, args: anytype) void {
fmt.format(screenWritter.writer(), format, args) catch |err| {
serial.ppanic("Failed print: {}", .{err});
};
}
pub fn serialPrint(comptime format: []const u8, args: anytype) void {
print(format, args);
serial.printf(format, args);
}
pub fn colorPrint(fg: ?u32, bg: ?u32, comptime format: []const u8, args: anytype) void {
const prevTextColor = graphics.getTextColor();
graphics.setTextColor(fg, bg);
print(format, args);
graphics.setTextColor(prevTextColor.fg, prevTextColor.bg);
}
pub fn alignLeft(offset: usize) void {
graphics.alignLeft(offset);
}
pub fn alignRight(offset: usize) void {
alignLeft(SCREEN_MODE_WIDTH - offset);
}
pub fn alignCenter(strLen: usize) void {
alignLeft((SCREEN_MODE_WIDTH - strLen) / 2);
}
pub fn panic(comptime format: []const u8, args: anytype) noreturn {
colorPrint(Color.White, null, "KERNEL PANIC: " ++ format ++ "\n", args);
platform.hang();
}
pub fn step(comptime format: []const u8, args: anytype) void {
colorPrint(Color.LightBlue, null, ">> ", .{});
print(format ++ "...", args);
}
pub fn stepOK() void {
const ok = " [ OK ]";
alignRight(ok.len);
colorPrint(Color.LightGreen, null, ok, .{});
}
pub fn selfTest() void {
print("{}", .{">>>\tLorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vitae ex eros. Suspendisse a purus at lorem porta porttitor quis a arcu. Aenean hendrerit arcu sed mi tincidunt auctor. Aliquam lorem mauris, semper eu erat ac, commodo sollicitudin ex. Aliquam non lorem vitae arcu posuere suscipit eget in eros. Aenean ultrices mauris quis est vestibulum, eu fringilla diam laoreet. Donec ornare erat nisi, a lobortis mauris pulvinar ut. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec euismod mi in sapien lacinia, vel consectetur risus pretium.X\x08\n\n"});
colorPrint(Color.LightGreen, Color.Red, "This is a green text on red\n", .{});
serialPrint("TTY self test completed.\n", .{});
} | src/kernel/tty.zig |
const std = @import("std");
const util = @import("util.zig");
const data = @embedFile("../data/day12.txt");
/// Errors for our recursive depth-first-search function.
pub const DFSError = error{ InvalidInput, OutOfMemory };
/// Takes in a graph, and conducts a variation of depth-first-search on it that is consistent
/// with the day12 problem statement (allow repeats only in large caves and possibly a single
/// small cave). Returns number of paths found between start and end.
pub fn paths_to_end_dfs(allocator: *util.Allocator, graph: util.Graph([]const u8), allow_single_repeats: bool) DFSError!u32 {
var visited = util.Map(*util.Graph([]const u8).Node, void).init(allocator);
defer visited.deinit();
// Start at the start node
const start = graph.vertices.get("start") orelse return error.InvalidInput;
// Call DFS recursively
return try dfs_paths_to_end_recursive(start, &visited, allow_single_repeats);
}
// The recursive element of the day 12 DFS algorithm
fn dfs_paths_to_end_recursive(
node: *util.GraphNode([]const u8),
visited: *util.Map(*util.GraphNode([]const u8), void),
allow_single_repeat: bool,
) DFSError!u32 {
// Label node as discovered, if it isn't a big cave (those, each path is allowed to visit
// more than once, so we won't mark at all). We'll mark them as unvisited after we're done
// processing the current path, so that other paths can visit the same nodes.
const count_as_visited = !visited.contains(node) and (node.value[0] < 'A' or node.value[0] > 'Z');
if (count_as_visited) try visited.put(node, {});
// Ensure we only remove it IF we're the one who added it. This is necessary because depending
// on config, small caves can repeat once (meaning this function is potentially run when) they
// are already visited.
defer if (count_as_visited) {
_ = visited.remove(node);
};
// Since we only care about paths that get to end, we can stop as soon as the path ends up
// there
if (std.mem.eql(u8, node.value, "end")) return 1;
// Process all edges recursively
var paths_to_end: u32 = 0;
for (node.edges.items) |edge_dest| {
// If we haven't visited the node yet, we can clearly just proceed to visit it.
//
// If we _have_ already visited the node, but we still have our repeat, count the path anyway
// and disallow future repetition (assuming we're not going back to start)
if (!visited.contains(edge_dest)) {
paths_to_end += try dfs_paths_to_end_recursive(edge_dest, visited, allow_single_repeat);
} else if (allow_single_repeat and !std.mem.eql(u8, edge_dest.value, "start")) {
paths_to_end += try dfs_paths_to_end_recursive(edge_dest, visited, false);
}
}
return paths_to_end;
}
pub fn main() !void {
defer {
const leaks = util.gpa_impl.deinit();
std.debug.assert(!leaks);
}
// Graph structure we'll parse data into
var graph = util.Graph([]const u8).init(util.gpa);
defer graph.deinit();
// Parse through each line, parsing out the edge and adding it to the graph
var it = std.mem.tokenize(u8, data, "\n");
while (it.next()) |line| {
// Find value for start and end vertex for the edge
var start_end_it = std.mem.tokenize(u8, line, "-");
const start = start_end_it.next() orelse return error.InvalidInput;
const end = start_end_it.next() orelse return error.InvalidInput;
// Add bidirectional edge, adding vertices as needed
try graph.addEdge(start, end, true);
}
const paths_to_end_pt1 = paths_to_end_dfs(util.gpa, graph, false);
util.print("Part 1: Number of paths to \"end\" found is {d}\n", .{paths_to_end_pt1});
const paths_to_end_pt2 = paths_to_end_dfs(util.gpa, graph, true);
util.print("Part 2: Number of paths to \"end\" found is {d}\n", .{paths_to_end_pt2});
} | src/day12.zig |
const std = @import("std");
const ConstantPool = @import("ConstantPool.zig");
const logger = std.log.scoped(.cf_attributes);
// TODO: Implement all attribute types
pub const AttributeInfo = union(enum) {
code: CodeAttribute,
line_number_table: LineNumberTableAttribute,
source_file: SourceFileAttribute,
exceptions: ExceptionsAttribute,
unknown: void,
pub fn decode(constant_pool: *ConstantPool, allocator: std.mem.Allocator, reader: anytype) anyerror!AttributeInfo {
var attribute_name_index = try reader.readIntBig(u16);
var attribute_length = try reader.readIntBig(u32);
var info = try allocator.alloc(u8, attribute_length);
defer allocator.free(info);
_ = try reader.readAll(info);
var fbs = std.io.fixedBufferStream(info);
var name = constant_pool.get(attribute_name_index).utf8.bytes;
inline for (std.meta.fields(AttributeInfo)) |field| {
if (field.field_type == void) {} else {
if (std.mem.eql(u8, @field(field.field_type, "name"), name)) {
return @unionInit(AttributeInfo, field.name, try @field(field.field_type, "decode")(constant_pool, allocator, fbs.reader()));
}
}
}
logger.err("Could not decode attribute: {s}", .{name});
return .unknown;
}
pub fn calcAttrLen(self: AttributeInfo) u32 {
inline for (std.meta.fields(AttributeInfo)) |field| {
if (field.field_type == void) continue;
if (std.meta.activeTag(self) == @field(std.meta.Tag(AttributeInfo), field.name)) {
return @field(self, field.name).calcAttrLen() + 6; // 6 intro bytes!
}
}
unreachable;
}
pub fn deinit(self: *AttributeInfo) void {
inline for (std.meta.fields(AttributeInfo)) |field| {
if (field.field_type == void) continue;
if (std.meta.activeTag(self.*) == @field(std.meta.Tag(AttributeInfo), field.name)) {
@field(self, field.name).deinit();
}
}
}
pub fn encode(self: AttributeInfo, writer: anytype) !void {
inline for (std.meta.fields(AttributeInfo)) |field| {
if (field.field_type == void) continue;
if (std.meta.activeTag(self) == @field(std.meta.Tag(AttributeInfo), field.name)) {
var attr = @field(self, field.name);
try writer.writeIntBig(u16, try attr.constant_pool.locateUtf8Entry(@field(field.field_type, "name")));
try writer.writeIntBig(u32, attr.calcAttrLen());
try attr.encode(writer);
}
}
}
};
pub const ExceptionTableEntry = packed struct {
/// Where the exception handler becomes active (inclusive)
start_pc: u16,
/// Where it becomes inactive (exclusive)
end_pc: u16,
/// Start of handler
handler_pc: u16,
/// Index into constant pool
catch_type: u16,
pub fn decode(reader: anytype) !ExceptionTableEntry {
var entry: ExceptionTableEntry = undefined;
entry.start_pc = try reader.readIntBig(u16);
entry.end_pc = try reader.readIntBig(u16);
entry.handler_pc = try reader.readIntBig(u16);
entry.catch_type = try reader.readIntBig(u16);
return entry;
}
pub fn encode(self: ExceptionTableEntry, writer: anytype) !void {
try writer.writeIntBig(u16, self.start_pc);
try writer.writeIntBig(u16, self.end_pc);
try writer.writeIntBig(u16, self.handler_pc);
try writer.writeIntBig(u16, self.catch_type);
}
};
pub const CodeAttribute = struct {
pub const name = "Code";
allocator: std.mem.Allocator,
constant_pool: *ConstantPool,
max_stack: u16,
max_locals: u16,
code: std.ArrayListUnmanaged(u8),
exception_table: std.ArrayListUnmanaged(ExceptionTableEntry),
attributes: std.ArrayListUnmanaged(AttributeInfo),
pub fn decode(constant_pool: *ConstantPool, allocator: std.mem.Allocator, reader: anytype) !CodeAttribute {
var max_stack = try reader.readIntBig(u16);
var max_locals = try reader.readIntBig(u16);
var code_length = try reader.readIntBig(u32);
var code = try std.ArrayListUnmanaged(u8).initCapacity(allocator, code_length);
code.items.len = code_length;
_ = try reader.readAll(code.items);
var exception_table_len = try reader.readIntBig(u16);
var exception_table = try std.ArrayListUnmanaged(ExceptionTableEntry).initCapacity(allocator, exception_table_len);
exception_table.items.len = exception_table_len;
for (exception_table.items) |*et| et.* = try ExceptionTableEntry.decode(reader);
var attributes_length = try reader.readIntBig(u16);
var attributes_index: usize = 0;
var attributes = try std.ArrayListUnmanaged(AttributeInfo).initCapacity(allocator, attributes_length);
while (attributes_index < attributes_length) : (attributes_index += 1) {
var decoded = try AttributeInfo.decode(constant_pool, allocator, reader);
if (decoded == .unknown) {
attributes_length -= 1;
continue;
}
try attributes.append(allocator, decoded);
}
return CodeAttribute{
.allocator = allocator,
.constant_pool = constant_pool,
.max_stack = max_stack,
.max_locals = max_locals,
.code = code,
.exception_table = exception_table,
.attributes = attributes,
};
}
pub fn calcAttrLen(self: CodeAttribute) u32 {
var len: u32 = 2 + 2 + 4 + @intCast(u32, self.code.items.len) + 2 + 2;
for (self.attributes.items) |att| len += att.calcAttrLen();
len += 8 * @intCast(u32, self.exception_table.items.len);
return len;
}
pub fn encode(self: CodeAttribute, writer: anytype) anyerror!void {
try writer.writeIntBig(u16, self.max_stack);
try writer.writeIntBig(u16, self.max_locals);
try writer.writeIntBig(u32, @intCast(u32, self.code.items.len));
try writer.writeAll(self.code.items);
try writer.writeIntBig(u16, @intCast(u16, self.exception_table.items.len));
for (self.exception_table.items) |et| try et.encode(writer);
try writer.writeIntBig(u16, @intCast(u16, self.attributes.items.len));
for (self.attributes.items) |at| try at.encode(writer);
}
pub fn deinit(self: *CodeAttribute) void {
self.code.deinit(self.allocator);
self.exception_table.deinit(self.allocator);
for (self.attributes.items) |*attr| {
attr.deinit();
}
self.attributes.deinit(self.allocator);
}
};
pub const LineNumberTableEntry = struct {
/// The index into the code array at which the code for a new line in the original source file begins
start_pc: u16,
/// The corresponding line number in the original source file
line_number: u16,
pub fn decode(reader: anytype) !LineNumberTableEntry {
var entry: LineNumberTableEntry = undefined;
entry.start_pc = try reader.readIntBig(u16);
entry.line_number = try reader.readIntBig(u16);
return entry;
}
pub fn encode(self: LineNumberTableEntry, writer: anytype) !void {
try writer.writeIntBig(u16, self.start_pc);
try writer.writeIntBig(u16, self.line_number);
}
};
pub const LineNumberTableAttribute = struct {
pub const name = "LineNumberTable";
allocator: std.mem.Allocator,
constant_pool: *ConstantPool,
line_number_table: std.ArrayListUnmanaged(LineNumberTableEntry),
pub fn decode(constant_pool: *ConstantPool, allocator: std.mem.Allocator, reader: anytype) !LineNumberTableAttribute {
var line_number_table_length = try reader.readIntBig(u16);
var line_number_table = try std.ArrayListUnmanaged(LineNumberTableEntry).initCapacity(allocator, line_number_table_length);
line_number_table.items.len = line_number_table_length;
for (line_number_table.items) |*entry| entry.* = try LineNumberTableEntry.decode(reader);
return LineNumberTableAttribute{
.allocator = allocator,
.constant_pool = constant_pool,
.line_number_table = line_number_table,
};
}
pub fn calcAttrLen(self: LineNumberTableAttribute) u32 {
var len: u32 = 2 + 4 * @intCast(u32, self.line_number_table.items.len);
return len;
}
pub fn encode(self: LineNumberTableAttribute, writer: anytype) anyerror!void {
try writer.writeIntBig(u16, @intCast(u16, self.line_number_table.items.len));
for (self.line_number_table.items) |entry| try entry.encode(writer);
}
pub fn deinit(self: *LineNumberTableAttribute) void {
self.line_number_table.deinit(self.allocator);
}
};
pub const SourceFileAttribute = struct {
pub const name = "SourceFile";
allocator: std.mem.Allocator,
constant_pool: *ConstantPool,
source_file_index: u16,
pub fn decode(constant_pool: *ConstantPool, allocator: std.mem.Allocator, reader: anytype) !SourceFileAttribute {
return SourceFileAttribute{
.allocator = allocator,
.constant_pool = constant_pool,
.source_file_index = try reader.readIntBig(u16),
};
}
pub fn calcAttrLen(self: SourceFileAttribute) u32 {
_ = self;
return 2;
}
pub fn encode(self: SourceFileAttribute, writer: anytype) anyerror!void {
try writer.writeIntBig(u16, self.source_file_index);
}
pub fn deinit(self: *SourceFileAttribute) void {
_ = self;
}
};
pub const ExceptionsAttribute = struct {
pub const name = "Exceptions";
allocator: std.mem.Allocator,
constant_pool: *ConstantPool,
exception_index_table: std.ArrayListUnmanaged(u16),
pub fn decode(constant_pool: *ConstantPool, allocator: std.mem.Allocator, reader: anytype) !ExceptionsAttribute {
var exception_index_table_length = try reader.readIntBig(u16);
var exception_index_table = try std.ArrayListUnmanaged(u16).initCapacity(allocator, exception_index_table_length);
exception_index_table.items.len = exception_index_table_length;
for (exception_index_table.items) |*entry| entry.* = try reader.readIntBig(u16);
return ExceptionsAttribute{
.allocator = allocator,
.constant_pool = constant_pool,
.exception_index_table = exception_index_table,
};
}
pub fn calcAttrLen(self: ExceptionsAttribute) u32 {
var len: u32 = 2 + 2 * @intCast(u32, self.exception_index_table.items.len);
return len;
}
pub fn encode(self: ExceptionsAttribute, writer: anytype) anyerror!void {
try writer.writeIntBig(u16, @intCast(u16, self.exception_index_table.items.len));
for (self.exception_index_table.items) |entry| try writer.writeIntBig(u16, entry);
}
pub fn deinit(self: *ExceptionsAttribute) void {
self.exception_index_table.deinit(self.allocator);
}
}; | src/attributes.zig |
const std = @import("std");
const assert = std.debug.assert;
// 8 bits in reverse order.
pub inline fn reverse8(x: u8) u8 {
var i: u3 = 0;
var res: u8 = 0;
while (i <= 7) : (i += 1) {
// Check whether the i-th least significant bit is set.
if (x & (@as(u8, 1) << i) > 0) {
// Set the i-th most significant bit.
res |= @as(u8, 1) << (8 - 1 - i);
}
if (i == 7) {
break;
}
}
return res;
}
// Reverse the n least significant bits of x.
// The (16 - n) most significant bits of the result will be zero.
pub inline fn reverse16(x: u16, n: u5) u16 {
assert(n > 0);
assert(n <= 16);
var lo: u8 = @truncate(u8, x & 0xff);
var hi: u8 = @truncate(u8, x >> 8);
var reversed: u16 = @intCast(u16, (@intCast(u16, reverse8(lo)) << 8) | reverse8(hi));
return reversed >> @truncate(u4, 16 - n);
}
// Read a 64-bit value from p in little-endian byte order.
pub inline fn read64le(p: [*]const u8) u64 {
// The one true way, see
// https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html
return (@intCast(u64, p[0]) << 0) |
(@intCast(u64, p[1]) << 8) |
(@intCast(u64, p[2]) << 16) |
(@intCast(u64, p[3]) << 24) |
(@intCast(u64, p[4]) << 32) |
(@intCast(u64, p[5]) << 40) |
(@intCast(u64, p[6]) << 48) |
(@intCast(u64, p[7]) << 56);
}
pub inline fn read32le(p: [*]const u8) u32 {
return (@intCast(u32, p[0]) << 0) |
(@intCast(u32, p[1]) << 8) |
(@intCast(u32, p[2]) << 16) |
(@intCast(u32, p[3]) << 24);
}
pub inline fn read16le(p: [*]const u8) u16 {
return @intCast(u16, (@intCast(u16, p[0]) << 0) | (@intCast(u16, p[1]) << 8));
}
// Write a 64-bit value x to dst in little-endian byte order.
pub inline fn write64le(dst: [*]u8, x: u64) void {
dst[0] = @truncate(u8, x >> 0);
dst[1] = @truncate(u8, x >> 8);
dst[2] = @truncate(u8, x >> 16);
dst[3] = @truncate(u8, x >> 24);
dst[4] = @truncate(u8, x >> 32);
dst[5] = @truncate(u8, x >> 40);
dst[6] = @truncate(u8, x >> 48);
dst[7] = @truncate(u8, x >> 56);
}
pub inline fn write32le(dst: [*]u8, x: u32) void {
dst[0] = @truncate(u8, x >> 0);
dst[1] = @truncate(u8, x >> 8);
dst[2] = @truncate(u8, x >> 16);
dst[3] = @truncate(u8, x >> 24);
}
pub inline fn write16le(dst: [*]u8, x: u16) void {
dst[0] = @truncate(u8, x >> 0);
dst[1] = @truncate(u8, x >> 8);
}
// Get the n least significant bits of x.
pub inline fn lsb(x: u64, n: u6) u64 {
assert(n <= 63);
return x & ((@as(u64, 1) << n) - 1);
}
// Round x up to the next multiple of m, which must be a power of 2.
pub inline fn round_up(x: usize, m: u6) usize {
assert(m > 0);
assert((m & (m - 1)) == 0); // "m must be a power of two"
var log2_m: u6 = 0;
var i = m;
while (i != 1) : (i >>= 1) {
log2_m += 1;
}
return ((x + m - 1) >> log2_m) << log2_m; // Hacker's Delight (2nd), 3-1.
} | src/bits.zig |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.